summaryrefslogtreecommitdiff
path: root/src/mesa/program/ir_to_mesa.cpp
AgeCommit message (Collapse)Author
2011-03-14ir_to_mesa: do not check the number of uniforms against hw limitsMarek Olšák
The r300 compiler can eliminate unused uniforms and remap uniform locations if their number surpasses hardware limits, so the limit is actually NumParameters + NumUnusedParameters. This is important for some apps under Wine to run. Wine sometimes declares a uniform array of 256 vec4's and some Wine-specific constants on top of that, so in total there is more uniforms than r300 can handle. This was the main motivation for implementing the elimination of unused constants. We should allow drivers to implement fail & recovery paths where it makes sense, so giving up too early especially when comes to uniforms is not so good idea, though I agree there should be some hard limit for all drivers. This patch fixes: - glsl-fs-uniform-array-5 - glsl-vs-large-uniform-array on drivers which can eliminate unused uniforms.
2011-03-11mesa: test against MaxUniformComponents in check_resources()Brian Paul
Since we're compiling/linking GLSL shaders we should check against the shader uniform limits, not the legacy vertex/fragment program parameter limits which are usually lower.
2011-03-11mesa: move location of some geometry program limitsBrian Paul
The gl_program_constants struct is for limits that are applicable to any/all shader stages. Move the geometry shader-only fields into the gl_constants struct. Remove redundant MaxGeometryUniformComponents field too.
2011-03-11mesa: use check_resources() to check program against limitsBrian Paul
Without these checks we could create shaders with more samplers, constants than the driver could handle. Fail linking rather than dying later.
2011-02-17mesa: Do copy propagation across if-else-endif.José Fonseca
Addresses excessive TEMP allocation in vertex shaders where all CONSTs are stored into TEMPS at the start, but copy propagation was failing due to the presence of IFs. We could do something about loops, but ifs are easy enough.
2011-02-11ir_to_mesa: Don't dereference a NULL pointer during copy propagationIan Romanick
The ACP may already be NULL, so don't try to make it NULL again. This should fix bugzilla #34119.
2011-02-08mesa: Fix the Mesa IR copy propagation to not read past writes to the reg.Eric Anholt
Fixes glsl-vs-post-increment-01. Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-01-31Convert everything from the talloc API to the ralloc API.Kenneth Graunke
2011-01-26glsl: use 'this' pointer to be consistentBrian Paul
2011-01-26glsl: remove needless conditionalBrian Paul
2011-01-26glsl: move ir_var_out codeBrian Paul
2011-01-26glsl: move ir_var_system_value codeBrian Paul
2011-01-26glsl: use local var to simplify code a bitBrian Paul
2011-01-26mesa: Propagate gl_FragDepth layout from GLSL IR to Mesa IRChad Versace
2011-01-25ir_to_mesa: Add several assertions about sizes of arraysIan Romanick
Both of these assertions are triggered by the test case in bugzilla size of 0.
2011-01-15Merge branch 'draw-instanced'Brian Paul
Conflicts: src/gallium/auxiliary/draw/draw_llvm.c src/gallium/drivers/llvmpipe/lp_state_fs.c src/glsl/ir_set_program_inouts.cpp src/mesa/tnl/t_vb_program.c
2011-01-14ir_to_mesa: Fix segfaults on ir_to_mesa invocation after MSVC change.Eric Anholt
2011-01-14mesa: Dynamically allocate acp array in ir_to_mesa_visitor::copy_propagate.Vinson Lee
Fixes these MSVC errors. ir_to_mesa.cpp(2644) : error C2057: expected constant expression ir_to_mesa.cpp(2644) : error C2466: cannot allocate an array of constant size 0 ir_to_mesa.cpp(2644) : error C2133: 'acp' : unknown size ir_to_mesa.cpp(2646) : error C2070: 'ir_to_mesa_instruction *[]': illegal sizeof operand ir_to_mesa.cpp(2709) : error C2070: 'ir_to_mesa_instruction *[]': illegal sizeof operand ir_to_mesa.cpp(2718) : error C2070: 'ir_to_mesa_instruction *[]': illegal sizeof operand
2011-01-14mesa: Add channel-wise copy propagation to ir_to_mesa.Eric Anholt
This catches more opportunities than the prog_optimize.c code on openarena's fixed function shaders turned to GLSL, mostly due to looking at multiple source instructions for copy propagation opportunities. It should also be much more CPU efficient than prog_optimize.c's code.
2010-12-27glsl: Support if-flattening beyond a given maximum nesting depth.Kenneth Graunke
This adds a new optional max_depth parameter (defaulting to 0) to lower_if_to_cond_assign, and makes the pass only flatten if-statements nested deeper than that. By default, all if-statements will be flattened, just like before. This patch also renames do_if_to_cond_assign to lower_if_to_cond_assign, to match the new naming conventions.
2010-12-13ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectorsIan Romanick
This is the same as what the array dereference handler does. Fixes piglit test glsl-link-struct-array (bugzilla #31648). NOTE: This is a candidate for the 7.9 and 7.10 branches.
2010-12-08mesa: ir_to_mesa support for system valuesBrian Paul
2010-12-01glsl: Lower ir_binop_pow to a sequence of EXP2 and LOG2Ian Romanick
2010-12-01glsl: Add a lowering pass to move discards out of if-statements.Kenneth Graunke
This should allow lower_if_to_cond_assign to work in the presence of discards, fixing bug #31690 and likely #31983. NOTE: This is a candidate for the 7.9 branch.
2010-12-01ir_to_mesa: Add support for conditional discards.Marek Olšák
NOTE: This is a candidate for the 7.9 branch. Signed-off-by: Marek Olšák <maraeo@gmail.com> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2010-11-23glsl: start restoring some geometry shader codeBrian Paul
2010-11-23glsl: better handling of linker failuresBrian Paul
Upon link error, exit translation loop, free program instructions. Check for null pointers in calling code.
2010-11-23glsl: use gl_register_file in a few placesBrian Paul
2010-11-23glsl: fix off by one in register index assertionBrian Paul
2010-11-19ir_to_mesa: Detect and emit MOV_SATs for saturate constructs.Eric Anholt
The goal here is to avoid regressing performance on ir_to_mesa drivers for fixed function fragment shaders requiring saturates.
2010-11-19glsl: Combine many instruction lowering passes into one.Kenneth Graunke
This should save on the overhead of tree-walking and provide a convenient place to add more instruction lowering in the future. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-11-19glsl: Add ir_quadop_vector expressionIan Romanick
The vector operator collects 2, 3, or 4 scalar components into a vector. Doing this has several advantages. First, it will make ud-chain tracking for components of vectors much easier. Second, a later optimization pass could collect scalars into vectors to allow generation of SWZ instructions (or similar as operands to other instructions on R200 and i915). It also enables an easy way to generate IR for SWZ instructions in the ARB_vertex_program assembler.
2010-11-19glsl: Eliminate assumptions about size of ir_expression::operandsIan Romanick
This may grow in the near future.
2010-11-19glsl: Add ir_unop_sin_reduced and ir_unop_cos_reducedIan Romanick
The operate just like ir_unop_sin and ir_unop_cos except that they expect their inputs to be limited to the range [-pi, pi]. Several GPUs require this limited range for their sine and cosine instructions, so having these as operations (along with a to-be-written lowering pass) helps this architectures. These new operations also matche the semantics of the GL_ARB_fragment_program SCS instruction. Having these as operations helps in generating GLSL IR directly from assembly fragment programs.
2010-11-18ir_to_mesa: Generate smarter code for some conditional movesIan Romanick
Condiation moves with a condition of (a < 0), (a > 0), (a <= 0), or (a >= 0) can be generated with "a" directly as an operand of the CMP instruction. This doesn't help much now, but it will help with assembly shaders that use the CMP instruction.
2010-11-17glsl: Remove the ir_binop_cross opcode.Kenneth Graunke
2010-11-09ir_to_mesa: Refactor code for emitting DP instructionsIan Romanick
2010-10-14glsl: Slightly change the semantic of _LinkedShadersIan Romanick
Previously _LinkedShaders was a compact array of the linked shaders for each shader stage. Now it is arranged such that each slot, indexed by the MESA_SHADER_* defines, refers to a specific shader stage. As a result, some slots will be NULL. This makes things a little more complex in the linker, but it simplifies things in other places. As a side effect _NumLinkedShaders is removed. NOTE: This may be a candidate for the 7.9 branch. If there are other patches that get backported to 7.9 that use _LinkedShader, this patch should be cherry picked also.
2010-10-14glsl: Add a new ir_unop_round_even opcode for GLSL 1.30's roundEven.Kenneth Graunke
Also, update ir_to_mesa's "1.30 is unsupported" case to "handle" it.
2010-10-13Drop GLcontext typedef and use struct gl_context insteadKristian Høgsberg
2010-10-12glsl: Fix incorrect assertionIan Romanick
This assertion was added in commit f1c1ee11, but it did not notice that the array is accessed with 'size-1' instead of 'size'. As a result, the assertion was off by one. This caused failures in at least glsl-orangebook-ch06-bump.
2010-10-12ir_to_mesa: assorted clean-ups, const qualifiers, new commentsBrian Paul
2010-09-28mesa: Move the list of builtin uniform info from ir_to_mesa to shared code.Eric Anholt
I'm still not pleased with how builtin uniforms are handled, but as long as we're relying on the prog_statevar stuff this seems about as good as it'll get.
2010-09-28mesa: Pull ir_to_mesa's sampler number fetcher out to shared code.Eric Anholt
2010-09-22ir_to_mesa: Only compare vector_elements present for any_nequal/all_equalEric Anholt
Fixes: glsl-mat-from-int-ctor-03
2010-09-22glsl: Rework assignments with write_masks to have LHS chan count match RHS.Eric Anholt
It turns out that most people new to this IR are surprised when an assignment to (say) 3 components on the LHS takes 4 components on the RHS. It also makes for quite strange IR output: (assign (constant bool (1)) (x) (var_ref color) (swiz x (var_ref v) )) (assign (constant bool (1)) (y) (var_ref color) (swiz yy (var_ref v) )) (assign (constant bool (1)) (z) (var_ref color) (swiz zzz (var_ref v) )) But even worse, even we get it wrong, as shown by this line of our current step(float, vec4): (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge)))) where we try to assign a float to the writemasked-out x channel and don't supply anything for the actual w channel we're writing. Drivers right now just get lucky since ir_to_mesa spams the float value across all the source channels of a vec4. Instead, the RHS will now have a number of components equal to the number of components actually being written. Hopefully this confuses everyone less, and it also makes codegen for a scalar target simpler. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-17ir_to_mesa: Remove unused member array_indexed from struct statevar_element.Vinson Lee
Fixes this GCC warning. warning: missing initializer for member 'statevar_element::array_indexed'
2010-09-17glsl2: Add flags to enable variable index loweringIan Romanick
2010-09-15glsl2: fix signed/unsigned comparison warningBrian Paul
2010-09-13glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmpsLuca Barbieri
Currently GLSL IR forbids any vector comparisons, and defines "ir_binop_equal" and "ir_binop_nequal" to compare all elements and give a single bool. This is highly unintuitive and prevents generation of optimal Mesa IR. Hence, first rename "ir_binop_equal" to "ir_binop_all_equal" and "ir_binop_nequal" to "ir_binop_any_nequal". Second, readd "ir_binop_equal" and "ir_binop_nequal" with the same semantics as less, lequal, etc. Third, allow all comparisons to acts on vectors. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>