anv/descriptor_set: Set descriptor type for immuatable samplers
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 23 Feb 2016 05:39:14 +0000 (21:39 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 23 Feb 2016 05:39:14 +0000 (21:39 -0800)
src/intel/vulkan/anv_descriptor_set.c

index b439f2a0c36d2498c84799781145840ff86a27df..fe105b23f42999c7e0cfba81111bdb50ab7b77aa 100644 (file)
@@ -399,8 +399,17 @@ anv_descriptor_set_create(struct anv_device *device,
    struct anv_descriptor *desc = set->descriptors;
    for (uint32_t b = 0; b < layout->binding_count; b++) {
       if (layout->binding[b].immutable_samplers) {
-         for (uint32_t i = 0; i < layout->binding[b].array_size; i++)
-            desc[i].sampler = layout->binding[b].immutable_samplers[i];
+         for (uint32_t i = 0; i < layout->binding[b].array_size; i++) {
+            /* The type will get changed to COMBINED_IMAGE_SAMPLER in
+             * 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.
+             */
+            desc[i] = (struct anv_descriptor) {
+               .type = VK_DESCRIPTOR_TYPE_SAMPLER,
+               .sampler = layout->binding[b].immutable_samplers[i],
+            };
+         }
       }
       desc += layout->binding[b].array_size;
    }