forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make a few additions/changes to init list logic:
1. allow a more formalized init-list logic for flattened init-lists's 2. fixing invalid tests
- Loading branch information
Showing
13 changed files
with
147 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
tests/language-feature/initializer-lists/dont-allow-cstyle-init-list-1.slang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//TEST:SIMPLE(filecheck=ERROR): -target hlsl -entry computeMain -stage compute | ||
|
||
public struct Test | ||
{ | ||
// note: we need an initExpr here for an error because else Slang will disallow | ||
// synthisis of a 'public' constructor, meaning nothing has to fail. | ||
internal uint a = 5; | ||
public uint b; | ||
}; | ||
|
||
|
||
//ERROR: error 30500 | ||
|
||
RWStructuredBuffer<uint> outputBuffer; | ||
|
||
[numthreads(1, 1, 1)] | ||
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) | ||
{ | ||
Test test[3] = {1, 2, 3, 4, 5, 6}; | ||
|
||
outputBuffer[0] = true | ||
&& test[0].a == 1 | ||
&& test[0].b == 2 | ||
|
||
&& test[1].a == 1 | ||
&& test[1].b == 2 | ||
|
||
&& test[2].a == 1 | ||
&& test[2].b == 2 | ||
; | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/language-feature/initializer-lists/dont-allow-cstyle-init-list-2.slang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//TEST:SIMPLE(filecheck=ERROR): -target hlsl -entry computeMain -stage compute | ||
|
||
struct Test | ||
{ | ||
uint a; | ||
uint b; | ||
__init(int a_in, int b_in) | ||
{ | ||
a_in = 0; | ||
b_in = 0; | ||
} | ||
}; | ||
|
||
|
||
//ERROR: error 30500 | ||
|
||
RWStructuredBuffer<uint> outputBuffer; | ||
|
||
[numthreads(1, 1, 1)] | ||
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) | ||
{ | ||
Test test[3] = {1, 2, 3, 4, 5, 6}; | ||
|
||
outputBuffer[0] = true | ||
&& test[0].a == 1 | ||
&& test[0].b == 2 | ||
|
||
&& test[1].a == 1 | ||
&& test[1].b == 2 | ||
|
||
&& test[2].a == 1 | ||
&& test[2].b == 2 | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.