mesa/bufferobj: rename bufferobj functions to be more consistent.

After all the refactoring, start consolidating a bit and get the API
names more consistent

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14133>
This commit is contained in:
Dave Airlie 2021-12-09 13:24:54 +10:00 committed by Marge Bot
parent f6840bb940
commit ff8c2a1748
15 changed files with 176 additions and 195 deletions

View File

@ -58,8 +58,6 @@
#include "util/u_memory.h"
#include "api_exec_decl.h"
#include "state_tracker/st_cb_bufferobjects.h"
const GLubyte
_mesa_vao_attribute_map[ATTRIBUTE_MAP_MODE_MAX][VERT_ATTRIB_MAX] =
{
@ -873,7 +871,7 @@ _mesa_vao_map_arrays(struct gl_context *ctx, struct gl_vertex_array_object *vao,
if (_mesa_bufferobj_mapped(bo, MAP_INTERNAL))
continue;
st_bufferobj_map_range(ctx, 0, bo->Size, access, bo, MAP_INTERNAL);
_mesa_bufferobj_map_range(ctx, 0, bo->Size, access, bo, MAP_INTERNAL);
}
}
@ -889,7 +887,7 @@ _mesa_vao_map(struct gl_context *ctx, struct gl_vertex_array_object *vao,
/* map the index buffer, if there is one, and not already mapped */
if (bo && !_mesa_bufferobj_mapped(bo, MAP_INTERNAL))
st_bufferobj_map_range(ctx, 0, bo->Size, access, bo, MAP_INTERNAL);
_mesa_bufferobj_map_range(ctx, 0, bo->Size, access, bo, MAP_INTERNAL);
_mesa_vao_map_arrays(ctx, vao, access);
}
@ -915,7 +913,7 @@ _mesa_vao_unmap_arrays(struct gl_context *ctx,
if (!_mesa_bufferobj_mapped(bo, MAP_INTERNAL))
continue;
st_bufferobj_unmap(ctx, bo, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, bo, MAP_INTERNAL);
}
}
@ -930,7 +928,7 @@ _mesa_vao_unmap(struct gl_context *ctx, struct gl_vertex_array_object *vao)
/* unmap the index buffer, if there is one, and still mapped */
if (bo && _mesa_bufferobj_mapped(bo, MAP_INTERNAL))
st_bufferobj_unmap(ctx, bo, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, bo, MAP_INTERNAL);
_mesa_vao_unmap_arrays(ctx, vao);
}

View File

@ -78,10 +78,10 @@
* Called via glBufferSubDataARB().
*/
void
st_bufferobj_subdata(struct gl_context *ctx,
GLintptrARB offset,
GLsizeiptrARB size,
const void * data, struct gl_buffer_object *obj)
_mesa_bufferobj_subdata(struct gl_context *ctx,
GLintptrARB offset,
GLsizeiptrARB size,
const void *data, struct gl_buffer_object *obj)
{
/* we may be called from VBO code, so double-check params here */
assert(offset >= 0);
@ -308,7 +308,7 @@ bufferobj_data(struct gl_context *ctx,
obj->Usage = usage;
obj->StorageFlags = storageFlags;
mesa_buffer_object_release_buffer(obj);
_mesa_bufferobj_release_buffer(obj);
unsigned bindings = buffer_target_to_bind_flags(target);
@ -385,7 +385,7 @@ bufferobj_data(struct gl_context *ctx,
* \return GL_TRUE for success, GL_FALSE if out of memory
*/
GLboolean
st_bufferobj_data(struct gl_context *ctx,
_mesa_bufferobj_data(struct gl_context *ctx,
GLenum target,
GLsizeiptrARB size,
const void *data,
@ -397,13 +397,13 @@ st_bufferobj_data(struct gl_context *ctx,
}
static GLboolean
st_bufferobj_data_mem(struct gl_context *ctx,
GLenum target,
GLsizeiptrARB size,
struct gl_memory_object *memObj,
GLuint64 offset,
GLenum usage,
struct gl_buffer_object *bufObj)
bufferobj_data_mem(struct gl_context *ctx,
GLenum target,
GLsizeiptrARB size,
struct gl_memory_object *memObj,
GLuint64 offset,
GLenum usage,
struct gl_buffer_object *bufObj)
{
return bufferobj_data(ctx, target, size, NULL, memObj, offset, usage, 0, bufObj);
}
@ -463,10 +463,10 @@ st_access_flags_to_transfer_flags(GLbitfield access, bool wholeBuffer)
* Called via glMapBufferRange().
*/
void *
st_bufferobj_map_range(struct gl_context *ctx,
GLintptr offset, GLsizeiptr length, GLbitfield access,
struct gl_buffer_object *obj,
gl_map_buffer_index index)
_mesa_bufferobj_map_range(struct gl_context *ctx,
GLintptr offset, GLsizeiptr length, GLbitfield access,
struct gl_buffer_object *obj,
gl_map_buffer_index index)
{
struct pipe_context *pipe = ctx->pipe;
@ -508,10 +508,10 @@ st_bufferobj_map_range(struct gl_context *ctx,
void
st_bufferobj_flush_mapped_range(struct gl_context *ctx,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj,
gl_map_buffer_index index)
_mesa_bufferobj_flush_mapped_range(struct gl_context *ctx,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj,
gl_map_buffer_index index)
{
struct pipe_context *pipe = ctx->pipe;
@ -534,8 +534,8 @@ st_bufferobj_flush_mapped_range(struct gl_context *ctx,
* Called via glUnmapBufferARB().
*/
GLboolean
st_bufferobj_unmap(struct gl_context *ctx, struct gl_buffer_object *obj,
gl_map_buffer_index index)
_mesa_bufferobj_unmap(struct gl_context *ctx, struct gl_buffer_object *obj,
gl_map_buffer_index index)
{
struct pipe_context *pipe = ctx->pipe;
@ -1008,7 +1008,7 @@ convert_clear_buffer_data(struct gl_context *ctx,
}
void
mesa_buffer_object_release_buffer(struct gl_buffer_object *obj)
_mesa_bufferobj_release_buffer(struct gl_buffer_object *obj)
{
if (!obj->buffer)
return;
@ -1038,7 +1038,7 @@ _mesa_delete_buffer_object(struct gl_context *ctx,
{
assert(bufObj->RefCount == 0);
_mesa_buffer_unmap_all_mappings(ctx, bufObj);
mesa_buffer_object_release_buffer(bufObj);
_mesa_bufferobj_release_buffer(bufObj);
vbo_delete_minmax_cache(bufObj);
align_free(bufObj->Data);
@ -1195,10 +1195,10 @@ _mesa_ClearBufferSubData_sw(struct gl_context *ctx,
GLsizeiptr i;
GLubyte *dest;
dest = st_bufferobj_map_range(ctx, offset, size,
GL_MAP_WRITE_BIT |
GL_MAP_INVALIDATE_RANGE_BIT,
bufObj, MAP_INTERNAL);
dest = _mesa_bufferobj_map_range(ctx, offset, size,
GL_MAP_WRITE_BIT |
GL_MAP_INVALIDATE_RANGE_BIT,
bufObj, MAP_INTERNAL);
if (!dest) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glClearBuffer[Sub]Data");
@ -1208,7 +1208,7 @@ _mesa_ClearBufferSubData_sw(struct gl_context *ctx,
if (clearValue == NULL) {
/* Clear with zeros, per the spec */
memset(dest, 0, size);
st_bufferobj_unmap(ctx, bufObj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, bufObj, MAP_INTERNAL);
return;
}
@ -1217,7 +1217,7 @@ _mesa_ClearBufferSubData_sw(struct gl_context *ctx,
dest += clearValueSize;
}
st_bufferobj_unmap(ctx, bufObj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, bufObj, MAP_INTERNAL);
}
/**
@ -1378,7 +1378,7 @@ _mesa_free_buffer_objects( struct gl_context *ctx )
}
struct gl_buffer_object *
_mesa_internal_buffer_object_alloc(struct gl_context *ctx, GLuint id)
_mesa_bufferobj_alloc(struct gl_context *ctx, GLuint id)
{
struct gl_buffer_object *buf = CALLOC_STRUCT(gl_buffer_object);
if (!buf)
@ -1397,7 +1397,7 @@ _mesa_internal_buffer_object_alloc(struct gl_context *ctx, GLuint id)
static struct gl_buffer_object *
new_gl_buffer_object(struct gl_context *ctx, GLuint id)
{
struct gl_buffer_object *buf = _mesa_internal_buffer_object_alloc(ctx, id);
struct gl_buffer_object *buf = _mesa_bufferobj_alloc(ctx, id);
buf->Ctx = ctx;
buf->RefCount++; /* global buffer reference held by the context */
@ -1623,7 +1623,7 @@ _mesa_buffer_unmap_all_mappings(struct gl_context *ctx,
{
for (int i = 0; i < MAP_COUNT; i++) {
if (_mesa_bufferobj_mapped(bufObj, i)) {
st_bufferobj_unmap(ctx, bufObj, i);
_mesa_bufferobj_unmap(ctx, bufObj, i);
assert(bufObj->Mappings[i].Pointer == NULL);
bufObj->Mappings[i].AccessFlags = 0;
}
@ -2276,12 +2276,12 @@ buffer_storage(struct gl_context *ctx, struct gl_buffer_object *bufObj,
bufObj->MinMaxCacheDirty = true;
if (memObj) {
res = st_bufferobj_data_mem(ctx, target, size, memObj, offset,
GL_DYNAMIC_DRAW, bufObj);
res = bufferobj_data_mem(ctx, target, size, memObj, offset,
GL_DYNAMIC_DRAW, bufObj);
}
else {
res = st_bufferobj_data(ctx, target, size, data, GL_DYNAMIC_DRAW,
flags, bufObj);
res = _mesa_bufferobj_data(ctx, target, size, data, GL_DYNAMIC_DRAW,
flags, bufObj);
}
if (!res) {
@ -2529,11 +2529,11 @@ buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
size += 100;
#endif
if (!st_bufferobj_data(ctx, target, size, data, usage,
GL_MAP_READ_BIT |
GL_MAP_WRITE_BIT |
GL_DYNAMIC_STORAGE_BIT,
bufObj)) {
if (!_mesa_bufferobj_data(ctx, target, size, data, usage,
GL_MAP_READ_BIT |
GL_MAP_WRITE_BIT |
GL_DYNAMIC_STORAGE_BIT,
bufObj)) {
if (target == GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD) {
if (!no_error) {
/* From GL_AMD_pinned_memory:
@ -2708,7 +2708,7 @@ _mesa_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
bufObj->Written = GL_TRUE;
bufObj->MinMaxCacheDirty = true;
st_bufferobj_subdata(ctx, offset, size, data, bufObj);
_mesa_bufferobj_subdata(ctx, offset, size, data, bufObj);
}
@ -3118,7 +3118,7 @@ _mesa_ClearNamedBufferSubDataEXT(GLuint buffer, GLenum internalformat,
static GLboolean
unmap_buffer(struct gl_context *ctx, struct gl_buffer_object *bufObj)
{
GLboolean status = st_bufferobj_unmap(ctx, bufObj, MAP_USER);
GLboolean status = _mesa_bufferobj_unmap(ctx, bufObj, MAP_USER);
bufObj->Mappings[MAP_USER].AccessFlags = 0;
assert(bufObj->Mappings[MAP_USER].Pointer == NULL);
assert(bufObj->Mappings[MAP_USER].Offset == 0);
@ -3813,8 +3813,8 @@ map_buffer_range(struct gl_context *ctx, struct gl_buffer_object *bufObj,
return NULL;
}
void *map = st_bufferobj_map_range(ctx, offset, length, access, bufObj,
MAP_USER);
void *map = _mesa_bufferobj_map_range(ctx, offset, length, access, bufObj,
MAP_USER);
if (!map) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s(map failed)", func);
}
@ -4142,8 +4142,8 @@ flush_mapped_buffer_range(struct gl_context *ctx,
assert(bufObj->Mappings[MAP_USER].AccessFlags & GL_MAP_WRITE_BIT);
st_bufferobj_flush_mapped_range(ctx, offset, length, bufObj,
MAP_USER);
_mesa_bufferobj_flush_mapped_range(ctx, offset, length, bufObj,
MAP_USER);
}
void GLAPIENTRY
@ -4154,8 +4154,8 @@ _mesa_FlushMappedBufferRange_no_error(GLenum target, GLintptr offset,
struct gl_buffer_object **bufObjPtr = get_buffer_target(ctx, target);
struct gl_buffer_object *bufObj = *bufObjPtr;
st_bufferobj_flush_mapped_range(ctx, offset, length, bufObj,
MAP_USER);
_mesa_bufferobj_flush_mapped_range(ctx, offset, length, bufObj,
MAP_USER);
}
void GLAPIENTRY
@ -4181,8 +4181,8 @@ _mesa_FlushMappedNamedBufferRange_no_error(GLuint buffer, GLintptr offset,
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, buffer);
st_bufferobj_flush_mapped_range(ctx, offset, length, bufObj,
MAP_USER);
_mesa_bufferobj_flush_mapped_range(ctx, offset, length, bufObj,
MAP_USER);
}
void GLAPIENTRY

View File

@ -37,7 +37,7 @@
*/
static inline struct pipe_resource *
_mesa_get_buffer_object_reference(struct gl_context *ctx, struct gl_buffer_object *obj)
_mesa_get_bufferobj_reference(struct gl_context *ctx, struct gl_buffer_object *obj)
{
if (unlikely(!obj))
return NULL;
@ -68,34 +68,34 @@ _mesa_get_buffer_object_reference(struct gl_context *ctx, struct gl_buffer_objec
return buffer;
}
void st_bufferobj_subdata(struct gl_context *ctx,
void _mesa_bufferobj_subdata(struct gl_context *ctx,
GLintptrARB offset,
GLsizeiptrARB size,
const void * data, struct gl_buffer_object *obj);
GLboolean st_bufferobj_data(struct gl_context *ctx,
GLboolean _mesa_bufferobj_data(struct gl_context *ctx,
GLenum target,
GLsizeiptrARB size,
const void *data,
GLenum usage,
GLbitfield storageFlags,
struct gl_buffer_object *obj);
void *st_bufferobj_map_range(struct gl_context *ctx,
GLintptr offset, GLsizeiptr length,
GLbitfield access,
struct gl_buffer_object *obj,
gl_map_buffer_index index);
void *_mesa_bufferobj_map_range(struct gl_context *ctx,
GLintptr offset, GLsizeiptr length,
GLbitfield access,
struct gl_buffer_object *obj,
gl_map_buffer_index index);
void st_bufferobj_flush_mapped_range(struct gl_context *ctx,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj,
gl_map_buffer_index index);
GLboolean st_bufferobj_unmap(struct gl_context *ctx, struct gl_buffer_object *obj,
gl_map_buffer_index index);
void _mesa_bufferobj_flush_mapped_range(struct gl_context *ctx,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj,
gl_map_buffer_index index);
GLboolean _mesa_bufferobj_unmap(struct gl_context *ctx, struct gl_buffer_object *obj,
gl_map_buffer_index index);
struct gl_buffer_object *
_mesa_internal_buffer_object_alloc(struct gl_context *ctx, GLuint id);
_mesa_bufferobj_alloc(struct gl_context *ctx, GLuint id);
void
mesa_buffer_object_release_buffer(struct gl_buffer_object *obj);
_mesa_bufferobj_release_buffer(struct gl_buffer_object *obj);
/** Is the given buffer object currently mapped by the GL user? */
static inline GLboolean

View File

@ -53,7 +53,6 @@
#include "state_tracker/st_cb_texture.h"
#include "state_tracker/st_cb_bitmap.h"
#include "state_tracker/st_cb_bufferobjects.h"
#define USE_BITMAP_ATLAS 1
@ -1449,9 +1448,9 @@ unpack_image(struct gl_context *ctx, GLuint dimensions,
GLvoid *image;
map = (GLubyte *)
st_bufferobj_map_range(ctx, 0, unpack->BufferObj->Size,
GL_MAP_READ_BIT, unpack->BufferObj,
MAP_INTERNAL);
_mesa_bufferobj_map_range(ctx, 0, unpack->BufferObj->Size,
GL_MAP_READ_BIT, unpack->BufferObj,
MAP_INTERNAL);
if (!map) {
/* unable to map src buffer! */
_mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
@ -1462,7 +1461,7 @@ unpack_image(struct gl_context *ctx, GLuint dimensions,
image = _mesa_unpack_image(dimensions, width, height, depth,
format, type, src, unpack);
st_bufferobj_unmap(ctx, unpack->BufferObj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, unpack->BufferObj, MAP_INTERNAL);
if (!image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");

View File

@ -25,8 +25,6 @@
#include "main/dispatch.h"
#include "main/bufferobj.h"
#include "state_tracker/st_cb_bufferobjects.h"
/**
* Create an upload buffer. This is called from the app thread, so everything
* has to be thread-safe in the driver.
@ -37,13 +35,13 @@ new_upload_buffer(struct gl_context *ctx, GLsizeiptr size, uint8_t **ptr)
assert(ctx->GLThread.SupportsBufferUploads);
struct gl_buffer_object *obj =
_mesa_internal_buffer_object_alloc(ctx, -1);
_mesa_bufferobj_alloc(ctx, -1);
if (!obj)
return NULL;
obj->Immutable = true;
if (!st_bufferobj_data(ctx, GL_ARRAY_BUFFER, size, NULL,
if (!_mesa_bufferobj_data(ctx, GL_ARRAY_BUFFER, size, NULL,
GL_WRITE_ONLY,
GL_CLIENT_STORAGE_BIT | GL_MAP_WRITE_BIT,
obj)) {
@ -51,7 +49,7 @@ new_upload_buffer(struct gl_context *ctx, GLsizeiptr size, uint8_t **ptr)
return NULL;
}
*ptr = st_bufferobj_map_range(ctx, 0, size,
*ptr = _mesa_bufferobj_map_range(ctx, 0, size,
GL_MAP_WRITE_BIT |
GL_MAP_UNSYNCHRONIZED_BIT |
MESA_MAP_THREAD_SAFE_BIT,

View File

@ -40,9 +40,6 @@
#include "macros.h"
#include "pbo.h"
#include "state_tracker/st_cb_bufferobjects.h"
/**
* When we're about to read pixel data out of a PBO (via glDrawPixels,
* glTexImage, etc) or write data into a PBO (via glReadPixels,
@ -154,11 +151,11 @@ _mesa_map_pbo_source(struct gl_context *ctx,
if (unpack->BufferObj) {
/* unpack from PBO */
buf = (GLubyte *) st_bufferobj_map_range(ctx, 0,
unpack->BufferObj->Size,
GL_MAP_READ_BIT,
unpack->BufferObj,
MAP_INTERNAL);
buf = (GLubyte *) _mesa_bufferobj_map_range(ctx, 0,
unpack->BufferObj->Size,
GL_MAP_READ_BIT,
unpack->BufferObj,
MAP_INTERNAL);
if (!buf)
return NULL;
@ -286,7 +283,7 @@ _mesa_unmap_pbo_source(struct gl_context *ctx,
{
assert(unpack != &ctx->Pack); /* catch pack/unpack mismatch */
if (unpack->BufferObj) {
st_bufferobj_unmap(ctx, unpack->BufferObj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, unpack->BufferObj, MAP_INTERNAL);
}
}
@ -308,11 +305,11 @@ _mesa_map_pbo_dest(struct gl_context *ctx,
if (pack->BufferObj) {
/* pack into PBO */
buf = (GLubyte *) st_bufferobj_map_range(ctx, 0,
pack->BufferObj->Size,
GL_MAP_WRITE_BIT,
pack->BufferObj,
MAP_INTERNAL);
buf = (GLubyte *) _mesa_bufferobj_map_range(ctx, 0,
pack->BufferObj->Size,
GL_MAP_WRITE_BIT,
pack->BufferObj,
MAP_INTERNAL);
if (!buf)
return NULL;
@ -383,7 +380,7 @@ _mesa_unmap_pbo_dest(struct gl_context *ctx,
{
assert(pack != &ctx->Unpack); /* catch pack/unpack mismatch */
if (pack->BufferObj) {
st_bufferobj_unmap(ctx, pack->BufferObj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, pack->BufferObj, MAP_INTERNAL);
}
}
@ -414,11 +411,11 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
return NULL;
}
buf = (GLubyte *) st_bufferobj_map_range(ctx, 0,
unpack->BufferObj->Size,
GL_MAP_READ_BIT,
unpack->BufferObj,
MAP_INTERNAL);
buf = (GLubyte *) _mesa_bufferobj_map_range(ctx, 0,
unpack->BufferObj->Size,
GL_MAP_READ_BIT,
unpack->BufferObj,
MAP_INTERNAL);
if (!buf) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(PBO is mapped)", funcName,
dimensions);
@ -456,11 +453,11 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
return pixels;
}
buf = (GLubyte*) st_bufferobj_map_range(ctx, 0,
packing->BufferObj->Size,
GL_MAP_READ_BIT,
packing->BufferObj,
MAP_INTERNAL);
buf = (GLubyte*) _mesa_bufferobj_map_range(ctx, 0,
packing->BufferObj->Size,
GL_MAP_READ_BIT,
packing->BufferObj,
MAP_INTERNAL);
/* Validation above already checked that PBO is not mapped, so buffer
* should not be null.
@ -480,6 +477,6 @@ _mesa_unmap_teximage_pbo(struct gl_context *ctx,
const struct gl_pixelstore_attrib *unpack)
{
if (unpack->BufferObj) {
st_bufferobj_unmap(ctx, unpack->BufferObj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, unpack->BufferObj, MAP_INTERNAL);
}
}

View File

@ -51,7 +51,6 @@
#include "api_exec_decl.h"
#include "state_tracker/st_cb_texture.h"
#include "state_tracker/st_cb_bufferobjects.h"
/**
* Can the given type represent negative values?
@ -711,9 +710,9 @@ _mesa_GetTexSubImage_sw(struct gl_context *ctx,
* texture data to the PBO if the PBO is in VRAM along with the texture.
*/
GLubyte *buf = (GLubyte *)
st_bufferobj_map_range(ctx, 0, ctx->Pack.BufferObj->Size,
GL_MAP_WRITE_BIT, ctx->Pack.BufferObj,
MAP_INTERNAL);
_mesa_bufferobj_map_range(ctx, 0, ctx->Pack.BufferObj->Size,
GL_MAP_WRITE_BIT, ctx->Pack.BufferObj,
MAP_INTERNAL);
if (!buf) {
/* out of memory or other unexpected error */
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)");
@ -763,7 +762,7 @@ _mesa_GetTexSubImage_sw(struct gl_context *ctx,
}
if (ctx->Pack.BufferObj) {
st_bufferobj_unmap(ctx, ctx->Pack.BufferObj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, ctx->Pack.BufferObj, MAP_INTERNAL);
}
}
@ -793,9 +792,9 @@ get_compressed_texsubimage_sw(struct gl_context *ctx,
if (ctx->Pack.BufferObj) {
/* pack texture image into a PBO */
dest = (GLubyte *)
st_bufferobj_map_range(ctx, 0, ctx->Pack.BufferObj->Size,
GL_MAP_WRITE_BIT, ctx->Pack.BufferObj,
MAP_INTERNAL);
_mesa_bufferobj_map_range(ctx, 0, ctx->Pack.BufferObj->Size,
GL_MAP_WRITE_BIT, ctx->Pack.BufferObj,
MAP_INTERNAL);
if (!dest) {
/* out of memory or other unexpected error */
_mesa_error(ctx, GL_OUT_OF_MEMORY,
@ -838,7 +837,7 @@ get_compressed_texsubimage_sw(struct gl_context *ctx,
}
if (ctx->Pack.BufferObj) {
st_bufferobj_unmap(ctx, ctx->Pack.BufferObj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, ctx->Pack.BufferObj, MAP_INTERNAL);
}
}

View File

@ -109,7 +109,7 @@ setup_arrays(struct st_context *st,
/* Set the vertex buffer. */
if (binding->BufferObj) {
vbuffer[bufidx].buffer.resource =
_mesa_get_buffer_object_reference(ctx, binding->BufferObj);
_mesa_get_bufferobj_reference(ctx, binding->BufferObj);
vbuffer[bufidx].is_user_buffer = false;
vbuffer[bufidx].buffer_offset = binding->Offset +
attrib->RelativeOffset;
@ -142,7 +142,7 @@ setup_arrays(struct st_context *st,
if (binding->BufferObj) {
/* Set the binding */
vbuffer[bufidx].buffer.resource =
_mesa_get_buffer_object_reference(ctx, binding->BufferObj);
_mesa_get_bufferobj_reference(ctx, binding->BufferObj);
vbuffer[bufidx].is_user_buffer = false;
vbuffer[bufidx].buffer_offset = _mesa_draw_binding_offset(binding);
} else {

View File

@ -273,7 +273,7 @@ st_bind_ubos(struct st_context *st, struct gl_program *prog,
binding =
&st->ctx->UniformBufferBindings[prog->sh.UniformBlocks[i]->Binding];
cb.buffer = _mesa_get_buffer_object_reference(st->ctx, binding->BufferObject);
cb.buffer = _mesa_get_bufferobj_reference(st->ctx, binding->BufferObject);
if (cb.buffer) {
cb.buffer_offset = binding->Offset;

View File

@ -154,7 +154,7 @@ prepare_indexed_draw(/* pass both st and ctx to reduce dereferences */
* the threaded batch buffer.
*/
info->index.resource =
_mesa_get_buffer_object_reference(ctx, info->index.gl_bo);
_mesa_get_bufferobj_reference(ctx, info->index.gl_bo);
info->take_index_buffer_ownership = true;
} else {
info->index.resource = info->index.gl_bo->buffer;

View File

@ -47,8 +47,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vbo_private.h"
#include "state_tracker/st_cb_bufferobjects.h"
/** ID/name for immediate-mode VBO */
#define IMM_BUFFER_NAME 0xaabbccdd
@ -1097,7 +1095,7 @@ vbo_exec_vtx_init(struct vbo_exec_context *exec)
{
struct gl_context *ctx = gl_context_from_vbo_exec(exec);
exec->vtx.bufferobj = _mesa_internal_buffer_object_alloc(ctx, IMM_BUFFER_NAME);
exec->vtx.bufferobj = _mesa_bufferobj_alloc(ctx, IMM_BUFFER_NAME);
exec->vtx.enabled = u_bit_consecutive64(0, VBO_ATTRIB_MAX); /* reset all */
vbo_reset_all_attr(exec);
@ -1129,7 +1127,7 @@ vbo_exec_vtx_destroy(struct vbo_exec_context *exec)
*/
if (exec->vtx.bufferobj &&
_mesa_bufferobj_mapped(exec->vtx.bufferobj, MAP_INTERNAL)) {
st_bufferobj_unmap(ctx, exec->vtx.bufferobj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, exec->vtx.bufferobj, MAP_INTERNAL);
}
_mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
}

View File

@ -37,8 +37,6 @@
#include "vbo_private.h"
#include "state_tracker/st_cb_bufferobjects.h"
static void
vbo_exec_debug_verts(struct vbo_exec_context *exec)
{
@ -163,9 +161,9 @@ vbo_exec_vtx_unmap(struct vbo_exec_context *exec)
sizeof(float);
if (length)
st_bufferobj_flush_mapped_range(ctx, offset, length,
exec->vtx.bufferobj,
MAP_INTERNAL);
_mesa_bufferobj_flush_mapped_range(ctx, offset, length,
exec->vtx.bufferobj,
MAP_INTERNAL);
}
exec->vtx.buffer_used += (exec->vtx.buffer_ptr -
@ -174,7 +172,7 @@ vbo_exec_vtx_unmap(struct vbo_exec_context *exec)
assert(exec->vtx.buffer_used <= ctx->Const.glBeginEndBufferSize);
assert(exec->vtx.buffer_ptr != NULL);
st_bufferobj_unmap(ctx, exec->vtx.bufferobj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, exec->vtx.bufferobj, MAP_INTERNAL);
exec->vtx.buffer_map = NULL;
exec->vtx.buffer_ptr = NULL;
exec->vtx.max_vert = 0;
@ -225,13 +223,13 @@ vbo_exec_vtx_map(struct vbo_exec_context *exec)
/* The VBO exists and there's room for more */
if (exec->vtx.bufferobj->Size > 0) {
exec->vtx.buffer_map = (fi_type *)
st_bufferobj_map_range(ctx,
exec->vtx.buffer_used,
ctx->Const.glBeginEndBufferSize
- exec->vtx.buffer_used,
accessRange,
exec->vtx.bufferobj,
MAP_INTERNAL);
_mesa_bufferobj_map_range(ctx,
exec->vtx.buffer_used,
ctx->Const.glBeginEndBufferSize
- exec->vtx.buffer_used,
accessRange,
exec->vtx.bufferobj,
MAP_INTERNAL);
exec->vtx.buffer_ptr = exec->vtx.buffer_map;
}
else {
@ -243,24 +241,24 @@ vbo_exec_vtx_map(struct vbo_exec_context *exec)
/* Need to allocate a new VBO */
exec->vtx.buffer_used = 0;
if (st_bufferobj_data(ctx, GL_ARRAY_BUFFER_ARB,
ctx->Const.glBeginEndBufferSize,
NULL, usage,
GL_MAP_WRITE_BIT |
(ctx->Extensions.ARB_buffer_storage ?
GL_MAP_PERSISTENT_BIT |
GL_MAP_COHERENT_BIT |
GL_MAP_READ_BIT : 0) |
GL_DYNAMIC_STORAGE_BIT |
GL_CLIENT_STORAGE_BIT,
exec->vtx.bufferobj)) {
if (_mesa_bufferobj_data(ctx, GL_ARRAY_BUFFER_ARB,
ctx->Const.glBeginEndBufferSize,
NULL, usage,
GL_MAP_WRITE_BIT |
(ctx->Extensions.ARB_buffer_storage ?
GL_MAP_PERSISTENT_BIT |
GL_MAP_COHERENT_BIT |
GL_MAP_READ_BIT : 0) |
GL_DYNAMIC_STORAGE_BIT |
GL_CLIENT_STORAGE_BIT,
exec->vtx.bufferobj)) {
/* buffer allocation worked, now map the buffer */
exec->vtx.buffer_map =
(fi_type *)st_bufferobj_map_range(ctx,
0, ctx->Const.glBeginEndBufferSize,
accessRange,
exec->vtx.bufferobj,
MAP_INTERNAL);
(fi_type *)_mesa_bufferobj_map_range(ctx,
0, ctx->Const.glBeginEndBufferSize,
accessRange,
exec->vtx.bufferobj,
MAP_INTERNAL);
}
else {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "VBO allocation");

View File

@ -36,8 +36,6 @@
#include "util/u_memory.h"
#include "pipe/p_state.h"
#include "state_tracker/st_cb_bufferobjects.h"
struct minmax_cache_key {
GLintptr offset;
GLuint count;
@ -339,8 +337,8 @@ vbo_get_minmax_index(struct gl_context *ctx, struct gl_buffer_object *obj,
max_index))
return;
indices = st_bufferobj_map_range(ctx, offset, size, GL_MAP_READ_BIT,
obj, MAP_INTERNAL);
indices = _mesa_bufferobj_map_range(ctx, offset, size, GL_MAP_READ_BIT,
obj, MAP_INTERNAL);
}
vbo_get_minmax_index_mapped(count, index_size, restart_index,
@ -350,7 +348,7 @@ vbo_get_minmax_index(struct gl_context *ctx, struct gl_buffer_object *obj,
if (obj) {
vbo_minmax_cache_store(ctx, obj, index_size, offset, count, *min_index,
*max_index);
st_bufferobj_unmap(ctx, obj, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, obj, MAP_INTERNAL);
}
}

View File

@ -124,8 +124,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "api_exec_decl.h"
#include "api_save.h"
#include "state_tracker/st_cb_bufferobjects.h"
#ifdef ERROR
#undef ERROR
#endif
@ -768,14 +766,14 @@ compile_vertex_list(struct gl_context *ctx)
if (total_bytes_needed > available_bytes) {
if (save->current_bo)
_mesa_reference_buffer_object(ctx, &save->current_bo, NULL);
save->current_bo = _mesa_internal_buffer_object_alloc(ctx, VBO_BUF_ID + 1);
bool success = st_bufferobj_data(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
MAX2(total_bytes_needed, VBO_SAVE_BUFFER_SIZE),
NULL,
GL_STATIC_DRAW_ARB, GL_MAP_WRITE_BIT |
MESA_GALLIUM_VERTEX_STATE_STORAGE,
save->current_bo);
save->current_bo = _mesa_bufferobj_alloc(ctx, VBO_BUF_ID + 1);
bool success = _mesa_bufferobj_data(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
MAX2(total_bytes_needed, VBO_SAVE_BUFFER_SIZE),
NULL,
GL_STATIC_DRAW_ARB, GL_MAP_WRITE_BIT |
MESA_GALLIUM_VERTEX_STATE_STORAGE,
save->current_bo);
if (!success) {
_mesa_reference_buffer_object(ctx, &save->current_bo, NULL);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "IB allocation");
@ -824,11 +822,11 @@ compile_vertex_list(struct gl_context *ctx)
_mesa_reference_buffer_object(ctx, &node->cold->ib.obj, save->current_bo);
/* Upload the vertices first (see buffer_offset) */
st_bufferobj_subdata(ctx,
save->current_bo_bytes_used,
total_vert_count * save->vertex_size * sizeof(fi_type),
vertex_to_index ? temp_vertices_buffer : save->vertex_store->buffer_in_ram,
node->cold->ib.obj);
_mesa_bufferobj_subdata(ctx,
save->current_bo_bytes_used,
total_vert_count * save->vertex_size * sizeof(fi_type),
vertex_to_index ? temp_vertices_buffer : save->vertex_store->buffer_in_ram,
node->cold->ib.obj);
save->current_bo_bytes_used += total_vert_count * save->vertex_size * sizeof(fi_type);
if (vertex_to_index) {
@ -846,11 +844,11 @@ compile_vertex_list(struct gl_context *ctx)
/* Then upload the indices. */
if (node->cold->ib.obj) {
st_bufferobj_subdata(ctx,
save->current_bo_bytes_used,
idx * sizeof(uint32_t),
indices,
node->cold->ib.obj);
_mesa_bufferobj_subdata(ctx,
save->current_bo_bytes_used,
idx * sizeof(uint32_t),
indices,
node->cold->ib.obj);
save->current_bo_bytes_used += idx * sizeof(uint32_t);
} else {
node->cold->vertex_count = 0;
@ -901,14 +899,14 @@ end:
node->draw_begins = node->cold->prims[0].begin;
if (!save->current_bo) {
save->current_bo = _mesa_internal_buffer_object_alloc(ctx, VBO_BUF_ID + 1);
bool success = st_bufferobj_data(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
VBO_SAVE_BUFFER_SIZE,
NULL,
GL_STATIC_DRAW_ARB, GL_MAP_WRITE_BIT |
MESA_GALLIUM_VERTEX_STATE_STORAGE,
save->current_bo);
save->current_bo = _mesa_bufferobj_alloc(ctx, VBO_BUF_ID + 1);
bool success = _mesa_bufferobj_data(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
VBO_SAVE_BUFFER_SIZE,
NULL,
GL_STATIC_DRAW_ARB, GL_MAP_WRITE_BIT |
MESA_GALLIUM_VERTEX_STATE_STORAGE,
save->current_bo);
if (!success)
save->out_of_memory = true;
}

View File

@ -41,8 +41,6 @@
#include "vbo_private.h"
#include "state_tracker/st_cb_bufferobjects.h"
static void
copy_vao(struct gl_context *ctx, const struct gl_vertex_array_object *vao,
GLbitfield mask, GLbitfield state, GLbitfield pop_state,
@ -148,14 +146,14 @@ loopback_vertex_list(struct gl_context *ctx,
const struct vbo_save_vertex_list *list)
{
struct gl_buffer_object *bo = list->cold->VAO[0]->BufferBinding[0].BufferObj;
void *buffer = st_bufferobj_map_range(ctx, 0, bo->Size, GL_MAP_READ_BIT, /* ? */
bo, MAP_INTERNAL);
void *buffer = _mesa_bufferobj_map_range(ctx, 0, bo->Size, GL_MAP_READ_BIT, /* ? */
bo, MAP_INTERNAL);
/* TODO: in this case, we shouldn't create a bo at all and instead keep
* the in-RAM buffer. */
_vbo_loopback_vertex_list(ctx, list, buffer);
st_bufferobj_unmap(ctx, bo, MAP_INTERNAL);
_mesa_bufferobj_unmap(ctx, bo, MAP_INTERNAL);
}