diff options
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index fada76437b2..00e77250eb8 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -237,6 +237,16 @@ st_invalidate_state(struct gl_context *ctx) if (new_state & _NEW_CURRENT_ATTRIB && st_vp_uses_current_values(ctx)) st->dirty |= ST_NEW_VERTEX_ARRAYS; + if (st->clamp_frag_depth_in_shader && (new_state & _NEW_VIEWPORT)) { + if (ctx->GeometryProgram._Current) + st->dirty |= ST_NEW_GS_CONSTANTS; + else if (ctx->TessEvalProgram._Current) + st->dirty |= ST_NEW_TES_CONSTANTS; + else + st->dirty |= ST_NEW_VS_CONSTANTS; + st->dirty |= ST_NEW_FS_CONSTANTS; + } + /* Update the vertex shader if ctx->Light._ClampVertexColor was changed. */ if (st->clamp_vert_color_in_shader && (new_state & _NEW_LIGHT)) { st->dirty |= ST_NEW_VS_STATE; @@ -511,7 +521,17 @@ st_init_driver_flags(struct st_context *st) f->NewClipControl = ST_NEW_VIEWPORT | ST_NEW_RASTERIZER; f->NewClipPlane = ST_NEW_CLIP_STATE; f->NewClipPlaneEnable = ST_NEW_RASTERIZER; - f->NewDepthClamp = ST_NEW_RASTERIZER; + + if (st->clamp_frag_depth_in_shader) { + f->NewClipControl |= ST_NEW_VS_STATE | ST_NEW_GS_STATE | + ST_NEW_TES_STATE; + + f->NewDepthClamp = ST_NEW_FS_STATE | ST_NEW_VS_STATE | + ST_NEW_GS_STATE | ST_NEW_TES_STATE; + } else { + f->NewDepthClamp = ST_NEW_RASTERIZER; + } + f->NewLineState = ST_NEW_RASTERIZER; f->NewPolygonState = ST_NEW_RASTERIZER; f->NewPolygonStipple = ST_NEW_POLY_STIPPLE; @@ -698,19 +718,23 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe, /* Set which shader types can be compiled at link time. */ st->shader_has_one_variant[MESA_SHADER_VERTEX] = st->has_shareable_shaders && + !st->clamp_frag_depth_in_shader && !st->clamp_vert_color_in_shader; st->shader_has_one_variant[MESA_SHADER_FRAGMENT] = st->has_shareable_shaders && !st->clamp_frag_color_in_shader && + !st->clamp_frag_depth_in_shader && !st->force_persample_in_shader; st->shader_has_one_variant[MESA_SHADER_TESS_CTRL] = st->has_shareable_shaders; st->shader_has_one_variant[MESA_SHADER_TESS_EVAL] = st->has_shareable_shaders && + !st->clamp_frag_depth_in_shader && !st->clamp_vert_color_in_shader; st->shader_has_one_variant[MESA_SHADER_GEOMETRY] = st->has_shareable_shaders && + !st->clamp_frag_depth_in_shader && !st->clamp_vert_color_in_shader; st->shader_has_one_variant[MESA_SHADER_COMPUTE] = st->has_shareable_shaders; |