diff options
author | Marek Olšák <[email protected]> | 2020-05-08 22:16:42 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-02 20:01:18 +0000 |
commit | a052a9c27777fc2cc92ed7ac3cd820e828abf2f0 (patch) | |
tree | ae41c54be09f5849f860789e38cbe9ff973146ea /src/compiler/glsl/opt_minmax.cpp | |
parent | 9c14a87839d2937e07f69418285bbfc3c5b3e629 (diff) |
glsl: handle int16 and uint16 types and add instructions for mediump
v2: add more changes to ir_validate.cpp
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5002>
Diffstat (limited to 'src/compiler/glsl/opt_minmax.cpp')
-rw-r--r-- | src/compiler/glsl/opt_minmax.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/compiler/glsl/opt_minmax.cpp b/src/compiler/glsl/opt_minmax.cpp index 36fe0a9f05b..9f20ff87f22 100644 --- a/src/compiler/glsl/opt_minmax.cpp +++ b/src/compiler/glsl/opt_minmax.cpp @@ -110,6 +110,22 @@ compare_components(ir_constant *a, ir_constant *b) i < components; c0 += a_inc, c1 += b_inc, ++i) { switch (a->type->base_type) { + case GLSL_TYPE_UINT16: + if (a->value.u16[c0] < b->value.u16[c1]) + foundless = true; + else if (a->value.u16[c0] > b->value.u16[c1]) + foundgreater = true; + else + foundequal = true; + break; + case GLSL_TYPE_INT16: + if (a->value.i16[c0] < b->value.i16[c1]) + foundless = true; + else if (a->value.i16[c0] > b->value.i16[c1]) + foundgreater = true; + else + foundequal = true; + break; case GLSL_TYPE_UINT: if (a->value.u[c0] < b->value.u[c1]) foundless = true; @@ -183,6 +199,16 @@ combine_constant(bool ismin, ir_constant *a, ir_constant *b) ir_constant *c = a->clone(mem_ctx, NULL); for (unsigned i = 0; i < c->type->components(); i++) { switch (c->type->base_type) { + case GLSL_TYPE_UINT16: + if ((ismin && b->value.u16[i] < c->value.u16[i]) || + (!ismin && b->value.u16[i] > c->value.u16[i])) + c->value.u16[i] = b->value.u16[i]; + break; + case GLSL_TYPE_INT16: + if ((ismin && b->value.i16[i] < c->value.i16[i]) || + (!ismin && b->value.i16[i] > c->value.i16[i])) + c->value.i16[i] = b->value.i16[i]; + break; case GLSL_TYPE_UINT: if ((ismin && b->value.u[i] < c->value.u[i]) || (!ismin && b->value.u[i] > c->value.u[i])) |