glslang/Test/baseResults/hlsl.type.half.frag.out
steve-lunarg 5ca85ad9de HLSL: allow scalar type keywords as identifiers, and add half type support.
HLSL allows type keywords to also be identifiers, so a sequence such as "float half = 3" is
valid, or more bizzarely, something like "float.float = int.uint + bool;"

There are places this is not supported.  E.g, it's permitted for struct members, but not struct
names or functions.  Also, vector or matrix types such as "float3" are not permitted as
identifiers.

This PR adds that support, as well as support for the "half" type.  In production shaders,
this was seen with variables named "half".  The PR attempts to support this without breaking
useful grammar errors such as "; expected" at the end of unterminated statements, so it errs
on that side at the possible expense of failing to accept valid constructs containing a type
keyword identifier.  If others are discovered, they can be added.

Also, half is now accepted as a valid type, alongside the min*float types.
2016-12-27 11:26:45 -07:00

162 lines
6.3 KiB
Plaintext

hlsl.type.half.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:3 Function Definition: main( (temp 4-component vector of float)
0:3 Function Parameters:
0:? Sequence
0:4 Sequence
0:4 move second child to first child (temp mediump float)
0:4 'h0' (temp mediump float)
0:4 Constant:
0:4 0.000000
0:5 Sequence
0:5 move second child to first child (temp mediump 1-component vector of float)
0:5 'h1' (temp mediump 1-component vector of float)
0:5 Constant:
0:5 1.000000
0:6 Sequence
0:6 move second child to first child (temp mediump 2-component vector of float)
0:6 'h2' (temp mediump 2-component vector of float)
0:6 Constant:
0:6 2.000000
0:6 2.000000
0:7 Sequence
0:7 move second child to first child (temp mediump 3-component vector of float)
0:7 'h3' (temp mediump 3-component vector of float)
0:7 Constant:
0:7 3.000000
0:7 3.000000
0:7 3.000000
0:8 Sequence
0:8 move second child to first child (temp mediump 4-component vector of float)
0:8 'h4' (temp mediump 4-component vector of float)
0:8 Constant:
0:8 4.000000
0:8 4.000000
0:8 4.000000
0:8 4.000000
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:10 Constant:
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:10 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:3 Function Definition: main( (temp 4-component vector of float)
0:3 Function Parameters:
0:? Sequence
0:4 Sequence
0:4 move second child to first child (temp mediump float)
0:4 'h0' (temp mediump float)
0:4 Constant:
0:4 0.000000
0:5 Sequence
0:5 move second child to first child (temp mediump 1-component vector of float)
0:5 'h1' (temp mediump 1-component vector of float)
0:5 Constant:
0:5 1.000000
0:6 Sequence
0:6 move second child to first child (temp mediump 2-component vector of float)
0:6 'h2' (temp mediump 2-component vector of float)
0:6 Constant:
0:6 2.000000
0:6 2.000000
0:7 Sequence
0:7 move second child to first child (temp mediump 3-component vector of float)
0:7 'h3' (temp mediump 3-component vector of float)
0:7 Constant:
0:7 3.000000
0:7 3.000000
0:7 3.000000
0:8 Sequence
0:8 move second child to first child (temp mediump 4-component vector of float)
0:8 'h4' (temp mediump 4-component vector of float)
0:8 Constant:
0:8 4.000000
0:8 4.000000
0:8 4.000000
0:8 4.000000
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:10 Constant:
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:10 0.000000
0:10 Branch: Return
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 31
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 28
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 8 "h0"
Name 10 "h1"
Name 14 "h2"
Name 19 "h3"
Name 24 "h4"
Name 28 "@entryPointOutput"
Decorate 8(h0) RelaxedPrecision
Decorate 10(h1) RelaxedPrecision
Decorate 14(h2) RelaxedPrecision
Decorate 19(h3) RelaxedPrecision
Decorate 24(h4) RelaxedPrecision
Decorate 28(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Function 6(float)
9: 6(float) Constant 0
11: 6(float) Constant 1065353216
12: TypeVector 6(float) 2
13: TypePointer Function 12(fvec2)
15: 6(float) Constant 1073741824
16: 12(fvec2) ConstantComposite 15 15
17: TypeVector 6(float) 3
18: TypePointer Function 17(fvec3)
20: 6(float) Constant 1077936128
21: 17(fvec3) ConstantComposite 20 20 20
22: TypeVector 6(float) 4
23: TypePointer Function 22(fvec4)
25: 6(float) Constant 1082130432
26: 22(fvec4) ConstantComposite 25 25 25 25
27: TypePointer Output 22(fvec4)
28(@entryPointOutput): 27(ptr) Variable Output
29: 22(fvec4) ConstantComposite 9 9 9 9
4(main): 2 Function None 3
5: Label
8(h0): 7(ptr) Variable Function
10(h1): 7(ptr) Variable Function
14(h2): 13(ptr) Variable Function
19(h3): 18(ptr) Variable Function
24(h4): 23(ptr) Variable Function
Store 8(h0) 9
Store 10(h1) 11
Store 14(h2) 16
Store 19(h3) 21
Store 24(h4) 26
Store 28(@entryPointOutput) 29
Return
FunctionEnd