| 1 |
#version 310 es |
| 2 |
precision mediump float; |
| 3 |
|
| 4 |
layout(location = 0) out vec4 FragColor; |
| 5 |
layout(constant_id = 1) const float a = 1.0; |
| 6 |
layout(constant_id = 2) const float b = 2.0; |
| 7 |
layout(constant_id = 3) const int c = 3; |
| 8 |
layout(constant_id = 4) const int d = 4; |
| 9 |
layout(constant_id = 5) const uint e = 5u; |
| 10 |
layout(constant_id = 6) const uint f = 6u; |
| 11 |
layout(constant_id = 7) const bool g = false; |
| 12 |
layout(constant_id = 8) const bool h = true; |
| 13 |
// glslang doesn't seem to support partial spec constants or composites yet, so only test the basics. |
| 14 |
|
| 15 |
void main() |
| 16 |
{ |
| 17 |
float t0 = a; |
| 18 |
float t1 = b; |
| 19 |
|
| 20 |
uint c0 = uint(c); // OpIAdd with different types. |
| 21 |
// FConvert, float-to-double. |
| 22 |
int c1 = -c; // SNegate |
| 23 |
int c2 = ~c; // OpNot |
| 24 |
int c3 = c + d; // OpIAdd |
| 25 |
int c4 = c - d; // OpISub |
| 26 |
int c5 = c * d; // OpIMul |
| 27 |
int c6 = c / d; // OpSDiv |
| 28 |
uint c7 = e / f; // OpUDiv |
| 29 |
int c8 = c % d; // OpSMod |
| 30 |
uint c9 = e % f; // OpUMod |
| 31 |
// TODO: OpSRem, any way to access this in GLSL? |
| 32 |
int c10 = c >> d; // OpShiftRightArithmetic |
| 33 |
uint c11 = e >> f; // OpShiftRightLogical |
| 34 |
int c12 = c << d; // OpShiftLeftLogical |
| 35 |
int c13 = c | d; // OpBitwiseOr |
| 36 |
int c14 = c ^ d; // OpBitwiseXor |
| 37 |
int c15 = c & d; // OpBitwiseAnd |
| 38 |
// VectorShuffle, CompositeExtract, CompositeInsert, not testable atm. |
| 39 |
bool c16 = g || h; // OpLogicalOr |
| 40 |
bool c17 = g && h; // OpLogicalAnd |
| 41 |
bool c18 = !g; // OpLogicalNot |
| 42 |
bool c19 = g == h; // OpLogicalEqual |
| 43 |
bool c20 = g != h; // OpLogicalNotEqual |
| 44 |
// OpSelect not testable atm. |
| 45 |
bool c21 = c == d; // OpIEqual |
| 46 |
bool c22 = c != d; // OpINotEqual |
| 47 |
bool c23 = c < d; // OpSLessThan |
| 48 |
bool c24 = e < f; // OpULessThan |
| 49 |
bool c25 = c > d; // OpSGreaterThan |
| 50 |
bool c26 = e > f; // OpUGreaterThan |
| 51 |
bool c27 = c <= d; // OpSLessThanEqual |
| 52 |
bool c28 = e <= f; // OpULessThanEqual |
| 53 |
bool c29 = c >= d; // OpSGreaterThanEqual |
| 54 |
bool c30 = e >= f; // OpUGreaterThanEqual |
| 55 |
// OpQuantizeToF16 not testable atm. |
| 56 |
|
| 57 |
int c31 = c8 + c3; |
| 58 |
|
| 59 |
int c32 = int(e); // OpIAdd with different types. |
| 60 |
bool c33 = bool(c); // int -> bool |
| 61 |
bool c34 = bool(e); // uint -> bool |
| 62 |
int c35 = int(g); // bool -> int |
| 63 |
uint c36 = uint(g); // bool -> uint |
| 64 |
float c37 = float(g); // bool -> float |
| 65 |
|
| 66 |
FragColor = vec4(t0 + t1); |
| 67 |
} |