summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Remove SGI_color_matrix.Eric Anholt2010-09-232-32/+0
| | | | Another optional ARB_imaging subset extension.
* ir_to_mesa: Only compare vector_elements present for any_nequal/all_equalEric Anholt2010-09-221-2/+18
| | | | Fixes: glsl-mat-from-int-ctor-03
* glsl: Rework assignments with write_masks to have LHS chan count match RHS.Eric Anholt2010-09-221-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* ir_to_mesa: Remove unused member array_indexed from struct statevar_element.Vinson Lee2010-09-171-1/+0
| | | | | Fixes this GCC warning. warning: missing initializer for member 'statevar_element::array_indexed'
* glsl2: Add flags to enable variable index loweringIan Romanick2010-09-171-0/+13
|
* glsl2: fix signed/unsigned comparison warningBrian Paul2010-09-151-2/+2
|
* mesa: Include missing header in program.h.Vinson Lee2010-09-141-0/+1
| | | | Include compiler.h for ASSERT symbol.
* glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmpsLuca Barbieri2010-09-131-1/+7
| | | | | | | | | | | | | | | | | 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 <[email protected]>
* glsl: call ir_lower_jumps according to compiler optionsLuca Barbieri2010-09-131-0/+2
|
* glsl2: Add EmitNoNoise flag, use it to remove noise opcodesIan Romanick2010-09-091-0/+3
|
* glsl2: Add ir_unop_noiseIan Romanick2010-09-091-0/+10
|
* glsl: add several EmitNo* options, and MaxUnrollIterationsLuca Barbieri2010-09-081-2/+2
| | | | | | | | | 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 <[email protected]>
* glsl: make compiler options per-targetLuca Barbieri2010-09-081-3/+9
| | | | | | | This allows us to specify different options, especially useful for chips without unified shaders. Signed-off-by: Ian Romanick <[email protected]>
* mesa: add PIPE_SHADER_* like constants and conversions to/from enums (v2)Luca Barbieri2010-09-081-0/+32
| | | | | Changes in v2: - No longer adds tessellation enums
* glsl: Define GL_ES preprocessor macro if API is OpenGL ES 2.0.Kenneth Graunke2010-09-071-1/+1
| | | | Also define it if #version 100 is encountered.
* ir_to_mesa: Add support for gl_NormalScale.Eric Anholt2010-09-072-0/+7
| | | | Bug #30040.
* glsl: Make sure shader source isn't NULL.Kenneth Graunke2010-09-071-0/+8
| | | | | This should only occur if glCompileShader is called without a prior call to glShaderSource. An empty source program should be the empty string.
* ir_to_mesa: Fix warning in last commit.Eric Anholt2010-09-071-1/+1
| | | | | 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.
* ir_to_mesa: Move the STATE_VAR elements of a builtin uniform to a temp (v2).Eric Anholt2010-09-071-345/+326
| | | | | | | | | | | | | | | | | | 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.
* mesa: don't smash the stack in _mesa_find_used_registersLuca Barbieri2010-09-051-2/+6
| | | | | | At some point this actually triggered, not sure if it still does. Give a meaningful assert and refuse to smash the stack anyway.
* Revert "ir_to_mesa: Load all the STATE_VAR elements of a builtin uniform to ↵Marek Olšák2010-09-041-291/+345
| | | | | | | | | | | | | | 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.
* ir_to_mesa: Handle loops with loop controls setIan Romanick2010-09-031-4/+44
| | | | | | 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.
* mesa: Fix printf-like warning.Vinson Lee2010-09-022-2/+2
|
* mesa: fix code generation for ir_unop_sqrtBrian Paul2010-09-021-2/+3
| | | | | | | The CMP instruction needed to be flipped to properly handle operand==0. Fixes fd.o bug 29923.
* ir_to_mesa: Load all the STATE_VAR elements of a builtin uniform to a temp.Eric Anholt2010-09-011-345/+291
| | | | | | | | | | | | | | | | | | 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.
* ir_to_mesa: Add a little helper for emitting link failure messages.Eric Anholt2010-09-011-24/+22
|
* mesa: more prog_execute.c debug codeBrian Paul2010-09-011-0/+7
|
* ir_to_mesa: When emitting a pixel kill, flag that we did so.Eric Anholt2010-08-311-0/+3
| | | | | | | Both i965 and swrast rely on UsesKill to determine whether to do early depth writes. Fixes glsl-fs-discard-02. Bug #29835.
* ir_to_mesa: Sort the uniform list we're adding to Parameters[] order.Eric Anholt2010-08-311-5/+41
| | | | | | | | | 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
* ir_to_mesa: Fix struct/class confusionnobled2010-08-311-1/+1
|
* ir_to_mesa: Set up our instruction nodes with zeroed data.Eric Anholt2010-08-311-0/+12
| | | | | | cond_update wasn't being set by emit_op3, leading to valgrind complaints, and failures in several piglit tests when built with clang.
* ir_to_mesa: use RSQ+MUL instead of RSQ+RCP for SQRTMarek Olšák2010-08-311-1/+2
| | | | | | | | sqrt(x) = 1/rsq(x) = x*rsq(x) This optimization already was in the old GLSL compiler. Acked on irc by Eric Anholt.
* mesa: Return after assertion failure.José Fonseca2010-08-301-1/+1
| | | | | | Addresses the warnings: warning: ‘target’ may be used uninitialized in this function warning: ‘target_string’ may be used uninitialized in this function
* mesa: Fix _mesa_lookup_parameter_constant's return value.José Fonseca2010-08-301-2/+4
| | | | | | | | | 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.
* ir_to_mesa: Initialize variable in ir_to_mesa_visitor::visit.Vinson Lee2010-08-291-1/+1
| | | | | Fixes piglit glsl-fs-loop valgrind uninitialized value error on softpipe and llvmpipe.
* ir_to_mesa: Don't assume that an ir_dereference_array is of a variable.Eric Anholt2010-08-261-1/+2
| | | | | | | | Fixes: glsl-array-bounds-02 (software) glsl-array-bounds-04 glsl-array-bounds-06 (software) glsl-array-bounds-08
* mesa: Remove now-unused _mesa_add_sampler().Eric Anholt2010-08-252-41/+0
| | | | | | 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.
* ir_to_mesa: Add support for samplers in structures.Eric Anholt2010-08-251-109/+122
| | | | | | | Fixes: glsl-fs-uniform-sampler-struct glsl-fs-sampler-numbering-3 Bug #29690
* mesa: Remove now-unused _mesa_add_uniform.Eric Anholt2010-08-252-35/+0
| | | | | We had to inline it to avoid doing a double-lookup in the process of adding assertion checks.
* ir_to_mesa: Convert this code to using linker.cpp's uniform locations.Eric Anholt2010-08-252-127/+77
| | | | Fixes: glsl-fs-uniform-array-4.
* mesa: Remove the "Used" flag in gl_program_parameter.Eric Anholt2010-08-253-33/+1
| | | | | | 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.
* ir_to_mesa: set IndirectRegisterFilesMarek Olšák2010-08-251-0/+8
| | | | | | | This fixes relative addressing of temporaries (and maybe others) in all gallium drivers. Acked on irc by Eric Anholt.
* glsl: Set up uniform initializers by walking the shaders after linking.Eric Anholt2010-08-241-73/+107
| | | | | | | | | | | | | 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.
* prog_execute: Implement OPCODE_TXLIan Romanick2010-08-241-0/+16
| | | | Fixes bugzilla #29628
* mesa: Add new ir_unop_any() expression operation.Eric Anholt2010-08-231-0/+20
| | | | | | | The previous any() implementation would generate arg0.x || arg0.y || arg0.z. Having an expression operation for this makes it easy for the backend to generate something easier (DPn + SNE for 915 FS, .any predication on 965 VS)
* ir_to_mesa: Implement f2b by comparing the arg to 0, not the result.Eric Anholt2010-08-231-1/+1
| | | | Fixes: glsl-fs-any
* ir_to_mesa: Fix constant array handling to return the temp we created.Eric Anholt2010-08-231-0/+1
| | | | | | | | | | | We ended up returning CONST[loc] rather than TEMP[loc2]. Things would *usually* end up working out OK, since the constants often ended up getting allocated to CONST[loc..loc+columns] with no swizzle. But for the case where the contigous temporary copy of the swizzled constant vec4 args was actually needed, we'd end up reading some other constant values, possibly including ones not actually allocated. Fixes: glsl-varying-mat3x2.
* mesa: Initialize member variables in ir_to_mesa_src_reg constructor.Vinson Lee2010-08-221-0/+4
| | | | The default constructor did not initialize some member variables.
* mesa: Initialize variables in mesa_src_reg_from_ir_src_reg.Vinson Lee2010-08-211-0/+2
|
* glsl: Remove bogus "ambient" field from vec4 gl_TextureEnvColor.Kenneth Graunke2010-08-201-1/+1
|