summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Silence gcc warning "missing initializer for member".José Fonseca2010-08-141-28/+28
|
* Merge branch 'master' into glsl2Ian Romanick2010-08-139-223/+290
|\
| * mesa: increase the relative address offset limit to 4096 in ARB_vp/fpMarek Olšák2010-08-042-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though the spec says that the limits should be -64/+63, proprietary drivers support much larger relative offsets and some applications do depend on this non-standard behavior. Also program_parse.tab.c has been regenerated. This fixes the parser error: ARB_vp: error: relative address offset too large See also: https://bugs.freedesktop.org/show_bug.cgi?id=28628 4096 * sizeof(vec4) is the maximum size of the constant buffer on NV50. It is not supposed to be a definite hardware limit, it is for the parser not to get in the way and let the underlying driver decide whether it can run the shader or not.
| * mesa: Remove inclusion of compiler.h from mtypes.h.Vinson Lee2010-07-311-0/+1
| | | | | | | | | | | | | | mtypes.h does not use any symbols from compiler.h. Also add the required headers for files that depended on symbols from compiler.h but were indirectly including compiler.h through mtypes.h.
| * mesa: Remove unnecessary headers.Vinson Lee2010-07-311-1/+0
| |
| * mesa: added gl_program::IndirectRegisterFiles fieldBrian Paul2010-07-306-210/+222
| | | | | | | | | | | | | | | | Now drivers, etc. can know which register files are accessed with indirect addressing. Before we just checked gl_program::NumAddressRegs but didn't know if that was the constant buffer, temp regs, or what. The only user of this new field so far will be the gallium state tracker.
| * mesa: Include macros.h in files that use symbols from macros.h.Vinson Lee2010-07-301-0/+1
| | | | | | | | Don't rely on inclusion of other files that already include macros.h.
| * mesa: implement RCC opcodeBrian Paul2010-07-291-0/+54
| |
| * mesa: update table of opcodes used by GLSLBrian Paul2010-07-291-8/+8
| |
* | glsl2: Move ir_to_mesa handling to driver CompileShader and LinkShader hooks.Eric Anholt2010-08-132-52/+76
| | | | | | | | | | This lets drivers override ir_to_mesa with their own codegen, or at least have a native alternative.
* | glsl2: Move the common optimization passes to a helper function.Eric Anholt2010-08-131-32/+29
| | | | | | | | | | These are passes that we expect all codegen to be happy with. The other lowering passes for Mesa IR are moved to the Mesa IR generator.
* | glsl2: Use Elements from main/compiler.h instead of open-codingIan Romanick2010-08-121-0/+1
| |
* | mesa: check for null shader->InfoLog before printingBrian Paul2010-08-121-1/+3
| |
* | glsl2: remove stray semicolonBrian Paul2010-08-111-1/+1
| |
* | glsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1))Eric Anholt2010-08-091-0/+1
| | | | | | | | | | | | All the current HW backends transform subtract to adding the negation, so I haven't bothered peepholing it back out in Mesa IR. This allows some subtract of subtract to get removed in ir_algebraic.
* | glsl2: Add constant propagation.Eric Anholt2010-08-091-0/+1
| | | | | | | | | | | | | | | | Whereas constant folding evaluates constant expressions at rvalue nodes, constant propagation tracks constant components of vectors across execution to replace (possibly swizzled) variable dereferences with constant values, triggering possible constant folding or reduced variable liveness.
* | glsl2: Move gl_program->InputsRead/OutputsWritten setting to an ir pass.Eric Anholt2010-08-061-67/+4
| | | | | | | | | | | | | | This lets us handle arrays much better than trying to work backwards from assembly. Fixes fbo-drawbuffers-maxtargets on swrast (i965 needs loop unrolling)
* | ir_to_mesa: Add support for sampler arrays.Eric Anholt2010-08-063-13/+43
| | | | | | | | | | | | | | | | | | Support for samplers in general is still incomplete -- anything in a uniform struct will still be broken. But that doesn't appear to be any different from master. Fixes: glsl-fs-uniform-sampler-array.shader_test
* | glsl2: Don't assert in a couple of places when encountering sampler arrays.Eric Anholt2010-08-061-0/+5
| | | | | | | | Fixes glean shaderAPI.
* | ir_to_mesa: Give the expected size for _mesa_add_attribute().Eric Anholt2010-08-061-1/+2
| | | | | | | | Fixes a failure in glean shaderAPI.
* | ir_to_mesa: Handle texture-array samplersIan Romanick2010-08-051-2/+4
| | | | | | | | Fixes piglit test array_texture.
* | glsl2: Add a pass to convert exp and log to exp2 and log2.Eric Anholt2010-08-051-5/+2
| | | | | | | | | | | | | | | | | | Fixes ir_to_mesa handling of unop_log, which used the weird ARB_vp LOG opcode that doesn't do what we want. This also lets the multiplication coefficients in there get constant-folded, possibly. Fixes: glsl-fs-log
* | ir_to_mesa: Don't do function inlining until linking.Eric Anholt2010-08-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Optimizations at compile time should generally be done with the goal of reducing instruction count so that other work, particularly linking, is less time-consuming if the shader is used multiple times. However, function inlining increases instruction count for the inlined function bodies without removing the original function body, since we don't know if it will be used at link time or not. Reduces the runtime of linking and executing a Yo Frankie fragment shader from 0.9 seconds to 0.5 seconds (-45.9%, +/- 2.2%, n=5).
* | glsl2: Don't try to dump GLSL IR for a shader that didn't compile.Eric Anholt2010-08-051-3/+5
| |
* | ir_to_mesa: Remove debug force-enablement of EmitNoIfs.Eric Anholt2010-08-051-1/+1
| |
* | i965: Settle on printing our program debug to stdout.Eric Anholt2010-08-042-16/+23
| | | | | | | | | | | | Mixing stderr (_mesa_print_program, _mesa_print_instruction, _mesa_print_alu) with stdout means that when writing both to a file, there isn't a consistent ordering between the two.
* | ir_to_mesa: Print shader source and compiled IR under MESA_GLSL=dump.Eric Anholt2010-08-041-1/+17
| | | | | | | | | | | | | | While the Mesa IR dumping includes some corresponding GLSL IR for correlating Mesa IR to GLSL IR, it doesn't completely express it. This printing includes things like variable declarations and control flow structure that is hard to read otherwise.
* | glsl2: Add ir_assignment::write_mask and associated methodsIan Romanick2010-08-041-42/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace swizzles on the LHS with additional swizzles on the RHS and a write mask in the assignment instruction. As part of this add ir_assignment::set_lhs. Ideally we'd make ir_assignment::lhs private to prevent erroneous writes, but that would require a lot of code butchery at this point. Add ir_assignment constructor that takes an explicit write mask. This is required for ir_assignment::clone, but it can also be used in other places. Without this, ir_assignment clones lose their write masks, and incorrect IR is generated in optimization passes. Add ir_assignment::whole_variable_written method. This method gets the variable on the LHS if the whole variable is written or NULL otherwise. This is different from ir->lhs->whole_variable_referenced() because the latter has no knowledge of the write mask stored in the ir_assignment. Gut all code from ir_to_mesa that handled swizzles on the LHS of assignments. There is probably some other refactoring that could be done here, but that can be left for another day.
* | ir_to_mesa: Clean up the mapping of samplers to Mesa's sampler uniforms.Eric Anholt2010-08-041-20/+22
| | | | | | | | | | | | Instead of using a linker-assigned location (since samplers don't actually take up uniform space, being a link-time choice), use the sampler's varaible pointer as a hash key.
* | mesa: Don't null deref looking for Mesa IR code at compile time.Eric Anholt2010-08-041-5/+3
| | | | | | | | | | | | | | The new compiler doesn't generate Mesa IR at compile time, and that compile time code previously wouldn't have reflected the link time code that actually got used. But do dump the info log of the compile regardless.
* | glsl2: Skip talloc_parent in constant_expression of non-constant arrays.Eric Anholt2010-08-041-1/+1
| |
* | ir_to_mesa: Add support for 1.20 uniform initializers.Eric Anholt2010-08-021-30/+97
| | | | | | | | | | | | | | | | | | Fixes: glsl-uniform-initializer-1 glsl-uniform-initializer-2 glsl-uniform-initializer-3 glsl-uniform-initializer-4 glsl1-GLSL 1.20 uniform array constructor
* | Initialize a couple of HasIndex2 fields on Mesa IR src regs.Eric Anholt2010-08-021-0/+1
| |
* | ir_to_mesa: Support for struct uniforms.Eric Anholt2010-08-021-0/+78
| | | | | | | | Fixes glsl-uniform-struct.
* | ir_to_mesa: Add a constructor for ir_to_mesa_src_reg.Eric Anholt2010-08-021-48/+34
| | | | | | | | | | This helps makes sure we don't miss any new fields, and makes totally uninitialized src_regs be PROGRAM_UNDEFINED.
* | Keep a local copy of the symbol name in the symbol tableIan Romanick2010-08-021-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The symbol_header structure that tracks symbols with a particular name may have a different (longer) life time than the symbols it tracks. Not keeping a local copy of the name can lead to use-after-free errors. For example, the following sequence would trigger such an error: char *copy = strdup(name); _mesa_symbol_table_push_scope(st); _mesa_symbol_table_add_symbol(st, 0, name, NULL); _mesa_symbol_table_pop_scope(st); free(name); _mesa_symbol_table_find_symbol(st, 0, copy); With this change, the symbol table keeps a local copy of the name that has the same life time as the symbol_header for that name. This resolves some use-after-free errors with built-in functions in the GLSL compiler.
* | ir_to_mesa: Add support for MESA_GLSL=log.Eric Anholt2010-08-011-0/+4
| | | | | | | | | | This is the option that dumps shader source to files in the current directory.
* | glsl2: Add new tree grafting optimization pass.Eric Anholt2010-07-311-0/+1
| |
* | ir_to_mesa: Add the function name as a comment to BGNSUB and ENDSUB.Eric Anholt2010-07-301-4/+18
| |
* | ir_to_mesa: Don't emit a duplicate return at the end of a function.Eric Anholt2010-07-291-2/+6
| | | | | | | | It was harmless, but ugly.
* | ir_to_mesa: Respect the driver if it rejects a shader.Eric Anholt2010-07-281-5/+9
| |
* | glsl2: Add support for redeclaring layout of gl_FragCoord for ARB_fcc.Eric Anholt2010-07-281-1/+6
| | | | | | | | | | Fixes: glsl-arb-fragment-coord-conventions
* | ir_to_mesa: Add remaining state variable (builtin uniforms) support.Eric Anholt2010-07-281-0/+201
| | | | | | | | | | | | | | | | | | | | Fixes: glsl1-GL state variable reference (diffuse product) glsl1-GL state variable reference (gl_FrontMaterial.ambient) glsl1-GL state variable reference (gl_LightSource[0].diffuse) glsl1-GL state variable reference (point attenuation) glsl1-GL state variable reference (point size) glsl1-linear fog
* | ir_to_mesa: Provide a restricted type size to _mesa_add_uniform.Eric Anholt2010-07-271-1/+10
| | | | | | | | | | Fixes: glsl-uniform-out-of-bounds.
* | ir_to_mesa: Add support for array constants.Eric Anholt2010-07-271-17/+31
| | | | | | | | | | | | | | | | | | Fixes: glsl1-GLSL 1.20 array constructor 1 glsl1-GLSL 1.20 array constructor 2 glsl1-GLSL 1.20 array.length() glsl1-GLSL 1.20 const array constructor 1 glsl1-GLSL 1.20 const array constructor 2
* | glsl2: Make the dead code handler make its own talloc context.Eric Anholt2010-07-271-1/+1
| | | | | | | | | | This way, we don't need to pass in a parse state, and the context doesn't grow with the number of passes through optimization.
* | mesa: Allow large temporary indices coming into the temporary reg allocator.Eric Anholt2010-07-271-21/+27
| | | | | | | | | | This gets glsl-vs-raytrace, glsl-fs-raytrace running on the new compiler.
* | ir_to_mesa: Set the swizzle on constant struct src regs.Eric Anholt2010-07-271-0/+1
| | | | | | | | MESA_GLSL=nopt now produces believable output for glsl-fs-raytrace.
* | ir_to_mesa: Fix stray "break" that broke functions of >1 argument.Eric Anholt2010-07-271-1/+0
| |
* | glsl2: Add optimization pass for algebraic simplifications.Eric Anholt2010-07-271-0/+1
| | | | | | | | | | | | This cleans up the assembly output of almost all the non-logic tests glsl-algebraic-*. glsl-algebraic-pow-two needs love (basically, flattening to a temporary and squaring it).