wined3d: Only invalidate the current ffp vertex shader if the light type changed.
As opposed to any time a light parameter changed.
This commit is contained in:
parent
bdd97858bf
commit
74c5a22daa
|
@ -1783,6 +1783,14 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
|
||||||
TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n",
|
TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n",
|
||||||
light->range, light->falloff, light->theta, light->phi);
|
light->range, light->falloff, light->theta, light->phi);
|
||||||
|
|
||||||
|
/* Update the live definitions if the light is currently assigned a glIndex. */
|
||||||
|
if (object->glIndex != -1 && !device->isRecordingState)
|
||||||
|
{
|
||||||
|
if (object->OriginalParms.type != light->type)
|
||||||
|
device_invalidate_state(device, STATE_LIGHT_TYPE);
|
||||||
|
device_invalidate_state(device, STATE_ACTIVELIGHT(object->glIndex));
|
||||||
|
}
|
||||||
|
|
||||||
/* Save away the information. */
|
/* Save away the information. */
|
||||||
object->OriginalParms = *light;
|
object->OriginalParms = *light;
|
||||||
|
|
||||||
|
@ -1855,10 +1863,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
|
||||||
FIXME("Unrecognized light type %#x.\n", light->type);
|
FIXME("Unrecognized light type %#x.\n", light->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the live definitions if the light is currently assigned a glIndex. */
|
|
||||||
if (object->glIndex != -1 && !device->isRecordingState)
|
|
||||||
device_invalidate_state(device, STATE_ACTIVELIGHT(object->glIndex));
|
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1932,7 +1936,10 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
|
||||||
if (light_info->glIndex != -1)
|
if (light_info->glIndex != -1)
|
||||||
{
|
{
|
||||||
if (!device->isRecordingState)
|
if (!device->isRecordingState)
|
||||||
|
{
|
||||||
|
device_invalidate_state(device, STATE_LIGHT_TYPE);
|
||||||
device_invalidate_state(device, STATE_ACTIVELIGHT(light_info->glIndex));
|
device_invalidate_state(device, STATE_ACTIVELIGHT(light_info->glIndex));
|
||||||
|
}
|
||||||
|
|
||||||
device->updateStateBlock->state.lights[light_info->glIndex] = NULL;
|
device->updateStateBlock->state.lights[light_info->glIndex] = NULL;
|
||||||
light_info->glIndex = -1;
|
light_info->glIndex = -1;
|
||||||
|
@ -1978,7 +1985,10 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
|
||||||
|
|
||||||
/* i == light_info->glIndex */
|
/* i == light_info->glIndex */
|
||||||
if (!device->isRecordingState)
|
if (!device->isRecordingState)
|
||||||
|
{
|
||||||
|
device_invalidate_state(device, STATE_LIGHT_TYPE);
|
||||||
device_invalidate_state(device, STATE_ACTIVELIGHT(i));
|
device_invalidate_state(device, STATE_ACTIVELIGHT(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6729,13 +6729,6 @@ static void glsl_vertex_pipe_shader(struct wined3d_context *context,
|
||||||
context->select_shader = 1;
|
context->select_shader = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void glsl_vertex_pipe_light(struct wined3d_context *context,
|
|
||||||
const struct wined3d_state *state, DWORD state_id)
|
|
||||||
{
|
|
||||||
light(context, state, state_id);
|
|
||||||
context->select_shader = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct StateEntryTemplate glsl_vertex_pipe_vp_states[] =
|
static const struct StateEntryTemplate glsl_vertex_pipe_vp_states[] =
|
||||||
{
|
{
|
||||||
{STATE_VDECL, {STATE_VDECL, vertexdeclaration }, WINED3D_GL_EXT_NONE },
|
{STATE_VDECL, {STATE_VDECL, vertexdeclaration }, WINED3D_GL_EXT_NONE },
|
||||||
|
@ -6776,14 +6769,15 @@ static const struct StateEntryTemplate glsl_vertex_pipe_vp_states[] =
|
||||||
{STATE_CLIPPLANE(30), {STATE_CLIPPLANE(30), clipplane }, WINED3D_GL_EXT_NONE },
|
{STATE_CLIPPLANE(30), {STATE_CLIPPLANE(30), clipplane }, WINED3D_GL_EXT_NONE },
|
||||||
{STATE_CLIPPLANE(31), {STATE_CLIPPLANE(31), clipplane }, WINED3D_GL_EXT_NONE },
|
{STATE_CLIPPLANE(31), {STATE_CLIPPLANE(31), clipplane }, WINED3D_GL_EXT_NONE },
|
||||||
/* Lights */
|
/* Lights */
|
||||||
{STATE_ACTIVELIGHT(0), {STATE_ACTIVELIGHT(0), glsl_vertex_pipe_light }, WINED3D_GL_EXT_NONE },
|
{STATE_LIGHT_TYPE, {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE },
|
||||||
{STATE_ACTIVELIGHT(1), {STATE_ACTIVELIGHT(1), glsl_vertex_pipe_light }, WINED3D_GL_EXT_NONE },
|
{STATE_ACTIVELIGHT(0), {STATE_ACTIVELIGHT(0), light }, WINED3D_GL_EXT_NONE },
|
||||||
{STATE_ACTIVELIGHT(2), {STATE_ACTIVELIGHT(2), glsl_vertex_pipe_light }, WINED3D_GL_EXT_NONE },
|
{STATE_ACTIVELIGHT(1), {STATE_ACTIVELIGHT(1), light }, WINED3D_GL_EXT_NONE },
|
||||||
{STATE_ACTIVELIGHT(3), {STATE_ACTIVELIGHT(3), glsl_vertex_pipe_light }, WINED3D_GL_EXT_NONE },
|
{STATE_ACTIVELIGHT(2), {STATE_ACTIVELIGHT(2), light }, WINED3D_GL_EXT_NONE },
|
||||||
{STATE_ACTIVELIGHT(4), {STATE_ACTIVELIGHT(4), glsl_vertex_pipe_light }, WINED3D_GL_EXT_NONE },
|
{STATE_ACTIVELIGHT(3), {STATE_ACTIVELIGHT(3), light }, WINED3D_GL_EXT_NONE },
|
||||||
{STATE_ACTIVELIGHT(5), {STATE_ACTIVELIGHT(5), glsl_vertex_pipe_light }, WINED3D_GL_EXT_NONE },
|
{STATE_ACTIVELIGHT(4), {STATE_ACTIVELIGHT(4), light }, WINED3D_GL_EXT_NONE },
|
||||||
{STATE_ACTIVELIGHT(6), {STATE_ACTIVELIGHT(6), glsl_vertex_pipe_light }, WINED3D_GL_EXT_NONE },
|
{STATE_ACTIVELIGHT(5), {STATE_ACTIVELIGHT(5), light }, WINED3D_GL_EXT_NONE },
|
||||||
{STATE_ACTIVELIGHT(7), {STATE_ACTIVELIGHT(7), glsl_vertex_pipe_light }, WINED3D_GL_EXT_NONE },
|
{STATE_ACTIVELIGHT(6), {STATE_ACTIVELIGHT(6), light }, WINED3D_GL_EXT_NONE },
|
||||||
|
{STATE_ACTIVELIGHT(7), {STATE_ACTIVELIGHT(7), light }, WINED3D_GL_EXT_NONE },
|
||||||
/* Viewport */
|
/* Viewport */
|
||||||
{STATE_VIEWPORT, {STATE_VIEWPORT, viewport_vertexpart }, WINED3D_GL_EXT_NONE },
|
{STATE_VIEWPORT, {STATE_VIEWPORT, viewport_vertexpart }, WINED3D_GL_EXT_NONE },
|
||||||
/* Transform states */
|
/* Transform states */
|
||||||
|
|
|
@ -5167,6 +5167,7 @@ const struct StateEntryTemplate vp_ffp_states[] =
|
||||||
{ STATE_CLIPPLANE(30), { STATE_CLIPPLANE(30), clipplane }, WINED3D_GL_EXT_NONE },
|
{ STATE_CLIPPLANE(30), { STATE_CLIPPLANE(30), clipplane }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_CLIPPLANE(31), { STATE_CLIPPLANE(31), clipplane }, WINED3D_GL_EXT_NONE },
|
{ STATE_CLIPPLANE(31), { STATE_CLIPPLANE(31), clipplane }, WINED3D_GL_EXT_NONE },
|
||||||
/* Lights */
|
/* Lights */
|
||||||
|
{ STATE_LIGHT_TYPE, { STATE_LIGHT_TYPE, state_nop }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_ACTIVELIGHT(0), { STATE_ACTIVELIGHT(0), light }, WINED3D_GL_EXT_NONE },
|
{ STATE_ACTIVELIGHT(0), { STATE_ACTIVELIGHT(0), light }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_ACTIVELIGHT(1), { STATE_ACTIVELIGHT(1), light }, WINED3D_GL_EXT_NONE },
|
{ STATE_ACTIVELIGHT(1), { STATE_ACTIVELIGHT(1), light }, WINED3D_GL_EXT_NONE },
|
||||||
{ STATE_ACTIVELIGHT(2), { STATE_ACTIVELIGHT(2), light }, WINED3D_GL_EXT_NONE },
|
{ STATE_ACTIVELIGHT(2), { STATE_ACTIVELIGHT(2), light }, WINED3D_GL_EXT_NONE },
|
||||||
|
@ -5862,6 +5863,7 @@ static void validate_state_table(struct StateEntry *state_table)
|
||||||
STATE_GEOMETRY_SHADER,
|
STATE_GEOMETRY_SHADER,
|
||||||
STATE_PIXELSHADER,
|
STATE_PIXELSHADER,
|
||||||
STATE_VIEWPORT,
|
STATE_VIEWPORT,
|
||||||
|
STATE_LIGHT_TYPE,
|
||||||
STATE_SCISSORRECT,
|
STATE_SCISSORRECT,
|
||||||
STATE_FRONTFACE,
|
STATE_FRONTFACE,
|
||||||
STATE_POINTSPRITECOORDORIGIN,
|
STATE_POINTSPRITECOORDORIGIN,
|
||||||
|
|
|
@ -2572,6 +2572,8 @@ const char *debug_d3dstate(DWORD state)
|
||||||
return "STATE_VERTEXSHADERCONSTANT";
|
return "STATE_VERTEXSHADERCONSTANT";
|
||||||
if (STATE_IS_PIXELSHADERCONSTANT(state))
|
if (STATE_IS_PIXELSHADERCONSTANT(state))
|
||||||
return "STATE_PIXELSHADERCONSTANT";
|
return "STATE_PIXELSHADERCONSTANT";
|
||||||
|
if (STATE_IS_LIGHT_TYPE(state))
|
||||||
|
return "STATE_LIGHT_TYPE";
|
||||||
if (STATE_IS_ACTIVELIGHT(state))
|
if (STATE_IS_ACTIVELIGHT(state))
|
||||||
return wine_dbg_sprintf("STATE_ACTIVELIGHT(%#x)", state - STATE_ACTIVELIGHT(0));
|
return wine_dbg_sprintf("STATE_ACTIVELIGHT(%#x)", state - STATE_ACTIVELIGHT(0));
|
||||||
if (STATE_IS_SCISSORRECT(state))
|
if (STATE_IS_SCISSORRECT(state))
|
||||||
|
|
|
@ -983,7 +983,9 @@ extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC
|
||||||
#define STATE_IS_VERTEXSHADERCONSTANT(a) ((a) == STATE_VERTEXSHADERCONSTANT)
|
#define STATE_IS_VERTEXSHADERCONSTANT(a) ((a) == STATE_VERTEXSHADERCONSTANT)
|
||||||
#define STATE_IS_PIXELSHADERCONSTANT(a) ((a) == STATE_PIXELSHADERCONSTANT)
|
#define STATE_IS_PIXELSHADERCONSTANT(a) ((a) == STATE_PIXELSHADERCONSTANT)
|
||||||
|
|
||||||
#define STATE_ACTIVELIGHT(a) (STATE_PIXELSHADERCONSTANT + (a) + 1)
|
#define STATE_LIGHT_TYPE (STATE_PIXELSHADERCONSTANT + 1)
|
||||||
|
#define STATE_IS_LIGHT_TYPE(a) ((a) == STATE_LIGHT_TYPE)
|
||||||
|
#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))
|
||||||
|
|
||||||
#define STATE_SCISSORRECT (STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS - 1) + 1)
|
#define STATE_SCISSORRECT (STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS - 1) + 1)
|
||||||
|
|
Loading…
Reference in New Issue