allow renaming of shader entry point when creating SPIR-V
Use "--source-entrypoint name" on the command line, or the TShader::setSourceEntryPoint(char*) API. When the name given to the above interfaces is detected in the shader source, it will be renamed to the entry point name supplied to the -e option or the TShader::setEntryPoint() method.
This commit is contained in:
119
Test/baseResults/hlsl.entry.rename.frag.out
Normal file
119
Test/baseResults/hlsl.entry.rename.frag.out
Normal file
@@ -0,0 +1,119 @@
|
||||
../Test/hlsl.entry.rename.frag
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:7 Function Definition: not_the_entry_point( (temp void)
|
||||
0:7 Function Parameters:
|
||||
0:11 Function Definition: main_in_spv( (temp structure{temp 4-component vector of float Color})
|
||||
0:11 Function Parameters:
|
||||
0:? Sequence
|
||||
0:13 move second child to first child (temp 4-component vector of float)
|
||||
0:13 Color: direct index for structure (temp 4-component vector of float)
|
||||
0:13 'psout' (temp structure{temp 4-component vector of float Color})
|
||||
0:13 Constant:
|
||||
0:13 0 (const int)
|
||||
0:13 Constant:
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:14 Sequence
|
||||
0:14 Sequence
|
||||
0:14 move second child to first child (temp 4-component vector of float)
|
||||
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
|
||||
0:14 Color: direct index for structure (temp 4-component vector of float)
|
||||
0:14 'psout' (temp structure{temp 4-component vector of float Color})
|
||||
0:14 Constant:
|
||||
0:14 0 (const int)
|
||||
0:14 Branch: Return
|
||||
0:? Linker Objects
|
||||
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
|
||||
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int also_not_the_entry_point})
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:7 Function Definition: not_the_entry_point( (temp void)
|
||||
0:7 Function Parameters:
|
||||
0:11 Function Definition: main_in_spv( (temp structure{temp 4-component vector of float Color})
|
||||
0:11 Function Parameters:
|
||||
0:? Sequence
|
||||
0:13 move second child to first child (temp 4-component vector of float)
|
||||
0:13 Color: direct index for structure (temp 4-component vector of float)
|
||||
0:13 'psout' (temp structure{temp 4-component vector of float Color})
|
||||
0:13 Constant:
|
||||
0:13 0 (const int)
|
||||
0:13 Constant:
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:13 0.000000
|
||||
0:14 Sequence
|
||||
0:14 Sequence
|
||||
0:14 move second child to first child (temp 4-component vector of float)
|
||||
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
|
||||
0:14 Color: direct index for structure (temp 4-component vector of float)
|
||||
0:14 'psout' (temp structure{temp 4-component vector of float Color})
|
||||
0:14 Constant:
|
||||
0:14 0 (const int)
|
||||
0:14 Branch: Return
|
||||
0:? Linker Objects
|
||||
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
|
||||
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int also_not_the_entry_point})
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 27
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main_in_spv" 20
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "main_in_spv"
|
||||
Name 6 "not_the_entry_point("
|
||||
Name 10 "PS_OUTPUT"
|
||||
MemberName 10(PS_OUTPUT) 0 "Color"
|
||||
Name 12 "psout"
|
||||
Name 20 "Color"
|
||||
Name 24 "$Global"
|
||||
MemberName 24($Global) 0 "also_not_the_entry_point"
|
||||
Name 26 ""
|
||||
Decorate 20(Color) Location 0
|
||||
MemberDecorate 24($Global) 0 Offset 0
|
||||
Decorate 24($Global) Block
|
||||
Decorate 26 DescriptorSet 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
8: TypeFloat 32
|
||||
9: TypeVector 8(float) 4
|
||||
10(PS_OUTPUT): TypeStruct 9(fvec4)
|
||||
11: TypePointer Function 10(PS_OUTPUT)
|
||||
13: TypeInt 32 1
|
||||
14: 13(int) Constant 0
|
||||
15: 8(float) Constant 0
|
||||
16: 9(fvec4) ConstantComposite 15 15 15 15
|
||||
17: TypePointer Function 9(fvec4)
|
||||
19: TypePointer Output 9(fvec4)
|
||||
20(Color): 19(ptr) Variable Output
|
||||
24($Global): TypeStruct 13(int)
|
||||
25: TypePointer Uniform 24($Global)
|
||||
26: 25(ptr) Variable Uniform
|
||||
4(main_in_spv): 2 Function None 3
|
||||
5: Label
|
||||
12(psout): 11(ptr) Variable Function
|
||||
18: 17(ptr) AccessChain 12(psout) 14
|
||||
Store 18 16
|
||||
21: 17(ptr) AccessChain 12(psout) 14
|
||||
22: 9(fvec4) Load 21
|
||||
Store 20(Color) 22
|
||||
Return
|
||||
FunctionEnd
|
||||
6(not_the_entry_point(): 2 Function None 3
|
||||
7: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
15
Test/hlsl.entry.rename.frag
Normal file
15
Test/hlsl.entry.rename.frag
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 Color : SV_Target0;
|
||||
};
|
||||
|
||||
void not_the_entry_point() { }
|
||||
int also_not_the_entry_point;
|
||||
|
||||
PS_OUTPUT main()
|
||||
{
|
||||
PS_OUTPUT psout;
|
||||
psout.Color = 0;
|
||||
return psout;
|
||||
}
|
||||
@@ -45,6 +45,13 @@ $EXE -i -C *.vert *.geom *.frag *.tes* *.comp > singleThread.out
|
||||
$EXE -i -C *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out
|
||||
diff singleThread.out multiThread.out || HASERROR=1
|
||||
|
||||
|
||||
#
|
||||
# entry point renaming tests
|
||||
#
|
||||
$EXE -i -H -V -D -e main_in_spv --source-entrypoint main ../Test/hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out
|
||||
diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1
|
||||
|
||||
if [ $HASERROR -eq 0 ]
|
||||
then
|
||||
echo Tests Succeeded.
|
||||
|
||||
Reference in New Issue
Block a user