HLSL: add intrinsic function implicit promotions

This PR handles implicit promotions for intrinsics when there is no exact match,
such as for example clamp(int, bool, float).  In this case the int and bool will
be promoted to a float, and the clamp(float, float, float) form used.

These promotions can be mixed with shape conversions, e.g, clamp(int, bool2, float2).

Output conversions are handled either via the existing addOutputArgumentConversion
function, which this PR generalizes to handle either aggregates or unaries, or by
intrinsic decomposition.  If there are methods or intrinsics to be decomposed,
then decomposition is responsible for any output conversions, which turns out to
happen automatically in all current cases.  This can be revisited once inout
conversions are in place.

Some cases of actual ambiguity were fixed in several tests, e.g, spv.register.autoassign.*

Some intrinsics with only uint versions were expanded to signed ints natively, where the
underlying AST and SPIR-V supports that.  E.g, countbits.  This avoids extraneous
conversion nodes.

A new function promoteAggregate is added, and used by findFunction.  This is essentially
a generalization of the "promote 1st or 2nd arg" algorithm in promoteBinary.

The actual selection proceeds in three steps, as described in the comments in
hlslParseContext::findFunction:

1. Attempt an exact match.  If found, use it.
2. If not, obtain the operator from step 1, and promote arguments.
3. Re-select the intrinsic overload from the results of step 2.
This commit is contained in:
steve-lunarg
2016-11-02 12:42:34 -06:00
parent 1c573fbcfb
commit ef33ec0925
19 changed files with 5453 additions and 3261 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,184 @@
hlsl.intrinsics.promote.down.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:15 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:15 Function Parameters:
0:? Sequence
0:16 Sequence
0:16 move second child to first child (temp uint)
0:16 'r00' (temp uint)
0:16 bitCount (temp uint)
0:16 Convert float to uint (temp uint)
0:16 f: direct index for structure (layout(offset=8 ) uniform float)
0:16 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2})
0:16 Constant:
0:16 2 (const uint)
0:17 Sequence
0:17 move second child to first child (temp 2-component vector of uint)
0:17 'r01' (temp 2-component vector of uint)
0:17 bitFieldReverse (temp 2-component vector of uint)
0:17 Convert float to uint (temp 2-component vector of uint)
0:17 f2: direct index for structure (layout(offset=32 ) uniform 2-component vector of float)
0:17 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2})
0:17 Constant:
0:17 6 (const uint)
0:20 move second child to first child (temp 4-component vector of float)
0:20 color: direct index for structure (temp 4-component vector of float)
0:20 'ps_output' (temp structure{temp 4-component vector of float color})
0:20 Constant:
0:20 0 (const int)
0:? Constant:
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:21 Sequence
0:21 Sequence
0:21 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:21 color: direct index for structure (temp 4-component vector of float)
0:21 'ps_output' (temp structure{temp 4-component vector of float color})
0:21 Constant:
0:21 0 (const int)
0:21 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 i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2})
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:15 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:15 Function Parameters:
0:? Sequence
0:16 Sequence
0:16 move second child to first child (temp uint)
0:16 'r00' (temp uint)
0:16 bitCount (temp uint)
0:16 Convert float to uint (temp uint)
0:16 f: direct index for structure (layout(offset=8 ) uniform float)
0:16 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2})
0:16 Constant:
0:16 2 (const uint)
0:17 Sequence
0:17 move second child to first child (temp 2-component vector of uint)
0:17 'r01' (temp 2-component vector of uint)
0:17 bitFieldReverse (temp 2-component vector of uint)
0:17 Convert float to uint (temp 2-component vector of uint)
0:17 f2: direct index for structure (layout(offset=32 ) uniform 2-component vector of float)
0:17 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2})
0:17 Constant:
0:17 6 (const uint)
0:20 move second child to first child (temp 4-component vector of float)
0:20 color: direct index for structure (temp 4-component vector of float)
0:20 'ps_output' (temp structure{temp 4-component vector of float color})
0:20 Constant:
0:20 0 (const int)
0:? Constant:
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:21 Sequence
0:21 Sequence
0:21 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:21 color: direct index for structure (temp 4-component vector of float)
0:21 'ps_output' (temp structure{temp 4-component vector of float color})
0:21 Constant:
0:21 0 (const int)
0:21 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 i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 45
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 41
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 8 "r00"
Name 14 "$Global"
MemberName 14($Global) 0 "i"
MemberName 14($Global) 1 "u"
MemberName 14($Global) 2 "f"
MemberName 14($Global) 3 "b"
MemberName 14($Global) 4 "i2"
MemberName 14($Global) 5 "u2"
MemberName 14($Global) 6 "f2"
MemberName 14($Global) 7 "b2"
Name 16 ""
Name 24 "r01"
Name 32 "PS_OUTPUT"
MemberName 32(PS_OUTPUT) 0 "color"
Name 34 "ps_output"
Name 41 "color"
MemberDecorate 14($Global) 0 Offset 0
MemberDecorate 14($Global) 1 Offset 4
MemberDecorate 14($Global) 2 Offset 8
MemberDecorate 14($Global) 3 Offset 12
MemberDecorate 14($Global) 4 Offset 16
MemberDecorate 14($Global) 5 Offset 24
MemberDecorate 14($Global) 6 Offset 32
MemberDecorate 14($Global) 7 Offset 40
Decorate 14($Global) Block
Decorate 16 DescriptorSet 0
Decorate 41(color) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer Function 6(int)
9: TypeInt 32 1
10: TypeFloat 32
11: TypeVector 9(int) 2
12: TypeVector 6(int) 2
13: TypeVector 10(float) 2
14($Global): TypeStruct 9(int) 6(int) 10(float) 6(int) 11(ivec2) 12(ivec2) 13(fvec2) 12(ivec2)
15: TypePointer Uniform 14($Global)
16: 15(ptr) Variable Uniform
17: 9(int) Constant 2
18: TypePointer Uniform 10(float)
23: TypePointer Function 12(ivec2)
25: 9(int) Constant 6
26: TypePointer Uniform 13(fvec2)
31: TypeVector 10(float) 4
32(PS_OUTPUT): TypeStruct 31(fvec4)
33: TypePointer Function 32(PS_OUTPUT)
35: 9(int) Constant 0
36: 10(float) Constant 0
37: 31(fvec4) ConstantComposite 36 36 36 36
38: TypePointer Function 31(fvec4)
40: TypePointer Output 31(fvec4)
41(color): 40(ptr) Variable Output
4(main): 2 Function None 3
5: Label
8(r00): 7(ptr) Variable Function
24(r01): 23(ptr) Variable Function
34(ps_output): 33(ptr) Variable Function
19: 18(ptr) AccessChain 16 17
20: 10(float) Load 19
21: 6(int) ConvertFToU 20
22: 6(int) BitCount 21
Store 8(r00) 22
27: 26(ptr) AccessChain 16 25
28: 13(fvec2) Load 27
29: 12(ivec2) ConvertFToU 28
30: 12(ivec2) BitReverse 29
Store 24(r01) 30
39: 38(ptr) AccessChain 34(ps_output) 35
Store 39 37
42: 38(ptr) AccessChain 34(ps_output) 35
43: 31(fvec4) Load 42
Store 41(color) 43
Return
FunctionEnd

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,337 @@
hlsl.intrinsics.promote.outputs.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:20 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:20 Function Parameters:
0:? Sequence
0:37 clamp (temp float)
0:37 fpos: direct index for structure (layout(offset=52 ) uniform float)
0:37 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2, layout(offset=48 ) uniform uint upos, layout(offset=52 ) uniform float fpos})
0:37 Constant:
0:37 9 (const uint)
0:37 Constant:
0:37 0.000000
0:37 Constant:
0:37 1.000000
0:40 Sequence
0:40 move second child to first child (temp uint)
0:40 'sizeQueryTemp' (temp uint)
0:40 textureSize (temp uint)
0:40 'g_tTex1df4' (uniform texture1D)
0:40 move second child to first child (temp int)
0:40 'WidthI' (temp int)
0:40 Convert uint to int (temp int)
0:40 'sizeQueryTemp' (temp uint)
0:41 Sequence
0:41 move second child to first child (temp uint)
0:41 'sizeQueryTemp' (temp uint)
0:41 textureSize (temp uint)
0:41 'g_tTex1df4' (uniform texture1D)
0:41 Constant:
0:41 6 (const uint)
0:41 move second child to first child (temp int)
0:41 'WidthI' (temp int)
0:41 Convert uint to int (temp int)
0:41 'sizeQueryTemp' (temp uint)
0:41 move second child to first child (temp uint)
0:41 'NumberOfLevelsU' (temp uint)
0:41 textureQueryLevels (temp uint)
0:41 'g_tTex1df4' (uniform texture1D)
0:42 Sequence
0:42 move second child to first child (temp uint)
0:42 'sizeQueryTemp' (temp uint)
0:42 textureSize (temp uint)
0:42 'g_tTex1df4' (uniform texture1D)
0:42 Constant:
0:42 6 (const uint)
0:42 move second child to first child (temp uint)
0:42 'WidthU' (temp uint)
0:42 'sizeQueryTemp' (temp uint)
0:42 move second child to first child (temp int)
0:42 'NumberOfLevelsI' (temp int)
0:42 Convert uint to int (temp int)
0:42 textureQueryLevels (temp uint)
0:42 'g_tTex1df4' (uniform texture1D)
0:43 Sequence
0:43 move second child to first child (temp uint)
0:43 'sizeQueryTemp' (temp uint)
0:43 textureSize (temp uint)
0:43 'g_tTex1df4' (uniform texture1D)
0:43 Constant:
0:43 6 (const uint)
0:43 move second child to first child (temp int)
0:43 'WidthI' (temp int)
0:43 Convert uint to int (temp int)
0:43 'sizeQueryTemp' (temp uint)
0:43 move second child to first child (temp int)
0:43 'NumberOfLevelsI' (temp int)
0:43 Convert uint to int (temp int)
0:43 textureQueryLevels (temp uint)
0:43 'g_tTex1df4' (uniform texture1D)
0:47 move second child to first child (temp 4-component vector of float)
0:47 color: direct index for structure (temp 4-component vector of float)
0:47 'ps_output' (temp structure{temp 4-component vector of float color})
0:47 Constant:
0:47 0 (const int)
0:47 Constant:
0:47 0.000000
0:47 0.000000
0:47 0.000000
0:47 0.000000
0:48 Sequence
0:48 Sequence
0:48 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:48 color: direct index for structure (temp 4-component vector of float)
0:48 'ps_output' (temp structure{temp 4-component vector of float color})
0:48 Constant:
0:48 0 (const int)
0:48 Branch: Return
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:? 'g_tTexbfs' (layout(r32f ) uniform samplerBuffer)
0:? 'g_tTex1df4' (uniform texture1D)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2, layout(offset=48 ) uniform uint upos, layout(offset=52 ) uniform float fpos})
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:20 Function Definition: main( (temp structure{temp 4-component vector of float color})
0:20 Function Parameters:
0:? Sequence
0:37 clamp (temp float)
0:37 fpos: direct index for structure (layout(offset=52 ) uniform float)
0:37 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2, layout(offset=48 ) uniform uint upos, layout(offset=52 ) uniform float fpos})
0:37 Constant:
0:37 9 (const uint)
0:37 Constant:
0:37 0.000000
0:37 Constant:
0:37 1.000000
0:40 Sequence
0:40 move second child to first child (temp uint)
0:40 'sizeQueryTemp' (temp uint)
0:40 textureSize (temp uint)
0:40 'g_tTex1df4' (uniform texture1D)
0:40 move second child to first child (temp int)
0:40 'WidthI' (temp int)
0:40 Convert uint to int (temp int)
0:40 'sizeQueryTemp' (temp uint)
0:41 Sequence
0:41 move second child to first child (temp uint)
0:41 'sizeQueryTemp' (temp uint)
0:41 textureSize (temp uint)
0:41 'g_tTex1df4' (uniform texture1D)
0:41 Constant:
0:41 6 (const uint)
0:41 move second child to first child (temp int)
0:41 'WidthI' (temp int)
0:41 Convert uint to int (temp int)
0:41 'sizeQueryTemp' (temp uint)
0:41 move second child to first child (temp uint)
0:41 'NumberOfLevelsU' (temp uint)
0:41 textureQueryLevels (temp uint)
0:41 'g_tTex1df4' (uniform texture1D)
0:42 Sequence
0:42 move second child to first child (temp uint)
0:42 'sizeQueryTemp' (temp uint)
0:42 textureSize (temp uint)
0:42 'g_tTex1df4' (uniform texture1D)
0:42 Constant:
0:42 6 (const uint)
0:42 move second child to first child (temp uint)
0:42 'WidthU' (temp uint)
0:42 'sizeQueryTemp' (temp uint)
0:42 move second child to first child (temp int)
0:42 'NumberOfLevelsI' (temp int)
0:42 Convert uint to int (temp int)
0:42 textureQueryLevels (temp uint)
0:42 'g_tTex1df4' (uniform texture1D)
0:43 Sequence
0:43 move second child to first child (temp uint)
0:43 'sizeQueryTemp' (temp uint)
0:43 textureSize (temp uint)
0:43 'g_tTex1df4' (uniform texture1D)
0:43 Constant:
0:43 6 (const uint)
0:43 move second child to first child (temp int)
0:43 'WidthI' (temp int)
0:43 Convert uint to int (temp int)
0:43 'sizeQueryTemp' (temp uint)
0:43 move second child to first child (temp int)
0:43 'NumberOfLevelsI' (temp int)
0:43 Convert uint to int (temp int)
0:43 textureQueryLevels (temp uint)
0:43 'g_tTex1df4' (uniform texture1D)
0:47 move second child to first child (temp 4-component vector of float)
0:47 color: direct index for structure (temp 4-component vector of float)
0:47 'ps_output' (temp structure{temp 4-component vector of float color})
0:47 Constant:
0:47 0 (const int)
0:47 Constant:
0:47 0.000000
0:47 0.000000
0:47 0.000000
0:47 0.000000
0:48 Sequence
0:48 Sequence
0:48 move second child to first child (temp 4-component vector of float)
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:48 color: direct index for structure (temp 4-component vector of float)
0:48 'ps_output' (temp structure{temp 4-component vector of float color})
0:48 Constant:
0:48 0 (const int)
0:48 Branch: Return
0:? Linker Objects
0:? 'color' (layout(location=0 ) out 4-component vector of float)
0:? 'g_tTexbfs' (layout(r32f ) uniform samplerBuffer)
0:? 'g_tTex1df4' (uniform texture1D)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int i, layout(offset=4 ) uniform uint u, layout(offset=8 ) uniform float f, layout(offset=12 ) uniform bool b, layout(offset=16 ) uniform 2-component vector of int i2, layout(offset=24 ) uniform 2-component vector of uint u2, layout(offset=32 ) uniform 2-component vector of float f2, layout(offset=40 ) uniform 2-component vector of bool b2, layout(offset=48 ) uniform uint upos, layout(offset=52 ) uniform float fpos})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 76
Capability Shader
Capability Sampled1D
Capability SampledBuffer
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 68
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 12 "$Global"
MemberName 12($Global) 0 "i"
MemberName 12($Global) 1 "u"
MemberName 12($Global) 2 "f"
MemberName 12($Global) 3 "b"
MemberName 12($Global) 4 "i2"
MemberName 12($Global) 5 "u2"
MemberName 12($Global) 6 "f2"
MemberName 12($Global) 7 "b2"
MemberName 12($Global) 8 "upos"
MemberName 12($Global) 9 "fpos"
Name 14 ""
Name 23 "sizeQueryTemp"
Name 26 "g_tTex1df4"
Name 30 "WidthI"
Name 33 "sizeQueryTemp"
Name 39 "NumberOfLevelsU"
Name 42 "sizeQueryTemp"
Name 45 "WidthU"
Name 47 "NumberOfLevelsI"
Name 51 "sizeQueryTemp"
Name 60 "PS_OUTPUT"
MemberName 60(PS_OUTPUT) 0 "color"
Name 62 "ps_output"
Name 68 "color"
Name 75 "g_tTexbfs"
MemberDecorate 12($Global) 0 Offset 0
MemberDecorate 12($Global) 1 Offset 4
MemberDecorate 12($Global) 2 Offset 8
MemberDecorate 12($Global) 3 Offset 12
MemberDecorate 12($Global) 4 Offset 16
MemberDecorate 12($Global) 5 Offset 24
MemberDecorate 12($Global) 6 Offset 32
MemberDecorate 12($Global) 7 Offset 40
MemberDecorate 12($Global) 8 Offset 48
MemberDecorate 12($Global) 9 Offset 52
Decorate 12($Global) Block
Decorate 14 DescriptorSet 0
Decorate 26(g_tTex1df4) DescriptorSet 0
Decorate 68(color) Location 0
Decorate 75(g_tTexbfs) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypeInt 32 0
8: TypeFloat 32
9: TypeVector 6(int) 2
10: TypeVector 7(int) 2
11: TypeVector 8(float) 2
12($Global): TypeStruct 6(int) 7(int) 8(float) 7(int) 9(ivec2) 10(ivec2) 11(fvec2) 10(ivec2) 7(int) 8(float)
13: TypePointer Uniform 12($Global)
14: 13(ptr) Variable Uniform
15: 6(int) Constant 9
16: TypePointer Uniform 8(float)
19: 8(float) Constant 0
20: 8(float) Constant 1065353216
22: TypePointer Function 7(int)
24: TypeImage 8(float) 1D sampled format:Unknown
25: TypePointer UniformConstant 24
26(g_tTex1df4): 25(ptr) Variable UniformConstant
29: TypePointer Function 6(int)
35: 7(int) Constant 6
59: TypeVector 8(float) 4
60(PS_OUTPUT): TypeStruct 59(fvec4)
61: TypePointer Function 60(PS_OUTPUT)
63: 6(int) Constant 0
64: 59(fvec4) ConstantComposite 19 19 19 19
65: TypePointer Function 59(fvec4)
67: TypePointer Output 59(fvec4)
68(color): 67(ptr) Variable Output
72: TypeImage 8(float) Buffer sampled format:R32f
73: TypeSampledImage 72
74: TypePointer UniformConstant 73
75(g_tTexbfs): 74(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
23(sizeQueryTemp): 22(ptr) Variable Function
30(WidthI): 29(ptr) Variable Function
33(sizeQueryTemp): 22(ptr) Variable Function
39(NumberOfLevelsU): 22(ptr) Variable Function
42(sizeQueryTemp): 22(ptr) Variable Function
45(WidthU): 22(ptr) Variable Function
47(NumberOfLevelsI): 29(ptr) Variable Function
51(sizeQueryTemp): 22(ptr) Variable Function
62(ps_output): 61(ptr) Variable Function
17: 16(ptr) AccessChain 14 15
18: 8(float) Load 17
21: 8(float) ExtInst 1(GLSL.std.450) 43(FClamp) 18 19 20
27: 24 Load 26(g_tTex1df4)
28: 6(int) ImageQuerySize 27
Store 23(sizeQueryTemp) 28
31: 7(int) Load 23(sizeQueryTemp)
32: 6(int) Bitcast 31
Store 30(WidthI) 32
34: 24 Load 26(g_tTex1df4)
36: 6(int) ImageQuerySizeLod 34 35
Store 33(sizeQueryTemp) 36
37: 7(int) Load 33(sizeQueryTemp)
38: 6(int) Bitcast 37
Store 30(WidthI) 38
40: 24 Load 26(g_tTex1df4)
41: 6(int) ImageQueryLevels 40
Store 39(NumberOfLevelsU) 41
43: 24 Load 26(g_tTex1df4)
44: 6(int) ImageQuerySizeLod 43 35
Store 42(sizeQueryTemp) 44
46: 7(int) Load 42(sizeQueryTemp)
Store 45(WidthU) 46
48: 24 Load 26(g_tTex1df4)
49: 6(int) ImageQueryLevels 48
50: 6(int) Bitcast 49
Store 47(NumberOfLevelsI) 50
52: 24 Load 26(g_tTex1df4)
53: 6(int) ImageQuerySizeLod 52 35
Store 51(sizeQueryTemp) 53
54: 7(int) Load 51(sizeQueryTemp)
55: 6(int) Bitcast 54
Store 30(WidthI) 55
56: 24 Load 26(g_tTex1df4)
57: 6(int) ImageQueryLevels 56
58: 6(int) Bitcast 57
Store 47(NumberOfLevelsI) 58
66: 65(ptr) AccessChain 62(ps_output) 63
Store 66 64
69: 65(ptr) AccessChain 62(ps_output) 63
70: 59(fvec4) Load 69
Store 68(color) 70
Return
FunctionEnd

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 30
// Id's are bound by 31
Capability Shader
1: ExtInstImport "GLSL.std.450"
@@ -16,14 +16,14 @@ Linked fragment stage:
Name 9 "Color"
Name 12 "g_tScene[0]"
Name 16 "g_tSamp"
Name 24 "g_tScene[1]"
Name 25 "g_tScene[1]"
Decorate 9(Color) Location 0
Decorate 12(g_tScene[0]) DescriptorSet 0
Decorate 12(g_tScene[0]) Binding 10
Decorate 16(g_tSamp) DescriptorSet 0
Decorate 16(g_tSamp) Binding 5
Decorate 24(g_tScene[1]) DescriptorSet 0
Decorate 24(g_tScene[1]) Binding 11
Decorate 25(g_tScene[1]) DescriptorSet 0
Decorate 25(g_tScene[1]) Binding 11
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -39,19 +39,20 @@ Linked fragment stage:
18: TypeSampledImage 10
20: TypeVector 6(float) 2
21: 6(float) Constant 1050253722
22: 20(fvec2) ConstantComposite 21 21
24(g_tScene[1]): 11(ptr) Variable UniformConstant
22: 6(float) Constant 1053609165
23: 20(fvec2) ConstantComposite 21 22
25(g_tScene[1]): 11(ptr) Variable UniformConstant
4(main): 2 Function None 3
5: Label
13: 10 Load 12(g_tScene[0])
17: 14 Load 16(g_tSamp)
19: 18 SampledImage 13 17
23: 7(fvec4) ImageSampleImplicitLod 19 22
25: 10 Load 24(g_tScene[1])
26: 14 Load 16(g_tSamp)
27: 18 SampledImage 25 26
28: 7(fvec4) ImageSampleImplicitLod 27 22
29: 7(fvec4) FAdd 23 28
Store 9(Color) 29
24: 7(fvec4) ImageSampleImplicitLod 19 23
26: 10 Load 25(g_tScene[1])
27: 14 Load 16(g_tSamp)
28: 18 SampledImage 26 27
29: 7(fvec4) ImageSampleImplicitLod 28 23
30: 7(fvec4) FAdd 24 29
Store 9(Color) 30
Return
FunctionEnd

View File

@@ -33,7 +33,7 @@ float PixelShaderFunctionS(float inF0, float inF1, float inF2, uint inU0, uint i
clip(inF0);
float r014 = cos(inF0);
float r015 = cosh(inF0);
uint r016 = countbits(7);
int r016 = countbits(7);
float r017 = ddx(inF0);
float r018 = ddx_coarse(inF0);
float r019 = ddx_fine(inF0);
@@ -111,7 +111,7 @@ float2 PixelShaderFunction2(float2 inF0, float2 inF1, float2 inF2, uint2 inU0, u
clip(inF0);
float2 r013 = cos(inF0);
float2 r015 = cosh(inF0);
uint2 r016 = countbits(int2(7,3));
int2 r016 = countbits(int2(7,3));
float2 r017 = ddx(inF0);
float2 r018 = ddx_coarse(inF0);
float2 r019 = ddx_fine(inF0);

View File

@@ -0,0 +1,22 @@
struct PS_OUTPUT { float4 color : SV_Target0; };
int i;
uint u;
float f;
bool b;
int2 i2;
uint2 u2;
float2 f2;
bool2 b2;
PS_OUTPUT main()
{
uint r00 = countbits(f);
uint2 r01 = reversebits(f2);
PS_OUTPUT ps_output;
ps_output.color = float4(0,0,0,0);
return ps_output;
};

View File

@@ -0,0 +1,79 @@
struct PS_OUTPUT { float4 color : SV_Target0; };
int i;
uint u;
float f;
bool b;
int2 i2;
uint2 u2;
float2 f2;
bool2 b2;
Buffer <float> g_tTexbfs;
Texture1D <float4> g_tTex1df4;
uint upos;
float fpos;
PS_OUTPUT main()
{
// Same shapes:
float r00 = max(b, f);
uint r01 = max(b, u);
int r02 = max(b, i);
float r03 = max(i, f);
float r04 = max(u, f);
float2 r10 = max(b2, f2);
uint2 r11 = max(b2, u2);
int2 r12 = max(b2, i2);
float2 r13 = max(i2, f2);
float2 r14 = max(u2, f2);
float2 r20 = clamp(i2, u2, f2); // 3 args, converts all to best type.
uint2 r21 = clamp(b2, u2, b2);
float2 r22 = clamp(b2, f2, b2);
// Mixed shapes:
float2 r30 = max(b, f2);
uint2 r31 = max(b, u2);
int2 r32 = max(b, i2);
float2 r33 = max(i, f2);
float2 r34 = max(u, f2);
float2 r40 = clamp(i, u2, f2); // 3 args, converts all to best type.
uint2 r41 = clamp(b2, u, b2);
float2 r42 = clamp(b2, f, b);
int2 r43 = clamp(i, i2, u2);
float r50 = g_tTexbfs.Load(upos);
float r51 = g_tTexbfs.Load(fpos);
int MipLevel;
uint WidthU;
uint HeightU;
uint ElementsU;
uint DepthU;
uint NumberOfLevelsU;
uint NumberOfSamplesU;
int WidthI;
int HeightI;
int ElementsI;
int DepthI;
int NumberOfLevelsI;
int NumberOfSamplesI;
g_tTex1df4 . GetDimensions(WidthI);
g_tTex1df4 . GetDimensions(6, WidthI, NumberOfLevelsU);
g_tTex1df4 . GetDimensions(6, WidthU, NumberOfLevelsI);
g_tTex1df4 . GetDimensions(6, WidthI, NumberOfLevelsI);
// max(i2, f2);
PS_OUTPUT ps_output;
ps_output.color = r00;
return ps_output;
};

View File

@@ -0,0 +1,49 @@
struct PS_OUTPUT { float4 color : SV_Target0; };
int i;
uint u;
float f;
bool b;
int2 i2;
uint2 u2;
float2 f2;
bool2 b2;
Buffer <float> g_tTexbfs;
Texture1D <float4> g_tTex1df4;
uint upos;
float fpos;
PS_OUTPUT main()
{
int MipLevel;
uint WidthU;
uint HeightU;
uint ElementsU;
uint DepthU;
uint NumberOfLevelsU;
uint NumberOfSamplesU;
int WidthI;
int HeightI;
int ElementsI;
int DepthI;
int NumberOfLevelsI;
int NumberOfSamplesI;
saturate(fpos);
// Test output promotions
g_tTex1df4 . GetDimensions(WidthI);
g_tTex1df4 . GetDimensions(6, WidthI, NumberOfLevelsU);
g_tTex1df4 . GetDimensions(6, WidthU, NumberOfLevelsI);
g_tTex1df4 . GetDimensions(6, WidthI, NumberOfLevelsI);
// max(i2, f2);
PS_OUTPUT ps_output;
ps_output.color = 0;
return ps_output;
};

View File

@@ -10,6 +10,6 @@ struct PS_OUTPUT
void main(out PS_OUTPUT psout)
{
psout.Color = g_tScene[0].Sample(g_tSamp, 0.3) +
g_tScene[1].Sample(g_tSamp, 0.3);
psout.Color = g_tScene[0].Sample(g_tSamp, float2(0.3,0.4)) +
g_tScene[1].Sample(g_tSamp, float2(0.3,0.4));
}

View File

@@ -10,6 +10,6 @@ struct PS_OUTPUT
void main(out PS_OUTPUT psout)
{
psout.Color = g_tScene[0].Sample(g_tSamp, 0.3) +
g_tScene[1].Sample(g_tSamp, 0.3);
psout.Color = g_tScene[0].Sample(g_tSamp, float2(0.3, 0.3)) +
g_tScene[1].Sample(g_tSamp, float2(0.3, 0.3));
}