Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
c0043cda
Commit
c0043cda
authored
Apr 27, 2017
by
steve-lunarg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Allow empty struct initializers
Review request: does this harm GLSL in any way?
parent
7cca1409
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
6 deletions
+121
-6
hlsl.emptystruct.init.vert.out
Test/baseResults/hlsl.emptystruct.init.vert.out
+112
-0
hlsl.emptystruct.init.vert
Test/hlsl.emptystruct.init.vert
+8
-0
parseConst.cpp
glslang/MachineIndependent/parseConst.cpp
+0
-6
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+1
-0
No files found.
Test/baseResults/hlsl.emptystruct.init.vert.out
0 → 100644
View file @
c0043cda
hlsl.emptystruct.init.vert
WARNING: 0:3: 'Test_Empty' : variable with qualifier 'const' not initialized; zero initializing
Shader version: 500
0:? Sequence
0:6 Function Definition: @main(u1; ( temp 4-component vector of float)
0:6 Function Parameters:
0:6 'vertexIndex' ( in uint)
0:? Sequence
0:7 Branch: Return with expression
0:7 Constant:
0:7 0.000000
0:7 0.000000
0:7 0.000000
0:7 0.000000
0:6 Function Definition: main( ( temp void)
0:6 Function Parameters:
0:? Sequence
0:6 move second child to first child ( temp uint)
0:? 'vertexIndex' ( temp uint)
0:? 'vertexIndex' (layout( location=0) in uint)
0:6 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:6 Function Call: @main(u1; ( temp 4-component vector of float)
0:? 'vertexIndex' ( temp uint)
0:? Linker Objects
0:? 'Test_Empty' ( const structure{})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'vertexIndex' (layout( location=0) in uint)
Linked vertex stage:
Shader version: 500
0:? Sequence
0:6 Function Definition: @main(u1; ( temp 4-component vector of float)
0:6 Function Parameters:
0:6 'vertexIndex' ( in uint)
0:? Sequence
0:7 Branch: Return with expression
0:7 Constant:
0:7 0.000000
0:7 0.000000
0:7 0.000000
0:7 0.000000
0:6 Function Definition: main( ( temp void)
0:6 Function Parameters:
0:? Sequence
0:6 move second child to first child ( temp uint)
0:? 'vertexIndex' ( temp uint)
0:? 'vertexIndex' (layout( location=0) in uint)
0:6 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:6 Function Call: @main(u1; ( temp 4-component vector of float)
0:? 'vertexIndex' ( temp uint)
0:? Linker Objects
0:? 'Test_Empty' ( const structure{})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'vertexIndex' (layout( location=0) in uint)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 29
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 20 23
Source HLSL 500
Name 4 "main"
Name 12 "@main(u1;"
Name 11 "vertexIndex"
Name 18 "vertexIndex"
Name 20 "vertexIndex"
Name 23 "@entryPointOutput"
Name 24 "param"
Name 27 "Test"
Decorate 20(vertexIndex) Location 0
Decorate 23(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
8: TypeFloat 32
9: TypeVector 8(float) 4
10: TypeFunction 9(fvec4) 7(ptr)
14: 8(float) Constant 0
15: 9(fvec4) ConstantComposite 14 14 14 14
19: TypePointer Input 6(int)
20(vertexIndex): 19(ptr) Variable Input
22: TypePointer Output 9(fvec4)
23(@entryPointOutput): 22(ptr) Variable Output
27(Test): TypeStruct
28: 27(Test) ConstantComposite
4(main): 2 Function None 3
5: Label
18(vertexIndex): 7(ptr) Variable Function
24(param): 7(ptr) Variable Function
21: 6(int) Load 20(vertexIndex)
Store 18(vertexIndex) 21
25: 6(int) Load 18(vertexIndex)
Store 24(param) 25
26: 9(fvec4) FunctionCall 12(@main(u1;) 24(param)
Store 23(@entryPointOutput) 26
Return
FunctionEnd
12(@main(u1;): 9(fvec4) Function None 10
11(vertexIndex): 7(ptr) FunctionParameter
13: Label
ReturnValue 15
FunctionEnd
Test/hlsl.emptystruct.init.vert
0 → 100644
View file @
c0043cda
struct
Test
{
};
static
const
Test
Test_Empty
;
float4
main
(
in
uint
vertexIndex
:
VERTEXID
)
:
VS_OUT_POSITION
{
return
0
;
}
glslang/MachineIndependent/parseConst.cpp
View file @
c0043cda
...
...
@@ -76,12 +76,6 @@ bool TConstTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node)
return
false
;
}
if
(
node
->
getSequence
().
size
()
==
0
)
{
error
=
true
;
return
false
;
}
bool
flag
=
node
->
getSequence
().
size
()
==
1
&&
node
->
getSequence
()[
0
]
->
getAsTyped
()
->
getAsConstantUnion
();
if
(
flag
)
{
singleConstantParam
=
true
;
...
...
gtests/Hlsl.FromFile.cpp
View file @
c0043cda
...
...
@@ -106,6 +106,7 @@ INSTANTIATE_TEST_CASE_P(
{
"hlsl.doLoop.frag"
,
"PixelShaderFunction"
},
{
"hlsl.emptystructreturn.frag"
,
"main"
},
{
"hlsl.emptystructreturn.vert"
,
"main"
},
{
"hlsl.emptystruct.init.vert"
,
"main"
},
{
"hlsl.entry-in.frag"
,
"PixelShaderFunction"
},
{
"hlsl.entry-out.frag"
,
"PixelShaderFunction"
},
{
"hlsl.float1.frag"
,
"PixelShaderFunction"
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment