v3dv/descriptor: handle not having a sampler when combining texture and sampler id
There are some texture operations (like mipmap query levels) that doesn't require a sampler. In fact, you should ignore it. So we need to take it into account when combining the indexes. nir_tex_instr_src_index is returning a negative value to identify that case, but as we are using a uint32_t to pack both values (for convenience, easy to pack/unpack the hash table key), we just use a uint value big enough to be a wrong sampler id. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
parent
56b611a9cf
commit
9b98d36522
|
@ -1976,13 +1976,17 @@ cmd_buffer_populate_v3d_key(struct v3d_key *key,
|
|||
if (image_view == NULL)
|
||||
return false;
|
||||
|
||||
const struct v3dv_sampler *sampler =
|
||||
v3dv_descriptor_map_get_sampler(descriptor_state,
|
||||
sampler_map,
|
||||
cmd_buffer->state.pipeline->layout,
|
||||
sampler_idx);
|
||||
if (sampler == NULL)
|
||||
return false;
|
||||
|
||||
const struct v3dv_sampler *sampler = NULL;
|
||||
if (sampler_idx != V3DV_NO_SAMPLER_IDX) {
|
||||
sampler =
|
||||
v3dv_descriptor_map_get_sampler(descriptor_state,
|
||||
sampler_map,
|
||||
cmd_buffer->state.pipeline->layout,
|
||||
sampler_idx);
|
||||
if (sampler == NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
key->tex[combined_idx].return_size =
|
||||
v3dv_get_tex_return_size(image_view->format,
|
||||
|
|
|
@ -639,7 +639,9 @@ lower_sampler(nir_builder *b, nir_tex_instr *instr,
|
|||
return false;
|
||||
|
||||
int combined_index =
|
||||
get_combined_index(pipeline, instr->texture_index, instr->sampler_index);
|
||||
get_combined_index(pipeline,
|
||||
instr->texture_index,
|
||||
sampler_idx < 0 ? V3DV_NO_SAMPLER_IDX : instr->sampler_index);
|
||||
|
||||
instr->texture_index = combined_index;
|
||||
instr->sampler_index = combined_index;
|
||||
|
|
|
@ -1030,6 +1030,8 @@ struct v3dv_sampler {
|
|||
struct v3dv_bo *state;
|
||||
};
|
||||
|
||||
#define V3DV_NO_SAMPLER_IDX 666
|
||||
|
||||
/*
|
||||
* Following two methods are using on the combined to/from texture/sampler
|
||||
* indices maps at v3dv_pipeline.
|
||||
|
|
|
@ -127,6 +127,7 @@ write_tmu_p1(struct v3dv_cmd_buffer *cmd_buffer,
|
|||
|
||||
v3dv_pipeline_combined_index_key_unpack(pipeline->combined_index_to_key_map[unit],
|
||||
NULL, &sampler_idx);
|
||||
assert(sampler_idx != V3DV_NO_SAMPLER_IDX);
|
||||
|
||||
const struct v3dv_sampler *sampler =
|
||||
v3dv_descriptor_map_get_sampler(descriptor_state, &pipeline->sampler_map,
|
||||
|
|
Loading…
Reference in New Issue