From 8d00fd0e2927cfa30e16dc0724286763d5a6d2f2 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Tue, 28 May 2013 07:29:58 +0000 Subject: [PATCH] Add missing type check for operands having the same type (after conversion) around the ":" in a "?:" operation. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21721 e7fa87d3-cd2b-0410-9028-fcbf551c1848 --- Test/120.frag | 7 +++++++ glslang/MachineIndependent/Intermediate.cpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/Test/120.frag b/Test/120.frag index 40ab2ef4..89f88747 100644 --- a/Test/120.frag +++ b/Test/120.frag @@ -71,6 +71,13 @@ void main() float uvec3; float uvec4; //packed; // ERROR, reserved word + + { + mat4 m; + vec4 v; + bool b; + gl_FragColor += b ? v : m; // ERROR, types don't match around ":" + } } float imageBuffer; diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index e69caf99..9e3e04f7 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -769,6 +769,10 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true else return 0; } + + // After conversion, types have to match. + if (falseBlock->getType() != trueBlock->getType()) + return 0; // // See if all the operands are constant, then fold it otherwise not.