Commit 57eb48ae by Nicolas Capens Committed by Nicolas Capens

Fix processing OpExecutionMode for the requested entry point

Previously any SPIR-V OpExecutionMode instruction would override the execution mode parameters, so a shader module with multiple entry points with different execution modes would not work as intended. Bug: b/155550449 Change-Id: I86211e66a3cef5a3bbf9e535e9be8415b5d69d4b Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45249 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com>
parent 660c3bc9
...@@ -189,7 +189,7 @@ SpirvShader::SpirvShader( ...@@ -189,7 +189,7 @@ SpirvShader::SpirvShader(
case spv::OpBranchConditional: case spv::OpBranchConditional:
case spv::OpSwitch: case spv::OpSwitch:
case spv::OpReturn: case spv::OpReturn:
// fallthrough // [[fallthrough]]
// Termination instruction: // Termination instruction:
case spv::OpKill: case spv::OpKill:
...@@ -874,6 +874,12 @@ void SpirvShader::ProcessInterfaceVariable(Object &object) ...@@ -874,6 +874,12 @@ void SpirvShader::ProcessInterfaceVariable(Object &object)
void SpirvShader::ProcessExecutionMode(InsnIterator insn) void SpirvShader::ProcessExecutionMode(InsnIterator insn)
{ {
Function::ID function = insn.word(1);
if(function != entryPoint)
{
return;
}
auto mode = static_cast<spv::ExecutionMode>(insn.word(2)); auto mode = static_cast<spv::ExecutionMode>(insn.word(2));
switch(mode) switch(mode)
{ {
......
...@@ -555,7 +555,9 @@ public: ...@@ -555,7 +555,9 @@ public:
bool NeedsCentroid : 1; bool NeedsCentroid : 1;
// Compute workgroup dimensions // Compute workgroup dimensions
int WorkgroupSizeX = 1, WorkgroupSizeY = 1, WorkgroupSizeZ = 1; int WorkgroupSizeX = 1;
int WorkgroupSizeY = 1;
int WorkgroupSizeZ = 1;
}; };
Modes const &getModes() const Modes const &getModes() const
......
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