summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* mesa: fix texture target mix-up in NV_fragment_program parserBrian Paul2011-11-031-7/+7
| | | | | | | | | | The returned value should be a texture target index, not a bit. I spotted this from seeing a new compiler warning caused by the increase in the number of texture targets. This has been broken for a long time. Note: This is a candidate for the 7.11 branch. Reviewed-by: Ian Romanick <[email protected]>
* mesa: add support for GL_OES_EGL_image_externalChia-I Wu2011-11-031-0/+3
| | | | | | | | | This is an OpenGL ES specific extension. External textures are textures that may be sampled from, but not be updated (no glTexSubImage* and etc.). The image data are taken from an EGLImage. Reviewed-by: Brian Paul <[email protected]> Acked-by: Jakob Bornecrantz <[email protected]>
* mesa, i965: prepare for more than 8 texture targetsChia-I Wu2011-11-032-2/+2
| | | | | | | | | 3-bit fields are used store texture target in several places. That will fail when TEXTURE_EXTERNAL_INDEX, which happends to be the 9th texture target, is added. Make them 4-bit fields. Reviewed-by: Brian Paul <[email protected]> Acked-by: Jakob Bornecrantz <[email protected]>
* ir_to_mesa: Let check_resources halt compilationIan Romanick2011-10-281-6/+17
| | | | | | | | | | | | | | | | Previously check_resources could fail, but we'd still try to optimize the shader, do device-specific code generation, etc. In some cases, this could explode (especially in the device-specific code generation). I haven't found that I could trigger this with the current code. When too many samplers were used with the new uniform handling code, I observed several crashes deep down in the driver. NOTE: This is candidate for the 7.11 branch. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41609 Cc: Eric Anholt <[email protected]> Reviewed-and-tested-by: Kenneth Graunke <[email protected]>
* mesa: Expose GLSL interpolation qualifiers in gl_fragment_program.Paul Berry2011-10-271-1/+1
| | | | | | | | | | | | | | | | | This patch makes GLSL interpolation qualifiers visible to drivers via the array InterpQualifier[] in gl_fragment_program, so that they can easily be used by driver back-ends to select the correct interpolation mode. Previous to this patch, the GLSL compiler was using the enum ir_variable_interpolation to represent interpolation types. Rather than make a duplicate enum in core mesa to represent the same thing, I moved the enum into mtypes.h and renamed it to be more consistent with the other enums defined there. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* ir_to_mesa: Use uniform_field_visitor to add all struct fields to parameter listIan Romanick2011-10-251-12/+38
| | | | | | | | | | | | | | Previously the uniform was passed as single, whole structure to _mesa_add_parameter. This was completely bogus and resulted in a DataType of 0 (instead of a valid GLSL type enum). Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980 Tested-by: Brian Paul <[email protected]> Cc: Bryan Cain <[email protected]> Cc: Vinson Lee <[email protected]> Cc: José Fonseca <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add uniform_locations_assigned parameter to do_dead_code opt passIan Romanick2011-10-251-2/+4
| | | | | | | | | | | | | | | | | Setting this flag prevents declarations of uniforms from being removed from the IR. Since the IR is directly used by several API functions that query uniforms in shaders, uniform declarations cannot be removed after the locations have been set. However, it should still be safe to reorder the declarations (this is not tested). Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41980 Tested-by: Brian Paul <[email protected]> Reviewed-by: Bryan Cain <[email protected]> Cc: Vinson Lee <[email protected]> Cc: José Fonseca <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Yuanhan Liu <[email protected]>
* ir_to_mesa: Generate gl_program_parameter list by walking the GLSL IR.Ian Romanick2011-10-182-100/+70
| | | | | | | | | | | | | Generate the program parameters list by walking the IR instead of by walking the list of linked uniforms. This simplifies the code quite a bit, and is probably a bit more correct. The list of linked uniforms should really only be used by the GL API to interact with the application. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: Bryan Cain <[email protected]> Cc: Eric Anholt <[email protected]>
* ir_to_mesa: Move some things outside the 'extern "C"' blocksIan Romanick2011-10-182-7/+8
| | | | | | | | | | | Having a few of these includes or forward declarations inside the 'extern "C"' block can cause problems later. Specifically, it prevents C++ linkage functions from being added to ir_to_mesa.h and makes G++ angry if 'struct foo' is seen both inside and outside an 'extern "C"'. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Simplify uniform debug logging logicIan Romanick2011-10-182-4/+3
| | | | | | | | | This simplificiation was enabled by the earlier refactors that eliminated the references to the assembly shaders stored in the gl_shader_program structure. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Convert fixed function fragment program generator to GLSL IR.Eric Anholt2011-10-181-1/+1
| | | | | | | | This is a step towards providing a direct route for drivers accepting GLSL IR for codegen. Perhaps more importantly, it runs the fixed function fragment program through the GLSL IR optimization. Having seen how easy it is to make ugly fixed function texenv code that can do unnecessary work, this may improve real applicatinos.
* hash_table: Make string_to_uint_map make a copy of the nameIan Romanick2011-10-101-1/+17
| | | | | | | | | | | | The hash table needs a copy of the key that it can keep for comparisons during searches. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41499 Cc: Stéphane Marchesin <[email protected]> Tested-by: Luzipher <[email protected]> Tested-by: Michał Lipski <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Remove unused function _mesa_append_uniformIan Romanick2011-10-072-78/+0
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Simplify calling Driver.ProgramStringNotify after previous refactorsIan Romanick2011-10-071-22/+11
| | | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: Use gl_shader_program::_LinkedShaders instead of FragmentProgramIan Romanick2011-10-071-4/+2
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Use gl_shader_program::_LinkedShaders instead of GeometryProgramIan Romanick2011-10-071-3/+2
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Use gl_shader_program::_LinkedShaders instead of VertexProgramIan Romanick2011-10-071-3/+2
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Remove unused gl_program::AttributesIan Romanick2011-10-042-14/+0
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Determine GL_ACTIVE_ATTRIBUTE_MAX_LENGTH by walking the GLSL IR.Ian Romanick2011-10-042-26/+0
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Add string_to_uint_map facade classIan Romanick2011-10-042-1/+120
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Paul Berry <[email protected]>
* mesa: Add hash_table_replaceIan Romanick2011-10-042-0/+40
| | | | | | | hash_table_replace doesn't use get_node to avoid having to hash the key twice. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* ir_to_mesa: Don't assertion fail on integer modulus.Kenneth Graunke2011-10-021-1/+4
| | | | | | | | | | | Drivers implementing GLSL 1.30 want to do integer modulus, and until we can stop generating code via ir_to_mesa, it's easier to make it silently generate rubbish code. Multiply will do. Signed-off-by: Kenneth Graunke <[email protected]> Tested-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: s/INLINE/inline/Brian Paul2011-10-013-17/+17
| | | | | | | INLINE is still seen in some files (some generated files, etc) but this is a good start. Acked-by: Kenneth Graunke <[email protected]>
* mesa: Refactor hash_table_{find,remove} to share some codeIan Romanick2011-09-301-16/+16
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Document an odd side-effect of hash_table_insertIan Romanick2011-09-301-0/+5
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Remove unused field gl_program::VaryingIan Romanick2011-09-302-7/+0
| | | | | | | Lots of things set and copy this field around, but nothing uses it. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Use Add linker_error instead of fail_linkIan Romanick2011-09-301-14/+3
| | | | | | | See also 8aadd89. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: add _NEW_CURRENT_ATTRIB in _mesa_program_state_flags()Brian Paul2011-09-301-2/+5
| | | | | | | | | | | | If color material mode is enabled, constant buffer entries related to the material coefficients will depend on glColor. So add _NEW_CURRENT_ATTRIB to the bitset returned for material-related constants in _mesa_program_state_flags(). This fixes a bug exercised by the new piglit draw-arrays-colormaterial test. Note: This is a candidate for the 7.11 branch.
* ir_to_mesa: Don't assertion fail on remaining GLSL 1.30 ops.Eric Anholt2011-09-281-2/+10
| | | | | | | | | | For hardware drivers, we only have ir_to_mesa called for the purposes of potential swrast fallbacks (basically never on a 1.30 driver), which we don't really care about. This will allow 1.30 to be implemented without rewriting swrast for it. Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Add a flag to indicate whether a program uses gl_ClipDistance.Paul Berry2011-09-231-0/+2
| | | | | | | | | | | | | | | | | | GLSL 1.30 requires us to use gl_ClipDistance for clipping if the vertex shader contains a static write to it, and otherwise use user-defined clipping planes. Since the driver needs to behave differently in these two cases, we need a flag to record whether the shader has written to gl_ClipDistance. The new flag is called UsesClipDistance. We initially store it in gl_shader_program (since that is the data structure that is available when we check to see whethe gl_ClipDistance was written to), and we later copy it to a flag with the same name in gl_vertex_program, since that is a more convenient place for the driver to access it (in i965, at least). Reviewed-by: Eric Anholt <[email protected]> Tested-by: Brian Paul <[email protected]>