mesa/st: don't use base shader serialization when uniforms are not packed
When loading the base shader serialization there is a discrepancy between the state parameters that may already have been optimized, because after storing the serialization the shader went through st_finalize_nir, and _mesa_optimize_state_parameters was run, so that original state parameters may have been optimized and replaced by new parameters. After get_nir_shader is called, the original state parameters are re-added - in addition to the optimized parameters. This lead to an bug with the uniform offsets when lowering uniforms to UBOs. Therefore, as a hotfix for drivers that don't support packed uniforms, ignore the base serialization and use the serialization obtained after st_finalize_nir was run. With that the problem can be avoided. Fixes:5eb0136a3c
mesa/st: when creating draw shader variants, use the base nir and skip driver opts Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10881 v2: reorder conditional evaluation for better readability (zmike) v3: revertc72bb8de7
("r300: mark new fails") (Pavel Ondračka) Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28994>
This commit is contained in:
@@ -635,7 +635,7 @@ static const struct nir_shader_compiler_options draw_nir_options = {
|
||||
static struct nir_shader *
|
||||
get_nir_shader(struct st_context *st, struct gl_program *prog, bool is_draw)
|
||||
{
|
||||
if (!is_draw && prog->nir) {
|
||||
if ((!is_draw || !st->ctx->Const.PackedDriverUniformStorage) && prog->nir) {
|
||||
nir_shader *nir = prog->nir;
|
||||
|
||||
/* The first shader variant takes ownership of NIR, so that there is
|
||||
@@ -651,7 +651,8 @@ get_nir_shader(struct st_context *st, struct gl_program *prog, bool is_draw)
|
||||
const struct nir_shader_compiler_options *options =
|
||||
is_draw ? &draw_nir_options : st_get_nir_compiler_options(st, prog->info.stage);
|
||||
|
||||
if (is_draw && (!prog->shader_program || prog->shader_program->data->LinkStatus != LINKING_SKIPPED)) {
|
||||
if (is_draw && st->ctx->Const.PackedDriverUniformStorage &&
|
||||
(!prog->shader_program || prog->shader_program->data->LinkStatus != LINKING_SKIPPED)) {
|
||||
assert(prog->base_serialized_nir);
|
||||
blob_reader_init(&blob_reader, prog->base_serialized_nir, prog->base_serialized_nir_size);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user