summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Rework assignments with write_masks to have LHS chan count match RHS.Eric Anholt2010-09-223-37/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
* glsl/builtins: Switch comparison functions to just return an expression.Kenneth Graunke2010-09-184-180/+36
|
* glsl/builtins: Fix equal and notEqual builtins.Kenneth Graunke2010-09-182-24/+24
| | | | | Commit 309cd4115b7cba669a0bf858e7809cb6dae90ddf incorrectly converted these to all_equal and any_nequal, which is the wrong operation.
* glsl2: Port equal() and notEqual() to ir_unop_all_equal and ir_unop_any_nequalIan Romanick2010-09-132-120/+24
|
* glsl2: Implement noise[1234] built-in functions using ir_unop_noiseIan Romanick2010-09-094-52/+229
|
* glsl/builtins: normalize of a negative scalar should be -1.0.Kenneth Graunke2010-09-091-1/+1
|
* glsl/builtins: Set the API in the fake context.Kenneth Graunke2010-09-081-0/+1
| | | | Otherwise it gets used uninitialized.
* glsl2: Clear out profile pointers in _mesa_glsl_release_functionsIan Romanick2010-09-081-0/+1
| | | | | | Otherwise builtin_profiles contains dangling pointers the next time _mesa_read_profile is called. I suspect this may fix bugzilla #29847, but I was never able to reproduce it.
* glsl: Fix for scalar float built-in definitions.Kenneth Graunke2010-09-082-2/+2
| | | | These need abs, and we need more tests.
* glsl: Fix typo in builtin step() using a wrong channel.Eric Anholt2010-09-081-1/+1
|
* glsl/builtins: Don't use ir_binop_dot on floating point values.Kenneth Graunke2010-09-084-6/+6
| | | | ir_binop_dot is only defined for vector types. Use ir_binop_mul.
* glsl/builtins: Simplify degenerate scalar float cases.Kenneth Graunke2010-09-083-5/+3
| | | | | | | The code being generated was just stupid, considering that: - normalize(x) = 1.0 - length(x) = x - distance(x, y) = x - y
* glsl2: Make sure _mesa_glsl_parse_state constructor gets a contextIan Romanick2010-09-081-1/+2
| | | | | Fix an major regression in dc754586. Too bad that change was obviously never tested.
* glsl: Add built-in function profiles for GLSL ES 1.00.Kenneth Graunke2010-09-072-0/+600
|
* glsl/builtins: Convert assignments to new format (with write mask).Kenneth Graunke2010-09-0415-398/+389
|
* glsl/builtins: Actually print the info log if reading a builtin failed.Kenneth Graunke2010-09-041-0/+1
|
* glsl: Add forgotten implementations of equal/notEqual on bvecs.Kenneth Graunke2010-09-012-0/+60
|
* glsl2: fix bug in atan(y, x) functionBrian Paul2010-08-311-7/+3
| | | | When x==0, the result was wrong. Fixes piglit glsl-fs-atan-1.shader_test
* glsl: Clear the static values of builtin function profiles at release.Eric Anholt2010-08-301-19/+37
| | | | | | | 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.
* 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.
* glsl: Use a single shared namespace in the symbol table.Kenneth Graunke2010-08-261-0/+1
| | | | | | | | | | | | 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.
* glsl: Include main/core.h.Chia-I Wu2010-08-241-1/+1
| | | | Make glsl include only main/core.h from core mesa.
* mesa: Add new ir_unop_any() expression operation.Eric Anholt2010-08-231-3/+3
| | | | | | | 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)
* generate_builtins.py: Generate output in sorted order.Kenneth Graunke2010-08-231-5/+6
|
* generate_builtins.py: Remove unused import sys.Vinson Lee2010-08-211-1/+1
|
* generate_builtins.py: Clean up generated output a bit.Kenneth Graunke2010-08-181-0/+12
| | | | | | | | This should make it easier to diff the output, clean up some of the insane whitespace, and make the strings a bit smaller. We'll probably need to split up the prototype strings eventually, but for now, this gets it under the 65K mark.
* glsl/builtins: Add forgotten hyperbolic trig builtins in 1.30 profiles.Kenneth Graunke2010-08-182-0/+64
|
* glsl2: Fix cut and paste error in EXT_texture_array builtins.Kenneth Graunke2010-08-172-4/+4
| | | | Fixes fd.o bug #29629.
* glsl2: Add builtins profile for GLSL 1.30.Kenneth Graunke2010-08-162-0/+1986
| | | | | Many functions are currently wrapped with #if 0 since we haven't implemented them yet.
* glsl2: Rework builtin function generation.Kenneth Graunke2010-08-1398-2332/+2499
| | | | | | | | | | | | | | | | Each language version/extension and target now has a "profile" containing all of the available builtin function prototypes. These are written in GLSL, and come directly out of the GLSL spec (except for expanding genType). A new builtins/ir/ folder contains the hand-written IR for each builtin, regardless of what version includes it. Only those definitions that have prototypes in the profile will be included. The autogenerated IR for texture builtins is no longer written to disk, so there's no longer any confusion as to what's hand-written or generated. All scripts are now in python instead of perl.
* glsl2: Use Elements from main/compiler.h instead of open-codingIan Romanick2010-08-121-4/+1
|
* texture_builtins.py: Remove useless comments.Kenneth Graunke2010-08-101-2/+2
|
* texture_builtins.py: Fix cut and paste errors in function names.Kenneth Graunke2010-08-093-4/+4
| | | | Some signatures were being generated with the wrong function name.
* glsl2: Fix expression type in builtin tan().Eric Anholt2010-08-021-3/+3
| | | | Fixes glsl-fs-tan-1.
* glsl2: Fix the implementation of atan(y, x).Eric Anholt2010-07-301-83/+83
| | | | | | | | | | | | | | | | So many problems here. One is that we can't do the quadrant handling for all the channels at the same time, so we call the float(y, x) version multiple times. I'd also left out the x == 0 handling. Also, the quadrant handling was broken for y == 0, so there was a funny discontinuity on the +x side if you plugged in obvious values to test. I generated the atan(float y, float x) code from a short segment of GLSL and pasted it in by hand. It would be nice to automate that somehow. Fixes: glsl-fs-atan-1 glsl-fs-atan-2
* glsl2: Fix outerProduct builtin.Kenneth Graunke2010-07-282-51/+51
| | | | The type signatures were completely backwards.
* glsl2/builtins: Add 1.30 bvec variant of the "mix" builtin.Kenneth Graunke2010-07-221-0/+39
|
* glsl2/builtins: Fix 1.30 sign implementation for ints.Kenneth Graunke2010-07-221-1/+1
|
* glsl2/builtins: Fix "mod" builtin to use scalar/vector operations.Kenneth Graunke2010-07-221-24/+3
|
* glsl2: Fix the type of (1.0 - arg2) for mix(gen, gen, float).Eric Anholt2010-07-221-3/+3
| | | | | | | Previously, we'd constant-fold up a value of vec4(1.0 - arg2, 0, 0, 0). Fixes: glsl1-mix(vec4) function
* linker: Link built-in functions instead of including them in every shaderIan Romanick2010-07-212-12/+55
| | | | | | | | This is an invasive set of changes. Each user shader tracks a set of other shaders that contain built-in functions. During compilation, function prototypes are imported from these shaders. During linking, the shaders are linked with these built-in-function shaders just like with any other shader.
* glsl2: Fix asin() implementation.Eric Anholt2010-07-201-61/+69
| | | | | | | | | | I'd flipped around the order of two operations in paren-balancing adventures, and left out the multiply by sign(x) required for negative x. Fixes: glsl1-acos(vec4) function glsl1-asin(vec4) function glsl1-atan(vec4) function
* glsl2: notEqual() produces a boolean value, not the base type of the args.Eric Anholt2010-07-201-18/+18
| | | | | | Fixes: glsl1-vector relational (bvec2 ==,!=) glsl1-vector relational (vec4 !=)
* glsl2: Use Elements macroIan Romanick2010-07-191-2/+5
|
* glsl2: Fix the expression type for atan's pi * sign(y).Eric Anholt2010-07-191-4/+4
| | | | Fixes CorrectFunction.vert.
* glsl2: Make cross() be an expression operation.Eric Anholt2010-07-181-11/+1
| | | | | | ARB_fp, ARB_vp, Mesa IR, and the 965 vertex shader all have instructions for cross. Shaves 12 Mesa instructions off of a 66-instruction shader I have.
* glsl2/builtins: Rework clamp to use scalar/vector combinations.Kenneth Graunke2010-07-142-45/+9
|
* glsl2/builtins: Rework min/max to use scalar/vector combinations.Kenneth Graunke2010-07-144-144/+18
|
* glsl: Fix the setup of refract()'s output for vec3/vec4 and k < 0.0.Eric Anholt2010-07-071-2/+2
| | | | caught by valgrind.
* glsl2/builtins: Use vector ops in the 130 version of "sign."Kenneth Graunke2010-07-021-15/+3
|