HLSL: Fix unary and binary operator type conversion issues
This fixes defects as follows: 1. handleLvalue could be called on a non-L-value, and it shouldn't be. 2. HLSL allows unary negation on non-bool values. TUnaryOperator::promote can now promote other types (e.g, int, float) to bool for this op. 3. HLSL allows binary logical operations (&&, ||) on arbitrary types, similar (2). 4. HLSL allows mod operation on arbitrary types, which will be promoted. E.g, int % float -> float % float.
This commit is contained in:
parent
5d45eadedc
commit
e5921f1309
12 changed files with 946 additions and 16 deletions
|
|
@ -52,6 +52,8 @@
|
|||
|
||||
namespace glslang {
|
||||
|
||||
class TIntermediate;
|
||||
|
||||
//
|
||||
// Operators used by the high-level (parse tree) representation.
|
||||
//
|
||||
|
|
@ -845,7 +847,7 @@ public:
|
|||
virtual TIntermOperator* getAsOperator() { return this; }
|
||||
virtual const TIntermOperator* getAsOperator() const { return this; }
|
||||
TOperator getOp() const { return op; }
|
||||
virtual bool promote() { return true; }
|
||||
virtual bool promote(TIntermediate&) { return true; }
|
||||
bool modifiesState() const;
|
||||
bool isConstructor() const;
|
||||
bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; }
|
||||
|
|
@ -1024,7 +1026,7 @@ public:
|
|||
virtual TIntermTyped* getRight() const { return right; }
|
||||
virtual TIntermBinary* getAsBinaryNode() { return this; }
|
||||
virtual const TIntermBinary* getAsBinaryNode() const { return this; }
|
||||
virtual bool promote();
|
||||
virtual bool promote(TIntermediate&);
|
||||
virtual void updatePrecision();
|
||||
protected:
|
||||
TIntermTyped* left;
|
||||
|
|
@ -1044,7 +1046,7 @@ public:
|
|||
virtual const TIntermTyped* getOperand() const { return operand; }
|
||||
virtual TIntermUnary* getAsUnaryNode() { return this; }
|
||||
virtual const TIntermUnary* getAsUnaryNode() const { return this; }
|
||||
virtual bool promote();
|
||||
virtual bool promote(TIntermediate&);
|
||||
virtual void updatePrecision();
|
||||
protected:
|
||||
TIntermTyped* operand;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue