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

wined3d: Don't load INT and BOOL constants needlessly.

parent a2089abd
...@@ -349,6 +349,8 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m ...@@ -349,6 +349,8 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
max_loop_depth = cur_loop_depth; max_loop_depth = cur_loop_depth;
pToken += curOpcode->num_params; pToken += curOpcode->num_params;
/* Rep and Loop always use an integer constant for the control parameters */
This->baseShader.uses_int_consts = TRUE;
} else if (WINED3DSIO_ENDLOOP == curOpcode->opcode || } else if (WINED3DSIO_ENDLOOP == curOpcode->opcode ||
WINED3DSIO_ENDREP == curOpcode->opcode) { WINED3DSIO_ENDREP == curOpcode->opcode) {
cur_loop_depth--; cur_loop_depth--;
...@@ -494,6 +496,12 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m ...@@ -494,6 +496,12 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
reg_maps->usesrelconstF = TRUE; reg_maps->usesrelconstF = TRUE;
} }
} }
else if(WINED3DSPR_CONSTINT == regtype) {
This->baseShader.uses_int_consts = TRUE;
}
else if(WINED3DSPR_CONSTBOOL == regtype) {
This->baseShader.uses_bool_consts = TRUE;
}
/* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and is used /* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and is used
* in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel shaders because TECRDOUT * in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel shaders because TECRDOUT
......
...@@ -418,12 +418,16 @@ static void shader_glsl_load_constants( ...@@ -418,12 +418,16 @@ static void shader_glsl_load_constants(
stateBlock->vertexShaderConstantF, constant_locations, constant_list); stateBlock->vertexShaderConstantF, constant_locations, constant_list);
/* Load DirectX 9 integer constants/uniforms for vertex shader */ /* Load DirectX 9 integer constants/uniforms for vertex shader */
shader_glsl_load_constantsI(vshader, gl_info, prog->vuniformI_locations, if(vshader->baseShader.uses_int_consts) {
stateBlock->vertexShaderConstantI, stateBlock->changed.vertexShaderConstantsI); shader_glsl_load_constantsI(vshader, gl_info, prog->vuniformI_locations,
stateBlock->vertexShaderConstantI, stateBlock->changed.vertexShaderConstantsI);
}
/* Load DirectX 9 boolean constants/uniforms for vertex shader */ /* Load DirectX 9 boolean constants/uniforms for vertex shader */
shader_glsl_load_constantsB(vshader, gl_info, programId, if(vshader->baseShader.uses_bool_consts) {
stateBlock->vertexShaderConstantB, stateBlock->changed.vertexShaderConstantsB); shader_glsl_load_constantsB(vshader, gl_info, programId,
stateBlock->vertexShaderConstantB, stateBlock->changed.vertexShaderConstantsB);
}
/* Upload the position fixup params */ /* Upload the position fixup params */
GL_EXTCALL(glUniform4fvARB(prog->posFixup_location, 1, &deviceImpl->posFixup[0])); GL_EXTCALL(glUniform4fvARB(prog->posFixup_location, 1, &deviceImpl->posFixup[0]));
...@@ -442,12 +446,16 @@ static void shader_glsl_load_constants( ...@@ -442,12 +446,16 @@ static void shader_glsl_load_constants(
stateBlock->pixelShaderConstantF, constant_locations, constant_list); stateBlock->pixelShaderConstantF, constant_locations, constant_list);
/* Load DirectX 9 integer constants/uniforms for pixel shader */ /* Load DirectX 9 integer constants/uniforms for pixel shader */
shader_glsl_load_constantsI(pshader, gl_info, prog->puniformI_locations, if(pshader->baseShader.uses_int_consts) {
stateBlock->pixelShaderConstantI, stateBlock->changed.pixelShaderConstantsI); shader_glsl_load_constantsI(pshader, gl_info, prog->puniformI_locations,
stateBlock->pixelShaderConstantI, stateBlock->changed.pixelShaderConstantsI);
}
/* Load DirectX 9 boolean constants/uniforms for pixel shader */ /* Load DirectX 9 boolean constants/uniforms for pixel shader */
shader_glsl_load_constantsB(pshader, gl_info, programId, if(pshader->baseShader.uses_bool_consts) {
stateBlock->pixelShaderConstantB, stateBlock->changed.pixelShaderConstantsB); shader_glsl_load_constantsB(pshader, gl_info, programId,
stateBlock->pixelShaderConstantB, stateBlock->changed.pixelShaderConstantsB);
}
/* Upload the environment bump map matrix if needed. The needsbumpmat member specifies the texture stage to load the matrix from. /* Upload the environment bump map matrix if needed. The needsbumpmat member specifies the texture stage to load the matrix from.
* It can't be 0 for a valid texbem instruction. * It can't be 0 for a valid texbem instruction.
......
...@@ -2194,6 +2194,7 @@ typedef struct IWineD3DBaseShaderClass ...@@ -2194,6 +2194,7 @@ typedef struct IWineD3DBaseShaderClass
BOOL is_compiled; BOOL is_compiled;
UINT cur_loop_depth, cur_loop_regno; UINT cur_loop_depth, cur_loop_regno;
BOOL load_local_constsF; BOOL load_local_constsF;
BOOL uses_bool_consts, uses_int_consts;
/* Type of shader backend */ /* Type of shader backend */
int shader_mode; int shader_mode;
......
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