layers:Immutable samplers are updated at creation
authorTobin Ehlis <tobine@google.com>
Mon, 8 May 2017 17:24:57 +0000 (11:24 -0600)
committerTobin Ehlis <tobine@google.com>
Mon, 8 May 2017 20:19:45 +0000 (14:19 -0600)
Fixes #1741

Descriptors with immutable samplers are updated at the time they're
created. Set update bool for descriptor sets with immutable samplers
at the time they're created. This will prevent false positives.

layers/descriptor_sets.cpp

index 40c280b8d0aa141ccf62e45bb0a8bd0f3bb7cf2e..58fc9ac1fd583776ce3ae6cdded981ea7ae934a7 100644 (file)
@@ -327,9 +327,10 @@ cvdescriptorset::DescriptorSet::DescriptorSet(const VkDescriptorSet set, const V
             case VK_DESCRIPTOR_TYPE_SAMPLER: {
                 auto immut_sampler = p_layout_->GetImmutableSamplerPtrFromIndex(i);
                 for (uint32_t di = 0; di < p_layout_->GetDescriptorCountFromIndex(i); ++di) {
-                    if (immut_sampler)
+                    if (immut_sampler) {
                         descriptors_.emplace_back(new SamplerDescriptor(immut_sampler + di));
-                    else
+                        some_update_ = true;  // Immutable samplers are updated at creation
+                    } else
                         descriptors_.emplace_back(new SamplerDescriptor());
                 }
                 break;
@@ -337,9 +338,10 @@ cvdescriptorset::DescriptorSet::DescriptorSet(const VkDescriptorSet set, const V
             case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: {
                 auto immut = p_layout_->GetImmutableSamplerPtrFromIndex(i);
                 for (uint32_t di = 0; di < p_layout_->GetDescriptorCountFromIndex(i); ++di) {
-                    if (immut)
+                    if (immut) {
                         descriptors_.emplace_back(new ImageSamplerDescriptor(immut + di));
-                    else
+                        some_update_ = true;  // Immutable samplers are updated at creation
+                    } else
                         descriptors_.emplace_back(new ImageSamplerDescriptor());
                 }
                 break;