summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl2: Remove unused 'constructor' parameter from glsl_symbol_table::add_typeIan Romanick2010-09-012-6/+4
|
* glsl2: Don't generate constructor functions for structuresIan Romanick2010-09-012-3/+2
|
* glsl2: Emit structure constructors inlineIan Romanick2010-09-011-37/+70
| | | | Fixes piglit test cases glsl-[fv]s-all-0[12].
* glsl: Fix write mask in matrix-from-matrix constructors.Kenneth Graunke2010-09-011-3/+5
| | | | | | | | | | | If the matrix being constructed was larger than the source matrix, it would overwrite the lower-right part of the matrix with the wrong values, rather than leaving it as the identity matrix. For example, constructing a mat4 from a mat2 should only use a writemask of "xy" when copying from the source, but was using "xyzw". Fixes the code generated by piglit test constructor-23.vert.
* glsl: Add proper handling for constant matrix-from-matrix constructors.Kenneth Graunke2010-09-011-0/+25
| | | | | Fixes piglit test case constructor-21.vert and changes constructor-22.vert to give the correct output.
* glsl: Move generate_constructor_(matrix|vector) to ir_constant ctor.Kenneth Graunke2010-09-012-99/+36
|
* ast_function: Fix check for "too few components".Kenneth Graunke2010-09-011-1/+2
| | | | | | | | | This was triggering even for matrix-from-matrix constructors. It is perfectly legal to construct a mat3 from a mat2 - the rest will be filled in by the identity matrix. Changes piglit test constructor-23.vert from FAIL to PASS, but the generated code is incorrect.
* ast_function: Remove bogus cases from generate_constructor_matrix.Kenneth Graunke2010-09-011-29/+8
| | | | There are no integer matrix types, so switching on them is silly.
* glsl: Add forgotten implementations of equal/notEqual on bvecs.Kenneth Graunke2010-09-013-0/+120
|
* glsl2: Perform algebraic simplifications on logical binary operatorsIan Romanick2010-09-011-0/+52
| | | | | Reduces glsl-vs-all-01 from 42 Mesa IR instructions (including the END) to 17.
* glsl2: Allow ir_constant::zero to create boolean constantsIan Romanick2010-09-011-1/+1
|
* glsl2: Disallow function declarations within function definitions in GLSL 1.20Ian Romanick2010-09-011-1/+36
| | | | | | | The GLSL 1.20 spec specifically disallows this, but it was allowed in GLSL 1.10. Fixes piglit test cases local-function-0[13].frag and bugzilla #29921.
* glsl2: fix bug in atan(y, x) functionBrian Paul2010-08-312-13/+9
| | | | When x==0, the result was wrong. Fixes piglit glsl-fs-atan-1.shader_test
* glsl2: Write vector constructor constants in a single assignmentIan Romanick2010-08-311-11/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make two passes over the constructor parameters. Write all of the constants in a single write, then write the non-constants one at a time. This causes the fragment shader varying float g; void main() { gl_FragColor = vec4(0.0, g, 0.0, 1.0); } to generate (function main (signature void (parameters ) ( (declare (temporary ) vec4 vec_ctor@0x8580058) (assign (constant bool (1)) (xzw) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) ) (assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058) (swiz xxxx (var_ref g@0x8580218) )) (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0) (var_ref vec_ctor@0x8580058) ) )) ) instead of (function main (signature void (parameters ) ( (declare (temporary ) vec4 vec_ctor@0x8580058) (assign (constant bool (1)) (x) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) ) (assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058) (swiz xxxx (var_ref g@0x8580218) )) (assign (constant bool (1)) (z) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) ) (assign (constant bool (1)) (w) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) ) (assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0) (var_ref vec_ctor@0x8580058) ) )) ) A similar optimization could be done for matrix constructors, but it is a little more complicate there.
* ast_to_hir: Add support for bit-wise operators (but not shifts).Kenneth Graunke2010-08-311-2/+53
| | | | | | | Previously, using bit-wise operators in some larger expression would crash on a NULL pointer dereference. This code at least doesn't crash. Fixes piglit test bitwise-01.frag.
* linker: Require an exact matching signature when looking for prototypes.Kenneth Graunke2010-08-301-1/+1
| | | | | | | Fixes piglit test glsl-override-builtin. The linker incorrectly found the prototype for the float signature, rather than adding a new prototype with the int return type. This caused ir_calls with type int to have their callees set to the float signature, triggering an assert.
* linker: Handle varying arrays, matrices, and arrays of matricesIan Romanick2010-08-301-6/+15
| | | | Fixes piglit test case glsl-array-varying-01.
* glsl: Clear the static values of builtin function profiles at release.Eric Anholt2010-08-302-152/+104
| | | | | | | When releasing the builtin functions, we were just freeing the memory, not telling the builtin function loader that we had freed its memory. I wish I had done ARB_ES2_compatibility so we had regression testing of this path. Fixes segfault on changing video options in nexuiz.
* glsl2: Commit generated files changed by previous commitIan Romanick2010-08-303-2553/+2646
|
* glsl2: Parse #pragma linesIan Romanick2010-08-302-3/+33
| | | | | | | | All pragmas are currently ignored. Also, the error messages when a pragma is used incorrectly (i.e., '#pragma debug(on)' inside a function) are crap, but I think this is sufficient for now. Fixes piglit test cases pragma-0[1-8].(vert|frag).
* glsl: Silence unused variable warning.José Fonseca2010-08-301-0/+1
|
* linker: Treat sized and unsized array types as the sameIan Romanick2010-08-291-6/+20
| | | | | | | | | | If two shaders contain variables declared with array types that have the same base type but one is sized and the other is not, linking should succeed. I'm not super pleased with the way this is implemented, and I am more convinced than ever that we need more linker tests. We especially need "negative" tests. Fixes bugzilla #29697 and piglit test glsl-link-array-01.
* glsl: Initialize data in ast_function_expression::hir.Vinson Lee2010-08-291-1/+1
| | | | | | | Completely initialize data that is passed to ir_constant constructor. Fixes piglit glsl-orangebook-ch06-bump valgrind uninitialized variable error on softpipe and llvmpipe.
* glsl: Completely initialize value member in ir_constant constructor.Vinson Lee2010-08-291-0/+3
| | | | | | | | | The ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) did not completely initialize the entire value member. Fixes piglit glsl-fs-sampler-numbering-2 valgrind uninitialized value error in softpipe and llvmpipe.
* glsl: Initialize variable in ir_swizzle::constant_expression_value.Vinson Lee2010-08-291-1/+1
| | | | | | | Complete initialize data passed to ir_constant constructor. Fixes piglit glsl-mat-from-int-ctor-02 valgrind unintialized variable error with softpipe and llvmpipe.
* glsl: Initialize data in read_constant.Vinson Lee2010-08-291-1/+1
| | | | | | | Completely initialize data that is passed into a ir_constant constructor. Fixes piglit glsl-fs-mix valgrind uninitialized variable error on softpipe and llvmpipe.
* glsl: Initialize the rest of values of ir_constant::value.Vinson Lee2010-08-281-0/+12
| | | | | Fixes valgrind uninitialized value errors in the piglit shader tests for softpipe and llvmpipe.
* glsl2: Decompose matrix comparison into vector operationsIan Romanick2010-08-271-9/+97
|
* glsl: Rename a couple of common variable names in mat_op_to_vec.Eric Anholt2010-08-271-16/+18
| | | | | It was easy while typing implementations to accidentally overwrite the original expression or assignment variables.
* glsl: Make mat_op_to_vec allocate out of the IR's parent.Eric Anholt2010-08-271-32/+36
| | | | | This will reduce memory consumption of compiled shaders by not dragging optimized-out children around.
* glsl: Regenerate for double destroy fix.Eric Anholt2010-08-271-0/+1
|
* glsl: Protect against double compiler-destroy.Eric Anholt2010-08-271-0/+1
| | | | | DRI was doing teardown when we close the last screen, then an atexit() was added to call it as well.
* glsl2: restructure header file for C++ and C inclusionBrian Paul2010-08-271-8/+28
| | | | As it was, the header could not be cleanly #included by a C source.
* glsl2: remove 'extern' keyword in .c fileBrian Paul2010-08-271-1/+1
|
* glsl: Add a quick hack to constant folding to reduce duplicated work.Eric Anholt2010-08-261-0/+13
| | | | Reduces runtime of glsl-max-varyings 92% on my system.
* scons: Add glsl_symbol_table.cppJosé Fonseca2010-08-261-0/+1
|
* glsl2: Remove a couple FINISHME comments that have already been resolvedIan Romanick2010-08-261-7/+1
|
* glsl: Move built-ins to live beyond the global scope.Kenneth Graunke2010-08-261-4/+20
| | | | | | | | | | Per the GLSL 1.20 specification (presumably a clarification of 1.10). Also, when creating user functions, make a new ir_function that shadows the built-in ir_function, rather than adding new signatures. User functions are supposed to hide built-ins, not overload them. Fixes piglit tests redeclaration-{04, 12, 14}.vert.
* glsl: Move is_built_in flag from ir_function_signature to ir_function.Kenneth Graunke2010-08-268-18/+13
| | | | | | Also rename it to "is_builtin" for consistency. Signed-off-by: Ian Romanick <[email protected]>
* glsl: Refactor variable declaration handling.Kenneth Graunke2010-08-261-36/+41
| | | | | | | | | | | | | Moving the check for an earlier variable declaration helps cleanly separate out the re-declaration vs. new declaration code a bit. With that in place, conflicts between variable names and structure types or function names aren't caught by the earlier "redeclaration" error message, so check the return type on glsl_symbol_table::add_variable and issue an error there. If one occurs, don't emit the initializer. Fixes redeclaration-01.vert and redeclaration-09.vert. Signed-off-by: Ian Romanick <[email protected]>
* glsl: Don't add overloads to existing structure constructors.Kenneth Graunke2010-08-263-4/+9
| | | | | | Instead, make a new ir_function and try to add it to the symbol table. Fixes piglit test redeclaration-08.vert.
* glsl: Remove name_declared_this_scope check when adding functions.Kenneth Graunke2010-08-261-9/+8
| | | | | | Instead, rely on the symbol table's rules. Fixes redeclaration-02.vert.
* glsl: Use a single shared namespace in the symbol table.Kenneth Graunke2010-08-2611-576/+686
| | | | | | | | | | | | As of 1.20, variable names, function names, and structure type names all share a single namespace, and should conflict with one another in the same scope, or hide each other in nested scopes. However, in 1.10, variables and functions can share the same name in the same scope. Structure types, however, conflict with/hide both. Fixes piglit tests redeclaration-06.vert, redeclaration-11.vert, redeclaration-19.vert, and struct-05.vert.
* glsl2: Move ir_expression_flattening to using the rvalue visitor class.Eric Anholt2010-08-261-110/+14
| | | | | | The previous implementation was missing handling of some rvalues, such as "if" conditions, leading to glsl-mat-int-from-ctor-* not getting caught.
* glsl: Don't consider things with a type containing a sampler as an lvalue.Eric Anholt2010-08-251-0/+23
| | | | | | | | | | | | | | | We had ad-hoc handled some common cases by flagging sampler-typed variables as read_only, and rejected initializers of samplers. However, people could sneak them in in all sorts of surprising ways, like using whole-array or structure assignment. Fixes: glslparsertest/glsl2/sampler-01.frag glslparsertest/glsl2/sampler-03.frag glslparsertest/glsl2/sampler-04.frag glslparsertest/glsl2/sampler-06.frag Bug #27403.
* glsl: fix crash with variable indexing into array in a structAras Pranckevicius2010-08-251-1/+7
| | | | Signed-off-by: Ian Romanick <[email protected]>
* ir_to_mesa: Convert this code to using linker.cpp's uniform locations.Eric Anholt2010-08-251-0/+1
| | | | Fixes: glsl-fs-uniform-array-4.
* glsl: Make uniform linking generate separate uniforms for struct members.Eric Anholt2010-08-251-42/+89
| | | | | This is a step towards making the linker code usable as our uniform setup, instead of having it wedged into ir_to_mesa.cpp.
* glsl/mesa: fixes for MSVCAras Pranckevicius2010-08-251-0/+1
| | | | Signed-off-by: Brian Paul <[email protected]>
* glsl: Don't dead-code eliminate a uniform initializer.Eric Anholt2010-08-241-0/+8
| | | | Partial fix for glsl-uniform-initializer-5.