diff --git a/.pick_status.json b/.pick_status.json index 1e5a42399fb..5ce31094d8f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -9744,7 +9744,7 @@ "description": "mesa/st: use same path for setting state ref locations", "nominated": false, "nomination_type": 0, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 53f4235678d..9944cdb3289 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -136,34 +136,18 @@ st_nir_assign_uniform_locations(struct st_context *st, } } else if (uniform->state_slots) { const gl_state_index16 *const stateTokens = uniform->state_slots[0].tokens; - if (st->allow_st_finalize_nir_twice) { - /* Make sure the variant has the correct locations set */ - loc = _mesa_lookup_state_param_idx(prog->Parameters, stateTokens); - if (loc >= 0) { - if (ctx->Const.PackedDriverUniformStorage) { - uniform->data.driver_location = - prog->Parameters->Parameters[loc].ValueOffset; - } else - uniform->data.driver_location = loc; - } - continue; + /* Make sure the variant has the correct locations set */ + loc = _mesa_lookup_state_param_idx(prog->Parameters, stateTokens); + if (loc >= 0) { + if (ctx->Const.PackedDriverUniformStorage) { + uniform->data.driver_location = + prog->Parameters->Parameters[loc].ValueOffset; + } else + uniform->data.driver_location = loc; } - unsigned comps; - if (glsl_type_is_struct_or_ifc(type)) { - comps = 4; - } else { - comps = glsl_get_vector_elements(type); - } - - if (ctx->Const.PackedDriverUniformStorage) { - loc = _mesa_add_sized_state_reference(prog->Parameters, - stateTokens, comps, false); - loc = prog->Parameters->Parameters[loc].ValueOffset; - } else { - loc = _mesa_add_state_reference(prog->Parameters, stateTokens); - } + continue; } else { loc = st_nir_lookup_parameter_index(prog, uniform); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 8332f3fb049..1ebdd595798 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -713,8 +713,6 @@ lower_ucp(struct st_context *st, clipplane_state[i][0] = STATE_CLIP_INTERNAL; clipplane_state[i][1] = i; } - if (!st->allow_st_finalize_nir_twice) - _mesa_add_state_reference(params, clipplane_state[i]); } if (nir->info.stage == MESA_SHADER_VERTEX || @@ -726,21 +724,19 @@ lower_ucp(struct st_context *st, can_compact, clipplane_state); } - if (st->allow_st_finalize_nir_twice) { - nir_foreach_variable_with_modes(uniform, nir, nir_var_uniform | - nir_var_image) { - if (!uniform->state_slots || !st->allow_st_finalize_nir_twice) - continue; + nir_foreach_variable_with_modes(uniform, nir, nir_var_uniform | + nir_var_image) { + if (!uniform->state_slots) + continue; - for (int plane = 0; plane < MAX_CLIP_PLANES; plane++) { - char tmp[100]; - snprintf(tmp, ARRAY_SIZE(tmp), "gl_ClipPlane%dMESA", plane); - if (strcmp(uniform->name, tmp) == 0) { - unsigned loc = - _mesa_add_state_reference(params, clipplane_state[plane]); - uniform->data.driver_location = st->ctx->Const.PackedDriverUniformStorage ? - params->Parameters[loc].ValueOffset : loc; - } + for (int plane = 0; plane < MAX_CLIP_PLANES; plane++) { + char tmp[100]; + snprintf(tmp, ARRAY_SIZE(tmp), "gl_ClipPlane%dMESA", plane); + if (strcmp(uniform->name, tmp) == 0) { + unsigned loc = + _mesa_add_state_reference(params, clipplane_state[plane]); + uniform->data.driver_location = st->ctx->Const.PackedDriverUniformStorage ? + params->Parameters[loc].ValueOffset : loc; } } } @@ -832,8 +828,7 @@ st_create_common_variant(struct st_context *st, /* if flag is set, shader must export psiz */ _mesa_add_state_reference(params, point_size_state); NIR_PASS(_, state.ir.nir, st_nir_lower_point_size_mov, - point_size_state, - st->allow_st_finalize_nir_twice ? prog->Parameters : NULL, + point_size_state, prog->Parameters, st->ctx->Const.PackedDriverUniformStorage); finalize = true; @@ -1104,8 +1099,7 @@ st_create_fp_variant(struct st_context *st, if (key->lower_alpha_func != COMPARE_FUNC_ALWAYS) { _mesa_add_state_reference(params, alpha_ref_state); NIR_PASS(_, state.ir.nir, st_nir_lower_alpha_test, key->lower_alpha_func, - false, alpha_ref_state, - st->allow_st_finalize_nir_twice ? fp->Parameters : NULL, + false, alpha_ref_state, fp->Parameters, st->ctx->Const.PackedDriverUniformStorage); finalize = true; } @@ -1180,8 +1174,7 @@ st_create_fp_variant(struct st_context *st, sizeof(options.texcoord_state_tokens)); NIR_PASS(_, state.ir.nir, st_nir_lower_drawpixels, &options, - st->allow_st_finalize_nir_twice ? fp->Parameters : NULL, - st->ctx->Const.PackedDriverUniformStorage); + fp->Parameters, st->ctx->Const.PackedDriverUniformStorage); finalize = true; }