mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 08:10:09 +01:00
st/glsl: set driver locations in nir_lower_drawpixels()
This previously worked because the driver locations would later be set when st_nir_assign_uniform_locations() was called for a second time but we will be skipping the extra call in a later patch. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37037>
This commit is contained in:
parent
8417f4a8eb
commit
3d9a5ee95d
3 changed files with 25 additions and 10 deletions
|
|
@ -46,7 +46,9 @@ typedef struct nir_lower_drawpixels_options {
|
|||
} nir_lower_drawpixels_options;
|
||||
|
||||
bool st_nir_lower_drawpixels(struct nir_shader *shader,
|
||||
const nir_lower_drawpixels_options *options);
|
||||
const nir_lower_drawpixels_options *options,
|
||||
struct gl_program_parameter_list *paramList,
|
||||
bool packed_driver_uniform_storage);
|
||||
|
||||
bool st_nir_lower_builtin(struct nir_shader *shader);
|
||||
bool st_nir_lower_tex_src_plane(struct nir_shader *shader, unsigned free_slots,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ typedef struct {
|
|||
const nir_lower_drawpixels_options *options;
|
||||
nir_shader *shader;
|
||||
nir_variable *texcoord_const, *scale, *bias, *tex, *pixelmap;
|
||||
struct gl_program_parameter_list *paramList;
|
||||
bool packed_driver_uniform_storage;
|
||||
} lower_drawpixels_state;
|
||||
|
||||
static nir_def *
|
||||
|
|
@ -48,8 +50,10 @@ static nir_def *
|
|||
get_scale(nir_builder *b, lower_drawpixels_state *state)
|
||||
{
|
||||
if (state->scale == NULL) {
|
||||
state->scale = nir_state_variable_create(state->shader, glsl_vec4_type(), "gl_PTscale",
|
||||
state->options->scale_state_tokens);
|
||||
state->scale =
|
||||
st_nir_state_variable_create(state->shader, glsl_vec4_type(), state->paramList,
|
||||
state->options->scale_state_tokens,
|
||||
"gl_PTscale", state->packed_driver_uniform_storage);
|
||||
}
|
||||
return nir_load_var(b, state->scale);
|
||||
}
|
||||
|
|
@ -58,8 +62,10 @@ static nir_def *
|
|||
get_bias(nir_builder *b, lower_drawpixels_state *state)
|
||||
{
|
||||
if (state->bias == NULL) {
|
||||
state->bias = nir_state_variable_create(state->shader, glsl_vec4_type(), "gl_PTbias",
|
||||
state->options->bias_state_tokens);
|
||||
state->bias =
|
||||
st_nir_state_variable_create(state->shader, glsl_vec4_type(), state->paramList,
|
||||
state->options->bias_state_tokens,
|
||||
"gl_PTbias", state->packed_driver_uniform_storage);
|
||||
}
|
||||
return nir_load_var(b, state->bias);
|
||||
}
|
||||
|
|
@ -68,9 +74,10 @@ static nir_def *
|
|||
get_texcoord_const(nir_builder *b, lower_drawpixels_state *state)
|
||||
{
|
||||
if (state->texcoord_const == NULL) {
|
||||
state->texcoord_const = nir_state_variable_create(state->shader, glsl_vec4_type(),
|
||||
"gl_MultiTexCoord0",
|
||||
state->options->texcoord_state_tokens);
|
||||
state->texcoord_const =
|
||||
st_nir_state_variable_create(state->shader, glsl_vec4_type(), state->paramList,
|
||||
state->options->texcoord_state_tokens,
|
||||
"gl_MultiTexCoord0", state->packed_driver_uniform_storage);
|
||||
}
|
||||
return nir_load_var(b, state->texcoord_const);
|
||||
}
|
||||
|
|
@ -212,13 +219,17 @@ lower_drawpixels_instr(nir_builder *b, nir_instr *instr, void *cb_data)
|
|||
|
||||
bool
|
||||
st_nir_lower_drawpixels(nir_shader *shader,
|
||||
const nir_lower_drawpixels_options *options)
|
||||
const nir_lower_drawpixels_options *options,
|
||||
struct gl_program_parameter_list *paramList,
|
||||
bool packed_driver_uniform_storage)
|
||||
{
|
||||
assert(shader->info.io_lowered);
|
||||
|
||||
lower_drawpixels_state state = {
|
||||
.options = options,
|
||||
.shader = shader,
|
||||
.paramList = paramList,
|
||||
.packed_driver_uniform_storage = packed_driver_uniform_storage,
|
||||
};
|
||||
|
||||
assert(shader->info.stage == MESA_SHADER_FRAGMENT);
|
||||
|
|
|
|||
|
|
@ -1155,7 +1155,9 @@ st_create_fp_variant(struct st_context *st,
|
|||
memcpy(options.texcoord_state_tokens, texcoord_state,
|
||||
sizeof(options.texcoord_state_tokens));
|
||||
|
||||
NIR_PASS(_, state.ir.nir, st_nir_lower_drawpixels, &options);
|
||||
NIR_PASS(_, state.ir.nir, st_nir_lower_drawpixels, &options,
|
||||
st->allow_st_finalize_nir_twice ? fp->Parameters : NULL,
|
||||
st->ctx->Const.PackedDriverUniformStorage);
|
||||
finalize = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue