HLSL: Fix #606: make layout() override register.
This commit is contained in:
parent
cc951f8183
commit
471bfed062
104
Test/baseResults/hlsl.layoutOverride.vert.out
Executable file
104
Test/baseResults/hlsl.layoutOverride.vert.out
Executable file
@ -0,0 +1,104 @@
|
|||||||
|
hlsl.layoutOverride.vert
|
||||||
|
Shader version: 500
|
||||||
|
0:? Sequence
|
||||||
|
0:5 Function Definition: @main( ( temp 4-component vector of float)
|
||||||
|
0:5 Function Parameters:
|
||||||
|
0:? Sequence
|
||||||
|
0:6 Branch: Return with expression
|
||||||
|
0:6 texture ( temp 4-component vector of float)
|
||||||
|
0:6 Construct combined texture-sampler ( temp sampler2D)
|
||||||
|
0:6 'tex' (layout( set=2 binding=0) uniform texture2D)
|
||||||
|
0:6 'samp' ( uniform sampler)
|
||||||
|
0:? Constant:
|
||||||
|
0:? 0.200000
|
||||||
|
0:? 0.300000
|
||||||
|
0:5 Function Definition: main( ( temp void)
|
||||||
|
0:5 Function Parameters:
|
||||||
|
0:? Sequence
|
||||||
|
0:5 move second child to first child ( temp 4-component vector of float)
|
||||||
|
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||||
|
0:5 Function Call: @main( ( temp 4-component vector of float)
|
||||||
|
0:? Linker Objects
|
||||||
|
0:? 'tex' (layout( set=2 binding=0) uniform texture2D)
|
||||||
|
0:? 'samp' ( uniform sampler)
|
||||||
|
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||||
|
|
||||||
|
|
||||||
|
Linked vertex stage:
|
||||||
|
|
||||||
|
|
||||||
|
Shader version: 500
|
||||||
|
0:? Sequence
|
||||||
|
0:5 Function Definition: @main( ( temp 4-component vector of float)
|
||||||
|
0:5 Function Parameters:
|
||||||
|
0:? Sequence
|
||||||
|
0:6 Branch: Return with expression
|
||||||
|
0:6 texture ( temp 4-component vector of float)
|
||||||
|
0:6 Construct combined texture-sampler ( temp sampler2D)
|
||||||
|
0:6 'tex' (layout( set=2 binding=0) uniform texture2D)
|
||||||
|
0:6 'samp' ( uniform sampler)
|
||||||
|
0:? Constant:
|
||||||
|
0:? 0.200000
|
||||||
|
0:? 0.300000
|
||||||
|
0:5 Function Definition: main( ( temp void)
|
||||||
|
0:5 Function Parameters:
|
||||||
|
0:? Sequence
|
||||||
|
0:5 move second child to first child ( temp 4-component vector of float)
|
||||||
|
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||||
|
0:5 Function Call: @main( ( temp 4-component vector of float)
|
||||||
|
0:? Linker Objects
|
||||||
|
0:? 'tex' (layout( set=2 binding=0) uniform texture2D)
|
||||||
|
0:? 'samp' ( uniform sampler)
|
||||||
|
0:? '@entryPointOutput' ( out 4-component vector of float Position)
|
||||||
|
|
||||||
|
// Module Version 10000
|
||||||
|
// Generated by (magic number): 80002
|
||||||
|
// Id's are bound by 32
|
||||||
|
|
||||||
|
Capability Shader
|
||||||
|
1: ExtInstImport "GLSL.std.450"
|
||||||
|
MemoryModel Logical GLSL450
|
||||||
|
EntryPoint Vertex 4 "main" 30
|
||||||
|
Source HLSL 500
|
||||||
|
Name 4 "main"
|
||||||
|
Name 9 "@main("
|
||||||
|
Name 13 "tex"
|
||||||
|
Name 17 "samp"
|
||||||
|
Name 30 "@entryPointOutput"
|
||||||
|
Decorate 13(tex) DescriptorSet 2
|
||||||
|
Decorate 13(tex) Binding 0
|
||||||
|
Decorate 17(samp) DescriptorSet 0
|
||||||
|
Decorate 30(@entryPointOutput) BuiltIn Position
|
||||||
|
2: TypeVoid
|
||||||
|
3: TypeFunction 2
|
||||||
|
6: TypeFloat 32
|
||||||
|
7: TypeVector 6(float) 4
|
||||||
|
8: TypeFunction 7(fvec4)
|
||||||
|
11: TypeImage 6(float) 2D sampled format:Unknown
|
||||||
|
12: TypePointer UniformConstant 11
|
||||||
|
13(tex): 12(ptr) Variable UniformConstant
|
||||||
|
15: TypeSampler
|
||||||
|
16: TypePointer UniformConstant 15
|
||||||
|
17(samp): 16(ptr) Variable UniformConstant
|
||||||
|
19: TypeSampledImage 11
|
||||||
|
21: TypeVector 6(float) 2
|
||||||
|
22: 6(float) Constant 1045220557
|
||||||
|
23: 6(float) Constant 1050253722
|
||||||
|
24: 21(fvec2) ConstantComposite 22 23
|
||||||
|
25: 6(float) Constant 0
|
||||||
|
29: TypePointer Output 7(fvec4)
|
||||||
|
30(@entryPointOutput): 29(ptr) Variable Output
|
||||||
|
4(main): 2 Function None 3
|
||||||
|
5: Label
|
||||||
|
31: 7(fvec4) FunctionCall 9(@main()
|
||||||
|
Store 30(@entryPointOutput) 31
|
||||||
|
Return
|
||||||
|
FunctionEnd
|
||||||
|
9(@main(): 7(fvec4) Function None 8
|
||||||
|
10: Label
|
||||||
|
14: 11 Load 13(tex)
|
||||||
|
18: 15 Load 17(samp)
|
||||||
|
20: 19 SampledImage 14 18
|
||||||
|
26: 7(fvec4) ImageSampleExplicitLod 20 24 Lod 25
|
||||||
|
ReturnValue 26
|
||||||
|
FunctionEnd
|
7
Test/hlsl.layoutOverride.vert
Normal file
7
Test/hlsl.layoutOverride.vert
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
layout(set=2,binding=0) Texture2D tex : register(t16);
|
||||||
|
SamplerState samp;
|
||||||
|
|
||||||
|
float4 main() : SV_Position
|
||||||
|
{
|
||||||
|
return tex.Sample(samp, float2(0.2, 0.3));
|
||||||
|
}
|
@ -211,6 +211,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
{"hlsl.intrinsics.promote.down.frag", "main"},
|
{"hlsl.intrinsics.promote.down.frag", "main"},
|
||||||
{"hlsl.intrinsics.promote.outputs.frag", "main"},
|
{"hlsl.intrinsics.promote.outputs.frag", "main"},
|
||||||
{"hlsl.layout.frag", "main"},
|
{"hlsl.layout.frag", "main"},
|
||||||
|
{"hlsl.layoutOverride.vert", "main"},
|
||||||
{"hlsl.load.2dms.dx10.frag", "main"},
|
{"hlsl.load.2dms.dx10.frag", "main"},
|
||||||
{"hlsl.load.array.dx10.frag", "main"},
|
{"hlsl.load.array.dx10.frag", "main"},
|
||||||
{"hlsl.load.basic.dx10.frag", "main"},
|
{"hlsl.load.basic.dx10.frag", "main"},
|
||||||
|
@ -5856,6 +5856,9 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
|
|||||||
case 'c':
|
case 'c':
|
||||||
case 's':
|
case 's':
|
||||||
case 'u':
|
case 'u':
|
||||||
|
// if nothing else has set the binding, do so now
|
||||||
|
// (other mechanisms override this one)
|
||||||
|
if (!qualifier.hasBinding())
|
||||||
qualifier.layoutBinding = regNumber + subComponent;
|
qualifier.layoutBinding = regNumber + subComponent;
|
||||||
|
|
||||||
// This handles per-register layout sets numbers. For the global mode which sets
|
// This handles per-register layout sets numbers. For the global mode which sets
|
||||||
@ -5890,7 +5893,9 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (spaceDesc) {
|
// if nothing else has set the set, do so now
|
||||||
|
// (other mechanisms override this one)
|
||||||
|
if (spaceDesc && !qualifier.hasSet()) {
|
||||||
if (! crackSpace()) {
|
if (! crackSpace()) {
|
||||||
error(loc, "expected spaceN", "register", "");
|
error(loc, "expected spaceN", "register", "");
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user