Commit 5bec2b56 by qining

integer type operation should not be noContraction

parent 34d25718
......@@ -325,8 +325,8 @@ Shader version: 450
0:63 0 (const int)
0:63 'k' (temp int)
0:63 Convert int to float (temp float)
0:63 add (noContraction temp int)
0:63 component-wise multiply (noContraction temp int)
0:63 add (temp int)
0:63 component-wise multiply (temp int)
0:63 'i' (noContraction temp int)
0:63 'j' (noContraction temp int)
0:63 'k' (noContraction temp int)
......@@ -848,8 +848,8 @@ Shader version: 450
0:63 0 (const int)
0:63 'k' (temp int)
0:63 Convert int to float (temp float)
0:63 add (noContraction temp int)
0:63 component-wise multiply (noContraction temp int)
0:63 add (temp int)
0:63 component-wise multiply (temp int)
0:63 'i' (noContraction temp int)
0:63 'j' (noContraction temp int)
0:63 'k' (noContraction temp int)
......
......@@ -14,17 +14,17 @@ float minimal() {
void continuous_assignment() {
precise float result = 5.0;
int a = 10;
int b = 20;
float a = 10.0;
float b = 20.0;
result = a = b + 4; // b + 4 should be 'noContraction'.
}
void convert() {
precise float result;
int a = 10;
int b = 20;
precise double result;
float a = 10.0;
float b = 20.0;
b = a + b; // a + b should be 'noContraction'.
result = float(b); // convert operation should not be 'noContraction'.
result = double(b); // convert operation should not be 'noContraction'.
}
float loop_for() {
......@@ -43,13 +43,13 @@ float loop_for() {
}
void loop_array(void) {
precise int result = 5;
precise float result;
int x = 22;
int y = 33;
int a0[3];
result += x + y; // x + y should be 'noContraction' also result + rvalue.
float a0[3];
result += float(x) + float(y); // x + y should be 'noContraction' also result + rvalue.
for (int i = 0; i < 3; ++i) {
// a's dereference + 2 should be 'noContraction'.
......@@ -66,7 +66,7 @@ void loop_while() {
while (result < 10) {
result += 3.12 + b; // result + 3.12 should be 'noContraction'.
}
result = a + b + 5; // b + 5 should be 'noCtraction' and also a + rvalue.
result = a + b + 5; // b + 5 should not be 'noCtraction' because all operands are integers.
result = 11.1;
}
......
......@@ -60,7 +60,7 @@ float complex_array_struct() {
for(int j=0; j<6; j++) {
for(int k = 0; k<3; k++) {
t3[i].t2.t1c[j].t1_array[k] = i * j + k; // NoContraction
t3[i].t2.t1c[j].t1_array[k] = i * j + k; // Not NoContraction because all operands are integers
}
t3[i].t2.t1c[j].t1_scalar = j * 2.0 / i; // Not NoContraction
}
......
......@@ -712,7 +712,7 @@ protected:
return false;
}
// If this is an arithmetic operation, marks this node as 'noContraction'.
if (isArithmeticOperation(node->getOp())) {
if (isArithmeticOperation(node->getOp()) && node->getBasicType() != glslang::EbtInt) {
node->getWritableType().getQualifier().noContraction = true;
}
// As this node is not an object node, need to traverse the children nodes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment