summaryrefslogtreecommitdiff
path: root/src/mesa/program
AgeCommit message (Collapse)Author
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-10-08mesa: Simplify a bit of _mesa_add_state_reference using memcmp.Eric Anholt
2010-09-29ra: First cut at a graph-coloring register allocator for mesa.Eric Anholt
Notably missing is choice of registers to spill.
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-23mesa: Remove SGI_color_matrix.Eric Anholt
Another optional ARB_imaging subset extension.
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-14mesa: Include missing header in program.h.Vinson Lee
Include compiler.h for ASSERT symbol.
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>
2010-09-13glsl: call ir_lower_jumps according to compiler optionsLuca Barbieri
2010-09-09glsl2: Add EmitNoNoise flag, use it to remove noise opcodesIan Romanick
2010-09-09glsl2: Add ir_unop_noiseIan Romanick
2010-09-08glsl: add several EmitNo* options, and MaxUnrollIterationsLuca Barbieri
This increases the chance that GLSL programs will actually work. Note that continues and returns are not yet lowered, so linking will just fail if not supported. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-08glsl: make compiler options per-targetLuca Barbieri
This allows us to specify different options, especially useful for chips without unified shaders. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-08mesa: add PIPE_SHADER_* like constants and conversions to/from enums (v2)Luca Barbieri
Changes in v2: - No longer adds tessellation enums
2010-09-07glsl: Define GL_ES preprocessor macro if API is OpenGL ES 2.0.Kenneth Graunke
Also define it if #version 100 is encountered.
2010-09-07ir_to_mesa: Add support for gl_NormalScale.Eric Anholt
Bug #30040.
2010-09-07glsl: Make sure shader source isn't NULL.Kenneth Graunke
This should only occur if glCompileShader is called without a prior call to glShaderSource. An empty source program should be the empty string.
2010-09-07ir_to_mesa: Fix warning in last commit.Eric Anholt
I swear there was some git option for "don't push things when you've got uncommitted changes", but I can't find it now.
2010-09-07ir_to_mesa: Move the STATE_VAR elements of a builtin uniform to a temp (v2).Eric Anholt
Like the constant handling and the handling of other uniforms, we add the whole thing to the Parameters, avoiding messy, incomplete logic for adding just the elements of a builting uniform that get used. This means that a driver that relies only on ParameterValues[] for its parameters will have an increased parameter load, but drivers generally don't do that (since they have other params they need to handle, too). Fixes glsl-fs-statevar-call (testcase for Ember). Bug #29687. v2: Continue referencing the STATE_VAR[] file directly when the uniform will land in STATE_VAR[] formatted exactly as we'd put into a temporary. When there's array dereferencing, we don't copy-propagate in Mesa IR (not knowing where the array is in register space), so smarts here are required or we'll massively increase the temp count.
2010-09-05mesa: don't smash the stack in _mesa_find_used_registersLuca Barbieri
At some point this actually triggered, not sure if it still does. Give a meaningful assert and refuse to smash the stack anyway.
2010-09-04Revert "ir_to_mesa: Load all the STATE_VAR elements of a builtin uniform to ↵Marek Olšák
a temp." This reverts commit 5ad74779cea07cc6a19a52874cdaef8b018e2f1b. Sorry, but I had to revert this. Any commit which needlessly increases the number of temporaries is wrong. More temporaries mean less shader performance because of reduced parallelism and therefore less efficient latency hiding. In this case, there is possible performance degradation of every shader which uses GL state variables. I cannot accept this.
2010-09-03ir_to_mesa: Handle loops with loop controls setIan Romanick
The downside of our talloc usage is that we can't really make static (i.e., not created with new) instances of our IR types. This leads to a lot of unnecessary dynamic allocation in this patch.
2010-09-02mesa: Fix printf-like warning.Vinson Lee
2010-09-02mesa: fix code generation for ir_unop_sqrtBrian Paul
The CMP instruction needed to be flipped to properly handle operand==0. Fixes fd.o bug 29923.
2010-09-01ir_to_mesa: Load all the STATE_VAR elements of a builtin uniform to a temp.Eric Anholt
Like the constant handling and the handling of other uniforms, we add the whole thing to the Parameters, avoiding messy, incomplete logic for adding just the elements of a builting uniform that get used. This means that a driver that relies only on ParameterValues[] for its parameters will have an increased parameter load, but drivers generally don't do that (since they have other params they need to handle, too). Fixes glsl-fs-statevar-call (testcase for Ember). Bug #29687. Regresses glsl-vs-array-04 on 965. Thanks to a slight change in register allocation, this test of undefined behavior now wraps around the register space and unexpectedly reads the constant value it's trying to compare to. The test should probably not look at the resulting color, since behavior is undefined.
2010-09-01ir_to_mesa: Add a little helper for emitting link failure messages.Eric Anholt
2010-09-01mesa: more prog_execute.c debug codeBrian Paul
2010-08-31ir_to_mesa: When emitting a pixel kill, flag that we did so.Eric Anholt
Both i965 and swrast rely on UsesKill to determine whether to do early depth writes. Fixes glsl-fs-discard-02. Bug #29835.
2010-08-31ir_to_mesa: Sort the uniform list we're adding to Parameters[] order.Eric Anholt
Fixes glsl-uniform-linking-1 and failure to link a shader in Unigine. An alternative here would be to just ditch using _mesa_add_parameter and build the initial params list on our own, but that would require two walks of the list as well. Bug #29822
2010-08-31ir_to_mesa: Fix struct/class confusionnobled
2010-08-31ir_to_mesa: Set up our instruction nodes with zeroed data.Eric Anholt
cond_update wasn't being set by emit_op3, leading to valgrind complaints, and failures in several piglit tests when built with clang.
2010-08-31ir_to_mesa: use RSQ+MUL instead of RSQ+RCP for SQRTMarek Olšák
sqrt(x) = 1/rsq(x) = x*rsq(x) This optimization already was in the old GLSL compiler. Acked on irc by Eric Anholt.
2010-08-30mesa: Return after assertion failure.José Fonseca
Addresses the warnings: warning: ‘target’ may be used uninitialized in this function warning: ‘target_string’ may be used uninitialized in this function
2010-08-30mesa: Fix _mesa_lookup_parameter_constant's return value.José Fonseca
Fixes gcc warning In function ‘_mesa_add_unnamed_constant’: warning: ‘pos’ may be used uninitialized in this function but also what appears to be a bug.
2010-08-29ir_to_mesa: Initialize variable in ir_to_mesa_visitor::visit.Vinson Lee
Fixes piglit glsl-fs-loop valgrind uninitialized value error on softpipe and llvmpipe.
2010-08-26ir_to_mesa: Don't assume that an ir_dereference_array is of a variable.Eric Anholt
Fixes: glsl-array-bounds-02 (software) glsl-array-bounds-04 glsl-array-bounds-06 (software) glsl-array-bounds-08
2010-08-25mesa: Remove now-unused _mesa_add_sampler().Eric Anholt
We do the generation of "what sampler number within Parameters are we" right in ir_to_mesa.cpp, instead of repeatedly walking the existing list to find out.
2010-08-25ir_to_mesa: Add support for samplers in structures.Eric Anholt
Fixes: glsl-fs-uniform-sampler-struct glsl-fs-sampler-numbering-3 Bug #29690
2010-08-25mesa: Remove now-unused _mesa_add_uniform.Eric Anholt
We had to inline it to avoid doing a double-lookup in the process of adding assertion checks.
2010-08-25ir_to_mesa: Convert this code to using linker.cpp's uniform locations.Eric Anholt
Fixes: glsl-fs-uniform-array-4.
2010-08-25mesa: Remove the "Used" flag in gl_program_parameter.Eric Anholt
This was in place for uniform handling, but nothing actually needs the value now, since presence in a parameter list indicates that the uniform was used as far as the linker was concerned.
2010-08-25ir_to_mesa: set IndirectRegisterFilesMarek Olšák
This fixes relative addressing of temporaries (and maybe others) in all gallium drivers. Acked on irc by Eric Anholt.
2010-08-24glsl: Set up uniform initializers by walking the shaders after linking.Eric Anholt
Previously, uniform initializers were handled by ir_to_mesa as it made its Parameters list. However, uniform values are global to all shaders, and the value set in one Parameters list wasn't propagated to the other gl_program->Parameters lists. By going back through the general Mesa uniform handling, we make sure that all gl_programs get updated values, and also successfully separate uniform initializer handling from ir_to_mesa gl_program generation. Fixes: glsl-uniform-initializer-5.
2010-08-24prog_execute: Implement OPCODE_TXLIan Romanick
Fixes bugzilla #29628