summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2019-02-07 22:34:57 -0600
committerJason Ekstrand <jason@jlekstrand.net>2019-04-19 19:56:42 +0000
commitf16fcb9db779bd9b48a79df144358ac50428e6e8 (patch)
tree8abfd899c1c445b0d9fbde6867963a85121c20cc /src/intel
parente612c3b9bfd5c9bfb6ece9e2b3c88f787d742d85 (diff)
anv: Use write_image_view to initialize immutable samplers
Instead of setting it manually, call the helper. When setting descriptor sets becomes more complicated than just setting some struct values, this will keep immutable sampler handling correct. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_descriptor_set.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 2d0df227852..c7a90127511 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -883,11 +883,15 @@ anv_descriptor_set_create(struct anv_device *device,
* UpdateDescriptorSets if needed. However, if the descriptor
* set has an immutable sampler, UpdateDescriptorSets may never
* touch it, so we need to make sure it's 100% valid now.
+ *
+ * We don't need to actually provide a sampler because the helper
+ * will always write in the immutable sampler regardless of what
+ * is in the sampler parameter.
*/
- desc[i] = (struct anv_descriptor) {
- .type = VK_DESCRIPTOR_TYPE_SAMPLER,
- .sampler = layout->binding[b].immutable_samplers[i],
- };
+ struct VkDescriptorImageInfo info = { };
+ anv_descriptor_set_write_image_view(device, set, &info,
+ VK_DESCRIPTOR_TYPE_SAMPLER,
+ b, i);
}
}
desc += layout->binding[b].array_size;
@@ -1010,7 +1014,11 @@ anv_descriptor_set_write_image_view(struct anv_device *device,
struct anv_image_view *image_view = NULL;
struct anv_sampler *sampler = NULL;
- assert(type == bind_layout->type);
+ /* We get called with just VK_DESCRIPTOR_TYPE_SAMPLER as part of descriptor
+ * set initialization to set the bindless samplers.
+ */
+ assert(type == bind_layout->type ||
+ type == VK_DESCRIPTOR_TYPE_SAMPLER);
switch (type) {
case VK_DESCRIPTOR_TYPE_SAMPLER: