Commit fdb62cba authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Do not activate vertex shaders needlessly.

parent 09ab812e
...@@ -2675,19 +2675,22 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) { ...@@ -2675,19 +2675,22 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
IWineD3DVertexShader_CompileShader(stateblock->vertexShader); IWineD3DVertexShader_CompileShader(stateblock->vertexShader);
} }
/* Vertex and pixel shaders are applied together for now, so let the last dirty state do the if(useVertexShaderFunction || device->last_was_vshader) {
* application
*/
if(!isStateDirty(device, STATE_PIXELSHADER)) {
BOOL usePixelShaderFunction = device->ps_selected_mode != SHADER_NONE && BOOL usePixelShaderFunction = device->ps_selected_mode != SHADER_NONE &&
stateblock->pixelShader && stateblock->pixelShader &&
((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function; ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function;
device->shader_backend->shader_select((IWineD3DDevice *) device, usePixelShaderFunction, useVertexShaderFunction); /* Vertex and pixel shaders are applied together for now, so let the last dirty state do the
* application
*/
if(!isStateDirty(device, STATE_PIXELSHADER)) {
device->shader_backend->shader_select((IWineD3DDevice *) device, usePixelShaderFunction, useVertexShaderFunction);
if(!isStateDirty(stateblock->wineD3DDevice, STATE_VERTEXSHADERCONSTANT) && (useVertexShaderFunction || usePixelShaderFunction)) { if(!isStateDirty(stateblock->wineD3DDevice, STATE_VERTEXSHADERCONSTANT) && (useVertexShaderFunction || usePixelShaderFunction)) {
shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock); shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock);
}
} }
device->last_was_vshader = useVertexShaderFunction;
} }
if(updateFog) { if(updateFog) {
......
...@@ -583,6 +583,7 @@ typedef struct IWineD3DDeviceImpl ...@@ -583,6 +583,7 @@ typedef struct IWineD3DDeviceImpl
BOOL last_was_notclipped; BOOL last_was_notclipped;
BOOL untransformed; BOOL untransformed;
BOOL last_was_pshader; BOOL last_was_pshader;
BOOL last_was_vshader;
BOOL last_was_foggy_shader; BOOL last_was_foggy_shader;
BOOL namedArraysLoaded, numberedArraysLoaded; BOOL namedArraysLoaded, numberedArraysLoaded;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment