Skip to content

Commit 98541a5

Browse files
committed
Enable sync2 feature
1 parent bd7bc0a commit 98541a5

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

examples/descriptorheap/descriptorheap.cpp

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class VulkanExample : public VulkanExampleBase
3535

3636
VkPhysicalDeviceDescriptorHeapFeaturesEXT enabledDeviceDescriptorHeapFeaturesEXT{};
3737
VkPhysicalDeviceBufferDeviceAddressFeatures enabledBufferDeviceAddressFeatures{};
38+
VkPhysicalDeviceSynchronization2Features enabledynchronization2Features{};
3839

3940
VkPhysicalDeviceDescriptorHeapPropertiesEXT descriptorHeapProperties{};
4041

@@ -83,9 +84,15 @@ class VulkanExample : public VulkanExampleBase
8384
enabledDeviceExtensions.push_back(VK_EXT_DESCRIPTOR_HEAP_EXTENSION_NAME);
8485
enabledDeviceExtensions.push_back(VK_KHR_MAINTENANCE_5_EXTENSION_NAME);
8586

87+
enabledynchronization2Features = {
88+
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES,
89+
.pNext = &baseDynamicRenderingFeatures,
90+
.synchronization2 = VK_TRUE
91+
};
92+
8693
enabledBufferDeviceAddressFeatures = {
8794
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES,
88-
.pNext = &baseDynamicRenderingFeatures,
95+
.pNext = &enabledynchronization2Features,
8996
.bufferDeviceAddress = VK_TRUE
9097
};
9198

@@ -280,7 +287,7 @@ class VulkanExample : public VulkanExampleBase
280287
const std::vector<VkDynamicState> dynamicStateEnables = { VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR };
281288

282289
VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCI = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE);
283-
VkPipelineRasterizationStateCreateInfo rasterizationStateCI = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_NONE, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0);
290+
VkPipelineRasterizationStateCreateInfo rasterizationStateCI = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_BACK_BIT, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0);
284291
VkPipelineColorBlendAttachmentState blendAttachmentState = vks::initializers::pipelineColorBlendAttachmentState(0xf, VK_FALSE);
285292
VkPipelineColorBlendStateCreateInfo colorBlendStateCI = vks::initializers::pipelineColorBlendStateCreateInfo(1, &blendAttachmentState);
286293
VkPipelineDepthStencilStateCreateInfo depthStencilStateCI = vks::initializers::pipelineDepthStencilStateCreateInfo(VK_TRUE, VK_TRUE, VK_COMPARE_OP_LESS_OR_EQUAL);
@@ -356,17 +363,19 @@ class VulkanExample : public VulkanExampleBase
356363
shaderStages[0].pNext = &descriptorSetAndBindingMappingInfo;
357364
shaderStages[1].pNext = &descriptorSetAndBindingMappingInfo;
358365

359-
VkGraphicsPipelineCreateInfo pipelineCI = vks::initializers::pipelineCreateInfo();
360-
pipelineCI.pInputAssemblyState = &inputAssemblyStateCI;
361-
pipelineCI.pRasterizationState = &rasterizationStateCI;
362-
pipelineCI.pColorBlendState = &colorBlendStateCI;
363-
pipelineCI.pMultisampleState = &multisampleStateCI;
364-
pipelineCI.pViewportState = &viewportStateCI;
365-
pipelineCI.pDepthStencilState = &depthStencilStateCI;
366-
pipelineCI.pDynamicState = &dynamicStateCI;
367-
pipelineCI.stageCount = static_cast<uint32_t>(shaderStages.size());
368-
pipelineCI.pStages = shaderStages.data();
369-
pipelineCI.pVertexInputState = vkglTF::Vertex::getPipelineVertexInputState({ vkglTF::VertexComponent::Position, vkglTF::VertexComponent::Normal, vkglTF::VertexComponent::UV, vkglTF::VertexComponent::Color });
366+
VkGraphicsPipelineCreateInfo pipelineCI{
367+
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
368+
.stageCount = static_cast<uint32_t>(shaderStages.size()),
369+
.pStages = shaderStages.data(),
370+
.pVertexInputState = vkglTF::Vertex::getPipelineVertexInputState({ vkglTF::VertexComponent::Position, vkglTF::VertexComponent::Normal, vkglTF::VertexComponent::UV, vkglTF::VertexComponent::Color }),
371+
.pInputAssemblyState = &inputAssemblyStateCI,
372+
.pViewportState = &viewportStateCI,
373+
.pRasterizationState = &rasterizationStateCI,
374+
.pMultisampleState = &multisampleStateCI,
375+
.pDepthStencilState = &depthStencilStateCI,
376+
.pColorBlendState = &colorBlendStateCI,
377+
.pDynamicState = &dynamicStateCI
378+
};
370379
VkPipelineRenderingCreateInfoKHR pipelineRenderingCreateInfo{
371380
.sType = VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR,
372381
.colorAttachmentCount = 1,

0 commit comments

Comments
 (0)