Check sampler validity against immutable samplers on serialise

This commit is contained in:
baldurk
2021-03-15 14:39:21 +00:00
parent 90d7bc1926
commit 827a48fe57
2 changed files with 23 additions and 0 deletions
+12
View File
@@ -23,6 +23,7 @@
******************************************************************************/
#include "vk_common.h"
#include "vk_info.h"
#include "vk_manager.h"
#include "vk_resources.h"
@@ -3250,8 +3251,19 @@ void DoSerialise(SerialiserType &ser, VkWriteDescriptorSet &el)
if(el.descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER ||
el.descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER)
{
validity = validity | VkDescriptorImageInfoValidity::Sampler;
// on writing check if this is an immutable samplers binding. If it is we can't treat the
// sampler as valid. On replay we don't have to do this because invalid samplers got
// serialised as NULL safely.
if(ser.IsWriting() && el.dstSet != VK_NULL_HANDLE)
{
if(GetRecord(el.dstSet)->descInfo->layout->bindings[el.dstBinding].immutableSampler != NULL)
validity = validity & ~VkDescriptorImageInfoValidity::Sampler;
}
}
if(el.descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ||
el.descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE ||
el.descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE ||
+11
View File
@@ -1236,6 +1236,17 @@ void main()
Submit(0, 4, {cmd});
}
// try writing with an invalid sampler to the immutable, it should be ignored
vkh::updateDescriptorSets(
device,
{
vkh::WriteDescriptorSet(
immutdescset, 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
{
vkh::DescriptorImageInfo(validImgView, VK_IMAGE_LAYOUT_GENERAL, invalidSampler),
}),
});
// do a bunch of spinning on fences/semaphores that should not be serialised exhaustively
VkResult status = VK_SUCCESS;
for(size_t i = 0; i < 1000; i++)