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
2de32911
Commit
2de32911
authored
Jul 28, 2016
by
steve-lunarg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: allow uint literals, and add test for numeric suffixes
parent
414f7354
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
205 additions
and
1 deletion
+205
-1
hlsl.numericsuffixes.frag.out
Test/baseResults/hlsl.numericsuffixes.frag.out
+181
-0
hlsl.numericsuffixes.frag
Test/hlsl.numericsuffixes.frag
+20
-0
Hlsl.FromFile.cpp
gtests/Hlsl.FromFile.cpp
+1
-0
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+3
-0
hlslParseHelper.h
hlsl/hlslParseHelper.h
+0
-1
No files found.
Test/baseResults/hlsl.numericsuffixes.frag.out
0 → 100644
View file @
2de32911
hlsl.numericsuffixes.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:21 Function Definition: main( (global structure{temp 4-component vector of float color})
0:5 Function Parameters:
0:? Sequence
0:7 Sequence
0:7 move second child to first child (temp float)
0:7 'r00' (temp float)
0:7 Constant:
0:7 1.000000
0:8 Sequence
0:8 move second child to first child (temp uint)
0:8 'r01' (temp uint)
0:8 Constant:
0:8 1 (const uint)
0:9 Sequence
0:9 move second child to first child (temp uint)
0:9 'r02' (temp uint)
0:9 Constant:
0:9 2 (const uint)
0:10 Sequence
0:10 move second child to first child (temp uint)
0:10 'r03' (temp uint)
0:10 Constant:
0:10 2748 (const uint)
0:11 Sequence
0:11 move second child to first child (temp uint)
0:11 'r04' (temp uint)
0:11 Constant:
0:11 2748 (const uint)
0:12 Sequence
0:12 move second child to first child (temp int)
0:12 'r05' (temp int)
0:12 Constant:
0:12 5 (const int)
0:13 Sequence
0:13 move second child to first child (temp int)
0:13 'r06' (temp int)
0:13 Constant:
0:13 6 (const int)
0:14 Sequence
0:14 move second child to first child (temp int)
0:14 'r07' (temp int)
0:14 Constant:
0:14 57 (const int)
0:15 Sequence
0:15 move second child to first child (temp uint)
0:15 'r08' (temp uint)
0:15 Constant:
0:15 58 (const uint)
0:19 Branch: Return with expression
0:19 '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:21 Function Definition: main( (global structure{temp 4-component vector of float color})
0:5 Function Parameters:
0:? Sequence
0:7 Sequence
0:7 move second child to first child (temp float)
0:7 'r00' (temp float)
0:7 Constant:
0:7 1.000000
0:8 Sequence
0:8 move second child to first child (temp uint)
0:8 'r01' (temp uint)
0:8 Constant:
0:8 1 (const uint)
0:9 Sequence
0:9 move second child to first child (temp uint)
0:9 'r02' (temp uint)
0:9 Constant:
0:9 2 (const uint)
0:10 Sequence
0:10 move second child to first child (temp uint)
0:10 'r03' (temp uint)
0:10 Constant:
0:10 2748 (const uint)
0:11 Sequence
0:11 move second child to first child (temp uint)
0:11 'r04' (temp uint)
0:11 Constant:
0:11 2748 (const uint)
0:12 Sequence
0:12 move second child to first child (temp int)
0:12 'r05' (temp int)
0:12 Constant:
0:12 5 (const int)
0:13 Sequence
0:13 move second child to first child (temp int)
0:13 'r06' (temp int)
0:13 Constant:
0:13 6 (const int)
0:14 Sequence
0:14 move second child to first child (temp int)
0:14 'r07' (temp int)
0:14 Constant:
0:14 57 (const int)
0:15 Sequence
0:15 move second child to first child (temp uint)
0:15 'r08' (temp uint)
0:15 Constant:
0:15 58 (const uint)
0:19 Branch: Return with expression
0:19 '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 35
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source HLSL 450
Name 4 "main"
Name 8 "r00"
Name 12 "r01"
Name 14 "r02"
Name 16 "r03"
Name 18 "r04"
Name 21 "r05"
Name 23 "r06"
Name 25 "r07"
Name 27 "r08"
Name 30 "PS_OUTPUT"
MemberName 30(PS_OUTPUT) 0 "color"
Name 32 "ps_output"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Function 6(float)
9: 6(float) Constant 1065353216
10: TypeInt 32 0
11: TypePointer Function 10(int)
13: 10(int) Constant 1
15: 10(int) Constant 2
17: 10(int) Constant 2748
19: TypeInt 32 1
20: TypePointer Function 19(int)
22: 19(int) Constant 5
24: 19(int) Constant 6
26: 19(int) Constant 57
28: 10(int) Constant 58
29: TypeVector 6(float) 4
30(PS_OUTPUT): TypeStruct 29(fvec4)
31: TypePointer Function 30(PS_OUTPUT)
4(main): 2 Function None 3
5: Label
8(r00): 7(ptr) Variable Function
12(r01): 11(ptr) Variable Function
14(r02): 11(ptr) Variable Function
16(r03): 11(ptr) Variable Function
18(r04): 11(ptr) Variable Function
21(r05): 20(ptr) Variable Function
23(r06): 20(ptr) Variable Function
25(r07): 20(ptr) Variable Function
27(r08): 11(ptr) Variable Function
32(ps_output): 31(ptr) Variable Function
Store 8(r00) 9
Store 12(r01) 13
Store 14(r02) 15
Store 16(r03) 17
Store 18(r04) 17
Store 21(r05) 22
Store 23(r06) 24
Store 25(r07) 26
Store 27(r08) 28
33:30(PS_OUTPUT) Load 32(ps_output)
ReturnValue 33
FunctionEnd
Test/hlsl.numericsuffixes.frag
0 → 100644
View file @
2de32911
struct
PS_OUTPUT
{
float4
color
:
SV_Target0
;
};
PS_OUTPUT
main
()
{
// Test numeric suffixes
float
r00
=
1
.
0
f
;
// float
uint
r01
=
1u
;
// lower uint
uint
r02
=
2U
;
// upper uint
uint
r03
=
0xabcu
;
// lower hex uint
uint
r04
=
0xABCU
;
// upper hex uint (upper 0X is not accepted)
int
r05
=
5l
;
// lower long int
int
r06
=
6L
;
// upper long int
int
r07
=
071
;
// octal
uint
r08
=
072u
;
// unsigned octal
PS_OUTPUT
ps_output
;
ps_output
.
color
=
r07
;
// gets 71 octal = 57 decimal
return
ps_output
;
}
gtests/Hlsl.FromFile.cpp
View file @
2de32911
...
...
@@ -112,6 +112,7 @@ INSTANTIATE_TEST_CASE_P(
{
"hlsl.load.basic.dx10.vert"
,
"main"
},
{
"hlsl.load.offset.dx10.frag"
,
"main"
},
{
"hlsl.load.offsetarray.dx10.frag"
,
"main"
},
{
"hlsl.numericsuffixes.frag"
,
"main"
},
{
"hlsl.pp.line.frag"
,
"main"
},
{
"hlsl.sample.array.dx10.frag"
,
"main"
},
{
"hlsl.sample.basic.dx10.frag"
,
"main"
},
...
...
hlsl/hlslGrammar.cpp
View file @
2de32911
...
...
@@ -1960,6 +1960,9 @@ bool HlslGrammar::acceptLiteral(TIntermTyped*& node)
case
EHTokIntConstant
:
node
=
intermediate
.
addConstantUnion
(
token
.
i
,
token
.
loc
,
true
);
break
;
case
EHTokUintConstant
:
node
=
intermediate
.
addConstantUnion
(
token
.
u
,
token
.
loc
,
true
);
break
;
case
EHTokFloatConstant
:
node
=
intermediate
.
addConstantUnion
(
token
.
d
,
EbtFloat
,
token
.
loc
,
true
);
break
;
...
...
hlsl/hlslParseHelper.h
View file @
2de32911
...
...
@@ -51,7 +51,6 @@ public:
void
setLimits
(
const
TBuiltInResource
&
);
bool
parseShaderStrings
(
TPpContext
&
,
TInputScanner
&
input
,
bool
versionWillBeError
=
false
);
void
getPreamble
(
std
::
string
&
);
void
C_DECL
error
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...);
...
...
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