summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/attrib.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Add support for AMD_depth_clamp_separateSagar Ghuge2018-08-281-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | Enable _mesa_PushAttrib() and _mesa_PopAttrib() to handle GL_DEPTH_CLAMP_NEAR_AMD and GL_DEPTH_CLAMP_FAR_AMD tokens. Remove DepthClamp, because DepthClampNear + DepthClampFar replaces it, as suggested by Marek Olsak. Driver that enables AMD_depth_clamp_separate will only ever look at DepthClampNear and DepthClampFar, as suggested by Ian Romanick. v2: 1) Remove unnecessary parentheses (Marek Olsak) 2) if AMD_depth_clamp_separate is unsupported, TEST_AND_UPDATE GL_DEPTH_CLAMP only (Marek Olsak) 3) Clamp against near and far plane separately (Marek Olsak) 4) Clip point separately for near and far Z clipping plane (Marek Olsak) v3: Clamp raster position zw to the range [min(n,f), 0] for near plane and [0, max(n,f)] for far plane (Marek Olsak) v4: Use MIN2 and MAX2 instead of CLAMP (Marek Olsak) Signed-off-by: Sagar Ghuge <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: Remove Array._DrawArrays.Mathias Fröhlich2018-05-101-1/+0
| | | | | | | | Only tnl based drivers still use this array. So remove it from core mesa and use Array._DrawVAO instead. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* mesa: Compute effective buffer bindings in the vao.Mathias Fröhlich2018-05-101-0/+1
| | | | | | | | | | | | | | | | Compute VAO buffer binding information past the position/generic0 mapping. Scan for duplicate buffer bindings and collapse them into derived effective buffer binding index and effective attribute mask variables. Provide a set of helper functions to access the distilled information in the VAO. All of them prefixed with _mesa_draw_... to indicate that they are meant to query draw information. v2: Also group user space arrays containing interleaved arrays. Add _Eff*Offset to be copied on attribute and binding copy. Update comments. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* mesa: add support for nvidia conservative rasterization extensionsRhys Perry2018-04-301-10/+50
| | | | | | | | Although the specs are written against compatibility GL 4.3 and allows core profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+. Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: include dispatch.h lessMarek Olšák2018-04-121-1/+0
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: When copying a VAO also copy the vertex attribute mode.Mathias Fröhlich2018-03-231-0/+1
| | | | | Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* mesa: Make gl_vertex_array contain pointers to first order VAO members.Mathias Fröhlich2018-03-101-1/+0
| | | | | | | | | | | | | | | Instead of keeping a copy of the vertex array content in struct gl_vertex_array only keep pointers to the first order information originaly in the VAO. For that represent the current values by struct gl_array_attributes and struct gl_vertex_buffer_binding. v2: Change comments. Remove gl... prefix from variables except in the i965 directory where it was like that before. Reindent because of that. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* mesa: Introduce a yet unused _DrawVAO.Mathias Fröhlich2018-02-231-0/+2
| | | | | | | | | | | | | During the patch series this VAO gets populated with either the currently bound VAO or an internal VAO that will be used for immediate mode and dlist rendering. v2: More comments about the _DrawVAO, filter and enabled mask. Rename _DrawVAOEnabled to _DrawVAOEnabledAttribs. v3: Fix and move comment. Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: separate legacy stuff from gl_texture_unit into gl_fixedfunc_texture_unitMarek Olšák2018-02-131-7/+10
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: rename gl_vertex_array_object::_VertexAttrib -> _VertexArrayBrian Paul2018-02-061-1/+1
| | | | | | | | | Since the type is gl_vertex_array. Update comment to explain that these arrays are only used by the VBO module. Also rename some local variables in _mesa_update_vao_derived_arrays(). Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa: change ctx->Color.ColorMask into a 32-bit bitmaskMarek Olšák2018-02-041-8/+8
| | | | | | | | 4 bits per draw buffer, 8 draw buffers in total --> 32 bits. This is easier to work with. Reviewed-by: Eric Anholt <[email protected]>
* mesa: rename some 'client' array functionsBrian Paul2018-01-301-1/+1
| | | | | | | A long time ago gl_vertex_array was gl_client_array. Update some function names to be consistent. Reviewed-by: Gert Wollny <[email protected]>
* mesa: replace GLenum with GLenum16 in common structures (v4)Marek Olšák2018-01-291-4/+9
| | | | | | | | | | | | | v2: - fix glGet* - also use GLenum16 for DrawBuffers v3: - rebase to top of tree (BrianP) and incorporate Ian's suggestions v4: - fix a GLenum16 bug in VBO/save code, add some STATIC_ASSERT()s gl_context = 152432 -> 136840 bytes vbo_context = 22096 -> 20608 bytes Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/vbo: replace vbo_draw_method() with _mesa_set_drawing_arrays()Brian Paul2018-01-291-3/+2
| | | | | | | | | | | | | | | | | The arrays specified by ctx->Array._DrawArrays are used for all vertex drawing via vbo_context::draw_prims(). Different arrays are used for immediate mode, vertex arrays, display lists, etc. Changing from one to another requires updating derived/driver array state. Before, we indirectly specifid the arrays with the gl_draw_method values. Now we just directly specify the arrays instead. This is simpler and will allow a subsequent display list optimization. In the future, it might make sense to get rid of ctx->Array._DrawArrays entirely and just pass the arrays as another parameter to vbo_context::draw_prims(). Reviewed-by: Mathias Fröhlich <[email protected]>
* mesa: whitespace fixes in attrib.cBrian Paul2018-01-251-78/+77
| | | | Trivial.
* mesa: set driver flags for glPopAttrib(GL_ENABLE_BIT) properlyMarek Olšák2017-06-221-0/+14
| | | | | | Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: don't flag _NEW_POLYGON_STIPPLE for st/mesaMarek Olšák2017-06-221-1/+6
| | | | | | Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: remove _mesa_problem() from a few locationsTimothy Arceri2017-05-111-4/+2
| | | | | | | | | | | _mesa_problem() is still useful in some places such as is if a backend compile fails, but for the majority of cases we should be able to remove it. OpenGL test suites are becoming very mature, we should place more trust in debug builds picking up missed cases. Reviewed-by: Eric Anholt <[email protected]>
* mesa: tidy up left over APPLE_vertex_array_object semanticsTimothy Arceri2017-04-261-16/+7
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: drop APPLE_vertex_array_object supportTimothy Arceri2017-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | Shared context support for VAOs was dropped in 0b2750620b65. From the ARB_vertex_array_object spec: "This extension differs from GL_APPLE_vertex_array_object in that client memory cannot be accessed through a non-zero vertex array object. It also differs in that vertex array objects are explicitly not sharable between contexts." Nobody should be using this extension over ARB_vertex_array_object anymore so just drop it rather than adding locking back just for VAOs created from these functions. For reference the Nvidia blob doesn't expose this extension. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: don't use _NEW_TEXTURE mainly in mesa/mainMarek Olšák2017-03-291-1/+1
| | | | | | | | v2: add missing %s Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/main: fix meta caller of _mesa_ClampColorNicolai Hähnle2017-01-191-1/+2
| | | | | | | | | | | Since _mesa_ClampColor properly checks for support of the API function now, it's meta callers need to check support as well. Fixes: 963311b71f ("mesa/main: fix version/extension checks in _mesa_ClampColor") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99401 Tested-by: Mark Janes <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Cc: "17.0" <[email protected]>
* mesa: rename gl_vertex_array_object::VertexBinding to BufferBindingBrian Paul2016-10-281-1/+1
| | | | | | To be a little more understandable. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: Copy bitmask of VBOs in the VAO on gl{Push,Pop}Attrib.Mathias Fröhlich2016-08-061-0/+2
| | | | | | | | | | | On gl{Push,Pop}Attrib(GL_CLIENT_VERTEX_ARRAY_BIT) take care that gl_vertex_array_object::VertexAttribBufferMask matches the bound buffer object in the gl_vertex_array_object::VertexBinding array. Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: add GL_EXT_window_rectangles state storage/retrieval functionalityIlia Mirkin2016-06-181-0/+7
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Rename CoordReplaceBits back to CoordReplace.Mathias Fröhlich2016-06-161-1/+1
| | | | | | | | It used to be called like that and fits better with 80 columns. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* mesa: Add gl_point_attrib::CoordReplaceBits bitfield.Mathias Fröhlich2016-06-161-1/+1
| | | | | | | | | | | | | The aim is to replace the CoordReplace array by a bitfield. Until all drivers are converted, establish the bitfield in parallel to the CoordReplace array. v2: Fix bitmask logic. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* mesa: remove _ARB suffix from cube map enumsBrian Paul2016-02-121-2/+2
| | | | | | | Just minor clean-up so we're consistent everywhere. Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Rename _mesa_lookup_enum_by_nr() to _mesa_enum_to_string().Kenneth Graunke2015-07-201-1/+1
| | | | | | | Generated by sed; no manual changes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: restore GL_EXT_depth_bounds_test state in glPopAttrib()Brian Paul2015-06-031-0/+5
| | | | | | Spotted by inspection. Untested (no piglit test). Signed-off-by: Brian Paul <[email protected]>
* mesa: fix glPushAttrib(0) / glPopAttrib() errorBrian Paul2015-06-031-0/+17
| | | | | | | | | | | If the glPushAttrib() mask value was zero we didn't actually push anything onto the attribute stack. A subsequent glPopAttrib() call would generate a GL_STACK_UNDERFLOW error. Now push a dummy attribute in that case to prevent the error. Mesa now matches nvidia's behavior. Reviewed-by: Jose Fonseca <[email protected]>
* mesa: remove unneeded #include of colormac.hBrian Paul2015-04-011-1/+0
| | | | | Acked-by: Matt Turner <[email protected]> Reviewed-by: Mark Janes <[email protected]>
* mesa/main: replace Elements() with ARRAY_SIZE()Brian Paul2015-03-021-1/+1
| | | | | | | | We've been using a mix of these two macros for a while now. Let's just use the later everywhere. It seems to be the convention used by other open-source projects. Acked-by: Ilia Mirkin <[email protected]>
* mesa: add support for GL_EXT_polygon_offset_clampIlia Mirkin2015-02-021-2/+4
| | | | | | | | | | Nothing enables the extension yet, but the values are now available. The spec calls for it to only be exposed for GL 3.3+, which is core-only in mesa. Instead we allow any driver to enable it, including in a compat context for any GL version. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Glenn Kennard <[email protected]>
* mesa: Don't call _mesa_ClipControl from glPopAttrib when unsupported.Kenneth Graunke2014-11-031-1/+2
| | | | | | | Otherwise, calling glPopAttrib on drivers that don't support ARB_clip_control gives you a GL error, which is surprising at best. Signed-off-by: Kenneth Graunke <[email protected]>
* mesa: Implement ARB_clip_control.Mathias Fröhlich2014-10-241-0/+1
| | | | | | | | | | | | | | | Implement the mesa parts of ARB_clip_control. So far no driver enables this. v3: Restrict getting clip control state to the availability of ARB_clip_control. Move to transformation state. Handle clip control state with the GL_TRANSFORM_BIT. Move _FrontBit update into state.c. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Froehlich <[email protected]>
* mesa: Use VertexArray, not _VertexArray, in array size expressions.Kenneth Graunke2014-09-241-1/+1
| | | | | | | | | Both sizes are VERT_ATTRIB_MAX, so this has no effect. But it drops a few trivial uses of the derived state. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Fredrik Höglund <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Delete VAO _MaxElement code and index buffer bounds checking.Kenneth Graunke2014-09-191-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fredrik's implementation of ARB_vertex_attrib_binding introduced new gl_vertex_attrib_array and gl_vertex_buffer_binding structures, and converted Mesa's older gl_client_array to be derived state. Ultimately, we'd like to drop gl_client_array and use those structures directly. One hitch is that gl_client_array::_MaxElement doesn't correspond to either structure (unlike every other field), so we'd have to figure out where to store it. The _MaxElement computation uses values from both structures, so it doesn't really belong in either place. We could put it in the VAO, but we'd have to pass it around everywhere. It turns out that it's only used when ctx->Const.CheckArrayBounds is set, which is only set by the (rarely used) classic swrast driver. It appears that drivers/x11 used to set it as well, which was intended to avoid segmentation faults on out-of-bounds memory access in the X server (probably for indirect GLX clients). However, ajax deleted that code in 2010 (commit 1ccef926be46dce3b6b5c76e812e2fae4e205ce7). The bounds checking apparently doesn't actually work, either. Non-VBO attributes arbitrarily set _MaxElement to 2 * 1000 * 1000 * 1000. vbo_save_draw and vbo_exec_draw remark /* ??? */ when setting it, and the i965 code contains a comment noting that _MaxElement is often bogus. Given that the code is complex, rarely used, and dubiously functional, it doesn't seem worth maintaining going forward. This patch drops it. This will probably mean the classic swrast driver may begin crashing on out of bounds vertex buffer access in some cases, but I believe that is allowed by OpenGL (and probably happened for non-VBO accesses anyway). There do not appear to be any Piglit regressions, either. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Roland Scheidegger <[email protected]>
* mesa: invalidate draw state in glPopClientAttribMarek Olšák2014-09-041-0/+4
| | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82538 Cc: [email protected] Reviewed-by: Brian Paul <[email protected]>
* mesa: use malloc/free instead of MALLOC/FREE in attrib stack codeBrian Paul2014-04-101-10/+10
| | | | | | | We moved away from MALLOC/FREE in the rest of core Mesa a while ago. Reviewed-by: Jakob Bornecrantz <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Preserve the NewArrays state when copying a VAOFredrik Höglund2014-02-121-0/+1
| | | | | | | Cc: "10.1" "10.0" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72895 Reviewed-by: Brian Paul <[email protected]>
* mesa: Rename ElementArrayBufferObj to IndexBufferObj.Kenneth Graunke2014-02-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | DirectX and most hardware documentation use the term "Index Buffer" to refer to a buffer containing indexes into arrays of vertex data, which allows random access to vertex data, rather than sequential access. OpenGL uses a different term for this concept: "Element Array Buffer". However, "Index Buffer" has become much more widespread. A quick Google search shows 29,300 hits for "Element Array Buffer" vs. 82,300 hits for "Index Buffer." Arguably, "Index Buffer" is clearer: an "element of an array" (or list) usually refers to an actual item stored in the array, not the index used to refer to it. The terminology is also already used in Mesa: some VBO module code for dealing with ElementArrayBufferObj names local variables "ib". Completely generated by: $ find . -type f -print0 | xargs -0 sed -i \ 's/ElementArrayBufferObj/IndexBufferObj/g' Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Rename _mesa_..._array_obj functions to _mesa_..._vao.Kenneth Graunke2014-02-031-2/+2
| | | | | | | | | | | | | | | _mesa_update_vao_client_arrays() is less of a mouthful than _mesa_update_array_object_client_arrays(), and generally clearer. Generated by: $ find . -type f -print0 | xargs -0 sed -i \ 's/_mesa_\([^_]*\)_array_object/_mesa_\1_vao/g' with manual whitespace and indentation fixes applied. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Rename "struct gl_array_object" to gl_vertex_array_object.Kenneth Graunke2014-02-031-5/+5
| | | | | | | | | | | | | | | | | | I considered replacing it with "gl_vao", but spelling it out seemed to fit better with Mesa's traditional style. Mesa doesn't shy away from long type names - consider gl_transform_feedback_object, gl_fragment_program_state, gl_uniform_buffer_binding, and so on. Completely generated by: $ find . -type f -print0 | xargs -0 sed -i \ 's/gl_array_object/gl_vertex_array_object/g' v2: Rerun command to resolve conflicts with Ian's meta patches. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Rename ArrayObj to VAO and DefaultArrayObj to DefaultVAO.Kenneth Graunke2014-02-031-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When reading through the Mesa drawing code, it's not immediately obvious to me that "ArrayObj" (gl_array_object) is the Vertex Array Object (VAO) state. The comment above the structure explains this, but readers still have to remember this and translate accordingly. Out of context, "array object" is a fairly vague. Even in context, "array" has a lot of meanings: glDrawArrays, vertex data stored in user arrays, gl_client_arrays, gl_vertex_attrib_arrays, and so on. Using the term "VAO" immediately associates these fields with the OpenGL concept, clarifying the situation and aiding programmer sanity. Completely generated by: $ find . -type f -print0 | xargs -0 sed -i \ -e 's/ArrayObj;/VAO;/g' \ -e 's/->ArrayObj/->VAO/g' \ -e 's/Array\.ArrayObj/Array.VAO/g' \ -e 's/Array\.DefaultArrayObj/Array.DefaultVAO/g' v2: Rerun command to resolve conflicts with Ian's meta patches. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Restore all the viewports in _mesa_PopAttribIan Romanick2014-01-201-2/+7
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Restore all the scissor rectangles in _mesa_PopAttribIan Romanick2014-01-201-6/+10
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Add an index parameter to _mesa_set_scissorIan Romanick2014-01-201-1/+1
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Convert gl_context::Viewport to gl_context::ViewportArrayCourtney Goeltzenleuchter2014-01-201-2/+3
| | | | | | | | | | | Only element 0 of the array is used anywhere at this time, so there should be no changes. v4: Split out from a single megapatch. Suggested by Ken. Signed-off-by: Courtney Goeltzenleuchter <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Update gl_scissor_attrib to support ARB_viewport_arrayCourtney Goeltzenleuchter2014-01-201-6/+16
| | | | | | | | | | | | | | | | | | Update Mesa and drivers to access updated gl_scissor_attrib. Now have an enable bitfield and array of gl_scissor_rects. Drivers have been updated to the new scissor enable state attribute (gl_context.scissor.EnableFlags) but still treat it as a single boolean which is okay as mesa will only use bit 0 when communicating with a driver that does not support ARB_viewport_array. v2 (idr): Rebase fixes. v3 (idr): Small code formatting fix suggsted by Ken. Signed-off-by: Courtney Goeltzenleuchter <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>