Skip to content

Commit aa28f26

Browse files
authored
Support an Upper-case variant of [NumThreads] and [Shader] (shader-slang#4780)
Closes shader-slang#4746. This commit adds a support for "NumThreads" and "Shader" attribute keyword, which is in CamelCasing starting with an upper case letter. The attribute keywords in HLSL are case-insensitive. As an example, one of D3D documents says, "The attribute name "Shader" is case insensitive." https://microsoft.github.io/DirectX-Specs/d3d/WorkGraphs.html Slang, however, doesn't support the case-insensitivity. They should be all lower-case or CamelCasing starting with an upper case.
1 parent d72f9f6 commit aa28f26

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

source/slang/core.meta.slang

+6
Original file line numberDiff line numberDiff line change
@@ -2590,6 +2590,9 @@ attribute_syntax [call] : CallAttribute;
25902590
__attributeTarget(FuncDecl)
25912591
attribute_syntax [shader(stage)] : EntryPointAttribute;
25922592

2593+
__attributeTarget(FuncDecl)
2594+
attribute_syntax [Shader(stage)] : EntryPointAttribute;
2595+
25932596
// Hull Shader
25942597
__attributeTarget(FuncDecl)
25952598
attribute_syntax [maxtessfactor(factor: float)] : MaxTessFactorAttribute;
@@ -2625,6 +2628,9 @@ attribute_syntax [earlydepthstencil] : EarlyDepthStencilAttribute;
26252628
__attributeTarget(FuncDecl)
26262629
attribute_syntax [numthreads(x: int, y: int = 1, z: int = 1)] : NumThreadsAttribute;
26272630

2631+
__attributeTarget(FuncDecl)
2632+
attribute_syntax [NumThreads(x: int, y: int = 1, z: int = 1)] : NumThreadsAttribute;
2633+
26282634
__attributeTarget(FuncDecl)
26292635
attribute_syntax [WaveSize(numLanes: int)] : WaveSizeAttribute;
26302636

tests/compute/frem.slang

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ int test(int inVal)
1919
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
2020
RWStructuredBuffer<float> outputBuffer;
2121

22-
[numthreads(4, 1, 1)]
22+
[Shader("compute")]
23+
[NumThreads(4, 1, 1)]
2324
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
2425
{
2526
int tid = dispatchThreadID.x;

0 commit comments

Comments
 (0)