forked from KhronosGroup/SPIRV-Cross
-
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.
Merge pull request KhronosGroup#2215 from KhronosGroup/fix-2210
GLSL: Fix and workaround some awkward code patterns
- Loading branch information
Showing
8 changed files
with
137 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
struct Data | ||
{ | ||
uint arr[3]; | ||
}; | ||
|
||
static uint _34; | ||
|
||
RWByteAddressBuffer _13 : register(u0); | ||
|
||
void comp_main() | ||
{ | ||
uint _33[3] = { _34, _34, _34 }; | ||
[unroll] | ||
for (int _0ident = 0; _0ident < 3; _0ident++) | ||
{ | ||
_13.Store(_0ident * 4 + 0, _33[_0ident]); | ||
} | ||
} | ||
|
||
[numthreads(1, 1, 1)] | ||
void main() | ||
{ | ||
comp_main(); | ||
} |
13 changes: 13 additions & 0 deletions
13
reference/shaders-no-opt/asm/comp/block-undef.noeliminate.invalid.asm.comp
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,13 @@ | ||
#version 460 | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
|
||
struct FHitGroupRootConstants | ||
{ | ||
uint BaseInstanceIndex; | ||
uint UserData; | ||
}; | ||
|
||
void main() | ||
{ | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
reference/shaders-no-opt/asm/comp/empty-ubo-block.noeliminate.asm.comp
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,12 @@ | ||
#version 460 | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
|
||
layout(binding = 15, std140) uniform type_Primitive | ||
{ | ||
int empty_struct_member; | ||
} Primitive; | ||
|
||
void main() | ||
{ | ||
} | ||
|
34 changes: 34 additions & 0 deletions
34
shaders-no-opt/asm/comp/block-undef.noeliminate.invalid.asm.comp
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 @@ | ||
OpCapability Shader | ||
%1 = OpExtInstImport "GLSL.std.450" | ||
OpMemoryModel Logical GLSL450 | ||
OpEntryPoint GLCompute %main "main" | ||
OpExecutionMode %main LocalSize 1 1 1 | ||
OpSource GLSL 460 | ||
OpName %main "main" | ||
OpName %FHitGroupRootConstants "FHitGroupRootConstants" | ||
OpMemberName %FHitGroupRootConstants 0 "BaseInstanceIndex" | ||
OpMemberName %FHitGroupRootConstants 1 "UserData" | ||
OpName %type_StructuredBuffer_FHitGroupRootConstants "type_StructuredBuffer_FHitGroupRootConstants" | ||
OpMemberName %type_StructuredBuffer_FHitGroupRootConstants 0 "_m0" | ||
OpName %HitGroupData "HitGroupData" | ||
OpMemberDecorate %FHitGroupRootConstants 0 Offset 0 | ||
OpMemberDecorate %FHitGroupRootConstants 1 Offset 4 | ||
OpDecorate %_runtimearr_FHitGroupRootConstants ArrayStride 8 | ||
OpMemberDecorate %type_StructuredBuffer_FHitGroupRootConstants 0 NonWritable | ||
OpMemberDecorate %type_StructuredBuffer_FHitGroupRootConstants 0 Offset 0 | ||
OpDecorate %type_StructuredBuffer_FHitGroupRootConstants BufferBlock | ||
OpDecorate %HitGroupData DescriptorSet 0 | ||
OpDecorate %HitGroupData Binding 20 | ||
%void = OpTypeVoid | ||
%3 = OpTypeFunction %void | ||
%uint = OpTypeInt 32 0 | ||
%FHitGroupRootConstants = OpTypeStruct %uint %uint | ||
%_runtimearr_FHitGroupRootConstants = OpTypeRuntimeArray %FHitGroupRootConstants | ||
%type_StructuredBuffer_FHitGroupRootConstants = OpTypeStruct %_runtimearr_FHitGroupRootConstants | ||
%_ptr_StorageBuffer_type_StructuredBuffer_FHitGroupRootConstants = OpTypePointer StorageBuffer %type_StructuredBuffer_FHitGroupRootConstants | ||
%HitGroupData = OpVariable %_ptr_StorageBuffer_type_StructuredBuffer_FHitGroupRootConstants StorageBuffer | ||
%728 = OpUndef %_ptr_StorageBuffer_type_StructuredBuffer_FHitGroupRootConstants | ||
%main = OpFunction %void None %3 | ||
%5 = OpLabel | ||
OpReturn | ||
OpFunctionEnd |
21 changes: 21 additions & 0 deletions
21
shaders-no-opt/asm/comp/empty-ubo-block.noeliminate.asm.comp
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,21 @@ | ||
OpCapability Shader | ||
%1 = OpExtInstImport "GLSL.std.450" | ||
OpMemoryModel Logical GLSL450 | ||
OpEntryPoint GLCompute %main "main" | ||
OpExecutionMode %main LocalSize 1 1 1 | ||
OpSource GLSL 460 | ||
OpName %main "main" | ||
OpName %type_Primitive "type_Primitive" | ||
OpName %Primitive "Primitive" | ||
OpDecorate %type_Primitive Block | ||
OpDecorate %Primitive DescriptorSet 0 | ||
OpDecorate %Primitive Binding 15 | ||
%void = OpTypeVoid | ||
%3 = OpTypeFunction %void | ||
%type_Primitive = OpTypeStruct | ||
%_ptr_Uniform_type_Primitive = OpTypePointer Uniform %type_Primitive | ||
%Primitive = OpVariable %_ptr_Uniform_type_Primitive Uniform | ||
%main = OpFunction %void None %3 | ||
%5 = OpLabel | ||
OpReturn | ||
OpFunctionEnd |
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