wined3d: Try to avoid redundant constant updates.

This gives a minor performance improvement. For example, in 3DMark03 Game Test
1 this gives about a 4% improvement, in the Counter Strike: Source stress test
it's about 1%. (NVIDIA GF9600M, Intel T9550, 1024x768).
This commit is contained in:
Henri Verbeet 2013-08-16 09:12:30 +02:00 committed by Alexandre Julliard
parent c1af405054
commit 37d1e8b79c
9 changed files with 216 additions and 236 deletions

View File

@ -648,7 +648,7 @@ static void shader_arb_vs_local_constants(const struct arb_vs_compiled_shader *g
checkGLcall("Load vs int consts"); checkGLcall("Load vs int consts");
} }
static void shader_arb_select(void *shader_priv, const struct wined3d_context *context, static void shader_arb_select(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state); const struct wined3d_state *state);
/** /**
@ -659,7 +659,7 @@ static void shader_arb_select(void *shader_priv, const struct wined3d_context *c
*/ */
/* Context activation is done by the caller (state handler). */ /* Context activation is done by the caller (state handler). */
static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, static void shader_arb_load_constants_internal(struct shader_arb_priv *priv,
const struct wined3d_context *context, const struct wined3d_state *state, struct wined3d_context *context, const struct wined3d_state *state,
BOOL usePixelShader, BOOL useVertexShader, BOOL from_shader_select) BOOL usePixelShader, BOOL useVertexShader, BOOL from_shader_select)
{ {
const struct wined3d_d3d_info *d3d_info = context->d3d_info; const struct wined3d_d3d_info *d3d_info = context->d3d_info;
@ -723,7 +723,7 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv,
} }
} }
static void shader_arb_load_constants(void *shader_priv, const struct wined3d_context *context, static void shader_arb_load_constants(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state) const struct wined3d_state *state)
{ {
BOOL vs = use_vs(state); BOOL vs = use_vs(state);
@ -736,6 +736,12 @@ static void shader_arb_update_float_vertex_constants(struct wined3d_device *devi
{ {
struct wined3d_context *context = context_get_current(); struct wined3d_context *context = context_get_current();
struct shader_arb_priv *priv = device->shader_priv; struct shader_arb_priv *priv = device->shader_priv;
unsigned int i;
for (i = 0; i < device->context_count; ++i)
{
device->contexts[i]->constant_update_mask |= WINED3D_SHADER_CONST_VS_F;
}
/* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
* context. On a context switch the old context will be fully dirtified */ * context. On a context switch the old context will be fully dirtified */
@ -749,6 +755,12 @@ static void shader_arb_update_float_pixel_constants(struct wined3d_device *devic
{ {
struct wined3d_context *context = context_get_current(); struct wined3d_context *context = context_get_current();
struct shader_arb_priv *priv = device->shader_priv; struct shader_arb_priv *priv = device->shader_priv;
unsigned int i;
for (i = 0; i < device->context_count; ++i)
{
device->contexts[i]->constant_update_mask |= WINED3D_SHADER_CONST_PS_F;
}
/* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
* context. On a context switch the old context will be fully dirtified */ * context. On a context switch the old context will be fully dirtified */
@ -4629,7 +4641,7 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state,
} }
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void shader_arb_select(void *shader_priv, const struct wined3d_context *context, static void shader_arb_select(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state) const struct wined3d_state *state)
{ {
struct shader_arb_priv *priv = shader_priv; struct shader_arb_priv *priv = shader_priv;
@ -4685,6 +4697,9 @@ static void shader_arb_select(void *shader_priv, const struct wined3d_context *c
/* Force constant reloading for the NP2 fixup (see comment in shader_glsl_select for more info) */ /* Force constant reloading for the NP2 fixup (see comment in shader_glsl_select for more info) */
if (compiled->np2fixup_info.super.active) if (compiled->np2fixup_info.super.active)
shader_arb_load_np2fixup_constants(priv, gl_info, state); shader_arb_load_np2fixup_constants(priv, gl_info, state);
if (ps->load_local_constsF)
context->constant_update_mask |= WINED3D_SHADER_CONST_PS_F;
} }
else else
{ {
@ -4746,6 +4761,9 @@ static void shader_arb_select(void *shader_priv, const struct wined3d_context *c
FIXME("vertex color clamp needs to be changed, but extension not supported.\n"); FIXME("vertex color clamp needs to be changed, but extension not supported.\n");
} }
} }
if (vs->load_local_constsF)
context->constant_update_mask |= WINED3D_SHADER_CONST_VS_F;
} }
else else
{ {
@ -5882,21 +5900,16 @@ static void set_bumpmat_arbfp(struct wined3d_context *context, const struct wine
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
float mat[2][2]; float mat[2][2];
if (use_ps(state)) context->constant_update_mask |= WINED3D_SHADER_CONST_PS_BUMP_ENV;
{
/* The pixel shader has to know the bump env matrix. Do a constants
* update. */
if (stage && (state->pixel_shader->reg_maps.bumpmat & (1 << stage)))
context->load_constants = 1;
if(device->shader_backend == &arb_program_shader_backend) { if (device->shader_backend == &arb_program_shader_backend)
/* Exit now, don't set the bumpmat below, otherwise we may overwrite pixel shader constants */
return;
}
}
else if (device->shader_backend == &arb_program_shader_backend)
{ {
struct shader_arb_priv *priv = device->shader_priv; struct shader_arb_priv *priv = device->shader_priv;
/* Exit now, don't set the bumpmat below, otherwise we may overwrite pixel shader constants. */
if (use_ps(state))
return;
priv->pshader_const_dirty[ARB_FFP_CONST_BUMPMAT(stage)] = 1; priv->pshader_const_dirty[ARB_FFP_CONST_BUMPMAT(stage)] = 1;
priv->highest_dirty_ps_const = max(priv->highest_dirty_ps_const, ARB_FFP_CONST_BUMPMAT(stage) + 1); priv->highest_dirty_ps_const = max(priv->highest_dirty_ps_const, ARB_FFP_CONST_BUMPMAT(stage) + 1);
} }
@ -5918,21 +5931,16 @@ static void tex_bumpenvlum_arbfp(struct wined3d_context *context,
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
float param[4]; float param[4];
if (use_ps(state)) context->constant_update_mask |= WINED3D_SHADER_CONST_PS_BUMP_ENV;
{
/* The pixel shader has to know the luminance offset. Do a constants
* update. */
if (stage && (state->pixel_shader->reg_maps.luminanceparams & (1 << stage)))
context->load_constants = 1;
if(device->shader_backend == &arb_program_shader_backend) { if (device->shader_backend == &arb_program_shader_backend)
/* Exit now, don't set the bumpmat below, otherwise we may overwrite pixel shader constants */
return;
}
}
else if (device->shader_backend == &arb_program_shader_backend)
{ {
struct shader_arb_priv *priv = device->shader_priv; struct shader_arb_priv *priv = device->shader_priv;
/* Exit now, don't set the bumpmat below, otherwise we may overwrite pixel shader constants. */
if (use_ps(state))
return;
priv->pshader_const_dirty[ARB_FFP_CONST_LUMINANCE(stage)] = 1; priv->pshader_const_dirty[ARB_FFP_CONST_LUMINANCE(stage)] = 1;
priv->highest_dirty_ps_const = max(priv->highest_dirty_ps_const, ARB_FFP_CONST_LUMINANCE(stage) + 1); priv->highest_dirty_ps_const = max(priv->highest_dirty_ps_const, ARB_FFP_CONST_LUMINANCE(stage) + 1);
} }
@ -6536,7 +6544,6 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi
} }
context->select_shader = 1; context->select_shader = 1;
context->load_constants = 1;
} }
/* We can't link the fog states to the fragment state directly since the /* We can't link the fog states to the fragment state directly since the

View File

@ -943,7 +943,6 @@ static void atifs_apply_pixelshader(struct wined3d_context *context, const struc
* states. If atifs can deal with this it keeps the rest of the code * states. If atifs can deal with this it keeps the rest of the code
* simpler. */ * simpler. */
context->select_shader = 1; context->select_shader = 1;
context->load_constants = 1;
} }
static void atifs_srgbwriteenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) static void atifs_srgbwriteenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)

View File

@ -1909,7 +1909,6 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con
/* Disable shaders */ /* Disable shaders */
device->shader_backend->shader_disable(device->shader_priv, context); device->shader_backend->shader_disable(device->shader_priv, context);
context->select_shader = 1; context->select_shader = 1;
context->load_constants = 1;
context->blit_w = rt_size.cx; context->blit_w = rt_size.cx;
context->blit_h = rt_size.cy; context->blit_h = rt_size.cy;
@ -2393,11 +2392,10 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
context->select_shader = 0; context->select_shader = 0;
} }
if (context->load_constants) if (context->constant_update_mask)
{ {
device->shader_backend->shader_load_constants(device->shader_priv, device->shader_backend->shader_load_constants(device->shader_priv, context, state);
context, state); context->constant_update_mask = 0;
context->load_constants = 0;
} }
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)

View File

@ -2518,6 +2518,16 @@ struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3
return device->stateBlock->state.vs_sampler[idx]; return device->stateBlock->state.vs_sampler[idx];
} }
void device_invalidate_shader_constants(const struct wined3d_device *device, DWORD mask)
{
UINT i;
for (i = 0; i < device->context_count; ++i)
{
device->contexts[i]->constant_update_mask |= mask;
}
}
HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
UINT start_register, const BOOL *constants, UINT bool_count) UINT start_register, const BOOL *constants, UINT bool_count)
{ {
@ -2538,7 +2548,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
device->updateStateBlock->changed.vertexShaderConstantsB |= (1 << i); device->updateStateBlock->changed.vertexShaderConstantsB |= (1 << i);
if (!device->isRecordingState) if (!device->isRecordingState)
device_invalidate_state(device, STATE_VERTEXSHADERCONSTANT); device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_VS_B);
return WINED3D_OK; return WINED3D_OK;
} }
@ -2581,7 +2591,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
device->updateStateBlock->changed.vertexShaderConstantsI |= (1 << i); device->updateStateBlock->changed.vertexShaderConstantsI |= (1 << i);
if (!device->isRecordingState) if (!device->isRecordingState)
device_invalidate_state(device, STATE_VERTEXSHADERCONSTANT); device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_VS_I);
return WINED3D_OK; return WINED3D_OK;
} }
@ -2628,10 +2638,7 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
} }
if (!device->isRecordingState) if (!device->isRecordingState)
{
device->shader_backend->shader_update_float_vertex_constants(device, start_register, vector4f_count); device->shader_backend->shader_update_float_vertex_constants(device, start_register, vector4f_count);
device_invalidate_state(device, STATE_VERTEXSHADERCONSTANT);
}
memset(device->updateStateBlock->changed.vertexShaderConstantsF + start_register, 1, memset(device->updateStateBlock->changed.vertexShaderConstantsF + start_register, 1,
sizeof(*device->updateStateBlock->changed.vertexShaderConstantsF) * vector4f_count); sizeof(*device->updateStateBlock->changed.vertexShaderConstantsF) * vector4f_count);
@ -3009,7 +3016,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
device->updateStateBlock->changed.pixelShaderConstantsB |= (1 << i); device->updateStateBlock->changed.pixelShaderConstantsB |= (1 << i);
if (!device->isRecordingState) if (!device->isRecordingState)
device_invalidate_state(device, STATE_PIXELSHADERCONSTANT); device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_PS_B);
return WINED3D_OK; return WINED3D_OK;
} }
@ -3052,7 +3059,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device,
device->updateStateBlock->changed.pixelShaderConstantsI |= (1 << i); device->updateStateBlock->changed.pixelShaderConstantsI |= (1 << i);
if (!device->isRecordingState) if (!device->isRecordingState)
device_invalidate_state(device, STATE_PIXELSHADERCONSTANT); device_invalidate_shader_constants(device, WINED3D_SHADER_CONST_PS_I);
return WINED3D_OK; return WINED3D_OK;
} }
@ -3100,10 +3107,7 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
} }
if (!device->isRecordingState) if (!device->isRecordingState)
{
device->shader_backend->shader_update_float_pixel_constants(device, start_register, vector4f_count); device->shader_backend->shader_update_float_pixel_constants(device, start_register, vector4f_count);
device_invalidate_state(device, STATE_PIXELSHADERCONSTANT);
}
memset(device->updateStateBlock->changed.pixelShaderConstantsF + start_register, 1, memset(device->updateStateBlock->changed.pixelShaderConstantsF + start_register, 1,
sizeof(*device->updateStateBlock->changed.pixelShaderConstantsF) * vector4f_count); sizeof(*device->updateStateBlock->changed.pixelShaderConstantsF) * vector4f_count);

View File

@ -147,6 +147,7 @@ struct glsl_shader_prog_link
struct glsl_gs_program gs; struct glsl_gs_program gs;
struct glsl_ps_program ps; struct glsl_ps_program ps;
GLhandleARB programId; GLhandleARB programId;
DWORD constant_update_mask;
UINT constant_version; UINT constant_version;
}; };
@ -800,12 +801,15 @@ static void shader_glsl_load_np2fixup_constants(void *shader_priv,
} }
/* Context activation is done by the caller (state handler). */ /* Context activation is done by the caller (state handler). */
static void shader_glsl_load_constants(void *shader_priv, const struct wined3d_context *context, static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state) const struct wined3d_state *state)
{ {
const struct wined3d_shader *vshader = state->vertex_shader;
const struct wined3d_shader *pshader = state->pixel_shader;
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
struct shader_glsl_priv *priv = shader_priv; struct shader_glsl_priv *priv = shader_priv;
float position_fixup[4]; float position_fixup[4];
DWORD update_mask = 0;
GLhandleARB programId; GLhandleARB programId;
struct glsl_shader_prog_link *prog = priv->glsl_program; struct glsl_shader_prog_link *prog = priv->glsl_program;
@ -818,111 +822,81 @@ static void shader_glsl_load_constants(void *shader_priv, const struct wined3d_c
} }
programId = prog->programId; programId = prog->programId;
constant_version = prog->constant_version; constant_version = prog->constant_version;
update_mask = context->constant_update_mask & prog->constant_update_mask;
if (use_vs(state)) if (update_mask & WINED3D_SHADER_CONST_VS_F)
{
const struct wined3d_shader *vshader = state->vertex_shader;
/* Load DirectX 9 float constants/uniforms for vertex shader */
shader_glsl_load_constantsF(vshader, gl_info, state->vs_consts_f, shader_glsl_load_constantsF(vshader, gl_info, state->vs_consts_f,
prog->vs.uniform_f_locations, &priv->vconst_heap, priv->stack, constant_version); prog->vs.uniform_f_locations, &priv->vconst_heap, priv->stack, constant_version);
/* Load DirectX 9 integer constants/uniforms for vertex shader */ if (update_mask & WINED3D_SHADER_CONST_VS_I)
shader_glsl_load_constantsI(vshader, gl_info, prog->vs.uniform_i_locations, state->vs_consts_i, shader_glsl_load_constantsI(vshader, gl_info, prog->vs.uniform_i_locations, state->vs_consts_i,
vshader->reg_maps.integer_constants); vshader->reg_maps.integer_constants);
/* Load DirectX 9 boolean constants/uniforms for vertex shader */ if (update_mask & WINED3D_SHADER_CONST_VS_B)
shader_glsl_load_constantsB(vshader, gl_info, programId, state->vs_consts_b, shader_glsl_load_constantsB(vshader, gl_info, programId, state->vs_consts_b,
vshader->reg_maps.boolean_constants); vshader->reg_maps.boolean_constants);
/* Upload the position fixup params */ if (update_mask & WINED3D_SHADER_CONST_VS_POS_FIXUP)
{
shader_get_position_fixup(context, state, position_fixup); shader_get_position_fixup(context, state, position_fixup);
GL_EXTCALL(glUniform4fvARB(prog->vs.pos_fixup_location, 1, position_fixup)); GL_EXTCALL(glUniform4fvARB(prog->vs.pos_fixup_location, 1, position_fixup));
checkGLcall("glUniform4fvARB"); checkGLcall("glUniform4fvARB");
} }
if (use_ps(state)) if (update_mask & WINED3D_SHADER_CONST_PS_F)
{
const struct wined3d_shader *pshader = state->pixel_shader;
/* Load DirectX 9 float constants/uniforms for pixel shader */
shader_glsl_load_constantsF(pshader, gl_info, state->ps_consts_f, shader_glsl_load_constantsF(pshader, gl_info, state->ps_consts_f,
prog->ps.uniform_f_locations, &priv->pconst_heap, priv->stack, constant_version); prog->ps.uniform_f_locations, &priv->pconst_heap, priv->stack, constant_version);
/* Load DirectX 9 integer constants/uniforms for pixel shader */ if (update_mask & WINED3D_SHADER_CONST_PS_I)
shader_glsl_load_constantsI(pshader, gl_info, prog->ps.uniform_i_locations, state->ps_consts_i, shader_glsl_load_constantsI(pshader, gl_info, prog->ps.uniform_i_locations, state->ps_consts_i,
pshader->reg_maps.integer_constants); pshader->reg_maps.integer_constants);
/* Load DirectX 9 boolean constants/uniforms for pixel shader */ if (update_mask & WINED3D_SHADER_CONST_PS_B)
shader_glsl_load_constantsB(pshader, gl_info, programId, state->ps_consts_b, shader_glsl_load_constantsB(pshader, gl_info, programId, state->ps_consts_b,
pshader->reg_maps.boolean_constants); pshader->reg_maps.boolean_constants);
/* Upload the environment bump map matrix if needed. The needsbumpmat if (update_mask & WINED3D_SHADER_CONST_PS_BUMP_ENV)
* member specifies the texture stage to load the matrix from. It
* can't be 0 for a valid texbem instruction. */
for (i = 0; i < MAX_TEXTURES; ++i)
{
const float *data;
if (prog->ps.bumpenv_mat_location[i] == -1)
continue;
data = (const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_MAT00];
GL_EXTCALL(glUniformMatrix2fvARB(prog->ps.bumpenv_mat_location[i], 1, 0, data));
checkGLcall("glUniformMatrix2fvARB");
/* texbeml needs the luminance scale and offset too. If texbeml
* is used, needsbumpmat is set too, so we can check that in the
* needsbumpmat check. */
if (prog->ps.bumpenv_lum_scale_location[i] != -1)
{
const GLfloat *scale = (const GLfloat *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LSCALE];
const GLfloat *offset = (const GLfloat *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LOFFSET];
GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_scale_location[i], 1, scale));
checkGLcall("glUniform1fvARB");
GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_offset_location[i], 1, offset));
checkGLcall("glUniform1fvARB");
}
}
if (prog->ps.ycorrection_location != -1)
{
float correction_params[4];
if (context->render_offscreen)
{
correction_params[0] = 0.0f;
correction_params[1] = 1.0f;
} else {
/* position is window relative, not viewport relative */
correction_params[0] = (float) context->current_rt->resource.height;
correction_params[1] = -1.0f;
}
GL_EXTCALL(glUniform4fvARB(prog->ps.ycorrection_location, 1, correction_params));
}
}
else if (priv->fragment_pipe == &glsl_fragment_pipe)
{ {
float col[4];
for (i = 0; i < MAX_TEXTURES; ++i) for (i = 0; i < MAX_TEXTURES; ++i)
{ {
if (prog->ps.bumpenv_mat_location[i] == -1) if (prog->ps.bumpenv_mat_location[i] == -1)
continue; continue;
GL_EXTCALL(glUniformMatrix2fvARB(prog->ps.bumpenv_mat_location[i], 1, 0, GL_EXTCALL(glUniformMatrix2fvARB(prog->ps.bumpenv_mat_location[i], 1, 0,
(const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_MAT00])); (const GLfloat *)&state->texture_states[i][WINED3D_TSS_BUMPENV_MAT00]));
if (prog->ps.bumpenv_lum_scale_location[i] != -1) if (prog->ps.bumpenv_lum_scale_location[i] != -1)
{ {
GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_scale_location[i], 1, GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_scale_location[i], 1,
(const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LSCALE])); (const GLfloat *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LSCALE]));
GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_offset_location[i], 1, GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_offset_location[i], 1,
(const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LOFFSET])); (const GLfloat *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LOFFSET]));
} }
} }
checkGLcall("bump env uniforms");
}
if (update_mask & WINED3D_SHADER_CONST_PS_Y_CORR)
{
float correction_params[4];
if (context->render_offscreen)
{
correction_params[0] = 0.0f;
correction_params[1] = 1.0f;
} else {
/* position is window relative, not viewport relative */
correction_params[0] = (float) context->current_rt->resource.height;
correction_params[1] = -1.0f;
}
GL_EXTCALL(glUniform4fvARB(prog->ps.ycorrection_location, 1, correction_params));
}
if (update_mask & WINED3D_SHADER_CONST_FFP_PS)
{
float col[4];
if (prog->ps.tex_factor_location != -1) if (prog->ps.tex_factor_location != -1)
{ {
D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col); D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col);
@ -985,6 +959,11 @@ static void shader_glsl_update_float_vertex_constants(struct wined3d_device *dev
else else
update_heap_entry(heap, i, heap->positions[i], priv->next_constant_version); update_heap_entry(heap, i, heap->positions[i], priv->next_constant_version);
} }
for (i = 0; i < device->context_count; ++i)
{
device->contexts[i]->constant_update_mask |= WINED3D_SHADER_CONST_VS_F;
}
} }
static void shader_glsl_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count) static void shader_glsl_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count)
@ -1000,6 +979,11 @@ static void shader_glsl_update_float_pixel_constants(struct wined3d_device *devi
else else
update_heap_entry(heap, i, heap->positions[i], priv->next_constant_version); update_heap_entry(heap, i, heap->positions[i], priv->next_constant_version);
} }
for (i = 0; i < device->context_count; ++i)
{
device->contexts[i]->constant_update_mask |= WINED3D_SHADER_CONST_PS_F;
}
} }
static unsigned int vec4_varyings(DWORD shader_major, const struct wined3d_gl_info *gl_info) static unsigned int vec4_varyings(DWORD shader_major, const struct wined3d_gl_info *gl_info)
@ -6036,6 +6020,44 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
*/ */
shader_glsl_load_vsamplers(gl_info, device->texUnitMap, programId); shader_glsl_load_vsamplers(gl_info, device->texUnitMap, programId);
shader_glsl_load_psamplers(gl_info, device->texUnitMap, programId); shader_glsl_load_psamplers(gl_info, device->texUnitMap, programId);
entry->constant_update_mask = 0;
if (vshader)
{
entry->constant_update_mask |= WINED3D_SHADER_CONST_VS_F;
if (vshader->reg_maps.integer_constants)
entry->constant_update_mask |= WINED3D_SHADER_CONST_VS_I;
if (vshader->reg_maps.boolean_constants)
entry->constant_update_mask |= WINED3D_SHADER_CONST_VS_B;
entry->constant_update_mask |= WINED3D_SHADER_CONST_VS_POS_FIXUP;
}
if (ps_id)
{
if (pshader)
{
entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_F;
if (pshader->reg_maps.integer_constants)
entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_I;
if (pshader->reg_maps.boolean_constants)
entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_B;
if (entry->ps.ycorrection_location != -1)
entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_Y_CORR;
}
else
{
entry->constant_update_mask |= WINED3D_SHADER_CONST_FFP_PS;
}
for (i = 0; i < MAX_TEXTURES; ++i)
{
if (entry->ps.bumpenv_mat_location[i] != -1)
{
entry->constant_update_mask |= WINED3D_SHADER_CONST_PS_BUMP_ENV;
break;
}
}
}
} }
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
@ -6149,20 +6171,41 @@ static GLhandleARB create_glsl_blt_shader(const struct wined3d_gl_info *gl_info,
} }
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void shader_glsl_select(void *shader_priv, const struct wined3d_context *context, static void shader_glsl_select(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state) const struct wined3d_state *state)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
struct shader_glsl_priv *priv = shader_priv; struct shader_glsl_priv *priv = shader_priv;
GLhandleARB program_id = 0; GLhandleARB program_id = 0, prev_id = 0;
GLenum old_vertex_color_clamp, current_vertex_color_clamp; GLenum old_vertex_color_clamp, current_vertex_color_clamp;
priv->vertex_pipe->vp_enable(gl_info, !use_vs(state)); priv->vertex_pipe->vp_enable(gl_info, !use_vs(state));
priv->fragment_pipe->enable_extension(gl_info, !use_ps(state)); priv->fragment_pipe->enable_extension(gl_info, !use_ps(state));
old_vertex_color_clamp = priv->glsl_program ? priv->glsl_program->vs.vertex_color_clamp : GL_FIXED_ONLY_ARB; if (priv->glsl_program)
{
prev_id = priv->glsl_program->programId;
old_vertex_color_clamp = priv->glsl_program->vs.vertex_color_clamp;
}
else
{
prev_id = 0;
old_vertex_color_clamp = GL_FIXED_ONLY_ARB;
}
set_glsl_shader_program(context, state, priv); set_glsl_shader_program(context, state, priv);
current_vertex_color_clamp = priv->glsl_program ? priv->glsl_program->vs.vertex_color_clamp : GL_FIXED_ONLY_ARB;
if (priv->glsl_program)
{
program_id = priv->glsl_program->programId;
current_vertex_color_clamp = priv->glsl_program->vs.vertex_color_clamp;
}
else
{
program_id = 0;
current_vertex_color_clamp = GL_FIXED_ONLY_ARB;
}
if (old_vertex_color_clamp != current_vertex_color_clamp) if (old_vertex_color_clamp != current_vertex_color_clamp)
{ {
if (gl_info->supported[ARB_COLOR_BUFFER_FLOAT]) if (gl_info->supported[ARB_COLOR_BUFFER_FLOAT])
@ -6176,10 +6219,16 @@ static void shader_glsl_select(void *shader_priv, const struct wined3d_context *
} }
} }
program_id = priv->glsl_program ? priv->glsl_program->programId : 0; TRACE("Using GLSL program %u.\n", program_id);
if (program_id) TRACE("Using GLSL program %u\n", program_id);
GL_EXTCALL(glUseProgramObjectARB(program_id)); if (prev_id != program_id)
checkGLcall("glUseProgramObjectARB"); {
GL_EXTCALL(glUseProgramObjectARB(program_id));
checkGLcall("glUseProgramObjectARB");
if (program_id)
context->constant_update_mask |= priv->glsl_program->constant_update_mask;
}
/* In case that NP2 texcoord fixup data is found for the selected program, trigger a reload of the /* In case that NP2 texcoord fixup data is found for the selected program, trigger a reload of the
* constants. This has to be done because it can't be guaranteed that sampler() (from state.c) is * constants. This has to be done because it can't be guaranteed that sampler() (from state.c) is
@ -7098,7 +7147,6 @@ static void glsl_fragment_pipe_shader(struct wined3d_context *context,
context->last_was_pshader = use_ps(state); context->last_was_pshader = use_ps(state);
context->select_shader = 1; context->select_shader = 1;
context->load_constants = 1;
} }
static void glsl_fragment_pipe_fog(struct wined3d_context *context, static void glsl_fragment_pipe_fog(struct wined3d_context *context,
@ -7110,7 +7158,6 @@ static void glsl_fragment_pipe_fog(struct wined3d_context *context,
DWORD fogend = state->render_states[WINED3D_RS_FOGEND]; DWORD fogend = state->render_states[WINED3D_RS_FOGEND];
context->select_shader = 1; context->select_shader = 1;
context->load_constants = 1;
if (!state->render_states[WINED3D_RS_FOGENABLE]) if (!state->render_states[WINED3D_RS_FOGENABLE])
return; return;
@ -7140,13 +7187,12 @@ static void glsl_fragment_pipe_tex_transform(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id) const struct wined3d_state *state, DWORD state_id)
{ {
context->select_shader = 1; context->select_shader = 1;
context->load_constants = 1;
} }
static void glsl_fragment_pipe_invalidate_constants(struct wined3d_context *context, static void glsl_fragment_pipe_invalidate_constants(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id) const struct wined3d_state *state, DWORD state_id)
{ {
context->load_constants = 1; context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_PS;
} }
static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] = static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
@ -7161,12 +7207,6 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
{STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
@ -7176,12 +7216,6 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
{STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
@ -7191,12 +7225,6 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
{STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
@ -7206,12 +7234,6 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
{STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
@ -7221,12 +7243,6 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
{STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
@ -7236,12 +7252,6 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
{STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
@ -7251,12 +7261,6 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
{STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
@ -7266,12 +7270,6 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
{STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE },
{STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{STATE_PIXELSHADER, {STATE_PIXELSHADER, glsl_fragment_pipe_shader }, WINED3D_GL_EXT_NONE }, {STATE_PIXELSHADER, {STATE_PIXELSHADER, glsl_fragment_pipe_shader }, WINED3D_GL_EXT_NONE },
{STATE_RENDER(WINED3D_RS_FOGENABLE), {STATE_RENDER(WINED3D_RS_FOGENABLE), glsl_fragment_pipe_fog }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_FOGENABLE), {STATE_RENDER(WINED3D_RS_FOGENABLE), glsl_fragment_pipe_fog }, WINED3D_GL_EXT_NONE },
{STATE_RENDER(WINED3D_RS_FOGTABLEMODE), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_FOGTABLEMODE), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },

View File

@ -1509,7 +1509,7 @@ static void shader_none_select_depth_blt(void *shader_priv, const struct wined3d
static void shader_none_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) {} static void shader_none_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) {}
static void shader_none_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count) {} static void shader_none_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count) {}
static void shader_none_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count) {} static void shader_none_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count) {}
static void shader_none_load_constants(void *shader_priv, const struct wined3d_context *context, static void shader_none_load_constants(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state) {} const struct wined3d_state *state) {}
static void shader_none_load_np2fixup_constants(void *shader_priv, static void shader_none_load_np2fixup_constants(void *shader_priv,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) {} const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) {}
@ -1517,7 +1517,7 @@ static void shader_none_destroy(struct wined3d_shader *shader) {}
static void shader_none_context_destroyed(void *shader_priv, const struct wined3d_context *context) {} static void shader_none_context_destroyed(void *shader_priv, const struct wined3d_context *context) {}
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void shader_none_select(void *shader_priv, const struct wined3d_context *context, static void shader_none_select(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state) const struct wined3d_state *state)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;

View File

@ -582,11 +582,6 @@ static void state_alpha(struct wined3d_context *context, const struct wined3d_st
} }
} }
static void shaderconstant(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
context->load_constants = 1;
}
void state_clipping(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) void state_clipping(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
@ -613,7 +608,6 @@ void state_clipping(struct wined3d_context *context, const struct wined3d_state
* shader to update the enabled clipplanes. In case of fixed function, we * shader to update the enabled clipplanes. In case of fixed function, we
* need to update the clipping field from ffp_vertex_settings. */ * need to update the clipping field from ffp_vertex_settings. */
context->select_shader = 1; context->select_shader = 1;
context->load_constants = 1;
/* TODO: Keep track of previously enabled clipplanes to avoid unnecessary resetting /* TODO: Keep track of previously enabled clipplanes to avoid unnecessary resetting
* of already set values * of already set values
@ -3592,16 +3586,6 @@ static void tex_coordindex(struct wined3d_context *context, const struct wined3d
} }
} }
static void tex_bumpenvlscale(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
const struct wined3d_shader *ps = state->pixel_shader;
/* The pixel shader has to know the luminance scale. Do a constants update. */
if (ps && stage && (ps->reg_maps.luminanceparams & (1 << stage)))
context->load_constants = 1;
}
void sampler_texmatrix(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) void sampler_texmatrix(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{ {
const DWORD sampler = state_id - STATE_SAMPLER(0); const DWORD sampler = state_id - STATE_SAMPLER(0);
@ -3748,7 +3732,6 @@ void apply_pixelshader(struct wined3d_context *context, const struct wined3d_sta
} }
context->select_shader = 1; context->select_shader = 1;
context->load_constants = 1;
} }
static void state_geometry_shader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) static void state_geometry_shader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@ -3756,14 +3739,9 @@ static void state_geometry_shader(struct wined3d_context *context, const struct
context->select_shader = 1; context->select_shader = 1;
} }
static void shader_bumpenvmat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) static void shader_bumpenv(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{ {
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); context->constant_update_mask |= WINED3D_SHADER_CONST_PS_BUMP_ENV;
const struct wined3d_shader *ps = state->pixel_shader;
/* The pixel shader has to know the bump env matrix. Do a constants update. */
if (ps && stage && (ps->reg_maps.bumpmat & (1 << stage)))
context->load_constants = 1;
} }
void transform_world(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) void transform_world(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@ -4653,7 +4631,6 @@ void vertexdeclaration(struct wined3d_context *context, const struct wined3d_sta
context->last_was_vshader = useVertexShaderFunction; context->last_was_vshader = useVertexShaderFunction;
context->select_shader = 1; context->select_shader = 1;
context->load_constants = 1;
if (updateFog) if (updateFog)
context_apply_state(context, state, STATE_RENDER(WINED3D_RS_FOGVERTEXMODE)); context_apply_state(context, state, STATE_RENDER(WINED3D_RS_FOGVERTEXMODE));
@ -4714,7 +4691,7 @@ void viewport_vertexpart(struct wined3d_context *context, const struct wined3d_s
if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE))) if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE)))
state_pscale(context, state, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE)); state_pscale(context, state, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE));
/* Update the position fixup. */ /* Update the position fixup. */
context->load_constants = 1; context->constant_update_mask |= WINED3D_SHADER_CONST_VS_POS_FIXUP;
} }
void light(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) void light(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@ -4958,55 +4935,53 @@ const struct StateEntryTemplate misc_state_template[] = {
/* TODO: Move shader constant loading to vertex and fragment pipeline respectively, as soon as the pshader and /* TODO: Move shader constant loading to vertex and fragment pipeline respectively, as soon as the pshader and
* vshader loadings are untied from each other * vshader loadings are untied from each other
*/ */
{ STATE_VERTEXSHADERCONSTANT, { STATE_VERTEXSHADERCONSTANT, shaderconstant }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_PIXELSHADERCONSTANT, { STATE_VERTEXSHADERCONSTANT, NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenvmat }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), tex_bumpenvlscale }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), shader_bumpenv }, WINED3D_GL_EXT_NONE },
{ STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LOFFSET), { STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_VIEWPORT, { STATE_VIEWPORT, viewport_miscpart }, WINED3D_GL_EXT_NONE }, { STATE_VIEWPORT, { STATE_VIEWPORT, viewport_miscpart }, WINED3D_GL_EXT_NONE },
@ -5865,8 +5840,6 @@ static void validate_state_table(struct StateEntry *state_table)
STATE_VDECL, STATE_VDECL,
STATE_STREAMSRC, STATE_STREAMSRC,
STATE_INDEXBUFFER, STATE_INDEXBUFFER,
STATE_VERTEXSHADERCONSTANT,
STATE_PIXELSHADERCONSTANT,
STATE_VSHADER, STATE_VSHADER,
STATE_GEOMETRY_SHADER, STATE_GEOMETRY_SHADER,
STATE_PIXELSHADER, STATE_PIXELSHADER,

View File

@ -2586,10 +2586,6 @@ const char *debug_d3dstate(DWORD state)
return "STATE_GEOMETRY_SHADER"; return "STATE_GEOMETRY_SHADER";
if (STATE_IS_VIEWPORT(state)) if (STATE_IS_VIEWPORT(state))
return "STATE_VIEWPORT"; return "STATE_VIEWPORT";
if (STATE_IS_VERTEXSHADERCONSTANT(state))
return "STATE_VERTEXSHADERCONSTANT";
if (STATE_IS_PIXELSHADERCONSTANT(state))
return "STATE_PIXELSHADERCONSTANT";
if (STATE_IS_LIGHT_TYPE(state)) if (STATE_IS_LIGHT_TYPE(state))
return "STATE_LIGHT_TYPE"; return "STATE_LIGHT_TYPE";
if (STATE_IS_ACTIVELIGHT(state)) if (STATE_IS_ACTIVELIGHT(state))

View File

@ -283,6 +283,17 @@ enum wined3d_sampler_texture_type
WINED3DSTT_VOLUME = 4, WINED3DSTT_VOLUME = 4,
}; };
#define WINED3D_SHADER_CONST_VS_F 0x00000001
#define WINED3D_SHADER_CONST_VS_I 0x00000002
#define WINED3D_SHADER_CONST_VS_B 0x00000004
#define WINED3D_SHADER_CONST_VS_POS_FIXUP 0x00000008
#define WINED3D_SHADER_CONST_PS_F 0x00000010
#define WINED3D_SHADER_CONST_PS_I 0x00000020
#define WINED3D_SHADER_CONST_PS_B 0x00000040
#define WINED3D_SHADER_CONST_PS_BUMP_ENV 0x00000080
#define WINED3D_SHADER_CONST_PS_Y_CORR 0x00000100
#define WINED3D_SHADER_CONST_FFP_PS 0x00000200
enum wined3d_shader_register_type enum wined3d_shader_register_type
{ {
WINED3DSPR_TEMP = 0, WINED3DSPR_TEMP = 0,
@ -796,7 +807,7 @@ struct wined3d_vertex_pipe_ops;
struct wined3d_shader_backend_ops struct wined3d_shader_backend_ops
{ {
void (*shader_handle_instruction)(const struct wined3d_shader_instruction *); void (*shader_handle_instruction)(const struct wined3d_shader_instruction *);
void (*shader_select)(void *shader_priv, const struct wined3d_context *context, void (*shader_select)(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state); const struct wined3d_state *state);
void (*shader_disable)(void *shader_priv, const struct wined3d_context *context); void (*shader_disable)(void *shader_priv, const struct wined3d_context *context);
void (*shader_select_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info, void (*shader_select_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info,
@ -804,7 +815,7 @@ struct wined3d_shader_backend_ops
void (*shader_deselect_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info); void (*shader_deselect_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info);
void (*shader_update_float_vertex_constants)(struct wined3d_device *device, UINT start, UINT count); void (*shader_update_float_vertex_constants)(struct wined3d_device *device, UINT start, UINT count);
void (*shader_update_float_pixel_constants)(struct wined3d_device *device, UINT start, UINT count); void (*shader_update_float_pixel_constants)(struct wined3d_device *device, UINT start, UINT count);
void (*shader_load_constants)(void *shader_priv, const struct wined3d_context *context, void (*shader_load_constants)(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state); const struct wined3d_state *state);
void (*shader_load_np2fixup_constants)(void *shader_priv, const struct wined3d_gl_info *gl_info, void (*shader_load_np2fixup_constants)(void *shader_priv, const struct wined3d_gl_info *gl_info,
const struct wined3d_state *state); const struct wined3d_state *state);
@ -982,12 +993,7 @@ extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC
#define STATE_VIEWPORT (STATE_GEOMETRY_SHADER + 1) #define STATE_VIEWPORT (STATE_GEOMETRY_SHADER + 1)
#define STATE_IS_VIEWPORT(a) ((a) == STATE_VIEWPORT) #define STATE_IS_VIEWPORT(a) ((a) == STATE_VIEWPORT)
#define STATE_VERTEXSHADERCONSTANT (STATE_VIEWPORT + 1) #define STATE_LIGHT_TYPE (STATE_VIEWPORT + 1)
#define STATE_PIXELSHADERCONSTANT (STATE_VERTEXSHADERCONSTANT + 1)
#define STATE_IS_VERTEXSHADERCONSTANT(a) ((a) == STATE_VERTEXSHADERCONSTANT)
#define STATE_IS_PIXELSHADERCONSTANT(a) ((a) == STATE_PIXELSHADERCONSTANT)
#define STATE_LIGHT_TYPE (STATE_PIXELSHADERCONSTANT + 1)
#define STATE_IS_LIGHT_TYPE(a) ((a) == STATE_LIGHT_TYPE) #define STATE_IS_LIGHT_TYPE(a) ((a) == STATE_LIGHT_TYPE)
#define STATE_ACTIVELIGHT(a) (STATE_LIGHT_TYPE + 1 + (a)) #define STATE_ACTIVELIGHT(a) (STATE_LIGHT_TYPE + 1 + (a))
#define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS)) #define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS))
@ -1096,10 +1102,9 @@ struct wined3d_context
DWORD destroyed : 1; DWORD destroyed : 1;
DWORD valid : 1; DWORD valid : 1;
DWORD select_shader : 1; DWORD select_shader : 1;
DWORD load_constants : 1; DWORD texShaderBumpMap : 8; /* MAX_TEXTURES, 8 */
DWORD padding : 15; DWORD lastWasPow2Texture : 8; /* MAX_TEXTURES, 8 */
BYTE texShaderBumpMap; /* MAX_TEXTURES, 8 */ DWORD constant_update_mask;
BYTE lastWasPow2Texture; /* MAX_TEXTURES, 8 */
DWORD numbered_array_mask; DWORD numbered_array_mask;
GLenum tracking_parm; /* Which source is tracking current colour */ GLenum tracking_parm; /* Which source is tracking current colour */
GLenum untracked_materials[2]; GLenum untracked_materials[2];