Only read pImmutableSamplers pointer for sampler descriptors

This commit is contained in:
baldurk
2019-10-28 11:17:54 +00:00
parent 938d8f63f5
commit b6c9b6298f
4 changed files with 17 additions and 3 deletions
+3 -1
View File
@@ -115,7 +115,9 @@ void DescSetLayout::Init(VulkanResourceManager *resourceMan, VulkanCreationInfo
bindings[b].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)
dynamicCount++;
if(pCreateInfo->pBindings[i].pImmutableSamplers)
if((bindings[b].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER ||
bindings[b].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) &&
pCreateInfo->pBindings[i].pImmutableSamplers)
{
bindings[b].immutableSampler = new ResourceId[bindings[b].descriptorCount];
+10 -1
View File
@@ -3050,7 +3050,16 @@ void DoSerialise(SerialiserType &ser, VkDescriptorSetLayoutBinding &el)
SERIALISE_MEMBER(descriptorType);
SERIALISE_MEMBER(descriptorCount);
SERIALISE_MEMBER_VKFLAGS(VkShaderStageFlags, stageFlags);
SERIALISE_MEMBER_ARRAY(pImmutableSamplers, descriptorCount);
if(el.descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER ||
el.descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)
{
SERIALISE_MEMBER_ARRAY(pImmutableSamplers, descriptorCount);
}
else
{
SERIALISE_MEMBER_ARRAY_EMPTY(pImmutableSamplers);
}
}
template <>
@@ -45,7 +45,9 @@ VkDescriptorSetLayoutCreateInfo WrappedVulkan::UnwrapInfo(const VkDescriptorSetL
{
unwrapped[i] = info->pBindings[i];
if(unwrapped[i].pImmutableSamplers)
if((unwrapped[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER ||
unwrapped[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) &&
unwrapped[i].pImmutableSamplers)
{
VkSampler *unwrappedSamplers = nextSampler;
nextSampler += unwrapped[i].descriptorCount;
+1
View File
@@ -112,6 +112,7 @@ void main()
VkDescriptorSetLayout immutsetlayout = createDescriptorSetLayout(vkh::DescriptorSetLayoutCreateInfo({
{0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_VERTEX_BIT, &validSampler},
{99, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1, VK_SHADER_STAGE_VERTEX_BIT, &invalidSampler},
}));
VkDescriptorSetLayout pushlayout = VK_NULL_HANDLE;