Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1126)

Unified Diff: media-libs/mesa/files/7.9-glsl-vector-compare.patch

Issue 5925002: Switch to Mesa 7.9. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/chromiumos-overlay.git@master
Patch Set: Switch to Mesa 7.9 version 2. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media-libs/mesa/files/7.9-glisbuffer.patch ('k') | media-libs/mesa/files/7.9-optimize-discards.patch » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media-libs/mesa/files/7.9-glsl-vector-compare.patch
diff --git a/media-libs/mesa/files/7.9-glsl-vector-compare.patch b/media-libs/mesa/files/7.9-glsl-vector-compare.patch
new file mode 100644
index 0000000000000000000000000000000000000000..9b30e45c5ecdb361dbcf887d3d7baf8b3656c60f
--- /dev/null
+++ b/media-libs/mesa/files/7.9-glsl-vector-compare.patch
@@ -0,0 +1,150 @@
+From e16c9d5d03a4606b37cbeb84358925913086d6eb Mon Sep 17 00:00:00 2001
+From: Kenneth Graunke <kenneth@whitecape.org>
+Date: Wed, 17 Nov 2010 18:40:28 +0000
+Subject: glsl: Fix constant expression handling for <, >, <=, >= on vectors.
+
+ir_binop_less, ir_binop_greater, ir_binop_lequal, and ir_binop_gequal
+are defined to work on vectors as well as scalars, as long as the two
+operands have the same type.
+
+This is evident from both ir_validate.cpp and our use of these opcodes
+in the GLSL lessThan, greaterThan, lessThanEqual, greaterThanEqual
+built-in functions.
+
+Found by code inspection. Not known to fix any bugs. Presumably, our
+tests for the built-in comparison functions must pass because C.E.
+handling is done on the ir_call of "greaterThan" rather than the inlined
+opcode. The C.E. handling of the built-in function calls is correct.
+
+NOTE: This is a candidate for the 7.9 branch.
+---
+diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
+index a6713e5..7402468 100644
+--- a/src/glsl/ir_constant_expression.cpp
++++ b/src/glsl/ir_constant_expression.cpp
+@@ -581,63 +581,75 @@ ir_expression::constant_expression_value()
+ break;
+
+ case ir_binop_less:
+- switch (op[0]->type->base_type) {
+- case GLSL_TYPE_UINT:
+- data.b[0] = op[0]->value.u[0] < op[1]->value.u[0];
+- break;
+- case GLSL_TYPE_INT:
+- data.b[0] = op[0]->value.i[0] < op[1]->value.i[0];
+- break;
+- case GLSL_TYPE_FLOAT:
+- data.b[0] = op[0]->value.f[0] < op[1]->value.f[0];
+- break;
+- default:
+- assert(0);
++ assert(op[0]->type == op[1]->type);
++ for (unsigned c = 0; c < op[0]->type->components(); c++) {
++ switch (op[0]->type->base_type) {
++ case GLSL_TYPE_UINT:
++ data.b[0] = op[0]->value.u[0] < op[1]->value.u[0];
++ break;
++ case GLSL_TYPE_INT:
++ data.b[0] = op[0]->value.i[0] < op[1]->value.i[0];
++ break;
++ case GLSL_TYPE_FLOAT:
++ data.b[0] = op[0]->value.f[0] < op[1]->value.f[0];
++ break;
++ default:
++ assert(0);
++ }
+ }
+ break;
+ case ir_binop_greater:
+- switch (op[0]->type->base_type) {
+- case GLSL_TYPE_UINT:
+- data.b[0] = op[0]->value.u[0] > op[1]->value.u[0];
+- break;
+- case GLSL_TYPE_INT:
+- data.b[0] = op[0]->value.i[0] > op[1]->value.i[0];
+- break;
+- case GLSL_TYPE_FLOAT:
+- data.b[0] = op[0]->value.f[0] > op[1]->value.f[0];
+- break;
+- default:
+- assert(0);
++ assert(op[0]->type == op[1]->type);
++ for (unsigned c = 0; c < op[0]->type->components(); c++) {
++ switch (op[0]->type->base_type) {
++ case GLSL_TYPE_UINT:
++ data.b[c] = op[0]->value.u[c] > op[1]->value.u[c];
++ break;
++ case GLSL_TYPE_INT:
++ data.b[c] = op[0]->value.i[c] > op[1]->value.i[c];
++ break;
++ case GLSL_TYPE_FLOAT:
++ data.b[c] = op[0]->value.f[c] > op[1]->value.f[c];
++ break;
++ default:
++ assert(0);
++ }
+ }
+ break;
+ case ir_binop_lequal:
+- switch (op[0]->type->base_type) {
+- case GLSL_TYPE_UINT:
+- data.b[0] = op[0]->value.u[0] <= op[1]->value.u[0];
+- break;
+- case GLSL_TYPE_INT:
+- data.b[0] = op[0]->value.i[0] <= op[1]->value.i[0];
+- break;
+- case GLSL_TYPE_FLOAT:
+- data.b[0] = op[0]->value.f[0] <= op[1]->value.f[0];
+- break;
+- default:
+- assert(0);
++ assert(op[0]->type == op[1]->type);
++ for (unsigned c = 0; c < op[0]->type->components(); c++) {
++ switch (op[0]->type->base_type) {
++ case GLSL_TYPE_UINT:
++ data.b[0] = op[0]->value.u[0] <= op[1]->value.u[0];
++ break;
++ case GLSL_TYPE_INT:
++ data.b[0] = op[0]->value.i[0] <= op[1]->value.i[0];
++ break;
++ case GLSL_TYPE_FLOAT:
++ data.b[0] = op[0]->value.f[0] <= op[1]->value.f[0];
++ break;
++ default:
++ assert(0);
++ }
+ }
+ break;
+ case ir_binop_gequal:
+- switch (op[0]->type->base_type) {
+- case GLSL_TYPE_UINT:
+- data.b[0] = op[0]->value.u[0] >= op[1]->value.u[0];
+- break;
+- case GLSL_TYPE_INT:
+- data.b[0] = op[0]->value.i[0] >= op[1]->value.i[0];
+- break;
+- case GLSL_TYPE_FLOAT:
+- data.b[0] = op[0]->value.f[0] >= op[1]->value.f[0];
+- break;
+- default:
+- assert(0);
++ assert(op[0]->type == op[1]->type);
++ for (unsigned c = 0; c < op[0]->type->components(); c++) {
++ switch (op[0]->type->base_type) {
++ case GLSL_TYPE_UINT:
++ data.b[0] = op[0]->value.u[0] >= op[1]->value.u[0];
++ break;
++ case GLSL_TYPE_INT:
++ data.b[0] = op[0]->value.i[0] >= op[1]->value.i[0];
++ break;
++ case GLSL_TYPE_FLOAT:
++ data.b[0] = op[0]->value.f[0] >= op[1]->value.f[0];
++ break;
++ default:
++ assert(0);
++ }
+ }
+ break;
+ case ir_binop_equal:
+--
+cgit v0.8.3-6-g21f6
« no previous file with comments | « media-libs/mesa/files/7.9-glisbuffer.patch ('k') | media-libs/mesa/files/7.9-optimize-discards.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698