From 644c21025dbf3c0ebb52137b62b62e5d671cd82f Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Fri, 18 Mar 2016 16:26:23 +0800 Subject: [PATCH] Parser: Type promotion for operator modulus(%) is missing. --- Test/baseResults/spv.400.frag.out | 20 ++++++++++++++++---- Test/spv.400.frag | 3 +++ glslang/MachineIndependent/Intermediate.cpp | 1 + 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Test/baseResults/spv.400.frag.out b/Test/baseResults/spv.400.frag.out index 0cf2c36e..651d67de 100644 --- a/Test/baseResults/spv.400.frag.out +++ b/Test/baseResults/spv.400.frag.out @@ -7,7 +7,7 @@ Linked fragment stage: // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 1104 +// Id's are bound by 1112 Capability Shader Capability Float64 @@ -15,7 +15,7 @@ Linked fragment stage: Capability SampledRect 1: ExtInstImport "GLSL.std.450" 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 Source GLSL 400 SourceExtension "GL_ARB_separate_shader_objects" @@ -52,6 +52,8 @@ Linked fragment stage: Name 1078 "isamp2DA" Name 1095 "gl_FragCoord" Name 1097 "vl2" + Name 1103 "uo" + Name 1105 "u" Decorate 17(u2drs) DescriptorSet 0 Decorate 1023(arrayedSampler) DescriptorSet 0 Decorate 1025(i) Flat @@ -60,6 +62,7 @@ Linked fragment stage: Decorate 1078(isamp2DA) DescriptorSet 0 Decorate 1095(gl_FragCoord) BuiltIn FragCoord Decorate 1097(vl2) Location 6 + Decorate 1105(u) Flat 2: TypeVoid 3: TypeFunction 2 10: TypeFloat 32 @@ -177,6 +180,10 @@ Linked fragment stage: 1094: TypePointer Input 11(fvec4) 1095(gl_FragCoord): 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 5: Label 1017(v): 1016(ptr) Variable Function @@ -227,8 +234,13 @@ Linked fragment stage: 1100: 11(fvec4) Load 13(outp) 1101: 11(fvec4) FAdd 1100 1099 Store 13(outp) 1101 - 1102: 2 FunctionCall 6(foo23() - 1103: 2 FunctionCall 8(doubles() + 1106: 30(int) Load 1105(u) + 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 FunctionEnd 6(foo23(): 2 Function None 3 diff --git a/Test/spv.400.frag b/Test/spv.400.frag index 2014b5b0..05b4370b 100644 --- a/Test/spv.400.frag +++ b/Test/spv.400.frag @@ -2,6 +2,8 @@ in vec2 c2D; flat in int i; +flat in uint u; +out uint uo; out vec4 outp; out ivec4 ioutp; out uvec4 uoutp; @@ -254,6 +256,7 @@ void main() ioutp += textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i)); outp += gl_FragCoord + vl2; + uo = u % i; foo23(); doubles(); } diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index bafcb917..e4d21e69 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -474,6 +474,7 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpSub: case EOpMul: case EOpDiv: + case EOpMod: case EOpVectorTimesScalar: case EOpVectorTimesMatrix: