forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix global value inlining for spirv_asm blocks. (shader-slang#4339)
- Loading branch information
Showing
3 changed files
with
199 additions
and
122 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//TEST:SIMPLE(filecheck=CHECK): -target spirv | ||
|
||
// Test that we can use intrinsics in global scope constant array, which causes | ||
// the spirv_asm to be inlined in global module scope. | ||
// Our global value inlining pass should be able to clean up the global scope spirv_asm | ||
// blocks and inlining them to use sites. | ||
|
||
// CHECK: %main = OpFunction | ||
// CHECK: OpStore | ||
|
||
static const uint staticArr[] = { | ||
uint((((uint)round(saturate(1) * 255) << 24) | ((uint)round(saturate(0) * 255) << 16) | ((uint)round(saturate(0) * 255) << 8) | 0xff)), | ||
uint((((uint)round(saturate(1) * 255) << 24) | ((uint)round(saturate(0) * 255) << 16) | ((uint)round(saturate(1) * 255) << 8) | 0xff)) | ||
}; | ||
|
||
RWStructuredBuffer<int> buffer; | ||
|
||
[numthreads(1,1,1)] | ||
void main(int i : SV_DispatchThreadID) | ||
{ | ||
buffer[0] = staticArr[i] + staticArr[1]; | ||
} |