summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/bufferobj.c
Commit message (Collapse)AuthorAgeFilesLines
* main: Add utility function _mesa_lookup_bufferobj_err.Laura Ekstrand2015-03-091-0/+19
| | | | | | | This function is exposed to mesa driver internals so that texture buffer objects and array objects can use it. Reviewed-by: Anuj Phogat <[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: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-28/+28
| | | | Acked-by: Eric Anholt <[email protected]>
* mesa: implement GL_AMD_pinned_memoryMarek Olšák2015-02-171-2/+31
| | | | | | | | | | | | | | It's not possible to query the current buffer binding, because the extension doesn't define GL_..._BUFFER__BINDING_AMD. Drivers should check the target parameter of Drivers.BufferData. If it's equal to GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, the memory should be pinned. That's all there is to it. A piglit test is on the piglit mailing list. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Christian König <[email protected]>
* mesa: fix AtomicBuffer typo in _mesa_DeleteBuffersMarek Olšák2015-02-171-1/+1
| | | | | Cc: 10.5 10.4 10.3 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Fix some signed-unsigned comparison warningsJan Vesely2015-01-211-9/+9
| | | | | | | | v2: s/unsigned int/unsigned/ in prog_optimize.c Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: fix 'misalgned' typos in error messagesBrian Paul2014-10-201-2/+2
| | | | Trivial.
* mesa: Drop the "target" parameter from NewBufferObject().Kenneth Graunke2014-10-161-8/+6
| | | | | | | | | | | NewBufferObject took a "target" parameter, which it blindly passed to _mesa_initialize_buffer_object(), which ignored it. Not much point in passing it around. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Mark buffer objects that are used as atomic counter buffersChris Forbes2014-10-161-0/+1
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* mesa: Mark buffer objects which are bound as UBOsChris Forbes2014-10-161-0/+6
| | | | | | | | | When a buffer object is bound to one of the indexed uniform buffer binding points, assume that from that point on it may be used as a uniform buffer. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa: use PRId64 for printing 64-bit intsBrian Paul2014-08-111-16/+17
| | | | | | | | | | | Silences MinGW warnings: warning: unknown conversion type character ‘l’ in format [-Wformat] warning: too many arguments for format [-Wformat-extra-args] v2: use signed types/formats Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: Add missing atomic buffer bindings and unbindingsAditya Atluri2014-08-011-0/+31
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa: Implement glBindBuffersRangeFredrik Höglund2014-05-021-0/+367
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Implement glBindBuffersBaseFredrik Höglund2014-05-021-0/+365
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Refactor set_ubo_binding()Fredrik Höglund2014-05-021-14/+40
| | | | | | | | | Make set_ubo_binding() just update the binding, and move the code that does validation, flushes the vertices etc. into a new bind_uniform_buffer() function. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add helper functions for looking up multiple buffersFredrik Höglund2014-05-021-0/+72
| | | | | | | | | v2: Document the difference between _mesa_lookup_bufferobj() and _mesa_multi_bind_lookup_bufferobj(). v3: Don't create the buffer objects when they don't exist. Reviewed-by: Brian Paul <[email protected]> (v2) Reviewed-by: Ian Romanick <[email protected]> (v2)
* mesa: Refactor set_atomic_buffer_binding()Fredrik Höglund2014-05-021-16/+40
| | | | | | | | | | Make set_atomic_buffer_binding() just update the binding, and move the code that does validation, flushes the vertices etc. into a new bind_atomic_buffer() function. Reviewed-by: Francisco Jerez <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glapi: Add infrastructure for ARB_multi_bindFredrik Höglund2014-05-021-0/+13
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa/st: Accelerate ARB_clear_buffer_object with clear_bufferIlia Mirkin2014-03-311-3/+3
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: switch to c11 mutex functionsBrian Paul2014-03-031-13/+13
| | | | Reviewed-by: José Fonseca <[email protected]>
* mesa: don't call ctx->Driver.ClearBufferSubData() if size==0Brian Paul2014-03-031-4/+8
| | | | | | | | Fixes failed assertion when trying to map zero-length region. https://bugs.freedesktop.org/show_bug.cgi?id=75660 Cc: "10.0" "10.1" <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: allow buffers to be mapped multiple timesMarek Olšák2014-02-251-113/+102
| | | | | | | | | | | | | | | | | | | OpenGL allows a buffer to be mapped only once, but we also map buffers internally, e.g. in the software primitive restart fallback, for PBOs, vbo_get_minmax_index, etc. This has always been a problem, but it will be a bigger problem with persistent buffer mappings, which will prevent all Mesa functions from mapping buffers for internal purposes. This adds a driver interface to core Mesa which supports multiple buffer mappings and allows 2 mappings: one for the GL user and one for Mesa. Note that Gallium supports an unlimited number of buffer and texture mappings, so it's not really an issue for Gallium. v2: fix unmapping in xm_dd.c, remove the GL errors there v3: fix the intel driver (by Fredrik) Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: allow buffers mapped with the persistent flag to be used by the GPUMarek Olšák2014-02-251-13/+19
| | | | | | v2: also fixed InvalidateBufferData, added citations from the 4.4 spec Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: add error checks to glMapBufferRange, glMapBuffer for ARB_buffer_storageMarek Olšák2014-02-251-7/+57
| | | | Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: implement glBufferStorage, immutable buffers; add extension enable flagMarek Olšák2014-02-251-0/+93
| | | | | | | Reviewed-by: Fredrik Höglund <[email protected]> v2: dropped the error that DYNAMIC_STORAGE is required for MAP_WRITE_BIT, the error is removed in the latest revision of GL 4.4
* mesa: add storage flags parameter to Driver.BufferDataMarek Olšák2014-02-251-2/+7
| | | | | | | It will be used by glBufferStorage. The parameters are chosen according to ARB_buffer_storage. Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: remove unused driver hook BindBufferMarek Olšák2014-02-251-5/+0
| | | | Reviewed-by: Fredrik Höglund <[email protected]>
* mesa: Removed unnecessary check for NULL pointer when freeing memorySiavash Eliasi2014-02-091-2/+1
| | | | | | | | | Note that it is OK to pass NULL pointers to this function since this commit: mesa: modified _mesa_align_free() to accept NULL pointer http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0cc59d68a9f5231e8e2111393a1834858820735 Reviewed-by: Marek Olšák <[email protected]>
* mesa: Rename ElementArrayBufferObj to IndexBufferObj.Kenneth Graunke2014-02-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 "struct gl_array_object" to gl_vertex_array_object.Kenneth Graunke2014-02-031-1/+1
| | | | | | | | | | | | | | | | | | 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" local variables to "vao".Kenneth Graunke2014-02-031-4/+4
| | | | | | | | | | | | | Now that the field is named "VAO" instead of "ArrayObj", it makes sense to call the local variables "vao" instead of "arrayObj". Completely generated by: $ find . -type f -print0 | xargs 0 sed -i 's/arrayObj/vao/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 ArrayObj to VAO and DefaultArrayObj to DefaultVAO.Kenneth Graunke2014-02-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: use _mesa_align_free() in _mesa_delete_buffer_object()Brian Paul2014-01-311-1/+1
| | | | | | | To match _mesa_align_malloc() call in _mesa_buffer_data(). Found by Colin Harrison <[email protected]> Signed-off-by: Brian Paul <[email protected]>
* mesa: Use _mesa_align_malloc in _mesa_buffer_dataSiavash Eliasi2014-01-291-2/+5
| | | | | | v2: Fixed memory leak. Reviewed-by: Ian Romanick <[email protected]>
* mesa: change gl_format to mesa_formatMark Mueller2014-01-271-6/+6
| | | | s/\bgl_format\b/mesa_format/g. Use better name for Mesa Formats enum
* mesa/main: Free ctx->DrawIndirectBuffer during teardownAaron Watry2014-01-161-0/+2
| | | | | | | | | | | | | | | | | | ctx->DrawIndirectBuffer wasn't being free'd in _mesa_free_buffer_objects With this patch, "valgrind --leak-check=full glxgears" on evergreen (CEDAR) now shows: LEAK SUMMARY: definitely lost: 0 bytes in 0 blocks indirectly lost: 0 bytes in 0 blocks possibly lost: 0 bytes in 0 blocks still reachable: 70,228 bytes in 651 blocks suppressed: 0 bytes in 0 blocks Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* mesa: Implement functions for clear_buffer_object extensionsPi Tabred2013-12-181-0/+279
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: Modify get_buffer() to allow for a variable error codePi Tabred2013-12-181-16/+28
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: Add bufferobj_range_mapped functionPi Tabred2013-12-181-32/+59
| | | | | | | | | | | Add function to test if the buffer is already mapped and if so, if the mapped range overlaps the given range. Modify the _mesa_InvalidateBufferSubData function to use the new function. Enable buffer_object_subdata_range_good() to use bufferobj_range_mapped Reviewed-by: Brian Paul <[email protected]>
* mesa: Add binding point for indirect bufferChris Forbes2013-11-251-0/+14
| | | | | | | | Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Add ARB_vertex_attrib_bindingFredrik Höglund2013-11-071-2/+2
| | | | | | | update_array() and update_array_format() are changed to update the new attrib and binding states, and the client arrays become derived state. Reviewed-by: Eric Anholt <[email protected]>
* mesa: Make handle_bind_buffer_gen() non-staticFredrik Höglund2013-11-071-10/+14
| | | | | | | | | | | | | | ...and rename it to _mesa_bind_buffer_gen(). This is so the function can be called from _mesa_BindVertexBuffer(). This patch also adds a caller parameter so we can report the right entry point in error messages. Based on a patch by Eric Anholt. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Rename gl_array_object::VertexAttrib to _VertexAttribFredrik Höglund2013-11-071-2/+2
| | | | | | | | This will become derived state as part of the ARB_vertex_attrib_binding support. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add support for ARB_shader_atomic_counters.Francisco Jerez2013-10-291-0/+58
| | | | | | | | | | | | | | | This patch implements the common support code required for the ARB_shader_atomic_counters extension. It defines the necessary data structures for tracking atomic counter buffer objects (from now on "ABOs") associated with some specific context or shader program, it implements support for binding buffers to an ABO binding point and querying the existing atomic counters and buffers declared by GLSL shaders. v2: Fix extension checks. Drop unused MAX_ATOMIC_BUFFERS constant. Acked-by: Paul Berry <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: remove outdated commentDylan Noblesmith2013-09-241-1/+0
| | | | | | | | | | | | | | No such argument exists since this commit: commit 92f3fca0ea429dcf07123e63447449db53308266 Author: Ian Romanick <[email protected]> AuthorDate: Sun Aug 21 17:23:58 2011 -0700 Commit: Ian Romanick <[email protected]> CommitDate: Tue Aug 23 14:52:09 2011 -0700 mesa: Remove target parameter from dd_function_table::BufferSubData Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: free object labels when deletingTimothy Arceri2013-09-041-0/+1
| | | | | | Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* mesa: declare UniformBufferBindings as an array with a static sizeMarek Olšák2013-05-281-8/+2
| | | | | | | | Some Gallium drivers were crashing, because the array was not large enough. v2: clamp the per-shader maximum in st/mesa, then sum them all up NOTE: This is a candidate for the stable branches.
* mesa: add & use a new driver flag for UBO updates instead of _NEW_BUFFER_OBJECTMarek Olšák2013-05-111-1/+2
| | | | | | | v2: move the flagging from intel_bufferobj_data to intel_bufferobj_alloc_buffer Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Restore 78-column wrapping of license text in C-style comments.Kenneth Graunke2013-04-231-3/+4
| | | | | | | | | | | | | | The previous commit introduced extra words, breaking the formatting. This text transformation was done automatically via the following shell command: $ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript where 'vimscript' is a file containing: /THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * ' :wq Reviewed-by: Brian Paul <[email protected]>