st/nir: Fix the st->pbo.use_gs case.
This case hadn't been ported to NIR before, and I missed that when
removing the TGSI path and replacing it with NIR -> NTT for TGSI drivers.
This caused breakage in nv50 on piglit's pbo-teximage.
In the process, the !use_gs gets its layer output fixed to be an int
instead of a vec4, which I suspect would fix validation in that path.
Fixes: 57effa342b
("st/mesa: Drop the TGSI paths for PBOs and use nir-to-tgsi if needed.")
Closes: #3680
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7320>
This commit is contained in:
parent
f8c1d79f69
commit
9143c08125
|
@ -292,13 +292,48 @@ st_pbo_draw(struct st_context *st, const struct st_pbo_addresses *addr,
|
|||
void *
|
||||
st_pbo_create_vs(struct st_context *st)
|
||||
{
|
||||
unsigned inputs[] = { VERT_ATTRIB_POS, SYSTEM_VALUE_INSTANCE_ID, };
|
||||
unsigned outputs[] = { VARYING_SLOT_POS, VARYING_SLOT_LAYER };
|
||||
const struct glsl_type *vec4 = glsl_vec4_type();
|
||||
const nir_shader_compiler_options *options =
|
||||
st_get_nir_compiler_options(st, MESA_SHADER_VERTEX);
|
||||
|
||||
return st_nir_make_passthrough_shader(st, "st/pbo VS",
|
||||
MESA_SHADER_VERTEX,
|
||||
st->pbo.layers ? 2 : 1,
|
||||
inputs, outputs, NULL, (1 << 1));
|
||||
nir_builder b;
|
||||
nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_VERTEX, options);
|
||||
|
||||
nir_variable *in_pos = nir_variable_create(b.shader, nir_var_shader_in,
|
||||
vec4, "in_pos");
|
||||
in_pos->data.location = VERT_ATTRIB_POS;
|
||||
|
||||
nir_variable *out_pos = nir_variable_create(b.shader, nir_var_shader_out,
|
||||
vec4, "out_pos");
|
||||
out_pos->data.location = VARYING_SLOT_POS;
|
||||
out_pos->data.interpolation = INTERP_MODE_NONE;
|
||||
|
||||
nir_copy_var(&b, out_pos, in_pos);
|
||||
|
||||
if (st->pbo.layers) {
|
||||
nir_variable *instance_id = nir_variable_create(b.shader,
|
||||
nir_var_system_value,
|
||||
glsl_int_type(),
|
||||
"instance_id");
|
||||
instance_id->data.location = SYSTEM_VALUE_INSTANCE_ID;
|
||||
|
||||
if (st->pbo.use_gs) {
|
||||
unsigned swiz_x[4] = {0, 0, 0, 0};
|
||||
nir_store_var(&b, out_pos,
|
||||
nir_swizzle(&b, nir_i2f32(&b, nir_load_var(&b, instance_id)), swiz_x, 4),
|
||||
(1 << 2));
|
||||
} else {
|
||||
nir_variable *out_layer = nir_variable_create(b.shader,
|
||||
nir_var_shader_out,
|
||||
glsl_int_type(),
|
||||
"out_layer");
|
||||
out_layer->data.location = VARYING_SLOT_LAYER;
|
||||
out_layer->data.interpolation = INTERP_MODE_NONE;
|
||||
nir_copy_var(&b, out_layer, instance_id);
|
||||
}
|
||||
}
|
||||
|
||||
return st_nir_finish_builtin_shader(st, b.shader, "st/pbo VS");
|
||||
}
|
||||
|
||||
void *
|
||||
|
|
Loading…
Reference in New Issue