From 55837bad64350a7c35d058564c1ec623f8d9a0fa Mon Sep 17 00:00:00 2001 From: Graeme Leese Date: Thu, 1 Mar 2018 17:48:57 +0000 Subject: [PATCH] Fix random shader generator Put parentheses around the RHS when converting L == R into abs(L - R) < 0.001. Affects: dEQP-GLES2.functional.shaders.random.* dEQP-GLES3.functional.shaders.random.* Components: OpenGL VK-GL-CTS issue: 286 Change-Id: I95d43ed40944c2815d7ce464ac4dc4993f87a4e9 --- framework/randomshaders/rsgBinaryOps.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/randomshaders/rsgBinaryOps.cpp b/framework/randomshaders/rsgBinaryOps.cpp index 99b78f7..4b383f4 100644 --- a/framework/randomshaders/rsgBinaryOps.cpp +++ b/framework/randomshaders/rsgBinaryOps.cpp @@ -283,10 +283,16 @@ Expression* BinaryOp::createNextChild (GeneratorState& state) VariableType floatType(VariableType::TYPE_FLOAT, 1); if (m_leftValueRange.getType() == floatType) { + VariableType boolType(VariableType::TYPE_BOOL, 1); + const ValueRange boolRange(boolType); + + ParenOp* parenRight = new ParenOp(state, boolRange); + parenRight->setChild(m_rightValueExpr); + typedef CustomBinaryOp CustomSubOp; CustomSubOp* subOperation = new CustomSubOp(); subOperation->setLeftValue(m_leftValueExpr); - subOperation->setRightValue(m_rightValueExpr); + subOperation->setRightValue(parenRight); CustomAbsOp* absOperation = new CustomAbsOp(); absOperation->setChild(subOperation); @@ -297,8 +303,6 @@ Expression* BinaryOp::createNextChild (GeneratorState& state) lessOperation->setLeftValue(absOperation); lessOperation->setRightValue(epsilonLiteral); - VariableType boolType(VariableType::TYPE_BOOL, 1); - const ValueRange boolRange(boolType); ParenOp* parenOperation = new ParenOp(state, boolRange); parenOperation->setChild(lessOperation); BoolLiteral* trueLiteral = new BoolLiteral(true); -- 2.7.4