mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 19:20:08 +01:00
lavapipe: emit correct textures_used for texture-arrays
When we lower a texture-lookup with a dynamic index, we need to mark the entire array as used, because we don't know better. Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10487>
This commit is contained in:
parent
ca9e0871fb
commit
c18ff60087
2 changed files with 20 additions and 11 deletions
|
|
@ -87,7 +87,6 @@ spec@arb_seamless_cube_map@arb_seamless_cubemap,Fail
|
|||
spec@arb_shader_storage_buffer_object@array-ssbo-binding,Crash
|
||||
spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgrad,Fail
|
||||
spec@arb_tessellation_shader@arb_tessellation_shader-tes-gs-max-output -small -scan 1 50,Crash
|
||||
spec@arb_texture_buffer_object@indexed,Fail
|
||||
spec@arb_texture_buffer_object@render-no-bo,Crash
|
||||
spec@arb_texture_buffer_range@ranges-2 compat,Fail
|
||||
spec@arb_texture_cube_map_array@arb_texture_cube_map_array-sampler-cube-array-shadow,Fail
|
||||
|
|
|
|||
|
|
@ -100,15 +100,16 @@ static nir_ssa_def *lower_vri_intrin_lvd(struct nir_builder *b,
|
|||
return nir_vec2(b, index, nir_imm_int(b, 0));
|
||||
}
|
||||
|
||||
static int lower_vri_instr_tex_deref(nir_tex_instr *tex,
|
||||
nir_tex_src_type deref_src_type,
|
||||
gl_shader_stage stage,
|
||||
struct lvp_pipeline_layout *layout)
|
||||
static unsigned
|
||||
lower_vri_instr_tex_deref(nir_tex_instr *tex,
|
||||
nir_tex_src_type deref_src_type,
|
||||
gl_shader_stage stage,
|
||||
struct lvp_pipeline_layout *layout)
|
||||
{
|
||||
int deref_src_idx = nir_tex_instr_src_index(tex, deref_src_type);
|
||||
|
||||
if (deref_src_idx < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
|
||||
nir_deref_instr *deref_instr = nir_src_as_deref(tex->src[deref_src_idx].src);
|
||||
nir_variable *var = nir_deref_instr_get_variable(deref_instr);
|
||||
|
|
@ -142,19 +143,28 @@ static int lower_vri_instr_tex_deref(nir_tex_instr *tex,
|
|||
tex->sampler_index = value;
|
||||
else
|
||||
tex->texture_index = value;
|
||||
return value;
|
||||
|
||||
if (deref_instr->deref_type == nir_deref_type_array) {
|
||||
assert(glsl_type_is_array(var->type));
|
||||
assert(value >= 0);
|
||||
unsigned size = glsl_get_aoa_size(var->type);
|
||||
return u_bit_consecutive(value, size);
|
||||
} else
|
||||
return 1u << value;
|
||||
}
|
||||
|
||||
static void lower_vri_instr_tex(struct nir_builder *b,
|
||||
nir_tex_instr *tex, void *data_cb)
|
||||
{
|
||||
struct lvp_pipeline_layout *layout = data_cb;
|
||||
int tex_value = 0;
|
||||
unsigned textures_used;
|
||||
|
||||
lower_vri_instr_tex_deref(tex, nir_tex_src_sampler_deref, b->shader->info.stage, layout);
|
||||
tex_value = lower_vri_instr_tex_deref(tex, nir_tex_src_texture_deref, b->shader->info.stage, layout);
|
||||
if (tex_value >= 0)
|
||||
BITSET_SET(b->shader->info.textures_used, tex_value);
|
||||
textures_used = lower_vri_instr_tex_deref(tex, nir_tex_src_texture_deref, b->shader->info.stage, layout);
|
||||
while (textures_used) {
|
||||
int i = u_bit_scan(&textures_used);
|
||||
BITSET_SET(b->shader->info.textures_used, i);
|
||||
}
|
||||
}
|
||||
|
||||
static nir_ssa_def *lower_vri_instr(struct nir_builder *b,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue