HLSL: Accept basic funtion definitions. (Not yet mapping input/output for entry point.)

This commit is contained in:
John Kessenich
2016-03-13 17:58:25 -06:00
parent 48882ef5a8
commit 5f934b039a
4 changed files with 240 additions and 76 deletions

View File

@@ -2,23 +2,23 @@ hlsl.frag
Shader version: 100
gl_FragCoord origin is upper left
0:? Sequence
0:5 move second child to first child (temp 4-component vector of float)
0:5 'AmbientColor' (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:6 move second child to first child (temp float)
0:6 'AmbientIntensity' (temp float)
0:6 Constant:
0:6 0.100000
0:8 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 'input' (temp 4-component vector of float)
0:6 'AmbientColor' (temp 4-component vector of float)
0:? Linker Objects
0:? 'World' (temp 4X4 matrix of float)
0:? 'View' (temp 4X4 matrix of float)
0:? 'Projection' (temp 4X4 matrix of float)
0:? 'AmbientColor' (temp 4-component vector of float)
0:? 'AmbientIntensity' (temp float)
Linked fragment stage:
@@ -27,27 +27,27 @@ Linked fragment stage:
Shader version: 100
gl_FragCoord origin is upper left
0:? Sequence
0:5 move second child to first child (temp 4-component vector of float)
0:5 'AmbientColor' (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:6 move second child to first child (temp float)
0:6 'AmbientIntensity' (temp float)
0:6 Constant:
0:6 0.100000
0:8 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 'input' (temp 4-component vector of float)
0:6 'AmbientColor' (temp 4-component vector of float)
0:? Linker Objects
0:? 'World' (temp 4X4 matrix of float)
0:? 'View' (temp 4X4 matrix of float)
0:? 'Projection' (temp 4X4 matrix of float)
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 17
// Id's are bound by 15
Capability Shader
1: ExtInstImport "GLSL.std.450"
@@ -56,24 +56,19 @@ gl_FragCoord origin is upper left
ExecutionMode 4 OriginUpperLeft
Source HLSL 100
Name 4 "PixelShaderFunction"
Name 10 "World"
Name 11 "View"
Name 12 "Projection"
Name 14 "AmbientColor"
Name 16 "AmbientIntensity"
Name 9 "input"
Name 11 "AmbientColor"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeMatrix 7(fvec4) 4
9: TypePointer Function 8
13: TypePointer Function 7(fvec4)
15: TypePointer Function 6(float)
8: TypePointer Function 7(fvec4)
4(PixelShaderFunction): 2 Function None 3
5: Label
10(World): 9(ptr) Variable Function
11(View): 9(ptr) Variable Function
12(Projection): 9(ptr) Variable Function
14(AmbientColor): 13(ptr) Variable Function
16(AmbientIntensity): 15(ptr) Variable Function
9(input): 8(ptr) Variable Function
11(AmbientColor): 8(ptr) Variable Function
10: 7(fvec4) Load 9(input)
12: 7(fvec4) Load 11(AmbientColor)
13: 7(fvec4) FAdd 10 12
ReturnValue 13
FunctionEnd

View File

@@ -1,11 +1,7 @@
float4x4 World;
float4x4 View;
float4x4 Projection;
float4 AmbientColor = float4(1, 0.5, 0, 1);
float AmbientIntensity = 0.1;
//float AmbientIntensity = 0.1;
//float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
//{
// return AmbientColor * AmbientIntensity;
//}
float4 PixelShaderFunction(float4 input) : COLOR0
{
return input /* * AmbientIntensity */ + AmbientColor;
}