summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-01-25 20:53:31 +0000
committerKeith Whitwell <[email protected]>2008-01-25 20:53:31 +0000
commit1e0d30a515e4cac891b6c590f12a33e0e8a8e295 (patch)
tree72ffec9e89bd0bd9202fcfc39f5e7bdf881adcf2 /src/mesa/state_tracker
parent756d52ec12c41ee90ee9598dc9028cc134806bd2 (diff)
gallium: rename pipe_buffer_handle to pipe_buffer, rework pipebuffer/ code
Provide an actual definition of the pipe_buffer struct, containing the parameters used to create the buffer, and its refcount. Shift refcounting buffers out of the winsys interface, similar to surfaces & textures. Rework pipebuffer/ to reflect the fact these changes, and also Michel's reworking of the buffer interface.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c3
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c5
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.h4
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c4
-rw-r--r--src/mesa/state_tracker/st_context.c3
-rw-r--r--src/mesa/state_tracker/st_draw.c21
6 files changed, 22 insertions, 18 deletions
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index c9d63136b5f..21416da2e01 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -37,6 +37,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
+#include "pipe/p_inlines.h"
#include "st_context.h"
#include "st_atom.h"
@@ -70,7 +71,7 @@ void st_upload_constants( struct st_context *st,
_mesa_load_state_parameters(st->ctx, params);
if (cbuf->buffer && cbuf->size != paramBytes)
- ws->buffer_reference( ws, &cbuf->buffer, NULL );
+ pipe_buffer_reference( ws, &cbuf->buffer, NULL );
if (!cbuf->buffer) {
cbuf->buffer = ws->buffer_create(ws, 1, PIPE_BUFFER_USAGE_CONSTANT,
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 60bd1d5f0d2..fa1254ff7ca 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -36,6 +36,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
+#include "pipe/p_inlines.h"
@@ -78,7 +79,7 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
struct st_buffer_object *st_obj = st_buffer_object(obj);
if (st_obj->buffer)
- pipe->winsys->buffer_reference(pipe->winsys, &st_obj->buffer, NULL);
+ pipe_buffer_reference(pipe->winsys, &st_obj->buffer, NULL);
free(st_obj);
}
@@ -173,7 +174,7 @@ st_bufferobj_data(GLcontext *ctx,
buffer_usage = 0;
}
- pipe->winsys->buffer_reference( pipe->winsys, &st_obj->buffer, NULL );
+ pipe_buffer_reference( pipe->winsys, &st_obj->buffer, NULL );
st_obj->buffer = pipe->winsys->buffer_create( pipe->winsys, 32, buffer_usage,
size );
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.h b/src/mesa/state_tracker/st_cb_bufferobjects.h
index 15003ae15d6..dcbb5a52336 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.h
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.h
@@ -30,7 +30,7 @@
struct st_context;
struct gl_buffer_object;
-struct pipe_buffer_handle;
+struct pipe_buffer;
/**
* State_tracker vertex/pixel buffer object, derived from Mesa's
@@ -39,7 +39,7 @@ struct pipe_buffer_handle;
struct st_buffer_object
{
struct gl_buffer_object Base;
- struct pipe_buffer_handle *buffer;
+ struct pipe_buffer *buffer;
GLsizeiptrARB size;
};
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index f02cb3d1336..43416232670 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -100,8 +100,8 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
}
if (strb->surface->buffer)
- pipe->winsys->buffer_reference(pipe->winsys, &strb->surface->buffer,
- NULL);
+ pipe_buffer_reference(pipe->winsys, &strb->surface->buffer,
+ NULL);
/* Determine surface format here */
if (strb->format != PIPE_FORMAT_NONE) {
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 668ac139f72..9c206c057a0 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -52,6 +52,7 @@
#include "st_program.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
+#include "pipe/p_inlines.h"
#include "pipe/draw/draw_context.h"
#include "pipe/cso_cache/cso_cache.h"
@@ -152,7 +153,7 @@ static void st_destroy_context_priv( struct st_context *st )
for (i = 0; i < Elements(st->state.constants); i++) {
if (st->state.constants[i].buffer) {
- ws->buffer_reference(ws, &st->state.constants[i].buffer, NULL);
+ pipe_buffer_reference(ws, &st->state.constants[i].buffer, NULL);
}
}
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 371d4e7966b..8ef50ee7684 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -45,6 +45,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_winsys.h"
+#include "pipe/p_inlines.h"
#include "pipe/draw/draw_private.h"
#include "pipe/draw/draw_context.h"
@@ -237,7 +238,7 @@ st_draw_vbo(GLcontext *ctx,
assert(stobj->buffer);
vbuffer[attr].buffer = NULL;
- winsys->buffer_reference(winsys, &vbuffer[attr].buffer, stobj->buffer);
+ pipe_buffer_reference(winsys, &vbuffer[attr].buffer, stobj->buffer);
vbuffer[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
velement.src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
assert(velement.src_offset <= 2048); /* 11-bit field */
@@ -282,7 +283,7 @@ st_draw_vbo(GLcontext *ctx,
if (ib) {
/* indexed primitive */
struct gl_buffer_object *bufobj = ib->obj;
- struct pipe_buffer_handle *indexBuf = NULL;
+ struct pipe_buffer *indexBuf = NULL;
unsigned indexSize, indexOffset, i;
switch (ib->type) {
@@ -303,7 +304,7 @@ st_draw_vbo(GLcontext *ctx,
if (bufobj && bufobj->Name) {
/* elements/indexes are in a real VBO */
struct st_buffer_object *stobj = st_buffer_object(bufobj);
- winsys->buffer_reference(winsys, &indexBuf, stobj->buffer);
+ pipe_buffer_reference(winsys, &indexBuf, stobj->buffer);
indexOffset = (unsigned) ib->ptr / indexSize;
}
else {
@@ -321,7 +322,7 @@ st_draw_vbo(GLcontext *ctx,
prims[i].start + indexOffset, prims[i].count);
}
- winsys->buffer_reference(winsys, &indexBuf, NULL);
+ pipe_buffer_reference(winsys, &indexBuf, NULL);
}
else {
/* non-indexed */
@@ -333,7 +334,7 @@ st_draw_vbo(GLcontext *ctx,
/* unreference buffers (frees wrapped user-space buffer objects) */
for (attr = 0; attr < vs->num_inputs; attr++) {
- winsys->buffer_reference(winsys, &vbuffer[attr].buffer, NULL);
+ pipe_buffer_reference(winsys, &vbuffer[attr].buffer, NULL);
assert(!vbuffer[attr].buffer);
pipe->set_vertex_buffer(pipe, attr, &vbuffer[attr]);
}
@@ -358,7 +359,7 @@ st_draw_vertices(GLcontext *ctx, unsigned prim,
const float height = ctx->DrawBuffer->Height;
const unsigned vertex_bytes = numVertex * numAttribs * 4 * sizeof(float);
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_buffer_handle *vbuf;
+ struct pipe_buffer *vbuf;
struct pipe_vertex_buffer vbuffer;
struct pipe_vertex_element velement;
unsigned i;
@@ -404,7 +405,7 @@ st_draw_vertices(GLcontext *ctx, unsigned prim,
pipe->draw_arrays(pipe, prim, 0, numVertex);
/* XXX: do one-time */
- pipe->winsys->buffer_reference(pipe->winsys, &vbuf, NULL);
+ pipe_buffer_reference(pipe->winsys, &vbuf, NULL);
}
@@ -465,7 +466,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
struct pipe_winsys *winsys = pipe->winsys;
const struct st_vertex_program *vp;
const struct pipe_shader_state *vs;
- struct pipe_buffer_handle *index_buffer_handle = 0;
+ struct pipe_buffer *index_buffer_handle = 0;
struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
GLuint attr, i;
ubyte *mapped_constants;
@@ -513,7 +514,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
assert(stobj->buffer);
vbuffer[attr].buffer = NULL;
- winsys->buffer_reference(winsys, &vbuffer[attr].buffer, stobj->buffer);
+ pipe_buffer_reference(winsys, &vbuffer[attr].buffer, stobj->buffer);
vbuffer[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
velement.src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
}
@@ -605,7 +606,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
if (draw->vertex_buffer[i].buffer) {
pipe->winsys->buffer_unmap(pipe->winsys,
draw->vertex_buffer[i].buffer);
- winsys->buffer_reference(winsys, &draw->vertex_buffer[i].buffer, NULL);
+ pipe_buffer_reference(winsys, &draw->vertex_buffer[i].buffer, NULL);
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
}