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
cb88de5e
Commit
cb88de5e
authored
Aug 03, 2016
by
steve-lunarg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: allow semicolons between global scope declarations.
parent
f6640761
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
0 deletions
+121
-0
hlsl.semicolons.frag.out
Test/baseResults/hlsl.semicolons.frag.out
+96
-0
hlsl.semicolons.frag
Test/hlsl.semicolons.frag
+19
-0
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+1
-0
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+5
-0
No files found.
Test/baseResults/hlsl.semicolons.frag.out
0 → 100644
View file @
cb88de5e
hlsl.semicolons.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:4 Function Definition: MyFunc( (global void)
0:2 Function Parameters:
0:8 Function Definition: MyFunc2( (global void)
0:8 Function Parameters:
0:18 Function Definition: main( (global structure{temp 4-component vector of float color})
0:13 Function Parameters:
0:? Sequence
0:16 move second child to first child (temp 4-component vector of float)
0:16 color: direct index for structure (temp 4-component vector of float)
0:16 'ps_output' (temp structure{temp 4-component vector of float color})
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 1.000000
0:16 1.000000
0:16 1.000000
0:16 1.000000
0:17 Branch: Return with expression
0:17 'ps_output' (temp structure{temp 4-component vector of float color})
0:? Linker Objects
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:4 Function Definition: MyFunc( (global void)
0:2 Function Parameters:
0:8 Function Definition: MyFunc2( (global void)
0:8 Function Parameters:
0:18 Function Definition: main( (global structure{temp 4-component vector of float color})
0:13 Function Parameters:
0:? Sequence
0:16 move second child to first child (temp 4-component vector of float)
0:16 color: direct index for structure (temp 4-component vector of float)
0:16 'ps_output' (temp structure{temp 4-component vector of float color})
0:16 Constant:
0:16 0 (const int)
0:16 Constant:
0:16 1.000000
0:16 1.000000
0:16 1.000000
0:16 1.000000
0:17 Branch: Return with expression
0:17 'ps_output' (temp structure{temp 4-component vector of float color})
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 23
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source HLSL 450
Name 4 "main"
Name 6 "MyFunc("
Name 8 "MyFunc2("
Name 12 "PS_OUTPUT"
MemberName 12(PS_OUTPUT) 0 "color"
Name 14 "ps_output"
2: TypeVoid
3: TypeFunction 2
10: TypeFloat 32
11: TypeVector 10(float) 4
12(PS_OUTPUT): TypeStruct 11(fvec4)
13: TypePointer Function 12(PS_OUTPUT)
15: TypeInt 32 1
16: 15(int) Constant 0
17: 10(float) Constant 1065353216
18: 11(fvec4) ConstantComposite 17 17 17 17
19: TypePointer Function 11(fvec4)
4(main): 2 Function None 3
5: Label
14(ps_output): 13(ptr) Variable Function
20: 19(ptr) AccessChain 14(ps_output) 16
Store 20 18
21:12(PS_OUTPUT) Load 14(ps_output)
ReturnValue 21
FunctionEnd
6(MyFunc(): 2 Function None 3
7: Label
Return
FunctionEnd
8(MyFunc2(): 2 Function None 3
9: Label
Return
FunctionEnd
Test/hlsl.semicolons.frag
0 → 100644
View file @
cb88de5e
void
MyFunc
()
{
}
;;;
;
;
;
;
// HLSL allows stray global scope semicolons.
void
MyFunc2
()
{;;;};
struct
PS_OUTPUT
{
float4
color
:
SV_Target0
;
};;;;;
;
PS_OUTPUT
main
()
{
PS_OUTPUT
ps_output
;;;
;
ps_output
.
color
=
1
.
0
;
return
ps_output
;
};
gtests/Hlsl.FromFile.cpp
View file @
cb88de5e
...
@@ -143,6 +143,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -143,6 +143,7 @@ INSTANTIATE_TEST_CASE_P(
{
"hlsl.samplelevel.basic.dx10.vert"
,
"main"
},
{
"hlsl.samplelevel.basic.dx10.vert"
,
"main"
},
{
"hlsl.samplelevel.offset.dx10.frag"
,
"main"
},
{
"hlsl.samplelevel.offset.dx10.frag"
,
"main"
},
{
"hlsl.samplelevel.offsetarray.dx10.frag"
,
"main"
},
{
"hlsl.samplelevel.offsetarray.dx10.frag"
,
"main"
},
{
"hlsl.semicolons.frag"
,
"main"
},
{
"hlsl.shapeConv.frag"
,
"main"
},
{
"hlsl.shapeConv.frag"
,
"main"
},
{
"hlsl.intrinsics.vert"
,
"VertexShaderFunction"
},
{
"hlsl.intrinsics.vert"
,
"VertexShaderFunction"
},
{
"hlsl.matType.frag"
,
"PixelShaderFunction"
},
{
"hlsl.matType.frag"
,
"PixelShaderFunction"
},
...
...
hlsl/hlslGrammar.cpp
View file @
cb88de5e
...
@@ -89,12 +89,17 @@ bool HlslGrammar::acceptIdentifier(HlslToken& idToken)
...
@@ -89,12 +89,17 @@ bool HlslGrammar::acceptIdentifier(HlslToken& idToken)
// compilationUnit
// compilationUnit
// : list of externalDeclaration
// : list of externalDeclaration
// | SEMICOLONS
//
//
bool
HlslGrammar
::
acceptCompilationUnit
()
bool
HlslGrammar
::
acceptCompilationUnit
()
{
{
TIntermNode
*
unitNode
=
nullptr
;
TIntermNode
*
unitNode
=
nullptr
;
while
(
!
peekTokenClass
(
EHTokNone
))
{
while
(
!
peekTokenClass
(
EHTokNone
))
{
// HLSL allows semicolons between global declarations, e.g, between functions.
if
(
acceptTokenClass
(
EHTokSemicolon
))
continue
;
// externalDeclaration
// externalDeclaration
TIntermNode
*
declarationNode
;
TIntermNode
*
declarationNode
;
if
(
!
acceptDeclaration
(
declarationNode
))
if
(
!
acceptDeclaration
(
declarationNode
))
...
...
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