summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Kill GL_ARB_shadow_ambient with fireIan Romanick2012-08-142-21/+0
| | | | | | | | | | No driver supports this extension, and it seems unlikely than any driver ever will. I think r300c may have supported it at one time, but that driver has already been removed. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* ir_to_mesa: Don't whack the ->location field of uniform block variables.Eric Anholt2012-08-071-1/+1
| | | | | | Fixes some failures in GL_ARB_uniform_buffer_object/maxblocks. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add a "ubo_load" expression type for fetches from UBOs.Eric Anholt2012-08-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drivers will probably want to be able to take UBO references in a shader like: uniform ubo1 { float a; float b; float c; float d; } void main() { gl_FragColor = vec4(a, b, c, d); } and generate a single aligned vec4 load out of the UBO. For intel, this involves recognizing the shared offset of the aligned loads and CSEing them out. Obviously that involves breaking things down to loads from an offset from a particular UBO first. Thus, the driver doesn't want to see variable_ref(ir_variable("a")), and even more so does it not want to see array_ref(record_ref(variable_ref(ir_variable("a")), "field1"), variable_ref(ir_variable("i"))). where a.field1[i] is a row_major matrix. Instead, we're going to make a lowering pass to break UBO references down to expressions that are obvious to codegen, and amenable to merging through CSE. v2: Fix some partial thoughts in the ir_binop comment (review by Kenneth) Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Fix off-by-one error in Parse_TextureImageId.Vinson Lee2012-08-041-1/+1
| | | | | | | Fixes out-of-bounds write defect reported by Coverity. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa/program: Use sampler object state if presentPauli Nieminen2012-08-011-1/+4
| | | | | | | | | CompareFailValue is part of Sampler state that needs to be read from bound sampler object if present. Signed-off-by: Pauli Nieminen <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* ir_to_mesa: make size_swizzles[] array static constBrian Paul2012-07-311-1/+1
|
* mesa: whitespace, etc. fixes in program.hBrian Paul2012-07-271-7/+5
|
* mesa: remove _math_matrix_alloc_inv()Brian Paul2012-07-261-1/+0
| | | | | | | Always allocate space for the inverse matrix in _math_matrix_ctr() since we were always calling _math_matrix_alloc_inv() anyway. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Make more consistent use of _mesa_is_{user,winsys}_fbo()Paul Berry2012-07-261-1/+2
| | | | | | | | | | A lot of code was still differentiating between between winsys and user fbos by testing the fbo's name against zero. This converts everything in core mesa, the state tracker, and src/mesa/program over to use _mesa_is_user_fbo() and _mesa_is_winsys_fbo(). Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Merge the lists of uniform blocks into the linked shader program.Eric Anholt2012-07-201-0/+6
| | | | | | This attempts error-checking, but the layout isn't done yet. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Set gl_fragment_program::UsesKill in do_set_program_inouts.Paul Berry2012-07-201-4/+0
| | | | | | | | | | | | | | | | | | | | | Previously, the code for setting this flag for GLSL programs was duplicated in three places: brw_link_shader(), glsl_to_tgsi_visitor, and ir_to_mesa_visitor. In addition to the unnecessary duplication, there was a performance problem on i965: brw_link_shader() set the flag before doing its final round of optimizations, which meant that if the optimizations managed to eliminate all the discard operations, the flag would still be set, resulting (at least in theory) in slower performance. This patch consolidates all of the code that sets UsesKill for GLSL programs into do_set_program_inouts(), which already is doing a similar job for UsesDFdy, and which occurs after i965's final round of optimizations. Non-GLSL programs (ARB programs and the state tracker's glBitmap program) are unaffected. Reviewed-by: Eric Anholt <[email protected]>
* mesa: Set UsesDFdy appropriately for assembly programs.Paul Berry2012-07-193-0/+4
| | | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add UsesDFdy to struct gl_fragment_program.Paul Berry2012-07-191-0/+2
| | | | | | | | | | | | The i965 back-end needs to compile dFdy() differently for FBOs and window system framebuffers, because Y coordinates are flipped between the two (see commit 82d2596: i965: Compute dFdy() correctly for FBOs). This boolean will allow it to avoid unnecessarily recompiling shaders that don't use dFdy(). Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: use gl_program cast wrappersBrian Paul2012-07-181-17/+12
| | | | | | | In a few cases, remove unneeded casts. And fix a few other const-correctness issues. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add some gl_program cast wrappersBrian Paul2012-07-181-0/+42
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: use the PRIx64 macro for printing 64-bit hexadecimal valuesBrian Paul2012-07-051-5/+6
| | | | | | We'll revert the #define fprintf __mingw_fprintf change next. Reviewed-by: José Fonseca <[email protected]>
* ir_to_mesa: Add support for ir_unop_f2u to ir_to_mesa backend.Paul Berry2012-06-151-0/+1
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Fix bool-int mismatchStéphane Marchesin2012-06-121-4/+5
| | | | Also include stdbool for windows.
* mesa: Fix hash table leakAntoine Labour2012-06-122-6/+15
| | | | | | | When a value was replaced, the new key was strdup'd and leaked. To fix this, we modify the hash table implementation to return whether the value was replaced and free() the (now useless) duplicate string.
* glsl: Bitwise conversion operator support in the software renderers.Olivier Galibert2012-06-071-0/+5
| | | | | | | | | | | | | TGSI doesn't need an opcode, since registers are untyped (but beware once doubles come into the scene). Mesa IR doesn't handle native integers, so trying to handle them there is worthless, the case entries are only added for warning reasons. It was only tested with softpipe, since llvmpipe doesn't support glsl 1.3 yet. Signed-off-by: Olivier Galibert <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* ir_to_mesa: Don't set initial uniform values againIan Romanick2012-05-231-104/+0
| | | | | | | | | This work is now done by the linker, so we don't need to keep doing it here. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* ir_to_mesa: Propagate initial values in _mesa_associate_uniform_storageIan Romanick2012-05-231-0/+9
| | | | | | | | | The linker may have set initial values for uniforms. Propagate these values to the driver's backing storage when it is first associated. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: use F_TO_I() instead of IROUND()Brian Paul2012-05-191-10/+10
| | | | | | | | Use it where performance matters more and the exact method of float->int conversion/rounding isn't terribly important. There should no net change here since F_TO_I() is the new name of the old IROUND() function. Reviewed-by: José Fonseca <[email protected]>
* ir_to_mesa: Fix uninitialized member in add_uniform_to_shader.Vinson Lee2012-04-121-1/+1
| | | | | | | | | Fix uninitialized scalar field defect reported by Coverity. NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* ir_to_mesa: Remove pretense of support for function calls.Kenneth Graunke2012-04-091-181/+5
| | | | | | | | | | | | | | | | | While ir_to_mesa contains code that attempts to support functions, I honestly doubt it's been tested and have little confidence that it works. The comment in visit(ir_function *ir) doesn't inspire confidence: /* Ignore function bodies other than main() -- we shouldn't see calls to * them since they should all be inlined before we get to ir_to_mesa. */ Furthermore, hardware drivers such as i915, i965, and (AFAICT) r200 don't support the BGNSUB/ENDSUB/CAL opcodes anyway. Only swrast does. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Remove ir_call::get_callee() and set_callee().Kenneth Graunke2012-04-021-1/+1
| | | | | | | | | | | | | Previously, set_callee() performed some assertions about the type of the ir_call; protecting the bare pointer ensured these checks would be run. However, ir_call no longer has a type, so the getter and setter methods don't actually do anything useful. Remove them in favor of accessing callee directly, as is done with most other fields in our IR. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove MAX_WIDTH from prog_execute.hBrian Paul2012-02-241-1/+5
| | | | | define a PROG_MAX_WIDTH var instead. It has to match MAX_WIDTH in swrast. More elaborate refactoring could fix that (someday).
* st/mesa: kill off point size clamping in vertex shadersMarek Olšák2012-01-312-28/+0
| | | | | | | | This fixes the gl_PointSize transform feedback test. Point size clamping should happen at the rasterizer stage, i.e. after the vertex and geometry shaders and transform feedback. Drivers are expected to do this by themselves.
* mesa: Make the register allocator allocation take a ralloc context.Eric Anholt2012-01-182-3/+9
| | | | | | This fixes a memory leak on i965 context destruction. NOTE: This is a candidate for the 8.0 branch.
* mesa: remove _mesa_ffs(), implement ffs() for non-GNU platformsBrian Paul2012-01-121-2/+2
| | | | | | | | | | | Call ffs() and ffsll() everywhere. Define our own ffs(), ffsll() functions when the platform doesn't have them. v2: remove #ifdef _WIN32, __IBMC__, __IBMCPP_ tests inside ffs() implementation. The #else clause was recursive. Reviewed-by: Kenneth Graunke <[email protected]> Tested-by: Alexander von Gluck <[email protected]>
* linker: Calculate used samplers and shadow samplers in the linkerIan Romanick2012-01-111-27/+4
| | | | | | | | | | | | It used to be done in ir_to_mesa, and that was kind of a bad place. I didn't change st_glsl_to_tgsi because there is some strange stuff happening in the code that generates glDrawPixels shaders. It looked like this would break horribly if I touched anything. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* linker: Calculate the sampler to texture target mapping during linkingIan Romanick2012-01-111-5/+3
| | | | | | | | | Track the calculated data in gl_shader_program instead of the individual assembly shaders. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Silence warningJakob Bornecrantz2012-01-101-0/+1
| | | | | | Signed-off-by: Jakob Bornecrantz <[email protected]> Reviewed-by Brian Paul <[email protected]> Reviewed-by Ian Romanick <[email protected]>
* mesa: Silence warningJakob Bornecrantz2012-01-101-0/+1
| | | | | | Signed-off-by: Jakob Bornecrantz <[email protected]> Reviewed-by Brian Paul <[email protected]> Reviewed-by Ian Romanick <[email protected]>
* program: fix previous commitnobled2011-12-181-1/+1
| | | | Accidentally an old patch.
* program: fix out of bounds array accesses and other bad thingsnobled2011-12-181-15/+59
| | | | | | | | | | | | | | | | | | | | Noticed a "warning: array subscript is above array bounds" given at one of the existing sanity-check asserts. Turns out all the arrays of strings haven't matched the corresponding enum values in a while, if ever. I didn't know the proper names for any of these and couldn't find them in the base specs aside from "result.pointsize" in ARB_vertex_program, so I just filled in the enum's value as was done with other slots. Also add four STATIC_ASSERT()s to be sure and catch future additions or bumps to MAX_VARYING/etc again, and some more non-static asserts where there weren't any before. (Note, the fragment enum that corresponded to result.color(half) was removed in 8d475822e6e19fa79719c856a2db5b6a205db1b9.) Reviewed-by: Brian Paul <[email protected]>
* mesa: Fix memory leak on error path.Vinson Lee2011-12-161-0/+1
| | | | | | | Fixes Coverity resource leak defect. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: fix an out-of-bounds access in prog_print.cMarek Olšák2011-12-131-0/+1
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: Use VERT_{ATTRIB,BIT}* for ARB input validation.Mathias Fröhlich2011-12-032-4/+4
| | | | | | | | | | | | | For validating ARB program inputs replace hard coded bitfield and attribute number with the appropriate VERT_{ATTRIB,BIT}* variant. This should fix: https://bugs.freedesktop.org/show_bug.cgi?id=43407 Signed-off-by: Mathias Froehlich <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: use Elements() macro in program printing codeBrian Paul2011-11-301-4/+4
|
* mesa: fix printf format warning in _mesa_fprint_program_parameters()Brian Paul2011-11-301-2/+2
|
* mesa: Make gl_program::InputsRead 64 bits.Mathias Fröhlich2011-11-292-5/+5
| | | | | | | | | Make gl_program::InputsRead a 64 bits bitfield. Adapt the intel and radeon driver to handle a 64 bits InputsRead value. Signed-off-by: Mathias Froehlich <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: set the gl_FragDepth layout in the GLSL linkerMarek Olšák2011-11-191-23/+6
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* ir_to_mesa: don't init unfirom if link failedYuanhan Liu2011-11-151-1/+3
| | | | | | | | | Don't call set_unfiform_initializers if link failed, or it would trigger a GL_INVALID_OPERATION error. That's not an expected behavior of glLinkProgram function. Signed-off-by: Yuanhan Liu <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Remove resource count checks from ir_to_mesa and st_glsl_to_tgsiIan Romanick2011-11-141-55/+0
| | | | | | | These checks are now performed by the linker. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa,glsl,mapi: Put extern "C" { ... } where appropriate.José Fonseca2011-11-094-11/+33
| | | | | Probably a several places missing, but enough to cover all headers (in)directly included by uniform_query.cpp, and fix the MSVC build.
* Delete code made dead by previous uniform related patchesIan Romanick2011-11-073-189/+0
| | | | | Signed-off-by: Ian Romanick <[email protected]> Tested-by: Tom Stellard <[email protected]>
* mesa: Rewrite the way uniforms are tracked and handledIan Romanick2011-11-072-25/+34
| | | | | | | | | | | | | | | | | | | | | Switch all of the code in ir_to_mesa, st_glsl_to_tgsi, glUniform*, glGetUniform, glGetUniformLocation, and glGetActiveUniforms to use the gl_uniform_storage structures in the gl_shader_program. A couple of notes: * Like most rewrite-the-world patches, this should be reviewed by applying the patch and examining the modified functions. * This leaves a lot of dead code around in linker.cpp and uniform_query.cpp. This will be deleted in the next patches. v2: Update the comment block (previously a FINISHME) in _mesa_uniform about generating GL_INVALID_VALUE when an out-of-range sampler index is specified. Signed-off-by: Ian Romanick <[email protected]> Tested-by: Tom Stellard <[email protected]>
* ir_to_mesa: Add _mesa_associate_uniform_storageIan Romanick2011-11-072-0/+76
| | | | | | | | Connects all of the gl_program_parameter structures with the correct gl_uniform_storage structures. Signed-off-by: Ian Romanick <[email protected]> Tested-by: Tom Stellard <[email protected]>
* mesa: Add string_to_uint_map::clear method to clear the mapIan Romanick2011-11-071-0/+8
| | | | | Signed-off-by: Ian Romanick <[email protected]> Tested-by: Tom Stellard <[email protected]>