Add robustBufferAccess to PipelineCache::SpirvBinaryKey
robustBufferAccess changes how OOB behavior is handled, so it must be
taken into account in PipelineCache::SpirvBinaryKey. Generally,
pipelines inherit whether robustness is enabled from the device, but
that can now be set per pipeline thanks to VK_EXT_pipeline_robustness.
For reference, see:
https://chromium-review.googlesource.com/c/angle/angle/+/3949915
Bug: b/253062051
Change-Id: I40b1fd6c6132e39e521ba8e775b16164c572a871
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/69008
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Commit-Queue: Alexis Hétu <sugoi@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/VkPipeline.cpp b/src/Vulkan/VkPipeline.cpp
index f014a95..15c3549 100644
--- a/src/Vulkan/VkPipeline.cpp
+++ b/src/Vulkan/VkPipeline.cpp
@@ -513,7 +513,7 @@
module = vk::Cast(tempModule);
}
- const PipelineCache::SpirvBinaryKey key(module->getBinary(), stageInfo.pSpecializationInfo, optimize);
+ const PipelineCache::SpirvBinaryKey key(module->getBinary(), stageInfo.pSpecializationInfo, robustBufferAccess, optimize);
if((pCreateInfo->flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT) &&
(!pPipelineCache || !pPipelineCache->contains(key)))
@@ -590,7 +590,7 @@
const bool optimize = true; // TODO(b/251802301): Don't optimize when debugging shaders.
- const PipelineCache::SpirvBinaryKey shaderKey(module->getBinary(), stage.pSpecializationInfo, optimize);
+ const PipelineCache::SpirvBinaryKey shaderKey(module->getBinary(), stage.pSpecializationInfo, robustBufferAccess, optimize);
if((pCreateInfo->flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT) &&
(!pPipelineCache || !pPipelineCache->contains(shaderKey)))
diff --git a/src/Vulkan/VkPipelineCache.cpp b/src/Vulkan/VkPipelineCache.cpp
index c187632..1146db2 100644
--- a/src/Vulkan/VkPipelineCache.cpp
+++ b/src/Vulkan/VkPipelineCache.cpp
@@ -20,9 +20,11 @@
PipelineCache::SpirvBinaryKey::SpirvBinaryKey(const sw::SpirvBinary &spirv,
const VkSpecializationInfo *specializationInfo,
+ bool robustBufferAccess,
bool optimize)
: spirv(spirv)
, specializationInfo(specializationInfo)
+ , robustBufferAccess(robustBufferAccess)
, optimize(optimize)
{
}
@@ -40,6 +42,11 @@
return cmp < 0;
}
+ if(robustBufferAccess != other.robustBufferAccess)
+ {
+ return !robustBufferAccess && other.robustBufferAccess;
+ }
+
if(optimize != other.optimize)
{
return !optimize && other.optimize;
diff --git a/src/Vulkan/VkPipelineCache.hpp b/src/Vulkan/VkPipelineCache.hpp
index 47ea0d6..13d944d 100644
--- a/src/Vulkan/VkPipelineCache.hpp
+++ b/src/Vulkan/VkPipelineCache.hpp
@@ -59,6 +59,7 @@
{
SpirvBinaryKey(const sw::SpirvBinary &spirv,
const VkSpecializationInfo *specializationInfo,
+ bool robustBufferAccess,
bool optimize);
bool operator<(const SpirvBinaryKey &other) const;
@@ -70,6 +71,7 @@
private:
const sw::SpirvBinary spirv;
const vk::SpecializationInfo specializationInfo;
+ const bool robustBufferAccess;
const bool optimize;
};