HLSL: Add function call syntax and AST building.

This commit is contained in:
John Kessenich
2016-05-13 09:33:42 -06:00
parent 9db3117e38
commit 4678ca9dac
6 changed files with 83 additions and 25 deletions

View File

@@ -2,10 +2,27 @@ hlsl.frag
Shader version: 100
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float)
0:1 move second child to first child (temp 4-component vector of float)
0:1 'AmbientColor' (temp 4-component vector of float)
0:? Constant:
0:? 1.000000
0:? 0.500000
0:? 0.000000
0:? 1.000000
0:2 move second child to first child (temp float)
0:2 'AmbientIntensity' (temp float)
0:2 Constant:
0:2 0.100000
0:13 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float)
0:5 Function Parameters:
0:5 'input' (temp 4-component vector of float)
0:? Sequence
0:6 Branch: Return with expression
0:6 add (temp 4-component vector of float)
0:6 vector-scale (temp 4-component vector of float)
0:6 'input' (temp 4-component vector of float)
0:6 'AmbientIntensity' (temp float)
0:6 'AmbientColor' (temp 4-component vector of float)
0:7 Branch: Return with expression
0:7 add (temp 4-component vector of float)
0:7 component-wise multiply (temp 4-component vector of float)
@@ -36,7 +53,12 @@ gl_FragCoord origin is upper left
0:10 'input' (temp 4-component vector of float)
0:10 Pre-Increment (temp 4-component vector of float)
0:10 'input' (temp 4-component vector of float)
0:11 Branch: Return with expression
0:11 sine (global 4-component vector of float)
0:11 'input' (temp 4-component vector of float)
0:? Linker Objects
0:? 'AmbientColor' (temp 4-component vector of float)
0:? 'AmbientIntensity' (temp float)
Linked fragment stage:
@@ -45,10 +67,27 @@ Linked fragment stage:
Shader version: 100
gl_FragCoord origin is upper left
0:? Sequence
0:12 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float)
0:1 move second child to first child (temp 4-component vector of float)
0:1 'AmbientColor' (temp 4-component vector of float)
0:? Constant:
0:? 1.000000
0:? 0.500000
0:? 0.000000
0:? 1.000000
0:2 move second child to first child (temp float)
0:2 'AmbientIntensity' (temp float)
0:2 Constant:
0:2 0.100000
0:13 Function Definition: PixelShaderFunction(vf4; (temp 4-component vector of float)
0:5 Function Parameters:
0:5 'input' (temp 4-component vector of float)
0:? Sequence
0:6 Branch: Return with expression
0:6 add (temp 4-component vector of float)
0:6 vector-scale (temp 4-component vector of float)
0:6 'input' (temp 4-component vector of float)
0:6 'AmbientIntensity' (temp float)
0:6 'AmbientColor' (temp 4-component vector of float)
0:7 Branch: Return with expression
0:7 add (temp 4-component vector of float)
0:7 component-wise multiply (temp 4-component vector of float)
@@ -79,11 +118,16 @@ gl_FragCoord origin is upper left
0:10 'input' (temp 4-component vector of float)
0:10 Pre-Increment (temp 4-component vector of float)
0:10 'input' (temp 4-component vector of float)
0:11 Branch: Return with expression
0:11 sine (global 4-component vector of float)
0:11 'input' (temp 4-component vector of float)
0:? Linker Objects
0:? 'AmbientColor' (temp 4-component vector of float)
0:? 'AmbientIntensity' (temp float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 45
// Id's are bound by 57
Capability Shader
1: ExtInstImport "GLSL.std.450"
@@ -93,21 +137,24 @@ gl_FragCoord origin is upper left
Source HLSL 100
Name 4 "PixelShaderFunction"
Name 9 "input"
Name 12 "AmbientIntensity"
Name 15 "AmbientColor"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
27: 6(float) Constant 1065353216
11: TypePointer Function 6(float)
36: 6(float) Constant 1065353216
4(PixelShaderFunction): 2 Function None 3
5: Label
9(input): 8(ptr) Variable Function
12(AmbientIntensity): 11(ptr) Variable Function
15(AmbientColor): 8(ptr) Variable Function
10: 7(fvec4) Load 9(input)
11: 7(fvec4) Load 9(input)
12: 7(fvec4) FMul 10 11
13: 7(fvec4) Load 9(input)
14: 7(fvec4) Load 9(input)
15: 7(fvec4) FMul 13 14
16: 7(fvec4) FAdd 12 15
ReturnValue 16
13: 6(float) Load 12(AmbientIntensity)
14: 7(fvec4) VectorTimesScalar 10 13
16: 7(fvec4) Load 15(AmbientColor)
17: 7(fvec4) FAdd 14 16
ReturnValue 17
FunctionEnd