Skip to content

Commit e3c1454

Browse files
committed
Detect entrypoint more robustly when applying ConstRef hack during lowring
For shaders like tests/compute/simple.slang, which have a 'numthreads' attribute but no 'shader' attribute, the old compile request API would add an EntryPointAttribute to the AST node of the entry point. However, the new API doesn't, and so a certain ConstRef hack doesn't get applied when using the new API, leading to subsequent code generation issues. This patch also checks for a 'numthreads' attribute when deciding whether to apply the ConstRef hack. This closes issue #6507 and helps to resolve issue #4760.
1 parent a626034 commit e3c1454

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

source/slang/slang-lower-to-ir.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -3214,7 +3214,8 @@ void collectParameterLists(
32143214
// For now we will rely on a follow up pass to remove unnecessary temporary variables if
32153215
// we can determine that they are never actually writtten to by the user.
32163216
//
3217-
bool lowerVaryingInputAsConstRef = declRef.getDecl()->hasModifier<EntryPointAttribute>();
3217+
bool lowerVaryingInputAsConstRef = declRef.getDecl()->hasModifier<EntryPointAttribute>() ||
3218+
declRef.getDecl()->hasModifier<NumThreadsAttribute>();
32183219

32193220
// Don't collect parameters from the outer scope if
32203221
// we are in a `static` context.

0 commit comments

Comments
 (0)