Commit 23668022 by Chris Forbes

Relax descriptor set index assert at descriptor point of definition

The module may legitimately contain descriptor set references (intended for another entrypoint) which are not compatible with our limits. There is a matching assert to verify the set index at the point the descriptor is actually referenced. Bug: b/140648941 Change-Id: Ie3b8c6a2e53e553d1dccb2995e6719539eab89de Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/36114Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 52445956
......@@ -2879,9 +2879,19 @@ namespace sw
case spv::StorageClassStorageBuffer:
{
const auto &d = descriptorDecorations.at(resultId);
ASSERT(d.DescriptorSet >= 0 && d.DescriptorSet < vk::MAX_BOUND_DESCRIPTOR_SETS);
ASSERT(d.DescriptorSet >= 0);
auto size = 0; // Not required as this pointer is not directly used by SIMD::Read or SIMD::Write.
state->createPointer(resultId, SIMD::Pointer(routine->descriptorSets[d.DescriptorSet], size));
// Note: the module may contain descriptor set references that are not suitable for this implementation -- using a set index higher than the number
// of descriptor set binding points we support. As long as the selected entrypoint doesn't actually touch the out of range binding points, this
// is valid. In this case make the value nullptr to make it easier to diagnose an attempt to dereference it.
if (d.DescriptorSet < vk::MAX_BOUND_DESCRIPTOR_SETS)
{
state->createPointer(resultId, SIMD::Pointer(routine->descriptorSets[d.DescriptorSet], size));
}
else
{
state->createPointer(resultId, SIMD::Pointer(nullptr, 0));
}
break;
}
case spv::StorageClassPushConstant:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment