From eaf3c72a8371a0a83261b1b1e1b0d68147314a99 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 24 Mar 2022 21:45:32 -0400 Subject: [PATCH] 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 Part-of: --- .../drivers/zink/ci/zink-radv-fails.txt | 6 ----- src/mesa/state_tracker/st_atom.c | 24 +++++++++++++++++++ src/mesa/state_tracker/st_program.c | 14 ----------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/zink/ci/zink-radv-fails.txt b/src/gallium/drivers/zink/ci/zink-radv-fails.txt index fbf0e7499af..0dc493048cf 100644 --- a/src/gallium/drivers/zink/ci/zink-radv-fails.txt +++ b/src/gallium/drivers/zink/ci/zink-radv-fails.txt @@ -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 diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index ee6e47b9793..0b7b5ffd4dd 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -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; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 06b2eb2c610..1bc332776da 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -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; }