mesa/st: add special casing for pointsize constant updating during validate

the previous method of using affected_states to trigger constant updates
was ineffectual in the scenario where a ubo pointsize was needed on
the first time a non-precompiled shader was used after being the not-last
vertex stage:

* have vs+gs -> gs precompiles with pointsize lowering -> gs constants get updated
* remove gs -> vs was precompiled without pointsize lowering -> vs constants broken

now just do a quick check as in st_atom_shader.c and set the flag manually to
ensure the update is done correctly every time

cc: mesa-stable

fixes #6207

fixes (radv):
KHR-GL46.texture_cube_map_array.image_op_fragment_sh
KHR-GL46.texture_cube_map_array.sampling
KHR-GL46.texture_cube_map_array.texture_size_fragment_sh
KHR-GL46.constant_expressions*

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15570>
This commit is contained in:
Mike Blumenkrantz 2022-03-24 21:45:32 -04:00 committed by Marge Bot
parent 6fb0bf51a3
commit eaf3c72a83
3 changed files with 24 additions and 20 deletions

View File

@ -1,9 +1,3 @@
#6207
KHR-GL46.texture_cube_map_array.image_op_fragment_sh,Fail
KHR-GL46.texture_cube_map_array.sampling,Fail
KHR-GL46.texture_cube_map_array.texture_size_fragment_sh,Fail
#6185
KHR-GL46.tessellation_shader.single.isolines_tessellation,Crash
KHR-GL46.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_MaxPatchVertices_Position_PointSize,Fail

View File

@ -178,6 +178,18 @@ static void check_attrib_edgeflag(struct st_context *st)
st_update_edgeflags(st, _mesa_draw_edge_flag_array_enabled(st->ctx));
}
static void check_pointsize(struct st_context *st)
{
if (st->ctx->VertexProgram.PointSizeEnabled)
return;
if (st->ctx->GeometryProgram._Current)
st->dirty |= ST_NEW_GS_CONSTANTS;
else if (st->ctx->TessEvalProgram._Current)
st->dirty |= ST_NEW_TES_CONSTANTS;
else
st->dirty |= ST_NEW_VS_CONSTANTS;
}
/***********************************************************************
* Update all derived state:
@ -207,6 +219,9 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
check_program_state(st);
st->gfx_shaders_may_be_dirty = false;
}
if (st->lower_point_size &&
(st->ctx->API == API_OPENGL_COMPAT || st->ctx->API == API_OPENGL_CORE))
check_pointsize(st);
st_manager_validate_framebuffers(st);
@ -217,6 +232,9 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
break;
case ST_PIPELINE_CLEAR:
if (st->lower_point_size &&
(st->ctx->API == API_OPENGL_COMPAT || st->ctx->API == API_OPENGL_CORE))
check_pointsize(st);
st_manager_validate_framebuffers(st);
pipeline_mask = ST_PIPELINE_CLEAR_STATE_MASK;
break;
@ -226,12 +244,18 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
check_program_state(st);
st->gfx_shaders_may_be_dirty = false;
}
if (st->lower_point_size &&
(st->ctx->API == API_OPENGL_COMPAT || st->ctx->API == API_OPENGL_CORE))
check_pointsize(st);
st_manager_validate_framebuffers(st);
pipeline_mask = ST_PIPELINE_META_STATE_MASK;
break;
case ST_PIPELINE_UPDATE_FRAMEBUFFER:
if (st->lower_point_size &&
(st->ctx->API == API_OPENGL_COMPAT || st->ctx->API == API_OPENGL_CORE))
check_pointsize(st);
st_manager_validate_framebuffers(st);
pipeline_mask = ST_PIPELINE_UPDATE_FB_STATE_MASK;
break;

View File

@ -802,20 +802,6 @@ st_create_common_variant(struct st_context *st,
NIR_PASS_V(state.ir.nir, nir_lower_point_size_mov,
point_size_state);
switch (prog->info.stage) {
case MESA_SHADER_VERTEX:
prog->affected_states |= ST_NEW_VS_CONSTANTS;
break;
case MESA_SHADER_TESS_EVAL:
prog->affected_states |= ST_NEW_TES_CONSTANTS;
break;
case MESA_SHADER_GEOMETRY:
prog->affected_states |= ST_NEW_GS_CONSTANTS;
break;
default:
unreachable("bad shader stage");
}
finalize = true;
}