Unverified Commit fb1e40b4 by John Kessenich Committed by GitHub

Merge pull request #1299 from KhronosGroup/fix-conversions

Fix conversions
parents cb32c544 647fccaf
...@@ -13,8 +13,7 @@ gl_FragCoord origin is upper left ...@@ -13,8 +13,7 @@ gl_FragCoord origin is upper left
0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
0:13 Constant: 0:13 Constant:
0:13 0 (const uint) 0:13 0 (const uint)
0:13 Convert int to bool ( temp bool) 0:13 Convert float to bool ( temp bool)
0:13 Convert float to int ( temp int)
0:13 fval: direct index for structure ( uniform float) 0:13 fval: direct index for structure ( uniform float)
0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
0:13 Constant: 0:13 Constant:
...@@ -28,8 +27,7 @@ gl_FragCoord origin is upper left ...@@ -28,8 +27,7 @@ gl_FragCoord origin is upper left
0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
0:14 Constant: 0:14 Constant:
0:14 0 (const uint) 0:14 0 (const uint)
0:14 Convert int to bool ( temp bool) 0:14 Convert float to bool ( temp bool)
0:14 Convert float to int ( temp int)
0:14 fval: direct index for structure ( uniform float) 0:14 fval: direct index for structure ( uniform float)
0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
0:14 Constant: 0:14 Constant:
...@@ -79,8 +77,7 @@ gl_FragCoord origin is upper left ...@@ -79,8 +77,7 @@ gl_FragCoord origin is upper left
0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
0:13 Constant: 0:13 Constant:
0:13 0 (const uint) 0:13 0 (const uint)
0:13 Convert int to bool ( temp bool) 0:13 Convert float to bool ( temp bool)
0:13 Convert float to int ( temp int)
0:13 fval: direct index for structure ( uniform float) 0:13 fval: direct index for structure ( uniform float)
0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
0:13 Constant: 0:13 Constant:
...@@ -94,8 +91,7 @@ gl_FragCoord origin is upper left ...@@ -94,8 +91,7 @@ gl_FragCoord origin is upper left
0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
0:14 Constant: 0:14 Constant:
0:14 0 (const uint) 0:14 0 (const uint)
0:14 Convert int to bool ( temp bool) 0:14 Convert float to bool ( temp bool)
0:14 Convert float to int ( temp int)
0:14 fval: direct index for structure ( uniform float) 0:14 fval: direct index for structure ( uniform float)
0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4})
0:14 Constant: 0:14 Constant:
...@@ -129,12 +125,12 @@ gl_FragCoord origin is upper left ...@@ -129,12 +125,12 @@ gl_FragCoord origin is upper left
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80006 // Generated by (magic number): 80006
// Id's are bound by 57 // Id's are bound by 56
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 54 EntryPoint Fragment 4 "main" 53
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source HLSL 500 Source HLSL 500
Name 4 "main" Name 4 "main"
...@@ -147,15 +143,15 @@ gl_FragCoord origin is upper left ...@@ -147,15 +143,15 @@ gl_FragCoord origin is upper left
MemberName 14($Global) 2 "fval" MemberName 14($Global) 2 "fval"
MemberName 14($Global) 3 "fval4" MemberName 14($Global) 3 "fval4"
Name 16 "" Name 16 ""
Name 45 "psout" Name 44 "psout"
Name 54 "@entryPointOutput.Color" Name 53 "@entryPointOutput.Color"
MemberDecorate 14($Global) 0 Offset 0 MemberDecorate 14($Global) 0 Offset 0
MemberDecorate 14($Global) 1 Offset 16 MemberDecorate 14($Global) 1 Offset 16
MemberDecorate 14($Global) 2 Offset 32 MemberDecorate 14($Global) 2 Offset 32
MemberDecorate 14($Global) 3 Offset 48 MemberDecorate 14($Global) 3 Offset 48
Decorate 14($Global) Block Decorate 14($Global) Block
Decorate 16 DescriptorSet 0 Decorate 16 DescriptorSet 0
Decorate 54(@entryPointOutput.Color) Location 0 Decorate 53(@entryPointOutput.Color) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -174,29 +170,29 @@ gl_FragCoord origin is upper left ...@@ -174,29 +170,29 @@ gl_FragCoord origin is upper left
23: 22(int) Constant 0 23: 22(int) Constant 0
25: 12(int) Constant 2 25: 12(int) Constant 2
26: TypePointer Uniform 6(float) 26: TypePointer Uniform 6(float)
44: TypePointer Function 8(PS_OUTPUT) 29: 6(float) Constant 0
46: 6(float) Constant 1065353216 43: TypePointer Function 8(PS_OUTPUT)
47: 7(fvec4) ConstantComposite 46 46 46 46 45: 6(float) Constant 1065353216
48: TypePointer Function 7(fvec4) 46: 7(fvec4) ConstantComposite 45 45 45 45
53: TypePointer Output 7(fvec4) 47: TypePointer Function 7(fvec4)
54(@entryPointOutput.Color): 53(ptr) Variable Output 52: TypePointer Output 7(fvec4)
53(@entryPointOutput.Color): 52(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
55:8(PS_OUTPUT) FunctionCall 10(@main() 54:8(PS_OUTPUT) FunctionCall 10(@main()
56: 7(fvec4) CompositeExtract 55 0 55: 7(fvec4) CompositeExtract 54 0
Store 54(@entryPointOutput.Color) 56 Store 53(@entryPointOutput.Color) 55
Return Return
FunctionEnd FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9 10(@main():8(PS_OUTPUT) Function None 9
11: Label 11: Label
45(psout): 44(ptr) Variable Function 44(psout): 43(ptr) Variable Function
19: 18(ptr) AccessChain 16 17 19: 18(ptr) AccessChain 16 17
20: 12(int) Load 19 20: 12(int) Load 19
24: 21(bool) INotEqual 20 23 24: 21(bool) INotEqual 20 23
27: 26(ptr) AccessChain 16 25 27: 26(ptr) AccessChain 16 25
28: 6(float) Load 27 28: 6(float) Load 27
29: 12(int) ConvertFToS 28 30: 21(bool) FOrdNotEqual 28 29
30: 21(bool) INotEqual 29 23
31: 21(bool) LogicalAnd 24 30 31: 21(bool) LogicalAnd 24 30
SelectionMerge 33 None SelectionMerge 33 None
BranchConditional 31 32 33 BranchConditional 31 32 33
...@@ -208,16 +204,15 @@ gl_FragCoord origin is upper left ...@@ -208,16 +204,15 @@ gl_FragCoord origin is upper left
36: 21(bool) INotEqual 35 23 36: 21(bool) INotEqual 35 23
37: 26(ptr) AccessChain 16 25 37: 26(ptr) AccessChain 16 25
38: 6(float) Load 37 38: 6(float) Load 37
39: 12(int) ConvertFToS 38 39: 21(bool) FOrdNotEqual 38 29
40: 21(bool) INotEqual 39 23 40: 21(bool) LogicalOr 36 39
41: 21(bool) LogicalOr 36 40 SelectionMerge 42 None
SelectionMerge 43 None BranchConditional 40 41 42
BranchConditional 41 42 43 41: Label
Branch 42
42: Label 42: Label
Branch 43 48: 47(ptr) AccessChain 44(psout) 17
43: Label Store 48 46
49: 48(ptr) AccessChain 45(psout) 17 49:8(PS_OUTPUT) Load 44(psout)
Store 49 47 ReturnValue 49
50:8(PS_OUTPUT) Load 45(psout)
ReturnValue 50
FunctionEnd FunctionEnd
spv.rankShift.comp
// Module Version 10000
// Generated by (magic number): 80006
// Id's are bound by 33
Capability Shader
Capability Int64
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 54 1 1
Source GLSL 450
SourceExtension "GL_ARB_gpu_shader_int64"
Name 4 "main"
Name 8 "result"
Name 11 "arg0"
Name 15 "arg1"
Decorate 11(arg0) Location 4
Decorate 15(arg1) Location 5
Decorate 32 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeInt 64 0
7: TypePointer Function 6(int)
9: TypeInt 64 1
10: TypePointer UniformConstant 9(int)
11(arg0): 10(ptr) Variable UniformConstant
13: TypeInt 32 0
14: TypePointer UniformConstant 13(int)
15(arg1): 14(ptr) Variable UniformConstant
29: TypeVector 13(int) 3
30: 13(int) Constant 54
31: 13(int) Constant 1
32: 29(ivec3) ConstantComposite 30 31 31
4(main): 2 Function None 3
5: Label
8(result): 7(ptr) Variable Function
12: 9(int) Load 11(arg0)
16: 13(int) Load 15(arg1)
17: 9(int) ShiftLeftLogical 12 16
18: 6(int) Bitcast 17
Store 8(result) 18
19: 9(int) Load 11(arg0)
20: 13(int) Load 15(arg1)
21: 9(int) ShiftRightArithmetic 19 20
22: 6(int) Bitcast 21
Store 8(result) 22
23: 13(int) Load 15(arg1)
24: 6(int) Load 8(result)
25: 6(int) ShiftLeftLogical 24 23
Store 8(result) 25
26: 13(int) Load 15(arg1)
27: 6(int) Load 8(result)
28: 6(int) ShiftRightLogical 27 26
Store 8(result) 28
Return
FunctionEnd
...@@ -116,6 +116,8 @@ void operators() ...@@ -116,6 +116,8 @@ void operators()
i64 = i64 % i; i64 = i64 % i;
// Shift // Shift
u64v = u64v << i;
i64 = i64 >> uv.y;
u64v <<= i; u64v <<= i;
i64 >>= uv.y; i64 >>= uv.y;
......
#version 450
#extension GL_ARB_gpu_shader_int64 : require
layout(local_size_x = 54) in;
layout(location=4) uniform int64_t arg0;
layout(location=5) uniform uint arg1;
void main()
{
uint64_t result = arg0 << arg1;
result = arg0 >> arg1;
result <<= arg1;
result >>= arg1;
}
\ No newline at end of file
...@@ -459,9 +459,6 @@ public: ...@@ -459,9 +459,6 @@ public:
TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc) const; TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc) const;
TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc, const TType&) const; TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc, const TType&) const;
// Add conversion from node's type to given basic type.
TIntermTyped* convertToBasicType(TOperator op, TBasicType basicType, TIntermTyped* node) const;
// Constant folding (in Constant.cpp) // Constant folding (in Constant.cpp)
TIntermTyped* fold(TIntermAggregate* aggrNode); TIntermTyped* fold(TIntermAggregate* aggrNode);
TIntermTyped* foldConstructor(TIntermAggregate* aggrNode); TIntermTyped* foldConstructor(TIntermAggregate* aggrNode);
......
...@@ -416,6 +416,7 @@ INSTANTIATE_TEST_CASE_P( ...@@ -416,6 +416,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.460.comp", "spv.460.comp",
"spv.atomic.comp", "spv.atomic.comp",
"spv.glFragColor.frag", "spv.glFragColor.frag",
"spv.rankShift.comp",
"spv.specConst.vert", "spv.specConst.vert",
"spv.OVR_multiview.vert", "spv.OVR_multiview.vert",
})), })),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment