forked from KhronosGroup/glslang
-
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.
Fix an issue of spirv_type used in local variable definitions
We previously use createOp() in SPV builder to create type declaration. However, all type declarations should be placed in const-type-variable declaration section. And duplicated type defintions ought to be avoided. We now make a method in SPV builder to perform this operation with a more general solution: makeGenericType().
- Loading branch information
Showing
7 changed files
with
103 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
spv.intrinsicsSpirvTypeLocalVar.vert | ||
// Module Version 10000 | ||
// Generated by (magic number): 8000a | ||
// Id's are bound by 22 | ||
|
||
Capability Shader | ||
1: ExtInstImport "GLSL.std.450" | ||
MemoryModel Logical GLSL450 | ||
EntryPoint Vertex 4 "main" | ||
Source GLSL 460 | ||
SourceExtension "GL_EXT_spirv_intrinsics" | ||
Name 4 "main" | ||
Name 10 "func(spv-t1;" | ||
Name 9 "emptyStruct" | ||
Name 13 "size" | ||
Name 16 "dummy" | ||
Name 18 "param" | ||
Decorate 13(size) SpecId 9 | ||
2: TypeVoid | ||
3: TypeFunction 2 | ||
6: TypeStruct | ||
7: TypePointer Function 6(struct) | ||
8: TypeFunction 2 7(ptr) | ||
12: TypeInt 32 1 | ||
13(size): 12(int) SpecConstant 9 | ||
14: TypeArray 6(struct) 13(size) | ||
15: TypePointer Function 14 | ||
17: 12(int) Constant 1 | ||
4(main): 2 Function None 3 | ||
5: Label | ||
16(dummy): 15(ptr) Variable Function | ||
18(param): 7(ptr) Variable Function | ||
19: 7(ptr) AccessChain 16(dummy) 17 | ||
20: 6(struct) Load 19 | ||
Store 18(param) 20 | ||
21: 2 FunctionCall 10(func(spv-t1;) 18(param) | ||
Return | ||
FunctionEnd | ||
10(func(spv-t1;): 2 Function None 8 | ||
9(emptyStruct): 7(ptr) FunctionParameter | ||
11: Label | ||
Return | ||
FunctionEnd |
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,14 @@ | ||
#version 460 core | ||
|
||
#extension GL_EXT_spirv_intrinsics: enable | ||
|
||
layout(constant_id = 9) const int size = 9; | ||
|
||
#define EmptyStruct spirv_type(id = 30) | ||
void func(EmptyStruct emptyStruct) {} | ||
|
||
void main() | ||
{ | ||
EmptyStruct dummy[size]; | ||
func(dummy[1]); | ||
} |
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