summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-modifier.cpp
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-01-31 03:28:04 +0800
committerGitHub <noreply@github.com>2024-01-30 11:28:04 -0800
commit2d0912bfe2de7799b32e80722fa5c8dc279a339b (patch)
tree152bfe7c054f035090c84fabd7d9d12e9f5fc362 /source/slang/slang-check-modifier.cpp
parent470c5a28f5b84353f077c2d871db65cddd5f923a (diff)
Correctly apply glsl local size layout to entry points during lowering (#3528)
* Correctly apply glsl local size layout to entry points during lowering * Test for glsl layout correctness
Diffstat (limited to 'source/slang/slang-check-modifier.cpp')
-rw-r--r--source/slang/slang-check-modifier.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/slang/slang-check-modifier.cpp b/source/slang/slang-check-modifier.cpp
index 413e1c157..96ec0acc8 100644
--- a/source/slang/slang-check-modifier.cpp
+++ b/source/slang/slang-check-modifier.cpp
@@ -1272,6 +1272,39 @@ namespace Slang
}
}
+ if (auto attr = as<GLSLLayoutLocalSizeAttribute>(m))
+ {
+ SLANG_ASSERT(attr->args.getCount() == 3);
+
+ int32_t values[3];
+
+ for (int i = 0; i < 3; ++i)
+ {
+ int32_t value = 1;
+
+ auto arg = attr->args[i];
+ if (arg)
+ {
+ auto intValue = checkConstantIntVal(arg);
+ if (!intValue)
+ {
+ return nullptr;
+ }
+ if (intValue->getValue() < 1)
+ {
+ getSink()->diagnose(attr, Diagnostics::nonPositiveNumThreads, intValue->getValue());
+ return nullptr;
+ }
+ value = int32_t(intValue->getValue());
+ }
+ values[i] = value;
+ }
+
+ attr->x = values[0];
+ attr->y = values[1];
+ attr->z = values[2];
+ }
+
// Default behavior is to leave things as they are,
// and assume that modifiers are mostly already checked.
//