wined3d: Only write gl_ClipVertex if clipping is enabled in shader_glsl_generate_ffp_vertex_shader().
This commit is contained in:
parent
1c2392ddb0
commit
bdd97858bf
|
@ -4937,7 +4937,8 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_
|
|||
|
||||
shader_addline(buffer, "vec4 ec_pos = gl_ModelViewMatrix * gl_Vertex;\n");
|
||||
shader_addline(buffer, "gl_Position = gl_ProjectionMatrix * ec_pos;\n");
|
||||
shader_addline(buffer, "gl_ClipVertex = ec_pos;\n");
|
||||
if (settings->clipping)
|
||||
shader_addline(buffer, "gl_ClipVertex = ec_pos;\n");
|
||||
shader_addline(buffer, "ec_pos /= ec_pos.w;\n");
|
||||
|
||||
if (!settings->normal)
|
||||
|
|
|
@ -593,32 +593,28 @@ void state_clipping(struct wined3d_context *context, const struct wined3d_state
|
|||
DWORD enable = 0xffffffff;
|
||||
DWORD disable = 0x00000000;
|
||||
|
||||
if (use_vs(state))
|
||||
if (use_vs(state) && !context->d3d_info->vs_clipping)
|
||||
{
|
||||
if (!context->d3d_info->vs_clipping)
|
||||
{
|
||||
/* The spec says that opengl clipping planes are disabled when using shaders. Direct3D planes aren't,
|
||||
* so that is an issue. The MacOS ATI driver keeps clipping planes activated with shaders in some
|
||||
* conditions I got sick of tracking down. The shader state handler disables all clip planes because
|
||||
* of that - don't do anything here and keep them disabled
|
||||
*/
|
||||
if (state->render_states[WINED3D_RS_CLIPPLANEENABLE])
|
||||
{
|
||||
static BOOL warned = FALSE;
|
||||
if(!warned) {
|
||||
FIXME("Clipping not supported with vertex shaders\n");
|
||||
warned = TRUE;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
static BOOL warned;
|
||||
|
||||
/* glEnable(GL_CLIP_PLANEx) doesn't apply to vertex shaders. The enabled / disabled planes are
|
||||
* hardcoded into the shader. Update the shader to update the enabled clipplanes */
|
||||
context->select_shader = 1;
|
||||
context->load_constants = 1;
|
||||
/* The OpenGL spec says that clipping planes are disabled when using
|
||||
* shaders. Direct3D planes aren't, so that is an issue. The MacOS ATI
|
||||
* driver keeps clipping planes activated with shaders in some
|
||||
* conditions I got sick of tracking down. The shader state handler
|
||||
* disables all clip planes because of that - don't do anything here
|
||||
* and keep them disabled. */
|
||||
if (state->render_states[WINED3D_RS_CLIPPLANEENABLE] && !warned++)
|
||||
FIXME("Clipping not supported with vertex shaders\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* glEnable(GL_CLIP_PLANEx) doesn't apply to (ARB backend) vertex shaders.
|
||||
* The enabled / disabled planes are hardcoded into the shader. Update the
|
||||
* shader to update the enabled clipplanes. In case of fixed function, we
|
||||
* need to update the clipping field from ffp_vertex_settings. */
|
||||
context->select_shader = 1;
|
||||
context->load_constants = 1;
|
||||
|
||||
/* TODO: Keep track of previously enabled clipplanes to avoid unnecessary resetting
|
||||
* of already set values
|
||||
*/
|
||||
|
|
|
@ -3532,6 +3532,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
|
|||
{
|
||||
memset(settings, 0, sizeof(*settings));
|
||||
|
||||
settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
|
||||
&& state->render_states[WINED3D_RS_CLIPPLANEENABLE];
|
||||
settings->point_size = state->gl_primitive_type == GL_POINTS;
|
||||
if (!state->render_states[WINED3D_RS_FOGENABLE])
|
||||
settings->fog_mode = WINED3D_FFP_VS_FOG_OFF;
|
||||
|
@ -3551,6 +3553,8 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
|
|||
return;
|
||||
}
|
||||
|
||||
settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
|
||||
&& state->render_states[WINED3D_RS_CLIPPLANEENABLE];
|
||||
settings->normal = !!(si->use_map & (1 << WINED3D_FFP_NORMAL));
|
||||
settings->normalize = settings->normal && state->render_states[WINED3D_RS_NORMALIZENORMALS];
|
||||
settings->lighting = !!state->render_states[WINED3D_RS_LIGHTING];
|
||||
|
|
|
@ -1716,6 +1716,7 @@ struct wined3d_ffp_vs_settings
|
|||
DWORD ambient_source : 2;
|
||||
DWORD specular_source : 2;
|
||||
|
||||
DWORD clipping : 1;
|
||||
DWORD normal : 1;
|
||||
DWORD normalize : 1;
|
||||
DWORD lighting : 1;
|
||||
|
@ -1723,7 +1724,7 @@ struct wined3d_ffp_vs_settings
|
|||
DWORD point_size : 1;
|
||||
DWORD fog_mode : 2;
|
||||
DWORD texcoords : 8; /* MAX_TEXTURES */
|
||||
DWORD padding : 17;
|
||||
DWORD padding : 16;
|
||||
|
||||
BYTE texgen[MAX_TEXTURES];
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue