Merge pull request #209 from amdrexu/bugfix

Parser: Type promotion for operator modulus(%) is missing.
This commit is contained in:
John Kessenich 2016-03-18 14:42:07 -06:00
commit 2cc221ade3
3 changed files with 20 additions and 4 deletions

View File

@ -7,7 +7,7 @@ Linked fragment stage:
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 1104 // Id's are bound by 1112
Capability Shader Capability Shader
Capability Float64 Capability Float64
@ -15,7 +15,7 @@ Linked fragment stage:
Capability SampledRect Capability SampledRect
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 13 1025 1031 1036 1048 1074 1095 1097 EntryPoint Fragment 4 "main" 13 1025 1031 1036 1048 1074 1095 1097 1103 1105
ExecutionMode 4 OriginUpperLeft ExecutionMode 4 OriginUpperLeft
Source GLSL 400 Source GLSL 400
SourceExtension "GL_ARB_separate_shader_objects" SourceExtension "GL_ARB_separate_shader_objects"
@ -52,6 +52,8 @@ Linked fragment stage:
Name 1078 "isamp2DA" Name 1078 "isamp2DA"
Name 1095 "gl_FragCoord" Name 1095 "gl_FragCoord"
Name 1097 "vl2" Name 1097 "vl2"
Name 1103 "uo"
Name 1105 "u"
Decorate 17(u2drs) DescriptorSet 0 Decorate 17(u2drs) DescriptorSet 0
Decorate 1023(arrayedSampler) DescriptorSet 0 Decorate 1023(arrayedSampler) DescriptorSet 0
Decorate 1025(i) Flat Decorate 1025(i) Flat
@ -60,6 +62,7 @@ Linked fragment stage:
Decorate 1078(isamp2DA) DescriptorSet 0 Decorate 1078(isamp2DA) DescriptorSet 0
Decorate 1095(gl_FragCoord) BuiltIn FragCoord Decorate 1095(gl_FragCoord) BuiltIn FragCoord
Decorate 1097(vl2) Location 6 Decorate 1097(vl2) Location 6
Decorate 1105(u) Flat
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
10: TypeFloat 32 10: TypeFloat 32
@ -177,6 +180,10 @@ Linked fragment stage:
1094: TypePointer Input 11(fvec4) 1094: TypePointer Input 11(fvec4)
1095(gl_FragCoord): 1094(ptr) Variable Input 1095(gl_FragCoord): 1094(ptr) Variable Input
1097(vl2): 1094(ptr) Variable Input 1097(vl2): 1094(ptr) Variable Input
1102: TypePointer Output 30(int)
1103(uo): 1102(ptr) Variable Output
1104: TypePointer Input 30(int)
1105(u): 1104(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
1017(v): 1016(ptr) Variable Function 1017(v): 1016(ptr) Variable Function
@ -227,8 +234,13 @@ Linked fragment stage:
1100: 11(fvec4) Load 13(outp) 1100: 11(fvec4) Load 13(outp)
1101: 11(fvec4) FAdd 1100 1099 1101: 11(fvec4) FAdd 1100 1099
Store 13(outp) 1101 Store 13(outp) 1101
1102: 2 FunctionCall 6(foo23() 1106: 30(int) Load 1105(u)
1103: 2 FunctionCall 8(doubles() 1107: 23(int) Load 1025(i)
1108: 30(int) Bitcast 1107
1109: 30(int) UMod 1106 1108
Store 1103(uo) 1109
1110: 2 FunctionCall 6(foo23()
1111: 2 FunctionCall 8(doubles()
Return Return
FunctionEnd FunctionEnd
6(foo23(): 2 Function None 3 6(foo23(): 2 Function None 3

View File

@ -2,6 +2,8 @@
in vec2 c2D; in vec2 c2D;
flat in int i; flat in int i;
flat in uint u;
out uint uo;
out vec4 outp; out vec4 outp;
out ivec4 ioutp; out ivec4 ioutp;
out uvec4 uoutp; out uvec4 uoutp;
@ -254,6 +256,7 @@ void main()
ioutp += textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i)); ioutp += textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i));
outp += gl_FragCoord + vl2; outp += gl_FragCoord + vl2;
uo = u % i;
foo23(); foo23();
doubles(); doubles();
} }

View File

@ -474,6 +474,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EOpSub: case EOpSub:
case EOpMul: case EOpMul:
case EOpDiv: case EOpDiv:
case EOpMod:
case EOpVectorTimesScalar: case EOpVectorTimesScalar:
case EOpVectorTimesMatrix: case EOpVectorTimesMatrix: