Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2890,11 +2890,8 @@ void WaterRenderObjClass::drawRiverWater(PolygonTrigger *pTrig)
DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );

if (m_riverWaterPixelShader) DX8Wrapper::_Get_D3D_Device8()->SetPixelShader(m_riverWaterPixelShader);
DWORD cull;
DX8Wrapper::_Get_D3D_Device8()->GetRenderState(D3DRS_CULLMODE, &cull);
DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);


DWORD cull = DX8Wrapper::Get_DX8_Render_State(D3DRS_CULLMODE);
DX8Wrapper::Set_DX8_Render_State(D3DRS_CULLMODE, D3DCULL_NONE);

if (wireframeForDebug) {
DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME);
Expand Down Expand Up @@ -2923,7 +2920,7 @@ void WaterRenderObjClass::drawRiverWater(PolygonTrigger *pTrig)
DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_ZFUNC, D3DCMP_EQUAL);
W3DShaderManager::resetShader(W3DShaderManager::ST_SHROUD_TEXTURE);
}
DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_CULLMODE, cull);
DX8Wrapper::Set_DX8_Render_State(D3DRS_CULLMODE, cull);


}
Expand Down Expand Up @@ -3265,12 +3262,8 @@ void WaterRenderObjClass::drawTrapezoidWater(Vector3 points[4])
DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND, D3DBLEND_INVDESTALPHA );
}


DWORD cull;
DX8Wrapper::_Get_D3D_Device8()->GetRenderState(D3DRS_CULLMODE, &cull);
DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);


DWORD cull = DX8Wrapper::Get_DX8_Render_State(D3DRS_CULLMODE);
DX8Wrapper::Set_DX8_Render_State(D3DRS_CULLMODE, D3DCULL_NONE);

//#ifdef FEATHER_WATER // the NEW WATER a'la LORENZEN

Expand Down Expand Up @@ -3337,7 +3330,7 @@ void WaterRenderObjClass::drawTrapezoidWater(Vector3 points[4])
W3DShaderManager::resetShader(W3DShaderManager::ST_SHROUD_TEXTURE);
}
}
DX8Wrapper::_Get_D3D_Device8()->SetRenderState(D3DRS_CULLMODE, cull);
DX8Wrapper::Set_DX8_Render_State(D3DRS_CULLMODE, cull);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3330,7 +3330,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill )
#else
//disable writes to color buffer
if (DX8Wrapper::Get_Current_Caps()->Get_DX8_Caps().PrimitiveMiscCaps & D3DPMISCCAPS_COLORWRITEENABLE)
{ DX8Wrapper::_Get_D3D_Device8()->GetRenderState(D3DRS_COLORWRITEENABLE, &oldColorWriteEnable);
{ oldColorWriteEnable = DX8Wrapper::Get_DX8_Render_State(D3DRS_COLORWRITEENABLE);
DX8Wrapper::Set_DX8_Render_State(D3DRS_COLORWRITEENABLE,0);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ void renderStenciledPlayerColor( UnsignedInt color, UnsignedInt stencilRef, Bool
//disable writes to color buffer
if (DX8Wrapper::Get_Current_Caps()->Get_DX8_Caps().PrimitiveMiscCaps & D3DPMISCCAPS_COLORWRITEENABLE)
{
DX8Wrapper::_Get_D3D_Device8()->GetRenderState(D3DRS_COLORWRITEENABLE, &oldColorWriteEnable);
oldColorWriteEnable = DX8Wrapper::Get_DX8_Render_State(D3DRS_COLORWRITEENABLE);
DX8Wrapper::Set_DX8_Render_State(D3DRS_COLORWRITEENABLE,0);
}
else
Expand Down
12 changes: 9 additions & 3 deletions Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ void DX8Wrapper::Invalidate_Cached_Render_States()
for (a=0;a<sizeof(RenderStates)/sizeof(unsigned);++a) {
RenderStates[a]=0x12345678;
}
// TheSuperHackers @performance Seed cache with D3D defaults for PUREDEVICE
RenderStates[D3DRS_COLORWRITEENABLE] = D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA;
RenderStates[D3DRS_CULLMODE] = D3DCULL_CCW;
for (a=0;a<MAX_TEXTURE_STAGES;++a)
{
for (int b=0; b<32;b++)
Expand Down Expand Up @@ -550,10 +553,13 @@ bool DX8Wrapper::Create_Device()
return false;
}

Vertex_Processing_Behavior=D3DCREATE_SOFTWARE_VERTEXPROCESSING;
if (caps.DevCaps&D3DDEVCAPS_HWTRANSFORMANDLIGHT)
Vertex_Processing_Behavior = (caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) ?
D3DCREATE_HARDWARE_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING;

// TheSuperHackers @performance Enable pure device to skip per-draw-call state validation
if (caps.DevCaps & D3DDEVCAPS_PUREDEVICE)
{
Vertex_Processing_Behavior=D3DCREATE_MIXED_VERTEXPROCESSING;
Vertex_Processing_Behavior |= D3DCREATE_PUREDEVICE;
}

#ifdef CREATE_DX8_MULTI_THREADED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3474,7 +3474,7 @@ void W3DVolumetricShadowManager::renderShadows( Bool forceStencilFill )
#else
//disable writes to color buffer
if (DX8Wrapper::Get_Current_Caps()->Get_DX8_Caps().PrimitiveMiscCaps & D3DPMISCCAPS_COLORWRITEENABLE)
{ DX8Wrapper::_Get_D3D_Device8()->GetRenderState(D3DRS_COLORWRITEENABLE, &oldColorWriteEnable);
{ oldColorWriteEnable = DX8Wrapper::Get_DX8_Render_State(D3DRS_COLORWRITEENABLE);
DX8Wrapper::Set_DX8_Render_State(D3DRS_COLORWRITEENABLE,0);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ void renderStenciledPlayerColor( UnsignedInt color, UnsignedInt stencilRef, Bool
//disable writes to color buffer
if (DX8Wrapper::Get_Current_Caps()->Get_DX8_Caps().PrimitiveMiscCaps & D3DPMISCCAPS_COLORWRITEENABLE)
{
DX8Wrapper::_Get_D3D_Device8()->GetRenderState(D3DRS_COLORWRITEENABLE, &oldColorWriteEnable);
oldColorWriteEnable = DX8Wrapper::Get_DX8_Render_State(D3DRS_COLORWRITEENABLE);
DX8Wrapper::Set_DX8_Render_State(D3DRS_COLORWRITEENABLE,0);
}
else
Expand Down
15 changes: 9 additions & 6 deletions GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ void DX8Wrapper::Invalidate_Cached_Render_States()
for (a=0;a<sizeof(RenderStates)/sizeof(unsigned);++a) {
RenderStates[a]=0x12345678;
}
// TheSuperHackers @performance Seed cache with D3D defaults for PUREDEVICE
RenderStates[D3DRS_COLORWRITEENABLE] = D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA;
RenderStates[D3DRS_CULLMODE] = D3DCULL_CCW;
for (a=0;a<MAX_TEXTURE_STAGES;++a)
{
for (int b=0; b<32;b++)
Expand Down Expand Up @@ -562,14 +565,14 @@ bool DX8Wrapper::Create_Device()

#ifndef _XBOX

Vertex_Processing_Behavior=(caps.DevCaps&D3DDEVCAPS_HWTRANSFORMANDLIGHT) ?
D3DCREATE_MIXED_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING;
Vertex_Processing_Behavior = (caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) ?
D3DCREATE_HARDWARE_VERTEXPROCESSING : D3DCREATE_SOFTWARE_VERTEXPROCESSING;

// enable this when all 'get' dx calls are removed KJM
/*if (caps.DevCaps&D3DDEVCAPS_PUREDEVICE)
// TheSuperHackers @performance Enable pure device to skip per-draw-call state validation
if (caps.DevCaps & D3DDEVCAPS_PUREDEVICE)
{
Vertex_Processing_Behavior|=D3DCREATE_PUREDEVICE;
}*/
Vertex_Processing_Behavior |= D3DCREATE_PUREDEVICE;
}

#else // XBOX
Vertex_Processing_Behavior=D3DCREATE_PUREDEVICE;
Expand Down
Loading