mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Do not create descriptor set layout/template if binding count is 0
Fixes a validation error in case an application renders geometry without any active shader resource slots.
This commit is contained in:
parent
f02b44f440
commit
fc47fb8f6c
@ -1604,6 +1604,7 @@ namespace dxvk {
|
|||||||
VkPipelineBindPoint bindPoint,
|
VkPipelineBindPoint bindPoint,
|
||||||
const DxvkBindingState& bindingState,
|
const DxvkBindingState& bindingState,
|
||||||
const Rc<DxvkPipelineLayout>& layout) {
|
const Rc<DxvkPipelineLayout>& layout) {
|
||||||
|
if (layout->bindingCount() != 0) {
|
||||||
const VkDescriptorSet dset =
|
const VkDescriptorSet dset =
|
||||||
m_cmd->allocateDescriptorSet(
|
m_cmd->allocateDescriptorSet(
|
||||||
layout->descriptorSetLayout());
|
layout->descriptorSetLayout());
|
||||||
@ -1615,6 +1616,7 @@ namespace dxvk {
|
|||||||
m_cmd->cmdBindDescriptorSet(bindPoint,
|
m_cmd->cmdBindDescriptorSet(bindPoint,
|
||||||
layout->pipelineLayout(), dset);
|
layout->pipelineLayout(), dset);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::updateIndexBufferBinding() {
|
void DxvkContext::updateIndexBufferBinding() {
|
||||||
|
@ -70,7 +70,9 @@ namespace dxvk {
|
|||||||
tEntries[i].stride = 0;
|
tEntries[i].stride = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create descriptor set layout
|
// Create descriptor set layout. We do not need to
|
||||||
|
// create one if there are no active resource bindings.
|
||||||
|
if (bindingCount > 0) {
|
||||||
VkDescriptorSetLayoutCreateInfo dsetInfo;
|
VkDescriptorSetLayoutCreateInfo dsetInfo;
|
||||||
dsetInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
dsetInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
||||||
dsetInfo.pNext = nullptr;
|
dsetInfo.pNext = nullptr;
|
||||||
@ -81,13 +83,14 @@ namespace dxvk {
|
|||||||
if (m_vkd->vkCreateDescriptorSetLayout(m_vkd->device(),
|
if (m_vkd->vkCreateDescriptorSetLayout(m_vkd->device(),
|
||||||
&dsetInfo, nullptr, &m_descriptorSetLayout) != VK_SUCCESS)
|
&dsetInfo, nullptr, &m_descriptorSetLayout) != VK_SUCCESS)
|
||||||
throw DxvkError("DxvkPipelineLayout: Failed to create descriptor set layout");
|
throw DxvkError("DxvkPipelineLayout: Failed to create descriptor set layout");
|
||||||
|
}
|
||||||
|
|
||||||
// Create pipeline layout
|
// Create pipeline layout with the given descriptor set layout
|
||||||
VkPipelineLayoutCreateInfo pipeInfo;
|
VkPipelineLayoutCreateInfo pipeInfo;
|
||||||
pipeInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
pipeInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||||
pipeInfo.pNext = nullptr;
|
pipeInfo.pNext = nullptr;
|
||||||
pipeInfo.flags = 0;
|
pipeInfo.flags = 0;
|
||||||
pipeInfo.setLayoutCount = 1;
|
pipeInfo.setLayoutCount = bindingCount > 0 ? 1 : 0;
|
||||||
pipeInfo.pSetLayouts = &m_descriptorSetLayout;
|
pipeInfo.pSetLayouts = &m_descriptorSetLayout;
|
||||||
pipeInfo.pushConstantRangeCount = 0;
|
pipeInfo.pushConstantRangeCount = 0;
|
||||||
pipeInfo.pPushConstantRanges = nullptr;
|
pipeInfo.pPushConstantRanges = nullptr;
|
||||||
@ -98,7 +101,9 @@ namespace dxvk {
|
|||||||
throw DxvkError("DxvkPipelineLayout: Failed to create pipeline layout");
|
throw DxvkError("DxvkPipelineLayout: Failed to create pipeline layout");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create descriptor update template
|
// Create descriptor update template. If there are no active
|
||||||
|
// resource bindings, there won't be any descriptors to update.
|
||||||
|
if (bindingCount > 0) {
|
||||||
VkDescriptorUpdateTemplateCreateInfoKHR templateInfo;
|
VkDescriptorUpdateTemplateCreateInfoKHR templateInfo;
|
||||||
templateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR;
|
templateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR;
|
||||||
templateInfo.pNext = nullptr;
|
templateInfo.pNext = nullptr;
|
||||||
@ -111,13 +116,14 @@ namespace dxvk {
|
|||||||
templateInfo.pipelineLayout = m_pipelineLayout;
|
templateInfo.pipelineLayout = m_pipelineLayout;
|
||||||
templateInfo.set = 0;
|
templateInfo.set = 0;
|
||||||
|
|
||||||
if (m_vkd->vkCreateDescriptorUpdateTemplateKHR(m_vkd->device(),
|
if (m_vkd->vkCreateDescriptorUpdateTemplateKHR(
|
||||||
&templateInfo, nullptr, &m_descriptorTemplate) != VK_SUCCESS) {
|
m_vkd->device(), &templateInfo, nullptr, &m_descriptorTemplate) != VK_SUCCESS) {
|
||||||
m_vkd->vkDestroyDescriptorSetLayout(m_vkd->device(), m_descriptorSetLayout, nullptr);
|
m_vkd->vkDestroyDescriptorSetLayout(m_vkd->device(), m_descriptorSetLayout, nullptr);
|
||||||
m_vkd->vkDestroyPipelineLayout(m_vkd->device(), m_pipelineLayout, nullptr);
|
m_vkd->vkDestroyPipelineLayout(m_vkd->device(), m_pipelineLayout, nullptr);
|
||||||
throw DxvkError("DxvkPipelineLayout: Failed to create descriptor update template");
|
throw DxvkError("DxvkPipelineLayout: Failed to create descriptor update template");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DxvkPipelineLayout::~DxvkPipelineLayout() {
|
DxvkPipelineLayout::~DxvkPipelineLayout() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user