Full stack: distinguish between a scalar and a vector of size 1.
There have been GLSL extensions considering this, and HLSL does it. This is a fully backward compatible change that allows this distinction.
This commit is contained in:
100
Test/baseResults/hlsl.float1.frag.out
Executable file
100
Test/baseResults/hlsl.float1.frag.out
Executable file
@@ -0,0 +1,100 @@
|
||||
hlsl.float1.frag
|
||||
Shader version: 100
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:1 move second child to first child (temp 1-component vector of float)
|
||||
0:1 'f1' (temp 1-component vector of float)
|
||||
0:1 Constant:
|
||||
0:1 1.000000
|
||||
0:2 move second child to first child (temp float)
|
||||
0:2 'scalar' (temp float)
|
||||
0:2 Constant:
|
||||
0:2 2.000000
|
||||
0:8 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float)
|
||||
0:5 Function Parameters:
|
||||
0:5 'inFloat1' (temp 1-component vector of float)
|
||||
0:5 'inScalar' (temp float)
|
||||
0:? Sequence
|
||||
0:6 Branch: Return with expression
|
||||
0:6 add (temp 1-component vector of float)
|
||||
0:6 vector-scale (temp 1-component vector of float)
|
||||
0:6 'f1' (temp 1-component vector of float)
|
||||
0:6 'scalar' (temp float)
|
||||
0:6 vector-scale (temp 1-component vector of float)
|
||||
0:6 'inFloat1' (temp 1-component vector of float)
|
||||
0:6 'inScalar' (temp float)
|
||||
0:? Linker Objects
|
||||
0:? 'f1' (temp 1-component vector of float)
|
||||
0:? 'scalar' (temp float)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 100
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:1 move second child to first child (temp 1-component vector of float)
|
||||
0:1 'f1' (temp 1-component vector of float)
|
||||
0:1 Constant:
|
||||
0:1 1.000000
|
||||
0:2 move second child to first child (temp float)
|
||||
0:2 'scalar' (temp float)
|
||||
0:2 Constant:
|
||||
0:2 2.000000
|
||||
0:8 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float)
|
||||
0:5 Function Parameters:
|
||||
0:5 'inFloat1' (temp 1-component vector of float)
|
||||
0:5 'inScalar' (temp float)
|
||||
0:? Sequence
|
||||
0:6 Branch: Return with expression
|
||||
0:6 add (temp 1-component vector of float)
|
||||
0:6 vector-scale (temp 1-component vector of float)
|
||||
0:6 'f1' (temp 1-component vector of float)
|
||||
0:6 'scalar' (temp float)
|
||||
0:6 vector-scale (temp 1-component vector of float)
|
||||
0:6 'inFloat1' (temp 1-component vector of float)
|
||||
0:6 'inScalar' (temp float)
|
||||
0:? Linker Objects
|
||||
0:? 'f1' (temp 1-component vector of float)
|
||||
0:? 'scalar' (temp float)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 24
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction"
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source HLSL 100
|
||||
Name 4 "PixelShaderFunction"
|
||||
Name 11 "ShaderFunction(vf1;f1;"
|
||||
Name 9 "inFloat1"
|
||||
Name 10 "inScalar"
|
||||
Name 13 "f1"
|
||||
Name 15 "scalar"
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypePointer Function 6(float)
|
||||
8: TypeFunction 6(float) 7(ptr) 7(ptr)
|
||||
4(PixelShaderFunction): 2 Function None 3
|
||||
5: Label
|
||||
FunctionEnd
|
||||
11(ShaderFunction(vf1;f1;): 6(float) Function None 8
|
||||
9(inFloat1): 7(ptr) FunctionParameter
|
||||
10(inScalar): 7(ptr) FunctionParameter
|
||||
12: Label
|
||||
13(f1): 7(ptr) Variable Function
|
||||
15(scalar): 7(ptr) Variable Function
|
||||
14: 6(float) Load 13(f1)
|
||||
16: 6(float) Load 15(scalar)
|
||||
17: 6(float) IMul 14 16
|
||||
18: 6(float) Load 9(inFloat1)
|
||||
19: 6(float) Load 10(inScalar)
|
||||
20: 6(float) IMul 18 19
|
||||
21: 6(float) FAdd 17 20
|
||||
ReturnValue 21
|
||||
FunctionEnd
|
||||
7
Test/hlsl.float1.frag
Normal file
7
Test/hlsl.float1.frag
Normal file
@@ -0,0 +1,7 @@
|
||||
float1 f1 = float1(1.0);
|
||||
float scalar = 2.0;
|
||||
|
||||
float1 ShaderFunction(float1 inFloat1, float inScalar) : COLOR0
|
||||
{
|
||||
return f1 * scalar + inFloat1 * inScalar;
|
||||
}
|
||||
Reference in New Issue
Block a user