summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
Commit message (Collapse)AuthorAgeFilesLines
* 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 <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: Replace VersionMajor/VersionMinor with a Version field.Eric Anholt2012-08-071-2/+1
| | | | | | | | | | | As we get into supporting GL 3.x core, we come across more and more features of the API that depend on the version number as opposed to just the extension list. This will let us more sanely do version checks than "(VersionMajor == 3 && VersionMinor >= 2) || VersionMajor >= 4". v2: Fix a bad <= 30 check. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* st/mesa: Fix a potential memory leak in get_mesa_program.Vinson Lee2012-08-061-1/+2
| | | | | | | Fixes resource leak defect reported by Coverity. Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/mesa: merge fragment/vertex sampler update codeBrian Paul2012-08-061-56/+50
| | | | Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/mesa: massage update_vertex_samplers() codeBrian Paul2012-08-061-16/+20
| | | | | | | ...to look like update_fragment_samplers() code, as with the previous commit. The next step would be to merge the two functions. Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/mesa: merge fragment/vertex texture update codeBrian Paul2012-08-061-58/+42
| | | | Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/mesa: massage the update_vertex_textures() codeBrian Paul2012-08-061-4/+14
| | | | | | | ...to look like update_fragment_textures() code. The next step would be to merge the two functions. Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/mesa: rename some vertex/fragment state fields for better consistencyBrian Paul2012-08-065-25/+34
| | | | Reviewed-by: José Fonseca <jfonseca@vmware.com>
* gallium: set sample mask to ~0 for clear, blit and gen_mipmapMarek Olšák2012-08-041-1/+3
| | | | | | | The sample mask affects single-sampled rendering too (it's orthogonal to the color mask). Reviewed-by: Brian Paul <brianp@vmware.com>
* gallium: consolidate CSO sampler and sampler_view functionsBrian Paul2012-08-034-26/+29
| | | | | | | | | | | | | Merge the vertex/fragment versions of the cso_set/save/restore_samplers() functions. Now we pass the shader stage (PIPE_SHADER_x) to the function to indicate vertex/fragment/geometry samplers. For example: cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, unit, sampler); This results in quite a bit of code reduction, fewer CSO functions and support for geometry shaders. Reviewed-by: Marek Olšák <maraeo@gmail.com>
* st/mesa: Ensure dst in compile_instruction is initialized.Vinson Lee2012-08-021-1/+1
| | | | | | | Fixes uninitialized scalar variable defect reported by Coverity. Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Make ARB_sampler_objects mandatoryPauli Nieminen2012-08-011-1/+0
| | | | | | | | | | | To allow meta acceleration operations to use sampler objects the ARB_sampler_objects extension needs to be mandatory for all drivers. Because the extension doesn't have any hardware dependencies it is trivial to implement. Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* mesa: Move DepthMode to texture objectPauli Nieminen2012-08-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | GL_DEPTH_TEXTURE_MODE isn't meant to be part of sampler state based on compatibility profile specifications. OpenGL specification 4.1 compatibility 20100725 3.9.2: "... The values accepted in the pname parameter are TEXTURE_WRAP_S, TEXTURE_WRAP_T, TEXTURE_WRAP_R, TEXTURE_MIN_- FILTER, TEXTURE_MAG_FILTER, TEXTURE_BORDER_COLOR, TEXTURE_MIN_- LOD, TEXTURE_MAX_LOD, TEXTURE_LOD_BIAS, TEXTURE_COMPARE_MODE, and TEXTURE_COMPARE_FUNC. Texture state listed in table 6.25 but not listed here and in the sampler state in table 6.26 is not part of the sampler state, and remains in the texture object." The list of states is in Table 6.24 "Textures (state per texture object)" instead of 6.25 mentioned in the specification text. Same can be found from 3.3 compatibility specification. Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* Revert "gallium: specify resource_resolve destination via a pipe_surface"Christoph Bumiller2012-08-011-6/+9
| | | | | | | | | | | This reverts commit 5d5af7d359e0060fa00b90a8f04900b96f9058b0. It turns out the issue this was supposed to fix merely counter-acted a bug in the hardware driver that I wasn't aware of. The resource_resolve is not supposed to do sRGB conversion, period. (This would violate the requirement that source and destination must be of the same format).
* gallium: specify resource_resolve destination via a pipe_surfaceChristoph Bumiller2012-07-281-9/+6
| | | | | | | | | | | The format member of pipe_surface may differ from that of the pipe_resource, which is used to communicate, for instance, whether sRGB encode should be enabled in the resolve operation or not. Fixes resolve to sRGB surfaces in mesa/st when GL_FRAMEBUFFER_SRGB is disabled. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: call update_renderbuffer_surface for sRGB renderbuffers, tooChristoph Bumiller2012-07-281-2/+3
| | | | | | | | | | | | sRGBEnabled should affect both textures and renderbuffers, so we need to check/update the pipe_surface format for both. Fixes, for instance, rendering appearing too bright in wine applications using sRGB multisample renderbuffers. NOTE: This is a candidate for the 8.0 branch. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: undo a couple static assertsBrian Paul2012-07-271-2/+2
| | | | Hmm, gcc didn't catch these mistakes, but MSVC did.
* st/mesa: use STATIC_ASSERT in a few placesBrian Paul2012-07-274-17/+17
|
* mesa: Make more consistent use of _mesa_is_{user,winsys}_fbo()Paul Berry2012-07-263-3/+8
| | | | | | | | | | 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 <brianp@vmware.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: move more format helper functions to glformats.cBrian Paul2012-07-241-1/+2
|
* mesa: move some format helper functions to glformats.cBrian Paul2012-07-241-0/+1
|
* st/mesa: fix DDY opcode for FBOsMarek Olšák2012-07-231-2/+22
| | | | | | This fixes piglit/fbo-deriv. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: set the centroid qualifier in fragment shader inputsMarek Olšák2012-07-233-4/+11
| | | | | | This fixes some centroid tests in the EXT_framebuffer_multisample piglit group. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: flush the glBitmap cache before changing framebuffer stateMarek Olšák2012-07-233-39/+41
| | | | | | | | | | This fixes the piglit EXT_framebuffer_multisample/bitmap tests. Note that we must not rely on ctx->DrawBuffer when flushing the cache, because that's already updated with a new framebuffer. We want to draw into the old framebuffer where glBitmap was called. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: set the correct window renderbuffer internal formatMarek Olšák2012-07-231-1/+9
| | | | | | The multisample-resolve blit relies on this being correct. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: remove st_flush_bitmap wrapperMarek Olšák2012-07-223-17/+1
| | | | just a cleanup
* mesa: add glformats integer type/format detection routinesJordan Justen2012-07-211-1/+2
| | | | | | | | | | | | _mesa_is_integer_format is moved to formats.c and renamed as _mesa_is_enum_format_integer. _mesa_is_format_unsigned, _mesa_is_type_integer, _mesa_is_type_unsigned, and _mesa_is_enum_format_or_type_integer are added. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Move the _mesa_uniform_merge_location_offset to glGetUniformLocation().Eric Anholt2012-07-201-3/+5
| | | | | | | With the upcoming GL_ARB_uniform_buffer_object changes, the only other caller that will want the cooked value is state_tracker. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* 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 <eric@anholt.net>
* mesa/st: Generates TGSI that always recognizes INSTANCEID/VERTEXID as integers.José Fonseca2012-07-132-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tested by running piglit draw-instanced, and by forcing llvmpipe advertise no native integer support, which now produces: VERT DCL IN[0] DCL SV[0], INSTANCEID DCL OUT[0], POSITION DCL OUT[1], COLOR DCL CONST[0..19] DCL TEMP[0], LOCAL DCL TEMP[1], LOCAL DCL TEMP[2], LOCAL DCL ADDR[0] 0: U2F TEMP[0].x, SV[0] 1: ARL ADDR[0].x, TEMP[0].xxxx 2: MOV TEMP[1].xy, CONST[ADDR[0].x+8].xyxx 3: ADD TEMP[2].x, IN[0].xxxx, TEMP[1].xxxx 4: ADD TEMP[1].x, IN[0].yyyy, TEMP[1].yyyy 5: MUL TEMP[2], CONST[16], TEMP[2].xxxx 6: MAD TEMP[2], CONST[17], TEMP[1].xxxx, TEMP[2] 7: MAD TEMP[2], CONST[18], IN[0].zzzz, TEMP[2] 8: MAD TEMP[2], CONST[19], IN[0].wwww, TEMP[2] 9: ARL ADDR[0].x, TEMP[0].xxxx 10: MOV TEMP[1], CONST[ADDR[0].x] 11: MOV OUT[0], TEMP[2] 12: MOV OUT[1], TEMP[1] 13: END
* mesa,st/mesa: implement GL_RGB565 from ARB_ES2_compatibilityMarek Olšák2012-07-132-0/+6
| | | | | | | | | | This was not implemented, because the spec was changed just recently. Everything has been in place already. Gallium has PIPE_FORMAT_B5G6R5_UNORM, while Mesa has MESA_FORMAT_RGB565. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* st/mesa: expose new transform feedback extensionsMarek Olšák2012-07-121-0/+6
|
* st/mesa: implement accelerated stencil blitting using shader stencil exportMarek Olšák2012-07-124-12/+41
| | | | Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
* st/mesa: set colormask to zero when blitting depthMarek Olšák2012-07-121-2/+2
| | | | Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
* gallium/u_blit: drop not-very-useful wrapper around util_blit_pixels_writemaskMarek Olšák2012-07-122-15/+15
| | | | | | just rename it to util_blit_pixels Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
* gallium: add util_format_stencil_only helper functionMarek Olšák2012-07-121-21/+2
| | | | | | used for stencil sampler views. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
* st/mesa: implement ARB_timer_queryMarek Olšák2012-07-102-0/+19
|
* st/mesa: only expose ARB_shader_bit_encoding with GLSL 1.3Marek Olšák2012-07-061-4/+1
| | | | | | I don't think it's possible or even useful to use the extension with GLSL 1.2. Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa/st: gl_ClipDistance must be interpolated in 3d space.Olivier Galibert2012-07-041-2/+2
| | | | | | | | | | | That old bug was hidden but the clipper always interpolating in 3d space no matter what it should have been doing. Now that the interpolation has been fixed, the bug shows up. Fixes fdo 51364. Signed-off-by: Olivier Galibert <galibert@pobox.com> Signed-off-by: José Fonseca <jfonseca@vmware.com>
* st/mesa: use DEBUG_INCOMPLETE_FBO debug flagBrian Paul2012-06-291-7/+3
|
* mesa: rename MaxTransformFeedbackSeparateAttribs to MaxTransformFeedbackBuffersMarek Olšák2012-06-281-1/+2
| | | | | | | | | | | | This is a cleanup for ARB_transform_feedback3, where GL_MAX_TRANSFORM_FEEDBACK_BUFFERS is introduced for interleaved attribs and has the same meaning as GL_MAX_.._SEPARATE_ATTRIBS for separate attribs. Also, the maximum number of TFB buffers is reduced from 32 to 4, which makes this patch useful even without the extension. I don't know of any hardware which can do more than 4. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: added some simple fbo debugging/helper codeBrian Paul2012-06-251-1/+25
|
* st/mesa: fix transform feedback of unsubscripted gl_ClipDistance arrayMarcin Slusarz2012-06-202-44/+6
| | | | | | | | | | | | | | | | | | | | | | | | | gl_ClipDistance needs special treatment in form of lowering pass which transforms gl_ClipDistance representation from float[] to vec4[]. There are 2 implementations - at glsl linker level (enabled by LowerClipDistance option) and at glsl_to_tgsi level (enabled unconditionally for gallium drivers). Second implementation is incomplete - it does not take into account transform feedback (see commit 642e5b413e0890b2070ba78fde42db381eaf02e5 "mesa: Fix transform feedback of unsubscripted gl_ClipDistance array" for details). There are 2 possible fixes: - adding transform feedback support into glsl_to_tgsi version - ripping gl_ClipDistance support from glsl_to_tgsi and enabling gl_ClipDistance lowering on glsl linker side This patch implements 2nd option. All it does is: - reverts most of the commit 59be691638200797583bce39a83f641d30d97492 "st/mesa: add support for gl_ClipDistance" - changes LowerClipDistance to true Fixes Piglit tests "EXT_transform_feedback/builtin-varyings gl_ClipDistance[{2,3,4,5,6,7,8}]-no-subscript" at least on nv50 and evergreen cards.
* st/mesa: clamp glDrawPixels size to max texture sizeBrian Paul2012-06-191-0/+31
|
* st/mesa: move st_validate_state() call earlier in st_DrawPixels()Brian Paul2012-06-191-5/+5
|
* st/mesa: Add support for GL_ARB_base_instanceFredrik Höglund2012-06-192-0/+2
| | | | Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: properly allocate MSAA renderbuffersMarek Olšák2012-06-161-3/+31
| | | | Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: make unsupported renderbuffer formats always fail as FBO incompleteMarek Olšák2012-06-161-4/+10
| | | | | | | | | instead of failing to allocate a renderbuffer. This also fixes piglit/get-renderbuffer-internalformat with non-renderable formats. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: separate sw renderbuffer allocation from hw oneMarek Olšák2012-06-161-75/+93
| | | | Reviewed-by: Brian Paul <brianp@vmware.com>
* st/mesa: don't do srgb->linear conversion in decompress_with_blitMarek Olšák2012-06-151-0/+1
| | | | | | | | This fixes piglit/getteximage-formats on r600g. NOTE: This is a candidate for stable branches. Reviewed-by: Brian Paul <brianp@vmware.com>