aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/program/prog_optimize.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: fix prog_optimize.c assertions triggered by SWZ opcodeBrian Paul2014-09-181-5/+4
| | | | | | | | | | | | | The SWZ instruction can have swizzle terms >4 (SWIZZLE_ZERO, SWIZZLE_ONE). These swizzle terms caused a few assertions to fail. This started happening after the commit "mesa: Actually use the Mesa IR optimizer for ARB programs." when replaying some apitrace files. A new piglit test (tests/asmparsertest/shaders/ARBfp1.0/swz-08.txt) exercises this. Cc: "10.3" <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* Eliminate several cases of multiplication in arguments to callocCarl Worth2014-09-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | In commit 32f2fd1c5d6088692551c80352b7d6fa35b0cd09, several calls to _mesa_calloc(x) were replaced with calls to calloc(1, x). This is strictly equivalent to what the code was doing previously. But for cases where "x" involves multiplication, now that we are explicitly using the two-argument calloc, we can do one step better and replace: calloc(1, A * B); with: calloc(A, B); The advantage of the latter is that calloc will detect any overflow that would have resulted from the multiplication and will fail the allocation, (whereas the former would return a small allocation). So this fix can change potentially exploitable buffer overruns into segmentation faults. Reviewed-by: Matt Turner <[email protected]>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* mesa: Remove prog_instruction.h field for never-supported NV_vertex_program3.Eric Anholt2012-10-151-1/+0
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: Remove Mesa IR opcodes that existed only for NV_vertex_program.Eric Anholt2012-10-151-2/+0
| | | | | | v2: Remove dead positive() function, caught by Matt. Reviewed-by: Brian Paul <[email protected]> (v1)
* Don't cast the return value of malloc/reallocMatt Turner2012-09-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Don't cast the return value of malloc/realloc. // // Casting the return value of malloc/realloc only stands to hide // errors. @@ type T; expression E1, E2; @@ - (T) ( _mesa_align_calloc(E1, E2) | _mesa_align_malloc(E1, E2) | calloc(E1, E2) | malloc(E1) | realloc(E1, E2) )
* mesa: Add partial constant propagation pass for Mesa IRIan Romanick2011-08-161-0/+2
| | | | | | | | | | | | This cleans up some code generated by the IR-to-Mesa pass for i915. In particular, some shaders involving arrays of constant matrices result in really bad code. v2: Silence several warnings from merging the gl_constant_value work. Fix DP[23] folding. Add support for a bunch more opcodes that appear in piglit runs on i915. Reviewed-by: Eric Anholt <[email protected]>
* prog_optimize: Add support for saturates to _mesa_merge_mov_into_inst.Eric Anholt2011-08-051-3/+5
| | | | | This fixes the remaining regression from ff_fragment_shader in Mesa IR instruction count, to now being a 1.9% win overall.
* prog_optimize: Set unused regs to PROGRAM_UNDEFINED after CMP->MOV conversionIan Romanick2011-07-231-0/+9
| | | | | | | | | | | | | | | | | | | Leaving the unused registers with other values caused assertion failures and other problems in places that blindly iterate over all sources. brw_vs_emit.c:1381: get_src_reg: Assertion `c->regs[file][index].nr != 0' failed. Fixes i965 piglit: vs-uniform-array-mat[234]-col-row-rd vs-uniform-array-mat[234]-index-col-row-rd vs-uniform-array-mat[234]-index-row-rd vs-uniform-mat[234]-col-row-rd Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* prog_optimize: fix a warning that a variable may be uninitializedMarek Olšák2011-07-151-0/+3
|
* prog_optimize: Add simplify CMP optimization passTom Stellard2011-04-161-0/+78
| | | | | | | This pass coverts CMP T0, T1 T2 T0 -> MOV T0, T2 when the CMP instruction is the first instruction to write to register T0. This pass is useful for hardware that requires a lot of lowering passes that generate many CMP instructions.
* prog_optimize: get_src_arg_mask() respect writemask for more opcodesTom Stellard2011-04-161-0/+11
| | | | Reviewed-by: Eric Anholt <[email protected]>
* prog_optimize: Fix reallocating registers for shaders with loopsTom Stellard2011-03-311-3/+14
| | | | | | | | | | | Registers that are used inside of loops need to be considered live starting with the first instruction of the outermost loop. https://bugs.freedesktop.org/show_bug.cgi?id=34370 NOTE: This is a candidate for the 7.9 and 7.10 branches. Reviewed-by: Eric Anholt <[email protected]>
* Drop GLcontext typedef and use struct gl_context insteadKristian Høgsberg2010-10-131-2/+2
|
* prog_optimize: Only merge writes to temporary registersBenjamin Segovia2010-08-171-1/+5
| | | | | | In one optimization pass, register files may have been messed therefore merging instructions which use the same index in two different register files.
* Merge branch 'glsl2'Ian Romanick2010-08-161-33/+45
|\ | | | | | | | | Conflicts: src/mesa/program/prog_optimize.c
| * mesa: Allow large temporary indices coming into the temporary reg allocator.Eric Anholt2010-07-271-21/+27
| | | | | | | | | | This gets glsl-vs-raytrace, glsl-fs-raytrace running on the new compiler.
| * Merge remote branch 'origin/master' into glsl2Eric Anholt2010-07-261-17/+23
| | | | | | | | | | | | | | | | | | | | | | This pulls in multiple i965 driver fixes which will help ensure better testing coverage during development, and also gets past the conflicts of the src/mesa/shader -> src/mesa/program move. Conflicts: src/mesa/Makefile src/mesa/main/shaderapi.c src/mesa/main/shaderobj.h
* | mesa: assorted clean-ups, var type changes, assertions in prog_optimize.cBrian Paul2010-08-131-30/+63
| |
* | mesa: more/better program optimizationsBenjamin Segovia2010-08-131-219/+385
|/ | | | | | | This is the patch from Benjamin's Aug 11, 2010 email with minor fixes (such as moving declarations before code) Signed-off-by: Brian Paul <[email protected]>
* mesa: rename src/mesa/shader/ to src/mesa/program/Brian Paul2010-06-101-0/+1035