Fix specializing graphics routines for the pipeline layout
Shader modules can be used by different pipelines, even with incompatible
layouts. The generated code differs based on the layout, so we must use
it as part of the cache key.
This change conservatively assumes each pipeline layout to be unique, so
a serial ID is used to differentiate between them.
Bug: b/154660947
Change-Id: I65cce79d7780d8b9eab1752a5005202263dc3c1d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/44228
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Device/VertexProcessor.cpp b/src/Device/VertexProcessor.cpp
index 54d5df8..f069c1c 100644
--- a/src/Device/VertexProcessor.cpp
+++ b/src/Device/VertexProcessor.cpp
@@ -18,6 +18,7 @@
#include "Pipeline/VertexProgram.hpp"
#include "System/Debug.hpp"
#include "System/Math.hpp"
+#include "Vulkan/VkPipelineLayout.hpp"
#include <cstring>
@@ -77,6 +78,7 @@
State state;
state.shaderID = context->vertexShader->getSerialID();
+ state.pipelineLayoutIdentifier = context->pipelineLayout->identifier;
state.robustBufferAccess = context->robustBufferAccess;
state.isPoint = context->topology == VK_PRIMITIVE_TOPOLOGY_POINT_LIST;