diff options
| -rw-r--r-- | source/slang/slang-ir-legalize-varying-params.cpp | 19 | ||||
| -rw-r--r-- | tests/language-feature/modules/module-name.slang | 1 |
2 files changed, 9 insertions, 11 deletions
diff --git a/source/slang/slang-ir-legalize-varying-params.cpp b/source/slang/slang-ir-legalize-varying-params.cpp index 5f6c7a34e..4c96dc0c7 100644 --- a/source/slang/slang-ir-legalize-varying-params.cpp +++ b/source/slang/slang-ir-legalize-varying-params.cpp @@ -185,11 +185,10 @@ void assign(IRBuilder& builder, LegalizedVaryingVal const& dest, IRInst* src) IRInst* emitCalcGroupExtents(IRBuilder& builder, IRFunc* entryPoint, IRVectorType* type) { + static const int kAxisCount = 3; + IRInst* groupExtentAlongAxis[kAxisCount] = {}; if (auto numThreadsDecor = entryPoint->findDecoration<IRNumThreadsDecoration>()) { - static const int kAxisCount = 3; - IRInst* groupExtentAlongAxis[kAxisCount] = {}; - for (int axis = 0; axis < kAxisCount; axis++) { auto litValue = as<IRIntLit>(numThreadsDecor->getOperand(axis)); @@ -199,16 +198,14 @@ IRInst* emitCalcGroupExtents(IRBuilder& builder, IRFunc* entryPoint, IRVectorTyp groupExtentAlongAxis[axis] = builder.getIntValue(type->getElementType(), litValue->getValue()); } - - return builder.emitMakeVector(type, kAxisCount, groupExtentAlongAxis); + } + else + { + for (int axis = 0; axis < kAxisCount; axis++) + groupExtentAlongAxis[axis] = builder.getIntValue(type->getElementType(), 1); } - // TODO: We may want to implement a backup option here, - // in case we ever want to support compute shaders with - // dynamic/flexible group size on targets that allow it. - // - SLANG_UNEXPECTED("Expected '[numthreads(...)]' attribute on compute entry point."); - UNREACHABLE_RETURN(nullptr); + return builder.emitMakeVector(type, kAxisCount, groupExtentAlongAxis); } // There are some cases of system-value inputs that can be derived diff --git a/tests/language-feature/modules/module-name.slang b/tests/language-feature/modules/module-name.slang index 32e8c70d2..933435f7f 100644 --- a/tests/language-feature/modules/module-name.slang +++ b/tests/language-feature/modules/module-name.slang @@ -1,5 +1,6 @@ //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -output-using-type //TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -output-using-type +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu -shaderobj -output-using-type // Test that decls with the same name as the module are allowed. |
