diff options
author | locke-lunarg <locke@lunarg.com> | 2019-06-13 18:04:56 -0600 |
---|---|---|
committer | Locke Lin <47329816+locke-lunarg@users.noreply.github.com> | 2019-06-17 16:33:19 -0600 |
commit | 22d739972d94d1d3ae21ca79c7eea175149990eb (patch) | |
tree | 0b8c35890a0fe614437afd7943b3bbf19e0098dd /tests | |
parent | 8e2c91ba00def6c675eceee9cec3cf953d26188c (diff) | |
download | vulkan-validation-layers-22d739972d94d1d3ae21ca79c7eea175149990eb.tar.gz |
tests: Change too terse names
Change-Id: I42a348ec36a7407215f38736a29799ed1838d1c0
Diffstat (limited to 'tests')
-rw-r--r-- | tests/layer_validation_tests.cpp | 7 | ||||
-rw-r--r-- | tests/layer_validation_tests.h | 8 | ||||
-rw-r--r-- | tests/vklayertests_buffer_image_memory_sampler.cpp | 63 | ||||
-rw-r--r-- | tests/vklayertests_descriptor_renderpass_framebuffer.cpp | 340 | ||||
-rw-r--r-- | tests/vklayertests_others.cpp | 8 | ||||
-rw-r--r-- | tests/vklayertests_pipeline_shader.cpp | 16 | ||||
-rw-r--r-- | tests/vkpositivelayertests.cpp | 118 |
7 files changed, 288 insertions, 272 deletions
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp index 285dad1d1..1d4187b09 100644 --- a/tests/layer_validation_tests.cpp +++ b/tests/layer_validation_tests.cpp @@ -1260,7 +1260,8 @@ OneOffDescriptorSet::~OneOffDescriptorSet() { bool OneOffDescriptorSet::Initialized() { return pool_ != VK_NULL_HANDLE && layout_.initialized() && set_ != VK_NULL_HANDLE; } -void OneOffDescriptorSet::WriteDescriptorBuffer(int blinding, VkBuffer buffer, VkDeviceSize size, VkDescriptorType descriptorType) { +void OneOffDescriptorSet::WriteDescriptorBufferInfo(int blinding, VkBuffer buffer, VkDeviceSize size, + VkDescriptorType descriptorType) { VkDescriptorBufferInfo buffer_info = {}; buffer_info.buffer = buffer; buffer_info.offset = 0; @@ -1297,8 +1298,8 @@ void OneOffDescriptorSet::WriteDescriptorBufferView(int blinding, VkBufferView & descriptor_writes.emplace_back(descriptor_write); } -void OneOffDescriptorSet::WriteDescriptorImage(int blinding, VkImageView image_view, VkSampler sampler, - VkDescriptorType descriptorType) { +void OneOffDescriptorSet::WriteDescriptorImageInfo(int blinding, VkImageView image_view, VkSampler sampler, + VkDescriptorType descriptorType) { VkDescriptorImageInfo image_info = {}; image_info.imageView = image_view; image_info.sampler = sampler; diff --git a/tests/layer_validation_tests.h b/tests/layer_validation_tests.h index 5afa4ef6c..dee886ed0 100644 --- a/tests/layer_validation_tests.h +++ b/tests/layer_validation_tests.h @@ -401,12 +401,12 @@ struct OneOffDescriptorSet { void *layout_pnext = NULL, VkDescriptorPoolCreateFlags poolFlags = 0, void *allocate_pnext = NULL); ~OneOffDescriptorSet(); bool Initialized(); - void WriteDescriptorBuffer(int blinding, VkBuffer buffer, VkDeviceSize size, - VkDescriptorType descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); + void WriteDescriptorBufferInfo(int blinding, VkBuffer buffer, VkDeviceSize size, + VkDescriptorType descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); void WriteDescriptorBufferView(int blinding, VkBufferView &buffer_view, VkDescriptorType descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER); - void WriteDescriptorImage(int blinding, VkImageView image_view, VkSampler sampler, - VkDescriptorType descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); + void WriteDescriptorImageInfo(int blinding, VkImageView image_view, VkSampler sampler, + VkDescriptorType descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); void UpdateDescriptorSets(); }; diff --git a/tests/vklayertests_buffer_image_memory_sampler.cpp b/tests/vklayertests_buffer_image_memory_sampler.cpp index 00bfaeb99..ae997ffd7 100644 --- a/tests/vklayertests_buffer_image_memory_sampler.cpp +++ b/tests/vklayertests_buffer_image_memory_sampler.cpp @@ -2768,9 +2768,10 @@ TEST_F(VkLayerTest, InvalidCmdBufferBufferViewDestroyed) { ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, + }); CreatePipelineHelper pipe(*this); VkBufferCreateInfo buffer_create_info = {}; VkBufferViewCreateInfo bvci = {}; @@ -2794,8 +2795,8 @@ TEST_F(VkLayerTest, InvalidCmdBufferBufferViewDestroyed) { VkResult err = vkCreateBufferView(m_device->device(), &bvci, NULL, &view); ASSERT_VK_SUCCESS(err); - ds.WriteDescriptorBufferView(0, view); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorBufferView(0, view); + descriptor_set.UpdateDescriptorSets(); char const *fsSource = "#version 450\n" @@ -2811,7 +2812,7 @@ TEST_F(VkLayerTest, InvalidCmdBufferBufferViewDestroyed) { pipe.InitInfo(); pipe.InitState(); pipe.shader_stages_ = {vs.GetStageCreateInfo(), fs.GetStageCreateInfo()}; - pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&ds.layout_}); + pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&descriptor_set.layout_}); pipe.CreateGraphicsPipeline(); m_commandBuffer->begin(); @@ -2824,7 +2825,7 @@ TEST_F(VkLayerTest, InvalidCmdBufferBufferViewDestroyed) { // Bind pipeline to cmd buffer - This causes crash on Mali vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.pipeline_); vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.pipeline_layout_.handle(), 0, 1, - &ds.set_, 0, nullptr); + &descriptor_set.set_, 0, nullptr); } // buffer is released. m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Descriptor in binding #0 index 0 is using buffer"); @@ -2842,12 +2843,12 @@ TEST_F(VkLayerTest, InvalidCmdBufferBufferViewDestroyed) { bvci.buffer = buffer.handle(); VkResult err = vkCreateBufferView(m_device->device(), &bvci, NULL, &view); ASSERT_VK_SUCCESS(err); - ds.descriptor_writes.clear(); - ds.WriteDescriptorBufferView(0, view); - ds.UpdateDescriptorSets(); + descriptor_set.descriptor_writes.clear(); + descriptor_set.WriteDescriptorBufferView(0, view); + descriptor_set.UpdateDescriptorSets(); vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.pipeline_layout_.handle(), 0, 1, - &ds.set_, 0, nullptr); + &descriptor_set.set_, 0, nullptr); m_commandBuffer->Draw(1, 0, 0, 0); m_commandBuffer->EndRenderPass(); m_commandBuffer->end(); @@ -3194,9 +3195,9 @@ TEST_F(VkLayerTest, InvalidBufferViewObject) { m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkWriteDescriptorSet-descriptorType-00323"); ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkBufferView view; { // Create a valid bufferView to start with @@ -3224,7 +3225,7 @@ TEST_F(VkLayerTest, InvalidBufferViewObject) { VkWriteDescriptorSet descriptor_write; memset(&descriptor_write, 0, sizeof(descriptor_write)); descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; descriptor_write.dstBinding = 0; descriptor_write.descriptorCount = 1; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER; @@ -4877,21 +4878,22 @@ TEST_F(VkLayerTest, InvalidStorageImageLayout) { return; } - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, + }); VkImageObj image(m_device); image.Init(32, 32, 1, tex_format, VK_IMAGE_USAGE_STORAGE_BIT, tiling, 0); ASSERT_TRUE(image.initialized()); VkImageView view = image.targetView(tex_format); - ds.WriteDescriptorImage(0, view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE); + descriptor_set.WriteDescriptorImageInfo(0, view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, " of VK_DESCRIPTOR_TYPE_STORAGE_IMAGE type is being updated with layout " "VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL but according to spec "); - ds.UpdateDescriptorSets(); + descriptor_set.UpdateDescriptorSets(); m_errorMonitor->VerifyFound(); } @@ -6236,9 +6238,10 @@ TEST_F(VkLayerTest, MultiplaneImageSamplerConversionMismatch) { vkCreateImageView(m_device->device(), &ivci, nullptr, &view); // Use the image and sampler together in a descriptor set - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, samplers}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2, VK_SHADER_STAGE_ALL, samplers}, + }); // Use the same image view twice, using the same sampler, with the *second* mismatched with the *second* immutable sampler VkDescriptorImageInfo image_infos[2]; @@ -6251,7 +6254,7 @@ TEST_F(VkLayerTest, MultiplaneImageSamplerConversionMismatch) { // Update the descriptor set expecting to get an error VkWriteDescriptorSet descriptor_write = {}; descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; descriptor_write.dstBinding = 0; descriptor_write.descriptorCount = 2; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; @@ -6263,10 +6266,11 @@ TEST_F(VkLayerTest, MultiplaneImageSamplerConversionMismatch) { // pImmutableSamplers = nullptr causes an error , VUID-01947. // Because if pNext chains a VkSamplerYcbcrConversionInfo, the sampler has to be a immutable sampler. - OneOffDescriptorSet ds_1947(m_device, { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); - descriptor_write.dstSet = ds_1947.set_; + OneOffDescriptorSet descriptor_set_1947(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); + descriptor_write.dstSet = descriptor_set_1947.set_; descriptor_write.descriptorCount = 1; descriptor_write.pImageInfo = &image_infos[0]; m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkWriteDescriptorSet-descriptorType-01947"); @@ -6296,9 +6300,6 @@ TEST_F(VkLayerTest, DepthStencilImageViewWithColorAspectBitError) { printf("%s Couldn't find depth stencil format.\n", kSkipPrefix); return; } - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); VkImageObj image_bad(m_device); VkImageObj image_good(m_device); diff --git a/tests/vklayertests_descriptor_renderpass_framebuffer.cpp b/tests/vklayertests_descriptor_renderpass_framebuffer.cpp index bd5c2aa5b..05ea80cc6 100644 --- a/tests/vklayertests_descriptor_renderpass_framebuffer.cpp +++ b/tests/vklayertests_descriptor_renderpass_framebuffer.cpp @@ -100,12 +100,12 @@ TEST_F(VkLayerTest, GpuValidationArrayOOB) { } // Prepare descriptors - OneOffDescriptorSet ds(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr}, - }, - layout_create_flags, layout_pnext, pool_create_flags); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 6, VK_SHADER_STAGE_ALL, nullptr}, + }, + layout_create_flags, layout_pnext, pool_create_flags); VkDescriptorSetVariableDescriptorCountAllocateInfoEXT variable_count = {}; uint32_t desc_counts; @@ -121,15 +121,15 @@ TEST_F(VkLayerTest, GpuValidationArrayOOB) { allocate_pnext = &variable_count; } - OneOffDescriptorSet ds_variable(m_device, - { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 8, VK_SHADER_STAGE_ALL, nullptr}, - }, - layout_create_flags, layout_pnext, pool_create_flags, allocate_pnext); + OneOffDescriptorSet descriptor_set_variable(m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 8, VK_SHADER_STAGE_ALL, nullptr}, + }, + layout_create_flags, layout_pnext, pool_create_flags, allocate_pnext); - const VkPipelineLayoutObj pipeline_layout(m_device, {&ds.layout_}); - const VkPipelineLayoutObj pipeline_layout_variable(m_device, {&ds_variable.layout_}); + const VkPipelineLayoutObj pipeline_layout(m_device, {&descriptor_set.layout_}); + const VkPipelineLayoutObj pipeline_layout_variable(m_device, {&descriptor_set_variable.layout_}); VkTextureObj texture(m_device, nullptr); VkSamplerObj sampler(m_device); @@ -147,13 +147,13 @@ TEST_F(VkLayerTest, GpuValidationArrayOOB) { VkWriteDescriptorSet descriptor_writes[2] = {}; descriptor_writes[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_writes[0].dstSet = ds.set_; // descriptor_set; + descriptor_writes[0].dstSet = descriptor_set.set_; // descriptor_set; descriptor_writes[0].dstBinding = 0; descriptor_writes[0].descriptorCount = 1; descriptor_writes[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; descriptor_writes[0].pBufferInfo = buffer_info; descriptor_writes[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_writes[1].dstSet = ds.set_; // descriptor_set; + descriptor_writes[1].dstSet = descriptor_set.set_; // descriptor_set; descriptor_writes[1].dstBinding = 1; if (descriptor_indexing) descriptor_writes[1].descriptorCount = 5; // Intentionally don't write index 5 @@ -163,8 +163,8 @@ TEST_F(VkLayerTest, GpuValidationArrayOOB) { descriptor_writes[1].pImageInfo = image_info; vkUpdateDescriptorSets(m_device->device(), 2, descriptor_writes, 0, NULL); if (descriptor_indexing) { - descriptor_writes[0].dstSet = ds_variable.set_; - descriptor_writes[1].dstSet = ds_variable.set_; + descriptor_writes[0].dstSet = descriptor_set_variable.set_; + descriptor_writes[1].dstSet = descriptor_set_variable.set_; vkUpdateDescriptorSets(m_device->device(), 2, descriptor_writes, 0, NULL); } @@ -285,10 +285,10 @@ TEST_F(VkLayerTest, GpuValidationArrayOOB) { vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle()); if (iter.variable_length) { vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout_variable.handle(), - 0, 1, &ds_variable.set_, 0, nullptr); + 0, 1, &descriptor_set_variable.set_, 0, nullptr); } else { vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, - &ds.set_, 0, nullptr); + &descriptor_set.set_, 0, nullptr); } vkCmdSetViewport(m_commandBuffer->handle(), 0, 1, &viewport); vkCmdSetScissor(m_commandBuffer->handle(), 0, 1, &scissors); @@ -331,11 +331,11 @@ TEST_F(VkLayerTest, InvalidDescriptorPoolConsistency) { err = vkCreateDescriptorPool(m_device->device(), &ds_pool_ci, NULL, &bad_pool); ASSERT_VK_SUCCESS(err); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); - err = vkFreeDescriptorSets(m_device->device(), bad_pool, 1, &ds.set_); + err = vkFreeDescriptorSets(m_device->device(), bad_pool, 1, &descriptor_set.set_); m_errorMonitor->VerifyFound(); @@ -942,7 +942,6 @@ TEST_F(VkLayerTest, RenderPassCreateOverlappingCorrelationMasks) { // Check for more specific "don't set any correlation masks when multiview is not enabled" if (rp2Supported) { - viewMasks[0] = 0; correlationMasks[0] = 0; correlationMasks[1] = 0; @@ -2552,14 +2551,14 @@ TEST_F(VkLayerTest, WriteDescriptorSetIntegrityCheck) { buffCI.queueFamilyIndexCount = 1; buffCI.pQueueFamilyIndices = &qfi; - VkBufferObj dyub; - dyub.init(*m_device, buffCI); + VkBufferObj dynamic_uniform_buffer; + dynamic_uniform_buffer.init(*m_device, buffCI); VkDescriptorBufferInfo buffInfo[2] = {}; - buffInfo[0].buffer = dyub.handle(); + buffInfo[0].buffer = dynamic_uniform_buffer.handle(); buffInfo[0].offset = 0; buffInfo[0].range = 1024; - buffInfo[1].buffer = dyub.handle(); + buffInfo[1].buffer = dynamic_uniform_buffer.handle(); buffInfo[1].offset = 0; buffInfo[1].range = 1024; descriptor_write.pBufferInfo = buffInfo; @@ -2614,10 +2613,10 @@ TEST_F(VkLayerTest, WriteDescriptorSetConsecutiveUpdates) { ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2, VK_SHADER_STAGE_ALL, nullptr}, + {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); uint32_t qfi = 0; VkBufferCreateInfo bci = {}; @@ -2647,7 +2646,7 @@ TEST_F(VkLayerTest, WriteDescriptorSetConsecutiveUpdates) { VkWriteDescriptorSet descriptor_write = {}; descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_write.dstSet = ds.set_; // descriptor_set; + descriptor_write.dstSet = descriptor_set.set_; // descriptor_set; descriptor_write.dstBinding = 0; descriptor_write.descriptorCount = 3; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; @@ -2677,7 +2676,7 @@ TEST_F(VkLayerTest, WriteDescriptorSetConsecutiveUpdates) { dyn_state_ci.pDynamicStates = dyn_states; pipe.dyn_state_ci_ = dyn_state_ci; pipe.InitState(); - pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&ds.layout_}); + pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&descriptor_set.layout_}); pipe.CreateGraphicsPipeline(); m_commandBuffer->begin(); @@ -2685,7 +2684,7 @@ TEST_F(VkLayerTest, WriteDescriptorSetConsecutiveUpdates) { vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.pipeline_); vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.pipeline_layout_.handle(), 0, 1, - &ds.set_, 0, nullptr); + &descriptor_set.set_, 0, nullptr); VkViewport viewport = {0, 0, 16, 16, 0, 1}; vkCmdSetViewport(m_commandBuffer->handle(), 0, 1, &viewport); @@ -2750,7 +2749,7 @@ TEST_F(VkLayerTest, InvalidCmdBufferDescriptorSetBufferDestroyed) { pipe.CreateGraphicsPipeline(); // Correctly update descriptor to avoid "NOT_UPDATED" error - pipe.descriptor_set_->WriteDescriptorBuffer(0, buffer.handle(), 1024); + pipe.descriptor_set_->WriteDescriptorBufferInfo(0, buffer.handle(), 1024); pipe.descriptor_set_->UpdateDescriptorSets(); m_commandBuffer->begin(); @@ -3102,12 +3101,13 @@ TEST_F(VkLayerTest, InvalidDescriptorSetSamplerDestroyed) { ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + {1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); - const VkPipelineLayoutObj pipeline_layout(m_device, {&ds.layout_}); + const VkPipelineLayoutObj pipeline_layout(m_device, {&descriptor_set.layout_}); // Create images to update the descriptor with VkImageObj image(m_device); const VkFormat tex_format = VK_FORMAT_B8G8R8A8_UNORM; @@ -3147,7 +3147,7 @@ TEST_F(VkLayerTest, InvalidDescriptorSetSamplerDestroyed) { VkWriteDescriptorSet descriptor_write; memset(&descriptor_write, 0, sizeof(descriptor_write)); descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; descriptor_write.dstBinding = 0; descriptor_write.descriptorCount = 1; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; @@ -3185,8 +3185,8 @@ TEST_F(VkLayerTest, InvalidDescriptorSetSamplerDestroyed) { m_commandBuffer->begin(); m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo); vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle()); - vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, &ds.set_, 0, - NULL); + vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, + &descriptor_set.set_, 0, NULL); VkViewport viewport = {0, 0, 16, 16, 0, 1}; VkRect2D scissor = {{0, 0}, {16, 16}}; vkCmdSetViewport(m_commandBuffer->handle(), 0, 1, &viewport); @@ -3218,12 +3218,13 @@ TEST_F(VkLayerTest, ImageDescriptorLayoutMismatch) { ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); - VkDescriptorSet descriptorSet = ds.set_; + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); + VkDescriptorSet descriptorSet = descriptor_set.set_; - const VkPipelineLayoutObj pipeline_layout(m_device, {&ds.layout_}); + const VkPipelineLayoutObj pipeline_layout(m_device, {&descriptor_set.layout_}); // Create image, view, and sampler const VkFormat format = VK_FORMAT_B8G8R8A8_UNORM; @@ -3387,11 +3388,12 @@ TEST_F(VkLayerTest, DescriptorPoolInUseResetSignaled) { ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); - const VkPipelineLayoutObj pipeline_layout(m_device, {&ds.layout_}); + const VkPipelineLayoutObj pipeline_layout(m_device, {&descriptor_set.layout_}); // Create image to update the descriptor with VkImageObj image(m_device); @@ -3405,8 +3407,8 @@ TEST_F(VkLayerTest, DescriptorPoolInUseResetSignaled) { VkResult err = vkCreateSampler(m_device->device(), &sampler_ci, nullptr, &sampler); ASSERT_VK_SUCCESS(err); // Update descriptor with image and sampler - ds.WriteDescriptorImage(0, view, sampler); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorImageInfo(0, view, sampler); + descriptor_set.UpdateDescriptorSets(); // Create PSO to be used for draw-time errors below VkShaderObj vs(m_device, bindStateVertShaderText, VK_SHADER_STAGE_VERTEX_BIT, this); @@ -3420,8 +3422,8 @@ TEST_F(VkLayerTest, DescriptorPoolInUseResetSignaled) { m_commandBuffer->begin(); m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo); vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle()); - vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, &ds.set_, 0, - nullptr); + vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, + &descriptor_set.set_, 0, nullptr); VkViewport viewport = {0, 0, 16, 16, 0, 1}; VkRect2D scissor = {{0, 0}, {16, 16}}; @@ -3439,7 +3441,7 @@ TEST_F(VkLayerTest, DescriptorPoolInUseResetSignaled) { vkQueueSubmit(m_device->m_queue, 1, &submit_info, VK_NULL_HANDLE); // Reset pool while in-flight, causing error m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-vkResetDescriptorPool-descriptorPool-00313"); - vkResetDescriptorPool(m_device->device(), ds.pool_, 0); + vkResetDescriptorPool(m_device->device(), descriptor_set.pool_, 0); m_errorMonitor->VerifyFound(); vkQueueWaitIdle(m_device->m_queue); // Cleanup @@ -3455,9 +3457,10 @@ TEST_F(VkLayerTest, DescriptorImageUpdateNoMemoryBound) { ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); // Create images to update the descriptor with VkImage image; @@ -3518,14 +3521,14 @@ TEST_F(VkLayerTest, DescriptorImageUpdateNoMemoryBound) { err = vkCreateSampler(m_device->device(), &sampler_ci, NULL, &sampler); ASSERT_VK_SUCCESS(err); // Update descriptor with image and sampler - ds.WriteDescriptorImage(0, view, sampler); + descriptor_set.WriteDescriptorImageInfo(0, view, sampler); // Break memory binding and attempt update vkFreeMemory(m_device->device(), image_memory, nullptr); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, " previously bound memory was freed. Memory must not be freed prior to this operation."); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "vkUpdateDescriptorSets() failed write update validation for Descriptor Set 0x"); - ds.UpdateDescriptorSets(); + descriptor_set.UpdateDescriptorSets(); m_errorMonitor->VerifyFound(); // Cleanup vkDestroyImage(m_device->device(), image, NULL); @@ -3546,11 +3549,12 @@ TEST_F(VkLayerTest, InvalidDynamicOffsetCases) { ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); - const VkPipelineLayoutObj pipeline_layout(m_device, {&ds.layout_}); + const VkPipelineLayoutObj pipeline_layout(m_device, {&descriptor_set.layout_}); // Create a buffer to update the descriptor with uint32_t qfi = 0; @@ -3561,24 +3565,24 @@ TEST_F(VkLayerTest, InvalidDynamicOffsetCases) { buffCI.queueFamilyIndexCount = 1; buffCI.pQueueFamilyIndices = &qfi; - VkBufferObj dyub; - dyub.init(*m_device, buffCI); + VkBufferObj dynamic_uniform_buffer; + dynamic_uniform_buffer.init(*m_device, buffCI); // Correctly update descriptor to avoid "NOT_UPDATED" error - ds.WriteDescriptorBuffer(0, dyub.handle(), 1024, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorBufferInfo(0, dynamic_uniform_buffer.handle(), 1024, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC); + descriptor_set.UpdateDescriptorSets(); m_commandBuffer->begin(); m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo); - vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, &ds.set_, 0, - NULL); + vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, + &descriptor_set.set_, 0, NULL); m_errorMonitor->VerifyFound(); uint32_t pDynOff[2] = {512, 756}; // Now cause error b/c too many dynOffsets in array for # of dyn descriptors m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Attempting to bind 1 descriptorSets with 1 dynamic descriptors, but "); - vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, &ds.set_, 2, - pDynOff); + vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, + &descriptor_set.set_, 2, pDynOff); m_errorMonitor->VerifyFound(); // Finally cause error due to dynamicOffset being too big m_errorMonitor->SetDesiredFailureMsg( @@ -3601,8 +3605,8 @@ TEST_F(VkLayerTest, InvalidDynamicOffsetCases) { vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle()); // This update should succeed, but offset size of 512 will overstep buffer // /w range 1024 & size 1024 - vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, &ds.set_, 1, - pDynOff); + vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, + &descriptor_set.set_, 1, pDynOff); m_commandBuffer->Draw(1, 0, 0, 0); m_errorMonitor->VerifyFound(); @@ -3622,9 +3626,10 @@ TEST_F(VkLayerTest, DescriptorBufferUpdateNoMemoryBound) { ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); // Create a buffer to update the descriptor with uint32_t qfi = 0; @@ -3635,15 +3640,15 @@ TEST_F(VkLayerTest, DescriptorBufferUpdateNoMemoryBound) { buffCI.queueFamilyIndexCount = 1; buffCI.pQueueFamilyIndices = &qfi; - VkBuffer dyub; - err = vkCreateBuffer(m_device->device(), &buffCI, NULL, &dyub); + VkBuffer dynamic_uniform_buffer; + err = vkCreateBuffer(m_device->device(), &buffCI, NULL, &dynamic_uniform_buffer); ASSERT_VK_SUCCESS(err); // Attempt to update descriptor without binding memory to it - ds.WriteDescriptorBuffer(0, dyub, 1024, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorBufferInfo(0, dynamic_uniform_buffer, 1024, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC); + descriptor_set.UpdateDescriptorSets(); m_errorMonitor->VerifyFound(); - vkDestroyBuffer(m_device->device(), dyub, NULL); + vkDestroyBuffer(m_device->device(), dynamic_uniform_buffer, NULL); } TEST_F(VkLayerTest, DescriptorSetCompatibility) { @@ -4052,7 +4057,7 @@ TEST_F(VkLayerTest, DSBufferInfoErrors) { std::vector<VkDescriptorSetLayoutBinding> ds_bindings = { {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}}; - OneOffDescriptorSet ds(m_device, ds_bindings); + OneOffDescriptorSet descriptor_set(m_device, ds_bindings); // Create a buffer to be used for invalid updates VkBufferCreateInfo buff_ci = {}; @@ -4074,7 +4079,7 @@ TEST_F(VkLayerTest, DSBufferInfoErrors) { descriptor_write.pImageInfo = nullptr; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; // Relying on the "return nullptr for non-enabled extensions auto vkCreateDescriptorUpdateTemplateKHR = @@ -4111,7 +4116,7 @@ TEST_F(VkLayerTest, DSBufferInfoErrors) { update_template_ci.descriptorUpdateEntryCount = 1; update_template_ci.pDescriptorUpdateEntries = &update_template_entry; update_template_ci.templateType = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET; - update_template_ci.descriptorSetLayout = ds.layout_.handle(); + update_template_ci.descriptorSetLayout = descriptor_set.layout_.handle(); VkDescriptorUpdateTemplate update_template = VK_NULL_HANDLE; if (update_template_support) { @@ -4167,7 +4172,7 @@ TEST_F(VkLayerTest, DSBufferInfoErrors) { if (update_template_support) { update_template_data.buff_info = buff_info; // copy the test case information into our "pData" m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, desired_failure); - vkUpdateDescriptorSetWithTemplateKHR(m_device->device(), ds.set_, update_template, &update_template_data); + vkUpdateDescriptorSetWithTemplateKHR(m_device->device(), descriptor_set.set_, update_template, &update_template_data); m_errorMonitor->VerifyFound(); if (push_descriptor_support) { m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, desired_failure); @@ -4234,9 +4239,9 @@ TEST_F(VkLayerTest, DSBufferLimitErrors) { m_device->props.limits.minStorageBufferOffsetAlignment, "VUID-VkWriteDescriptorSet-descriptorType-00328"}), }) { // Create layout with single buffer - OneOffDescriptorSet ds(m_device, { - {0, test_case.descriptor_type, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, test_case.descriptor_type, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); // Create a buffer to be used for invalid updates VkBufferCreateInfo bci = {}; @@ -4283,7 +4288,7 @@ TEST_F(VkLayerTest, DSBufferLimitErrors) { descriptor_write.pBufferInfo = &buff_info; descriptor_write.pImageInfo = nullptr; descriptor_write.descriptorType = test_case.descriptor_type; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; // Exceed range limit if (test_case.max_range != UINT32_MAX) { @@ -4329,9 +4334,9 @@ TEST_F(VkLayerTest, DSAspectBitsErrors) { return; } - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); // Create an image to be used for invalid updates VkImageObj image_obj(m_device); @@ -4362,13 +4367,13 @@ TEST_F(VkLayerTest, DSAspectBitsErrors) { VkImageView image_view; err = vkCreateImageView(m_device->device(), &image_view_ci, NULL, &image_view); ASSERT_VK_SUCCESS(err); - ds.WriteDescriptorImage(0, image_view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT); + descriptor_set.WriteDescriptorImageInfo(0, image_view, VK_NULL_HANDLE, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT); // TODO(whenning42): Update this check to look for a VUID when this error is // assigned one. const char *error_msg = " please only set either VK_IMAGE_ASPECT_DEPTH_BIT or VK_IMAGE_ASPECT_STENCIL_BIT "; m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, error_msg); - ds.UpdateDescriptorSets(); + descriptor_set.UpdateDescriptorSets(); m_errorMonitor->VerifyFound(); vkDestroyImageView(m_device->device(), image_view, NULL); } @@ -4382,17 +4387,17 @@ TEST_F(VkLayerTest, DSTypeMismatch) { " binding #0 with type VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER but update type is VK_DESCRIPTOR_TYPE_SAMPLER"); ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkSamplerCreateInfo sampler_ci = SafeSaneSamplerCreateInfo(); VkSampler sampler; err = vkCreateSampler(m_device->device(), &sampler_ci, NULL, &sampler); ASSERT_VK_SUCCESS(err); - ds.WriteDescriptorImage(0, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorImageInfo(0, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); + descriptor_set.UpdateDescriptorSets(); m_errorMonitor->VerifyFound(); @@ -4404,9 +4409,9 @@ TEST_F(VkLayerTest, DSUpdateOutOfBounds) { m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkWriteDescriptorSet-dstArrayElement-00321"); ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkBufferTest buffer_test(m_device, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); if (!buffer_test.GetBufferCurrent()) { @@ -4424,7 +4429,7 @@ TEST_F(VkLayerTest, DSUpdateOutOfBounds) { VkWriteDescriptorSet descriptor_write; memset(&descriptor_write, 0, sizeof(descriptor_write)); descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; descriptor_write.dstArrayElement = 1; /* This index out of bounds for the update */ descriptor_write.descriptorCount = 1; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; @@ -4442,9 +4447,9 @@ TEST_F(VkLayerTest, InvalidDSUpdateIndex) { m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkWriteDescriptorSet-dstBinding-00315"); ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkSamplerCreateInfo sampler_ci = SafeSaneSamplerCreateInfo(); VkSampler sampler; @@ -4452,8 +4457,8 @@ TEST_F(VkLayerTest, InvalidDSUpdateIndex) { ASSERT_VK_SUCCESS(err); // This is the wrong type, but out of bounds will be flagged first - ds.WriteDescriptorImage(2, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorImageInfo(2, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); + descriptor_set.UpdateDescriptorSets(); m_errorMonitor->VerifyFound(); vkDestroySampler(m_device->device(), sampler, NULL); @@ -4465,9 +4470,9 @@ TEST_F(VkLayerTest, DSUpdateEmptyBinding) { ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_SAMPLER, 0 /* !! */, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_SAMPLER, 0 /* !! */, VK_SHADER_STAGE_ALL, nullptr}, + }); VkSamplerCreateInfo sampler_ci = SafeSaneSamplerCreateInfo(); VkSampler sampler; @@ -4476,10 +4481,10 @@ TEST_F(VkLayerTest, DSUpdateEmptyBinding) { // descriptor_write.descriptorCount = 1, Lie here to avoid parameter_validation error // This is the wrong type, but empty binding error will be flagged first - ds.WriteDescriptorImage(0, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); + descriptor_set.WriteDescriptorImageInfo(0, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkWriteDescriptorSet-dstBinding-00316"); - ds.UpdateDescriptorSets(); + descriptor_set.UpdateDescriptorSets(); m_errorMonitor->VerifyFound(); vkDestroySampler(m_device->device(), sampler, NULL); @@ -4494,9 +4499,9 @@ TEST_F(VkLayerTest, InvalidDSUpdateStruct) { ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkSamplerCreateInfo sampler_ci = SafeSaneSamplerCreateInfo(); VkSampler sampler; @@ -4509,7 +4514,7 @@ TEST_F(VkLayerTest, InvalidDSUpdateStruct) { VkWriteDescriptorSet descriptor_write; memset(&descriptor_write, 0, sizeof(descriptor_write)); descriptor_write.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; /* Intentionally broken struct type */ - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; descriptor_write.descriptorCount = 1; // This is the wrong type, but out of bounds will be flagged first descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER; @@ -4527,14 +4532,14 @@ TEST_F(VkLayerTest, SampleDescriptorUpdateError) { m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkWriteDescriptorSet-descriptorType-00325"); ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkSampler sampler = CastToHandle<VkSampler, uintptr_t>(0xbaadbeef); // Sampler with invalid handle - ds.WriteDescriptorImage(0, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorImageInfo(0, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); + descriptor_set.UpdateDescriptorSets(); m_errorMonitor->VerifyFound(); } @@ -4546,9 +4551,10 @@ TEST_F(VkLayerTest, ImageViewDescriptorUpdateError) { m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkWriteDescriptorSet-descriptorType-00326"); ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkSamplerCreateInfo sampler_ci = SafeSaneSamplerCreateInfo(); VkSampler sampler; @@ -4557,8 +4563,8 @@ TEST_F(VkLayerTest, ImageViewDescriptorUpdateError) { VkImageView view = CastToHandle<VkImageView, uintptr_t>(0xbaadbeef); // invalid imageView object - ds.WriteDescriptorImage(0, view, sampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorImageInfo(0, view, sampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); + descriptor_set.UpdateDescriptorSets(); m_errorMonitor->VerifyFound(); vkDestroySampler(m_device->device(), sampler, NULL); @@ -4573,10 +4579,10 @@ TEST_F(VkLayerTest, CopyDescriptorUpdateErrors) { " binding #1 with type VK_DESCRIPTOR_TYPE_SAMPLER. Types do not match."); ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkSamplerCreateInfo sampler_ci = SafeSaneSamplerCreateInfo(); VkSampler sampler; @@ -4585,15 +4591,15 @@ TEST_F(VkLayerTest, CopyDescriptorUpdateErrors) { // SAMPLER binding from layout above // This write update should succeed - ds.WriteDescriptorImage(1, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorImageInfo(1, VK_NULL_HANDLE, sampler, VK_DESCRIPTOR_TYPE_SAMPLER); + descriptor_set.UpdateDescriptorSets(); // Now perform a copy update that fails due to type mismatch VkCopyDescriptorSet copy_ds_update; memset(©_ds_update, 0, sizeof(VkCopyDescriptorSet)); copy_ds_update.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET; - copy_ds_update.srcSet = ds.set_; + copy_ds_update.srcSet = descriptor_set.set_; copy_ds_update.srcBinding = 1; // Copy from SAMPLER binding - copy_ds_update.dstSet = ds.set_; + copy_ds_update.dstSet = descriptor_set.set_; copy_ds_update.dstBinding = 0; // ERROR : copy to UNIFORM binding copy_ds_update.descriptorCount = 1; // copy 1 descriptor vkUpdateDescriptorSets(m_device->device(), 0, NULL, 1, ©_ds_update); @@ -4603,9 +4609,9 @@ TEST_F(VkLayerTest, CopyDescriptorUpdateErrors) { m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, " does not have copy update src binding of 3."); memset(©_ds_update, 0, sizeof(VkCopyDescriptorSet)); copy_ds_update.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET; - copy_ds_update.srcSet = ds.set_; + copy_ds_update.srcSet = descriptor_set.set_; copy_ds_update.srcBinding = 3; // ERROR : Invalid binding for matching layout - copy_ds_update.dstSet = ds.set_; + copy_ds_update.dstSet = descriptor_set.set_; copy_ds_update.dstBinding = 0; copy_ds_update.descriptorCount = 1; // Copy 1 descriptor vkUpdateDescriptorSets(m_device->device(), 0, NULL, 1, ©_ds_update); @@ -4619,9 +4625,9 @@ TEST_F(VkLayerTest, CopyDescriptorUpdateErrors) { memset(©_ds_update, 0, sizeof(VkCopyDescriptorSet)); copy_ds_update.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET; - copy_ds_update.srcSet = ds.set_; + copy_ds_update.srcSet = descriptor_set.set_; copy_ds_update.srcBinding = 1; - copy_ds_update.dstSet = ds.set_; + copy_ds_update.dstSet = descriptor_set.set_; copy_ds_update.dstBinding = 0; copy_ds_update.descriptorCount = 5; // ERROR copy 5 descriptors (out of bounds for layout) vkUpdateDescriptorSets(m_device->device(), 0, NULL, 1, ©_ds_update); @@ -4639,11 +4645,11 @@ TEST_F(VkLayerTest, DrawWithPipelineIncompatibleWithRenderPass) { ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); - const VkPipelineLayoutObj pipeline_layout(m_device, {&ds.layout_}); + const VkPipelineLayoutObj pipeline_layout(m_device, {&descriptor_set.layout_}); VkShaderObj vs(m_device, bindStateVertShaderText, VK_SHADER_STAGE_VERTEX_BIT, this); VkShaderObj fs(m_device, bindStateFragShaderText, VK_SHADER_STAGE_FRAGMENT_BIT, this); // We shouldn't need a fragment shader @@ -4718,9 +4724,10 @@ TEST_F(VkLayerTest, Maint1BindingSliceOf3DImage) { VkResult err; - OneOffDescriptorSet set(m_device, { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, + }); VkImageCreateInfo ici = {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, nullptr, @@ -4760,8 +4767,16 @@ TEST_F(VkLayerTest, Maint1BindingSliceOf3DImage) { m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkDescriptorImageInfo-imageView-00343"); VkDescriptorImageInfo dii = {VK_NULL_HANDLE, view, VK_IMAGE_LAYOUT_GENERAL}; - VkWriteDescriptorSet write = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, nullptr, set.set_, 0, 0, 1, - VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, &dii, nullptr, nullptr}; + VkWriteDescriptorSet write = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, + nullptr, + descriptor_set.set_, + 0, + 0, + 1, + VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, + &dii, + nullptr, + nullptr}; vkUpdateDescriptorSets(m_device->device(), 1, &write, 0, nullptr); m_errorMonitor->VerifyFound(); @@ -5441,13 +5456,13 @@ TEST_F(VkLayerTest, DescriptorIndexingUpdateAfterBind) { buffCI.size = 1024; buffCI.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; - VkBuffer dyub; - err = vkCreateBuffer(m_device->device(), &buffCI, NULL, &dyub); + VkBuffer dynamic_uniform_buffer; + err = vkCreateBuffer(m_device->device(), &buffCI, NULL, &dynamic_uniform_buffer); ASSERT_VK_SUCCESS(err); VkDeviceMemory mem; VkMemoryRequirements mem_reqs; - vkGetBufferMemoryRequirements(m_device->device(), dyub, &mem_reqs); + vkGetBufferMemoryRequirements(m_device->device(), dynamic_uniform_buffer, &mem_reqs); VkMemoryAllocateInfo mem_alloc_info = {}; mem_alloc_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; @@ -5456,11 +5471,11 @@ TEST_F(VkLayerTest, DescriptorIndexingUpdateAfterBind) { err = vkAllocateMemory(m_device->device(), &mem_alloc_info, NULL, &mem); ASSERT_VK_SUCCESS(err); - err = vkBindBufferMemory(m_device->device(), dyub, mem, 0); + err = vkBindBufferMemory(m_device->device(), dynamic_uniform_buffer, mem, 0); ASSERT_VK_SUCCESS(err); VkDescriptorBufferInfo buffInfo[2] = {}; - buffInfo[0].buffer = dyub; + buffInfo[0].buffer = dynamic_uniform_buffer; buffInfo[0].offset = 0; buffInfo[0].range = 1024; @@ -5484,11 +5499,6 @@ TEST_F(VkLayerTest, DescriptorIndexingUpdateAfterBind) { vkCreatePipelineLayout(m_device->device(), &pipeline_layout_ci, NULL, &pipeline_layout); // Create a dummy pipeline, since VL inspects which bindings are actually used at draw time - char const *vsSource = - "#version 450\n" - "void main(){\n" - " gl_Position = vec4(0);\n" - "}\n"; char const *fsSource = "#version 450\n" "\n" @@ -5499,7 +5509,7 @@ TEST_F(VkLayerTest, DescriptorIndexingUpdateAfterBind) { " color = vec4(bar0.x0 + bar1.x1);\n" "}\n"; - VkShaderObj vs(m_device, vsSource, VK_SHADER_STAGE_VERTEX_BIT, this); + VkShaderObj vs(m_device, bindStateVertShaderText, VK_SHADER_STAGE_VERTEX_BIT, this); VkShaderObj fs(m_device, fsSource, VK_SHADER_STAGE_FRAGMENT_BIT, this); VkPipelineObj pipe(m_device); @@ -5551,7 +5561,7 @@ TEST_F(VkLayerTest, DescriptorIndexingUpdateAfterBind) { vkDestroyDescriptorSetLayout(m_device->handle(), ds_layout, nullptr); vkDestroyDescriptorPool(m_device->handle(), pool, nullptr); - vkDestroyBuffer(m_device->handle(), dyub, NULL); + vkDestroyBuffer(m_device->handle(), dynamic_uniform_buffer, NULL); vkFreeMemory(m_device->handle(), mem, NULL); vkDestroyPipelineLayout(m_device->handle(), pipeline_layout, NULL); } diff --git a/tests/vklayertests_others.cpp b/tests/vklayertests_others.cpp index 2a6167af6..7f9abe321 100644 --- a/tests/vklayertests_others.cpp +++ b/tests/vklayertests_others.cpp @@ -1714,7 +1714,7 @@ TEST_F(VkLayerTest, DescriptorPoolInUseDestroyedSignaled) { pipe.CreateGraphicsPipeline(); // Update descriptor with image and sampler - pipe.descriptor_set_->WriteDescriptorImage(0, view, sampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); + pipe.descriptor_set_->WriteDescriptorImageInfo(0, view, sampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); pipe.descriptor_set_->UpdateDescriptorSets(); m_commandBuffer->begin(); @@ -1902,7 +1902,7 @@ TEST_F(VkLayerTest, InUseDestroyedSignaled) { pipe.InitState(); pipe.CreateGraphicsPipeline(); - pipe.descriptor_set_->WriteDescriptorBuffer(0, buffer_test.GetBuffer(), 1024, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); + pipe.descriptor_set_->WriteDescriptorBufferInfo(0, buffer_test.GetBuffer(), 1024, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); pipe.descriptor_set_->UpdateDescriptorSets(); VkEvent event; @@ -2107,7 +2107,7 @@ TEST_F(VkLayerTest, ImageViewInUseDestroyedSignaled) { pipe.InitState(); pipe.CreateGraphicsPipeline(); - pipe.descriptor_set_->WriteDescriptorImage(0, view, sampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); + pipe.descriptor_set_->WriteDescriptorImageInfo(0, view, sampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); pipe.descriptor_set_->UpdateDescriptorSets(); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-vkDestroyImageView-imageView-01026"); @@ -2267,7 +2267,7 @@ TEST_F(VkLayerTest, SamplerInUseDestroyedSignaled) { pipe.InitState(); pipe.CreateGraphicsPipeline(); - pipe.descriptor_set_->WriteDescriptorImage(0, view, sampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); + pipe.descriptor_set_->WriteDescriptorImageInfo(0, view, sampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); pipe.descriptor_set_->UpdateDescriptorSets(); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-vkDestroySampler-sampler-01082"); diff --git a/tests/vklayertests_pipeline_shader.cpp b/tests/vklayertests_pipeline_shader.cpp index 16f922d5b..fcfb2d6cd 100644 --- a/tests/vklayertests_pipeline_shader.cpp +++ b/tests/vklayertests_pipeline_shader.cpp @@ -2386,9 +2386,9 @@ TEST_F(VkLayerTest, NumSamplesMismatch) { ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkPipelineMultisampleStateCreateInfo pipe_ms_state_ci = {}; pipe_ms_state_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; @@ -2398,7 +2398,7 @@ TEST_F(VkLayerTest, NumSamplesMismatch) { pipe_ms_state_ci.minSampleShading = 1.0; pipe_ms_state_ci.pSampleMask = NULL; - const VkPipelineLayoutObj pipeline_layout(m_device, {&ds.layout_}); + const VkPipelineLayoutObj pipeline_layout(m_device, {&descriptor_set.layout_}); VkShaderObj vs(m_device, bindStateVertShaderText, VK_SHADER_STAGE_VERTEX_BIT, this); VkShaderObj fs(m_device, bindStateFragShaderText, VK_SHADER_STAGE_FRAGMENT_BIT, this); // We shouldn't need a fragment shader @@ -2841,9 +2841,9 @@ TEST_F(VkLayerTest, CreatePipelineCheckShaderDescriptorTypeMismatch) { ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); char const *vsSource = "#version 450\n" @@ -2861,7 +2861,7 @@ TEST_F(VkLayerTest, CreatePipelineCheckShaderDescriptorTypeMismatch) { pipe.InitInfo(); pipe.shader_stages_ = {vs.GetStageCreateInfo(), pipe.fs_->GetStageCreateInfo()}; pipe.InitState(); - pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&ds.layout_}); + pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&descriptor_set.layout_}); m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "Type mismatch on descriptor slot 0.0 "); pipe.CreateGraphicsPipeline(); diff --git a/tests/vkpositivelayertests.cpp b/tests/vkpositivelayertests.cpp index 903e62cb0..b4e0fbb4d 100644 --- a/tests/vkpositivelayertests.cpp +++ b/tests/vkpositivelayertests.cpp @@ -916,15 +916,15 @@ TEST_F(VkPositiveLayerTest, CopyNonupdatedDescriptors) { unsigned int i; ASSERT_NO_FATAL_FAILURE(Init()); - OneOffDescriptorSet src_ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - {2, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); - OneOffDescriptorSet dst_ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet src_descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, + {2, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); + OneOffDescriptorSet dst_descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + {1, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); m_errorMonitor->ExpectSuccess(); @@ -933,9 +933,9 @@ TEST_F(VkPositiveLayerTest, CopyNonupdatedDescriptors) { memset(copy_ds_update, 0, sizeof(copy_ds_update)); for (i = 0; i < copy_size; i++) { copy_ds_update[i].sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET; - copy_ds_update[i].srcSet = src_ds.set_; + copy_ds_update[i].srcSet = src_descriptor_set.set_; copy_ds_update[i].srcBinding = i; - copy_ds_update[i].dstSet = dst_ds.set_; + copy_ds_update[i].dstSet = dst_descriptor_set.set_; copy_ds_update[i].dstBinding = i; copy_ds_update[i].descriptorCount = 1; } @@ -1866,9 +1866,9 @@ TEST_F(VkPositiveLayerTest, IgnoreUnrelatedDescriptor) { VkImageView view = image.targetView(VK_FORMAT_B8G8R8A8_UNORM); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkDescriptorImageInfo image_info = {}; image_info.imageView = view; @@ -1877,7 +1877,7 @@ TEST_F(VkPositiveLayerTest, IgnoreUnrelatedDescriptor) { VkWriteDescriptorSet descriptor_write; memset(&descriptor_write, 0, sizeof(descriptor_write)); descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; descriptor_write.dstBinding = 0; descriptor_write.descriptorCount = 1; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; @@ -1912,9 +1912,9 @@ TEST_F(VkPositiveLayerTest, IgnoreUnrelatedDescriptor) { VkBufferObj buffer; buffer.init(*m_device, buffer_create_info); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkDescriptorBufferInfo buffer_info = {}; buffer_info.buffer = buffer.handle(); @@ -1924,7 +1924,7 @@ TEST_F(VkPositiveLayerTest, IgnoreUnrelatedDescriptor) { VkWriteDescriptorSet descriptor_write; memset(&descriptor_write, 0, sizeof(descriptor_write)); descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; descriptor_write.dstBinding = 0; descriptor_write.descriptorCount = 1; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; @@ -1967,14 +1967,15 @@ TEST_F(VkPositiveLayerTest, IgnoreUnrelatedDescriptor) { VkBufferView buffer_view; VkResult err = vkCreateBufferView(m_device->device(), &buff_view_ci, NULL, &buffer_view); ASSERT_VK_SUCCESS(err); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr}, + }); VkWriteDescriptorSet descriptor_write; memset(&descriptor_write, 0, sizeof(descriptor_write)); descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; descriptor_write.dstBinding = 0; descriptor_write.descriptorCount = 1; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER; @@ -2003,23 +2004,23 @@ TEST_F(VkPositiveLayerTest, ImmutableSamplerOnlyDescriptor) { ASSERT_NO_FATAL_FAILURE(Init()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, { + {0, VK_DESCRIPTOR_TYPE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, + }); VkSamplerCreateInfo sampler_ci = SafeSaneSamplerCreateInfo(); VkSampler sampler; VkResult err = vkCreateSampler(m_device->device(), &sampler_ci, NULL, &sampler); ASSERT_VK_SUCCESS(err); - const VkPipelineLayoutObj pipeline_layout(m_device, {&ds.layout_}); + const VkPipelineLayoutObj pipeline_layout(m_device, {&descriptor_set.layout_}); m_errorMonitor->ExpectSuccess(); m_commandBuffer->begin(); m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo); - vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, &ds.set_, 0, - nullptr); + vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, + &descriptor_set.set_, 0, nullptr); m_errorMonitor->VerifyNotFound(); vkDestroySampler(m_device->device(), sampler, NULL); @@ -2218,7 +2219,8 @@ TEST_F(VkPositiveLayerTest, PushDescriptorUnboundSetTest) { dsl_binding.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; dsl_binding.pImmutableSamplers = NULL; - OneOffDescriptorSet ds(m_device, {dsl_binding}, 0, nullptr, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, nullptr); + OneOffDescriptorSet descriptor_set(m_device, {dsl_binding}, 0, nullptr, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, + nullptr); // Create push descriptor set layout const VkDescriptorSetLayoutObj push_ds_layout(m_device, {dsl_binding}, VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR); @@ -2240,15 +2242,15 @@ TEST_F(VkPositiveLayerTest, PushDescriptorUnboundSetTest) { pipe.shader_stages_ = {vs.GetStageCreateInfo(), fs.GetStageCreateInfo()}; pipe.InitState(); // Now use the descriptor layouts to create a pipeline layout - pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&push_ds_layout, &ds.layout_}); + pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&push_ds_layout, &descriptor_set.layout_}); pipe.CreateGraphicsPipeline(); const float bo_data[1] = {1.f}; VkConstantBufferObj buffer(m_device, sizeof(bo_data), (const void *)&bo_data, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT); // Update descriptor set - ds.WriteDescriptorBuffer(2, buffer.handle(), sizeof(bo_data)); - ds.UpdateDescriptorSets(); + descriptor_set.WriteDescriptorBufferInfo(2, buffer.handle(), sizeof(bo_data)); + descriptor_set.UpdateDescriptorSets(); PFN_vkCmdPushDescriptorSetKHR vkCmdPushDescriptorSetKHR = (PFN_vkCmdPushDescriptorSetKHR)vkGetDeviceProcAddr(m_device->device(), "vkCmdPushDescriptorSetKHR"); @@ -2260,9 +2262,9 @@ TEST_F(VkPositiveLayerTest, PushDescriptorUnboundSetTest) { // Push descriptors and bind descriptor set vkCmdPushDescriptorSetKHR(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.pipeline_layout_.handle(), 0, 1, - ds.descriptor_writes.data()); + descriptor_set.descriptor_writes.data()); vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.pipeline_layout_.handle(), 1, 1, - &ds.set_, 0, NULL); + &descriptor_set.set_, 0, NULL); // No errors should be generated. vkCmdDraw(m_commandBuffer->handle(), 3, 1, 0, 0); @@ -2743,11 +2745,12 @@ TEST_F(VkPositiveLayerTest, DynamicOffsetWithInactiveBinding) { ASSERT_NO_FATAL_FAILURE(InitViewport()); ASSERT_NO_FATAL_FAILURE(InitRenderTarget()); - OneOffDescriptorSet ds(m_device, { - {2, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, - {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, - {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {2, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, + {0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, + {1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, + }); // Create two buffers to update the descriptors with // The first will be 2k and used for bindings 0 & 1, the second is 1k for binding 2 @@ -2759,28 +2762,28 @@ TEST_F(VkPositiveLayerTest, DynamicOffsetWithInactiveBinding) { buffCI.queueFamilyIndexCount = 1; buffCI.pQueueFamilyIndices = &qfi; - VkBufferObj dyub1, dyub2; - dyub1.init(*m_device, buffCI); + VkBufferObj dynamic_uniform_buffer_1, dynamic_uniform_buffer_2; + dynamic_uniform_buffer_1.init(*m_device, buffCI); buffCI.size = 1024; - dyub2.init(*m_device, buffCI); + dynamic_uniform_buffer_2.init(*m_device, buffCI); // Update descriptors const uint32_t BINDING_COUNT = 3; VkDescriptorBufferInfo buff_info[BINDING_COUNT] = {}; - buff_info[0].buffer = dyub1.handle(); + buff_info[0].buffer = dynamic_uniform_buffer_1.handle(); buff_info[0].offset = 0; buff_info[0].range = 256; - buff_info[1].buffer = dyub1.handle(); + buff_info[1].buffer = dynamic_uniform_buffer_1.handle(); buff_info[1].offset = 256; buff_info[1].range = 512; - buff_info[2].buffer = dyub2.handle(); + buff_info[2].buffer = dynamic_uniform_buffer_2.handle(); buff_info[2].offset = 0; buff_info[2].range = 512; VkWriteDescriptorSet descriptor_write; memset(&descriptor_write, 0, sizeof(descriptor_write)); descriptor_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; - descriptor_write.dstSet = ds.set_; + descriptor_write.dstSet = descriptor_set.set_; descriptor_write.dstBinding = 0; descriptor_write.descriptorCount = BINDING_COUNT; descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC; @@ -2808,7 +2811,7 @@ TEST_F(VkPositiveLayerTest, DynamicOffsetWithInactiveBinding) { pipe.InitInfo(); pipe.InitState(); pipe.shader_stages_ = {vs.GetStageCreateInfo(), fs.GetStageCreateInfo()}; - pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&ds.layout_}); + pipe.pipeline_layout_ = VkPipelineLayoutObj(m_device, {&descriptor_set.layout_}); pipe.CreateGraphicsPipeline(); vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.pipeline_); @@ -2816,7 +2819,7 @@ TEST_F(VkPositiveLayerTest, DynamicOffsetWithInactiveBinding) { // we used to have a bug in this case. uint32_t dyn_off[BINDING_COUNT] = {0, 1024, 256}; vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.pipeline_layout_.handle(), 0, 1, - &ds.set_, BINDING_COUNT, dyn_off); + &descriptor_set.set_, BINDING_COUNT, dyn_off); m_commandBuffer->Draw(1, 0, 0, 0); m_errorMonitor->VerifyNotFound(); @@ -6924,9 +6927,10 @@ TEST_F(VkPositiveLayerTest, MultiplaneImageTests) { ivci.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; vkCreateImageView(m_device->device(), &ivci, nullptr, &view); - OneOffDescriptorSet ds(m_device, { - {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, - }); + OneOffDescriptorSet descriptor_set(m_device, + { + {0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, + }); VkSamplerCreateInfo sampler_ci = SafeSaneSamplerCreateInfo(); VkSampler sampler; @@ -6935,9 +6939,9 @@ TEST_F(VkPositiveLayerTest, MultiplaneImageTests) { err = vkCreateSampler(m_device->device(), &sampler_ci, NULL, &sampler); ASSERT_VK_SUCCESS(err); - const VkPipelineLayoutObj pipeline_layout(m_device, {&ds.layout_}); - ds.WriteDescriptorImage(0, view, sampler); - ds.UpdateDescriptorSets(); + const VkPipelineLayoutObj pipeline_layout(m_device, {&descriptor_set.layout_}); + descriptor_set.WriteDescriptorImageInfo(0, view, sampler); + descriptor_set.UpdateDescriptorSets(); VkShaderObj vs(m_device, bindStateVertShaderText, VK_SHADER_STAGE_VERTEX_BIT, this); VkShaderObj fs(m_device, bindStateFragSamplerShaderText, VK_SHADER_STAGE_FRAGMENT_BIT, this); @@ -6967,8 +6971,8 @@ TEST_F(VkPositiveLayerTest, MultiplaneImageTests) { VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, 1, &img_barrier); m_commandBuffer->BeginRenderPass(m_renderPassBeginInfo); vkCmdBindPipeline(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle()); - vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, &ds.set_, 0, - nullptr); + vkCmdBindDescriptorSets(m_commandBuffer->handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout.handle(), 0, 1, + &descriptor_set.set_, 0, nullptr); VkViewport viewport = {0, 0, 16, 16, 0, 1}; VkRect2D scissor = {{0, 0}, {16, 16}}; |