diff options
author | Connor Abbott <[email protected]> | 2020-06-09 14:40:58 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-09 15:35:29 +0000 |
commit | 334204823eee0f5d308fedbebab75228354ec07a (patch) | |
tree | 072adcf324972454a981299bb1a829ee0800c84f /src/freedreno/vulkan/tu_shader.c | |
parent | a751051248d445c3d726a3eab8fc999b0876364e (diff) |
tu: Fix context faults loading unused descriptor sets
The app is allowed to never bind descriptor sets that are statically
unused by the pipeline, which would've caused a context fault since
CP_LOAD_STATE6 would try to load the descriptors that don't exist. Fix
this by not preloading descriptors from unused descriptor sets. We could
do more fine-grained accounting of which descriptors are used, but this
is enough to fix the problem.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5400>
Diffstat (limited to 'src/freedreno/vulkan/tu_shader.c')
-rw-r--r-- | src/freedreno/vulkan/tu_shader.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c index 29ac80bc48d..d26154a3b02 100644 --- a/src/freedreno/vulkan/tu_shader.c +++ b/src/freedreno/vulkan/tu_shader.c @@ -135,6 +135,8 @@ lower_vulkan_resource_index(nir_builder *b, nir_intrinsic_instr *instr, &set_layout->binding[binding]; uint32_t base; + shader->active_desc_sets |= 1u << set; + switch (binding_layout->type) { case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: @@ -175,6 +177,8 @@ build_bindless(nir_builder *b, nir_deref_instr *deref, bool is_sampler, const struct tu_descriptor_set_binding_layout *bind_layout = &layout->set[set].layout->binding[binding]; + shader->active_desc_sets |= 1u << set; + nir_ssa_def *desc_offset; unsigned descriptor_stride; if (bind_layout->type == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT) { |