[Mesa-dev] [PATCH 1/2] r600g: LIT: swap MUL_LIT operands to fix 0^0

2011-07-05 Thread Vadim Girlin
For 0^0 case result of "LOG_CLAMPED ...,0" is -MAX_FLOAT, and then result of "MUL_LIT ...,0,-MAX_FLOAT,..." is -MAX_FLOAT instead of 0 because of special src1 checks for -MAX_FLOAT. So swap src0/1: "MUL_LIT ...,-MAX_FLOAT,0,..." to get expected 0, then result of "EXP_IEEE ...,0" is 1 as expected

[Mesa-dev] [PATCH 2/2] r600g: RSQ: clear NEG for operand

2011-07-05 Thread Vadim Girlin
Need to clear NEG bit because it applies after ABS, e.g. "RSQ ..., -1" uses -|1| as operand. Signed-off-by: Vadim Girlin --- src/gallium/drivers/r600/r600_shader.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drive

[Mesa-dev] [PATCH 0/2] r600g: fixes for LIT & RSQ

2011-07-05 Thread Vadim Girlin
These patches should fix the following piglit glean tests for r600g: #1 fp1-LIT test 2 (degenerate case: 0 ^ 0 -> 1) vp1-LIT test 2 (degenerate case: 0 ^ 0 -> 1) #2 fp1-RSQ test 2 (reciprocal square root of negative value) vp1-RSQ test 2 (reciprocal square root of

[Mesa-dev] [PATCH 11/11] glsl: Lower break instructions when necessary at the end of a loop.

2011-07-05 Thread Paul Berry
Normally lower_jumps.cpp doesn't need to lower a break instruction that occurs at the end of a loop, because all back-ends can produce proper GPU instructions for a break instruction in this "canonical" location. However, if other break instructions within the loop are already being lowered, then

[Mesa-dev] [PATCH 10/11] glsl: In lower_jumps.cpp, lower both branches of a conditional.

2011-07-05 Thread Paul Berry
Previously, lower_jumps.cpp would break out of its loop after lowering a jump instruction in just the then- or else-branch of a conditional, and it would fail to lower a jump instruction occurring in the other branch. Without this patch, lower_jumps.cpp may require multiple passes in order lower a

[Mesa-dev] [PATCH 09/11] glsl: Use foreach_list in lower_jumps.cpp

2011-07-05 Thread Paul Berry
The visitor class in lower_jumps.cpp never removes or replaces the instruction being visited, but it frequently alters or removes the instructions that follow it. Therefore, in order to be safe, it needs to iterate through exec_lists using foreach_list rather than visit_exec_list(). Without this

[Mesa-dev] [PATCH 08/11] glsl: lower unconditional returns and continues in loops.

2011-07-05 Thread Paul Berry
Previously, lower_jumps.cpp would only lower return and continue statements that appeared inside conditionals. This patch makes it lower unconditional returns and continue statements that occur inside a loop. Such unconditional flow control statements would be unlikely to be explicitly coded by a

[Mesa-dev] [PATCH 07/11] glsl: Lower unconditional return statements.

2011-07-05 Thread Paul Berry
Previously, lower_jumps.cpp only lowered return statements that appeared inside of an if statement. Without this patch, lower_jumps.cpp might not lower certain return statements, causing some back-ends to fail (as in bug #36669). Fixes unit test test_lower_returns_1. --- src/glsl/lower_jumps.cpp

[Mesa-dev] [PATCH 06/11] glsl: Refactor logic for determining whether to lower return statements.

2011-07-05 Thread Paul Berry
Previously, do_lower_jumps.cpp determined whether to lower return statements in ir_lower_jumps_visitor::should_lower_jumps(). Moved this logic to ir_lower_jumps_visitor::visit(ir_function_signature *), so that it can be used in determining whether to lower a return statement at the end of a functi

[Mesa-dev] [PATCH 05/11] glsl: Add explanatory comments to lower_jumps.cpp.

2011-07-05 Thread Paul Berry
No functional change. --- src/glsl/lower_jumps.cpp | 336 -- 1 files changed, 322 insertions(+), 14 deletions(-) diff --git a/src/glsl/lower_jumps.cpp b/src/glsl/lower_jumps.cpp index dd2601d..da85c6b 100644 --- a/src/glsl/lower_jumps.cpp +++ b/src/gls

[Mesa-dev] [PATCH 04/11] glsl: Add a unit test for lower_jumps.cpp

2011-07-05 Thread Paul Berry
This test invokes do_lower_jumps() in isolation (using the glsl_test executable) and verifies that it transforms the IR in the expected way. The unit test may be run from the top level directory using "make check". --- Makefile |6 +- src/glsl/testing/lower_jumps.py |

[Mesa-dev] [PATCH 03/11] glsl: Create a standalone executable for testing optimization passes.

2011-07-05 Thread Paul Berry
This patch adds a new build artifact, glsl_test, which can be used for testing optimization passes in isolation. I'm hoping that we will be able to add other useful standalone tests to this executable in the future. Accordingly, it is built in a modular fashion: the main() function uses its first

[Mesa-dev] [PATCH 02/11] glsl: Make ir_reader able to read plain (return) statements.

2011-07-05 Thread Paul Berry
Previously ir_reader was only able to handle return of non-void. This patch is necessary in order to allow optimization passes to be tested in isolation. --- src/glsl/ir_reader.cpp | 24 +--- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/glsl/ir_reader

[Mesa-dev] [PATCH 01/11] glsl: Remove unused function prototypes.

2011-07-05 Thread Paul Berry
No functional change. Remove prototypes for do_mod_to_fract() and do_sub_to_add_neg(), which haven't existed since November 2010. --- src/glsl/ir_optimization.h |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index

[Mesa-dev] glsl: Improvements to lower_jumps.cpp

2011-07-05 Thread Paul Berry
The following patch series fixes bug #36669 (EmitNoMainReturn set to 1 doesn't make the GLSL compiler lower all the RET opcodes) as well as several other bugs I found in the course of reviewing lower_jumps.cpp. Some of these bugs prevented certain jumps from ever being lowered, or produced asserti

Re: [Mesa-dev] [PATCH] st/glx: Fix endless loop in drawable validation

2011-07-05 Thread Jose Fonseca
I didn't reproduce this issue here yet, but this looks like a sensible thing to do regardless -- we should never invalidate anything if the size does not change. Jose - Original Message - > This fixes a regression introduced with commit > > "st-api: Rework how drawables are invalidated