v3dv/pipeline: track if texture is shadow

To be used to decide the texture return size. We add it on the
descriptor map because it is the easier place to do so. As we are
lowering the texture accesses we can check instr->is_shadow at that
point. It is true that it is somewhat odd, as so far the descriptor
map was general-descriptor info, but is_shadow is only for
textures. But it doesn't make sense to make an effort now, as it is
possible that we would get more descriptor-specific info on the map on
the future. We can revisit that later.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Alejandro Piñeiro 2020-08-19 23:34:30 +02:00 committed by Marge Bot
parent c1bd8e0a1c
commit 229cce4056
2 changed files with 15 additions and 4 deletions

View file

@ -539,7 +539,8 @@ descriptor_map_add(struct v3dv_descriptor_map *map,
int set,
int binding,
int array_index,
int array_size)
int array_size,
bool is_shadow)
{
assert(array_index < array_size);
@ -560,6 +561,7 @@ descriptor_map_add(struct v3dv_descriptor_map *map,
map->binding[map->num_desc] = binding;
map->array_index[map->num_desc] = array_index;
map->array_size[map->num_desc] = array_size;
map->is_shadow[map->num_desc] = is_shadow;
map->num_desc++;
return index;
@ -605,7 +607,8 @@ lower_vulkan_resource_index(nir_builder *b,
index = descriptor_map_add(descriptor_map, set, binding,
const_val->u32,
binding_layout->array_size);
binding_layout->array_size,
false /* is_shadow: Doesn't really matter in this case */);
if (nir_intrinsic_desc_type(instr) == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) {
/* skip index 0 which is used for push constants */
@ -742,7 +745,9 @@ lower_tex_src_to_offset(nir_builder *b, nir_tex_instr *instr, unsigned src_idx,
deref->var->data.descriptor_set,
deref->var->data.binding,
array_index,
binding_layout->array_size);
binding_layout->array_size,
instr->is_shadow);
if (is_sampler)
instr->sampler_index = desc_index;
else
@ -838,7 +843,8 @@ lower_image_deref(nir_builder *b,
deref->var->data.descriptor_set,
deref->var->data.binding,
array_index,
binding_layout->array_size);
binding_layout->array_size,
false /* is_shadow: Doesn't really matter in this case */);
/* We still need to get a combined_index, as we are integrating images with
* the rest of the texture/sampler support

View file

@ -1443,6 +1443,11 @@ struct v3dv_descriptor_map {
int binding[64];
int array_index[64];
int array_size[64];
/* The following makes sense for textures, but this is the easier place to
* put it
*/
bool is_shadow[64];
};
struct v3dv_sampler {