mesa/st: Signal state changes when depth_clamp is emulated
v1 implemented by Erik Faye-Lund <erik.faye-lund@collabora.com> v2: - Add GS and TES - fix constants state update flags (Erik) v3: don't update rasterizer when depth_clamp is lowered (Erik) v4: Correct NewDepthClamp and also set flags for NewClipControl (Erik) v5: Also set shader_has_one_variant property acording to possible depth_clamp lowering (Marek) Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user