gallium: use new buffer wrapper functions in p_inlines.h
This allows us to remove most of the direct references to winsys in the state tracker.
This commit is contained in:
parent
15318c8d8e
commit
99fba5466b
|
@ -36,7 +36,6 @@
|
||||||
|
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_winsys.h"
|
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
|
|
||||||
#include "st_context.h"
|
#include "st_context.h"
|
||||||
|
@ -54,7 +53,7 @@ void st_upload_constants( struct st_context *st,
|
||||||
struct gl_program_parameter_list *params,
|
struct gl_program_parameter_list *params,
|
||||||
unsigned id)
|
unsigned id)
|
||||||
{
|
{
|
||||||
struct pipe_winsys *ws = st->pipe->winsys;
|
struct pipe_context *pipe = st->pipe;
|
||||||
struct pipe_constant_buffer *cbuf = &st->state.constants[id];
|
struct pipe_constant_buffer *cbuf = &st->state.constants[id];
|
||||||
|
|
||||||
assert(id == PIPE_SHADER_VERTEX || id == PIPE_SHADER_FRAGMENT);
|
assert(id == PIPE_SHADER_VERTEX || id == PIPE_SHADER_FRAGMENT);
|
||||||
|
@ -74,8 +73,8 @@ void st_upload_constants( struct st_context *st,
|
||||||
/* We always need to get a new buffer, to keep the drivers simple and
|
/* We always need to get a new buffer, to keep the drivers simple and
|
||||||
* avoid gratuitous rendering synchronization.
|
* avoid gratuitous rendering synchronization.
|
||||||
*/
|
*/
|
||||||
pipe_buffer_reference( ws, &cbuf->buffer, NULL );
|
pipe_reference_buffer(pipe, &cbuf->buffer, NULL );
|
||||||
cbuf->buffer = ws->buffer_create( ws, 1, PIPE_BUFFER_USAGE_CONSTANT,
|
cbuf->buffer = pipe_buffer_create(pipe, 1, PIPE_BUFFER_USAGE_CONSTANT,
|
||||||
paramBytes );
|
paramBytes );
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
|
@ -87,9 +86,10 @@ void st_upload_constants( struct st_context *st,
|
||||||
|
|
||||||
/* load Mesa constants into the constant buffer */
|
/* load Mesa constants into the constant buffer */
|
||||||
if (cbuf->buffer) {
|
if (cbuf->buffer) {
|
||||||
memcpy(ws->buffer_map(ws, cbuf->buffer, PIPE_BUFFER_USAGE_CPU_WRITE),
|
void *map = pipe_buffer_map(pipe, cbuf->buffer,
|
||||||
params->ParameterValues, paramBytes);
|
PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||||
ws->buffer_unmap(ws, cbuf->buffer);
|
memcpy(map, params->ParameterValues, paramBytes);
|
||||||
|
pipe_buffer_unmap(pipe, cbuf->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
cbuf->size = paramBytes;
|
cbuf->size = paramBytes;
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "pipe/p_winsys.h"
|
|
||||||
#include "util/p_tile.h"
|
#include "util/p_tile.h"
|
||||||
#include "util/u_draw_quad.h"
|
#include "util/u_draw_quad.h"
|
||||||
#include "util/u_simple_shaders.h"
|
#include "util/u_simple_shaders.h"
|
||||||
|
@ -372,9 +371,8 @@ setup_bitmap_vertex_data(struct st_context *st,
|
||||||
void *buf;
|
void *buf;
|
||||||
|
|
||||||
if (!st->bitmap.vbuf) {
|
if (!st->bitmap.vbuf) {
|
||||||
st->bitmap.vbuf = pipe->winsys->buffer_create(pipe->winsys, 32,
|
st->bitmap.vbuf = pipe_buffer_create(pipe, 32, PIPE_BUFFER_USAGE_VERTEX,
|
||||||
PIPE_BUFFER_USAGE_VERTEX,
|
sizeof(st->bitmap.vertices));
|
||||||
sizeof(st->bitmap.vertices));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Positions are in clip coords since we need to do clipping in case
|
/* Positions are in clip coords since we need to do clipping in case
|
||||||
|
@ -413,10 +411,9 @@ setup_bitmap_vertex_data(struct st_context *st,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put vertex data into vbuf */
|
/* put vertex data into vbuf */
|
||||||
buf = pipe->winsys->buffer_map(pipe->winsys, st->bitmap.vbuf,
|
buf = pipe_buffer_map(pipe, st->bitmap.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
|
||||||
memcpy(buf, st->bitmap.vertices, sizeof(st->bitmap.vertices));
|
memcpy(buf, st->bitmap.vertices, sizeof(st->bitmap.vertices));
|
||||||
pipe->winsys->buffer_unmap(pipe->winsys, st->bitmap.vbuf);
|
pipe_buffer_unmap(pipe, st->bitmap.vbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -761,7 +758,7 @@ st_destroy_bitmap(struct st_context *st)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st->bitmap.vbuf) {
|
if (st->bitmap.vbuf) {
|
||||||
pipe->winsys->buffer_destroy(pipe->winsys, st->bitmap.vbuf);
|
pipe_buffer_destroy(pipe, st->bitmap.vbuf);
|
||||||
st->bitmap.vbuf = NULL;
|
st->bitmap.vbuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_winsys.h"
|
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +78,7 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
|
||||||
struct st_buffer_object *st_obj = st_buffer_object(obj);
|
struct st_buffer_object *st_obj = st_buffer_object(obj);
|
||||||
|
|
||||||
if (st_obj->buffer)
|
if (st_obj->buffer)
|
||||||
pipe_buffer_reference(pipe->winsys, &st_obj->buffer, NULL);
|
pipe_reference_buffer(pipe, &st_obj->buffer, NULL);
|
||||||
|
|
||||||
free(st_obj);
|
free(st_obj);
|
||||||
}
|
}
|
||||||
|
@ -106,10 +105,9 @@ st_bufferobj_subdata(GLcontext *ctx,
|
||||||
if (offset >= st_obj->size || size > (st_obj->size - offset))
|
if (offset >= st_obj->size || size > (st_obj->size - offset))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
map = pipe->winsys->buffer_map(pipe->winsys, st_obj->buffer,
|
map = pipe_buffer_map(pipe, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
|
||||||
memcpy(map + offset, data, size);
|
memcpy(map + offset, data, size);
|
||||||
pipe->winsys->buffer_unmap(pipe->winsys, st_obj->buffer);
|
pipe_buffer_unmap(pipe, st_obj->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,10 +128,9 @@ st_bufferobj_get_subdata(GLcontext *ctx,
|
||||||
if (offset >= st_obj->size || size > (st_obj->size - offset))
|
if (offset >= st_obj->size || size > (st_obj->size - offset))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
map = pipe->winsys->buffer_map(pipe->winsys, st_obj->buffer,
|
map = pipe_buffer_map(pipe, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
|
||||||
PIPE_BUFFER_USAGE_CPU_READ);
|
|
||||||
memcpy(data, map + offset, size);
|
memcpy(data, map + offset, size);
|
||||||
pipe->winsys->buffer_unmap(pipe->winsys, st_obj->buffer);
|
pipe_buffer_unmap(pipe, st_obj->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,10 +171,9 @@ st_bufferobj_data(GLcontext *ctx,
|
||||||
buffer_usage = 0;
|
buffer_usage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe_buffer_reference( pipe->winsys, &st_obj->buffer, NULL );
|
pipe_reference_buffer( pipe, &st_obj->buffer, NULL );
|
||||||
|
|
||||||
st_obj->buffer = pipe->winsys->buffer_create( pipe->winsys, 32, buffer_usage,
|
st_obj->buffer = pipe_buffer_create( pipe, 32, buffer_usage, size );
|
||||||
size );
|
|
||||||
|
|
||||||
st_obj->size = size;
|
st_obj->size = size;
|
||||||
|
|
||||||
|
@ -211,7 +207,7 @@ st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->Pointer = pipe->winsys->buffer_map(pipe->winsys, st_obj->buffer, flags);
|
obj->Pointer = pipe_buffer_map(pipe, st_obj->buffer, flags);
|
||||||
return obj->Pointer;
|
return obj->Pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +221,7 @@ st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
|
||||||
struct pipe_context *pipe = st_context(ctx)->pipe;
|
struct pipe_context *pipe = st_context(ctx)->pipe;
|
||||||
struct st_buffer_object *st_obj = st_buffer_object(obj);
|
struct st_buffer_object *st_obj = st_buffer_object(obj);
|
||||||
|
|
||||||
pipe->winsys->buffer_unmap(pipe->winsys, st_obj->buffer);
|
pipe_buffer_unmap(pipe, st_obj->buffer);
|
||||||
obj->Pointer = NULL;
|
obj->Pointer = NULL;
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,9 @@
|
||||||
#include "st_mesa_to_tgsi.h"
|
#include "st_mesa_to_tgsi.h"
|
||||||
|
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
|
#include "pipe/p_inlines.h"
|
||||||
#include "pipe/p_state.h"
|
#include "pipe/p_state.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_winsys.h"
|
|
||||||
#include "util/u_pack_color.h"
|
#include "util/u_pack_color.h"
|
||||||
#include "util/u_simple_shaders.h"
|
#include "util/u_simple_shaders.h"
|
||||||
#include "util/u_draw_quad.h"
|
#include "util/u_draw_quad.h"
|
||||||
|
@ -106,7 +106,7 @@ st_destroy_clear(struct st_context *st)
|
||||||
st->clear.vs = NULL;
|
st->clear.vs = NULL;
|
||||||
}
|
}
|
||||||
if (st->clear.vbuf) {
|
if (st->clear.vbuf) {
|
||||||
pipe->winsys->buffer_destroy(pipe->winsys, st->clear.vbuf);
|
pipe_buffer_destroy(pipe, st->clear.vbuf);
|
||||||
st->clear.vbuf = NULL;
|
st->clear.vbuf = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,9 +142,8 @@ draw_quad(GLcontext *ctx,
|
||||||
void *buf;
|
void *buf;
|
||||||
|
|
||||||
if (!st->clear.vbuf) {
|
if (!st->clear.vbuf) {
|
||||||
st->clear.vbuf = pipe->winsys->buffer_create(pipe->winsys, 32,
|
st->clear.vbuf = pipe_buffer_create(pipe, 32, PIPE_BUFFER_USAGE_VERTEX,
|
||||||
PIPE_BUFFER_USAGE_VERTEX,
|
sizeof(st->clear.vertices));
|
||||||
sizeof(st->clear.vertices));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* positions */
|
/* positions */
|
||||||
|
@ -171,10 +170,9 @@ draw_quad(GLcontext *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put vertex data into vbuf */
|
/* put vertex data into vbuf */
|
||||||
buf = pipe->winsys->buffer_map(pipe->winsys, st->clear.vbuf,
|
buf = pipe_buffer_map(pipe, st->clear.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
|
||||||
memcpy(buf, st->clear.vertices, sizeof(st->clear.vertices));
|
memcpy(buf, st->clear.vertices, sizeof(st->clear.vertices));
|
||||||
pipe->winsys->buffer_unmap(pipe->winsys, st->clear.vbuf);
|
pipe_buffer_unmap(pipe, st->clear.vbuf);
|
||||||
|
|
||||||
/* draw */
|
/* draw */
|
||||||
util_draw_vertex_buffer(pipe, st->clear.vbuf,
|
util_draw_vertex_buffer(pipe, st->clear.vbuf,
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "pipe/p_winsys.h"
|
|
||||||
#include "util/p_tile.h"
|
#include "util/p_tile.h"
|
||||||
#include "util/u_draw_quad.h"
|
#include "util/u_draw_quad.h"
|
||||||
#include "shader/prog_instruction.h"
|
#include "shader/prog_instruction.h"
|
||||||
|
@ -483,20 +482,18 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
|
||||||
ubyte *map;
|
ubyte *map;
|
||||||
|
|
||||||
/* allocate/load buffer object with vertex data */
|
/* allocate/load buffer object with vertex data */
|
||||||
buf = pipe->winsys->buffer_create(pipe->winsys, 32,
|
buf = pipe_buffer_create(pipe,32, PIPE_BUFFER_USAGE_VERTEX,
|
||||||
PIPE_BUFFER_USAGE_VERTEX,
|
sizeof(verts));
|
||||||
sizeof(verts));
|
map = pipe_buffer_map(pipe, buf, PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||||
map = pipe->winsys->buffer_map(pipe->winsys, buf,
|
|
||||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
|
||||||
memcpy(map, verts, sizeof(verts));
|
memcpy(map, verts, sizeof(verts));
|
||||||
pipe->winsys->buffer_unmap(pipe->winsys, buf);
|
pipe_buffer_unmap(pipe, buf);
|
||||||
|
|
||||||
util_draw_vertex_buffer(pipe, buf,
|
util_draw_vertex_buffer(pipe, buf,
|
||||||
PIPE_PRIM_QUADS,
|
PIPE_PRIM_QUADS,
|
||||||
4, /* verts */
|
4, /* verts */
|
||||||
3); /* attribs/vert */
|
3); /* attribs/vert */
|
||||||
|
|
||||||
pipe->winsys->buffer_destroy(pipe->winsys, buf);
|
pipe_buffer_destroy(pipe, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
}
|
}
|
||||||
else if (strb->surface->buffer) {
|
else if (strb->surface->buffer) {
|
||||||
/* release/discard the old surface buffer */
|
/* release/discard the old surface buffer */
|
||||||
pipe_buffer_reference(pipe->winsys, &strb->surface->buffer, NULL);
|
pipe_reference_buffer(pipe, &strb->surface->buffer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine surface format here */
|
/* Determine surface format here */
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
#include "st_gen_mipmap.h"
|
#include "st_gen_mipmap.h"
|
||||||
#include "st_program.h"
|
#include "st_program.h"
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
#include "pipe/p_winsys.h"
|
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "draw/draw_context.h"
|
#include "draw/draw_context.h"
|
||||||
#include "cso_cache/cso_cache.h"
|
#include "cso_cache/cso_cache.h"
|
||||||
|
@ -157,7 +156,6 @@ struct st_context *st_create_context(struct pipe_context *pipe,
|
||||||
|
|
||||||
static void st_destroy_context_priv( struct st_context *st )
|
static void st_destroy_context_priv( struct st_context *st )
|
||||||
{
|
{
|
||||||
struct pipe_winsys *ws = st->pipe->winsys;
|
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
draw_destroy(st->draw);
|
draw_destroy(st->draw);
|
||||||
|
@ -172,7 +170,7 @@ static void st_destroy_context_priv( struct st_context *st )
|
||||||
|
|
||||||
for (i = 0; i < Elements(st->state.constants); i++) {
|
for (i = 0; i < Elements(st->state.constants); i++) {
|
||||||
if (st->state.constants[i].buffer) {
|
if (st->state.constants[i].buffer) {
|
||||||
pipe_buffer_reference(ws, &st->state.constants[i].buffer, NULL);
|
pipe_reference_buffer(st->pipe, &st->state.constants[i].buffer, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
|
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_winsys.h"
|
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
|
|
||||||
#include "draw/draw_private.h"
|
#include "draw/draw_private.h"
|
||||||
|
@ -219,8 +218,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
|
||||||
if (!vec)
|
if (!vec)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
map = pipe->winsys->buffer_map(pipe->winsys, stobj->buffer,
|
map = pipe_buffer_map(pipe, stobj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
|
||||||
PIPE_BUFFER_USAGE_CPU_READ);
|
|
||||||
map = ADD_POINTERS(map, array->Ptr);
|
map = ADD_POINTERS(map, array->Ptr);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
|
@ -230,7 +228,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
|
||||||
map += array->StrideB;
|
map += array->StrideB;
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe->winsys->buffer_unmap(pipe->winsys, stobj->buffer);
|
pipe_buffer_unmap(pipe, stobj->buffer);
|
||||||
|
|
||||||
pipe->set_edgeflags(pipe, vec);
|
pipe->set_edgeflags(pipe, vec);
|
||||||
|
|
||||||
|
@ -260,7 +258,6 @@ st_draw_vbo(GLcontext *ctx,
|
||||||
GLuint max_index)
|
GLuint max_index)
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe = ctx->st->pipe;
|
struct pipe_context *pipe = ctx->st->pipe;
|
||||||
struct pipe_winsys *winsys = pipe->winsys;
|
|
||||||
const struct st_vertex_program *vp;
|
const struct st_vertex_program *vp;
|
||||||
const struct pipe_shader_state *vs;
|
const struct pipe_shader_state *vs;
|
||||||
struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
|
struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
|
||||||
|
@ -292,7 +289,7 @@ st_draw_vbo(GLcontext *ctx,
|
||||||
assert(stobj->buffer);
|
assert(stobj->buffer);
|
||||||
|
|
||||||
vbuffer[attr].buffer = NULL;
|
vbuffer[attr].buffer = NULL;
|
||||||
pipe_buffer_reference(winsys, &vbuffer[attr].buffer, stobj->buffer);
|
pipe_reference_buffer(pipe, &vbuffer[attr].buffer, stobj->buffer);
|
||||||
vbuffer[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
|
vbuffer[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
|
||||||
velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
|
velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
|
||||||
assert(velements[attr].src_offset <= 2048); /* 11-bit field */
|
assert(velements[attr].src_offset <= 2048); /* 11-bit field */
|
||||||
|
@ -310,9 +307,8 @@ st_draw_vbo(GLcontext *ctx,
|
||||||
|
|
||||||
/* wrap user data */
|
/* wrap user data */
|
||||||
vbuffer[attr].buffer
|
vbuffer[attr].buffer
|
||||||
= winsys->user_buffer_create(winsys,
|
= pipe_user_buffer_create(pipe, (void *) arrays[mesaAttr]->Ptr,
|
||||||
(void *) arrays[mesaAttr]->Ptr,
|
bytes);
|
||||||
bytes);
|
|
||||||
vbuffer[attr].buffer_offset = 0;
|
vbuffer[attr].buffer_offset = 0;
|
||||||
velements[attr].src_offset = 0;
|
velements[attr].src_offset = 0;
|
||||||
}
|
}
|
||||||
|
@ -358,14 +354,13 @@ st_draw_vbo(GLcontext *ctx,
|
||||||
if (bufobj && bufobj->Name) {
|
if (bufobj && bufobj->Name) {
|
||||||
/* elements/indexes are in a real VBO */
|
/* elements/indexes are in a real VBO */
|
||||||
struct st_buffer_object *stobj = st_buffer_object(bufobj);
|
struct st_buffer_object *stobj = st_buffer_object(bufobj);
|
||||||
pipe_buffer_reference(winsys, &indexBuf, stobj->buffer);
|
pipe_reference_buffer(pipe, &indexBuf, stobj->buffer);
|
||||||
indexOffset = (unsigned) ib->ptr / indexSize;
|
indexOffset = (unsigned) ib->ptr / indexSize;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* element/indicies are in user space memory */
|
/* element/indicies are in user space memory */
|
||||||
indexBuf = winsys->user_buffer_create(winsys,
|
indexBuf = pipe_user_buffer_create(pipe, (void *) ib->ptr,
|
||||||
(void *) ib->ptr,
|
ib->count * indexSize);
|
||||||
ib->count * indexSize);
|
|
||||||
indexOffset = 0;
|
indexOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +375,7 @@ st_draw_vbo(GLcontext *ctx,
|
||||||
prims[i].start + indexOffset, prims[i].count);
|
prims[i].start + indexOffset, prims[i].count);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipe_buffer_reference(winsys, &indexBuf, NULL);
|
pipe_reference_buffer(pipe, &indexBuf, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* non-indexed */
|
/* non-indexed */
|
||||||
|
@ -396,7 +391,7 @@ st_draw_vbo(GLcontext *ctx,
|
||||||
|
|
||||||
/* unreference buffers (frees wrapped user-space buffer objects) */
|
/* unreference buffers (frees wrapped user-space buffer objects) */
|
||||||
for (attr = 0; attr < vp->num_inputs; attr++) {
|
for (attr = 0; attr < vp->num_inputs; attr++) {
|
||||||
pipe_buffer_reference(winsys, &vbuffer[attr].buffer, NULL);
|
pipe_reference_buffer(pipe, &vbuffer[attr].buffer, NULL);
|
||||||
assert(!vbuffer[attr].buffer);
|
assert(!vbuffer[attr].buffer);
|
||||||
}
|
}
|
||||||
pipe->set_vertex_buffers(pipe, vp->num_inputs, vbuffer);
|
pipe->set_vertex_buffers(pipe, vp->num_inputs, vbuffer);
|
||||||
|
@ -458,7 +453,6 @@ st_feedback_draw_vbo(GLcontext *ctx,
|
||||||
struct st_context *st = ctx->st;
|
struct st_context *st = ctx->st;
|
||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
struct draw_context *draw = st->draw;
|
struct draw_context *draw = st->draw;
|
||||||
struct pipe_winsys *winsys = pipe->winsys;
|
|
||||||
const struct st_vertex_program *vp;
|
const struct st_vertex_program *vp;
|
||||||
const struct pipe_shader_state *vs;
|
const struct pipe_shader_state *vs;
|
||||||
struct pipe_buffer *index_buffer_handle = 0;
|
struct pipe_buffer *index_buffer_handle = 0;
|
||||||
|
@ -509,7 +503,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
|
||||||
assert(stobj->buffer);
|
assert(stobj->buffer);
|
||||||
|
|
||||||
vbuffers[attr].buffer = NULL;
|
vbuffers[attr].buffer = NULL;
|
||||||
pipe_buffer_reference(winsys, &vbuffers[attr].buffer, stobj->buffer);
|
pipe_reference_buffer(pipe, &vbuffers[attr].buffer, stobj->buffer);
|
||||||
vbuffers[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
|
vbuffers[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
|
||||||
velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
|
velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
|
||||||
}
|
}
|
||||||
|
@ -521,9 +515,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
|
||||||
|
|
||||||
/* wrap user data */
|
/* wrap user data */
|
||||||
vbuffers[attr].buffer
|
vbuffers[attr].buffer
|
||||||
= winsys->user_buffer_create(winsys,
|
= pipe_user_buffer_create(pipe, (void *) arrays[mesaAttr]->Ptr,
|
||||||
(void *) arrays[mesaAttr]->Ptr,
|
bytes);
|
||||||
bytes);
|
|
||||||
vbuffers[attr].buffer_offset = 0;
|
vbuffers[attr].buffer_offset = 0;
|
||||||
velements[attr].src_offset = 0;
|
velements[attr].src_offset = 0;
|
||||||
}
|
}
|
||||||
|
@ -544,9 +537,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* map the attrib buffer */
|
/* map the attrib buffer */
|
||||||
map = pipe->winsys->buffer_map(pipe->winsys,
|
map = pipe_buffer_map(pipe, vbuffers[attr].buffer,
|
||||||
vbuffers[attr].buffer,
|
PIPE_BUFFER_USAGE_CPU_READ);
|
||||||
PIPE_BUFFER_USAGE_CPU_READ);
|
|
||||||
draw_set_mapped_vertex_buffer(draw, attr, map);
|
draw_set_mapped_vertex_buffer(draw, attr, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,9 +564,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
map = pipe->winsys->buffer_map(pipe->winsys,
|
map = pipe_buffer_map(pipe, index_buffer_handle,
|
||||||
index_buffer_handle,
|
PIPE_BUFFER_USAGE_CPU_READ);
|
||||||
PIPE_BUFFER_USAGE_CPU_READ);
|
|
||||||
draw_set_mapped_element_buffer(draw, indexSize, map);
|
draw_set_mapped_element_buffer(draw, indexSize, map);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -584,7 +575,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
|
||||||
|
|
||||||
|
|
||||||
/* map constant buffers */
|
/* map constant buffers */
|
||||||
mapped_constants = winsys->buffer_map(winsys,
|
mapped_constants = pipe_buffer_map(pipe,
|
||||||
st->state.constants[PIPE_SHADER_VERTEX].buffer,
|
st->state.constants[PIPE_SHADER_VERTEX].buffer,
|
||||||
PIPE_BUFFER_USAGE_CPU_READ);
|
PIPE_BUFFER_USAGE_CPU_READ);
|
||||||
draw_set_mapped_constant_buffer(st->draw, mapped_constants);
|
draw_set_mapped_constant_buffer(st->draw, mapped_constants);
|
||||||
|
@ -597,21 +588,20 @@ st_feedback_draw_vbo(GLcontext *ctx,
|
||||||
|
|
||||||
|
|
||||||
/* unmap constant buffers */
|
/* unmap constant buffers */
|
||||||
winsys->buffer_unmap(winsys, st->state.constants[PIPE_SHADER_VERTEX].buffer);
|
pipe_buffer_unmap(pipe, st->state.constants[PIPE_SHADER_VERTEX].buffer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* unmap vertex/index buffers
|
* unmap vertex/index buffers
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
|
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
|
||||||
if (draw->pt.vertex_buffer[i].buffer) {
|
if (draw->pt.vertex_buffer[i].buffer) {
|
||||||
pipe->winsys->buffer_unmap(pipe->winsys,
|
pipe_buffer_unmap(pipe, draw->pt.vertex_buffer[i].buffer);
|
||||||
draw->pt.vertex_buffer[i].buffer);
|
pipe_reference_buffer(pipe, &draw->pt.vertex_buffer[i].buffer, NULL);
|
||||||
pipe_buffer_reference(winsys, &draw->pt.vertex_buffer[i].buffer, NULL);
|
|
||||||
draw_set_mapped_vertex_buffer(draw, i, NULL);
|
draw_set_mapped_vertex_buffer(draw, i, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ib) {
|
if (ib) {
|
||||||
pipe->winsys->buffer_unmap(pipe->winsys, index_buffer_handle);
|
pipe_buffer_unmap(pipe, index_buffer_handle);
|
||||||
draw_set_mapped_element_buffer(draw, 0, NULL);
|
draw_set_mapped_element_buffer(draw, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "pipe/p_winsys.h"
|
|
||||||
#include "util/u_gen_mipmap.h"
|
#include "util/u_gen_mipmap.h"
|
||||||
|
|
||||||
#include "cso_cache/cso_cache.h"
|
#include "cso_cache/cso_cache.h"
|
||||||
|
@ -105,7 +104,6 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe = ctx->st->pipe;
|
struct pipe_context *pipe = ctx->st->pipe;
|
||||||
struct pipe_screen *screen = pipe->screen;
|
struct pipe_screen *screen = pipe->screen;
|
||||||
struct pipe_winsys *ws = pipe->winsys;
|
|
||||||
struct pipe_texture *pt = st_get_texobj_texture(texObj);
|
struct pipe_texture *pt = st_get_texobj_texture(texObj);
|
||||||
const uint baseLevel = texObj->BaseLevel;
|
const uint baseLevel = texObj->BaseLevel;
|
||||||
const uint lastLevel = pt->last_level;
|
const uint lastLevel = pt->last_level;
|
||||||
|
@ -128,11 +126,11 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
|
||||||
srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice);
|
srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice);
|
||||||
dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice);
|
dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice);
|
||||||
|
|
||||||
srcData = (ubyte *) ws->buffer_map(ws, srcSurf->buffer,
|
srcData = (ubyte *) pipe_buffer_map(pipe, srcSurf->buffer,
|
||||||
PIPE_BUFFER_USAGE_CPU_READ)
|
PIPE_BUFFER_USAGE_CPU_READ)
|
||||||
+ srcSurf->offset;
|
+ srcSurf->offset;
|
||||||
dstData = (ubyte *) ws->buffer_map(ws, dstSurf->buffer,
|
dstData = (ubyte *) pipe_buffer_map(pipe, dstSurf->buffer,
|
||||||
PIPE_BUFFER_USAGE_CPU_WRITE)
|
PIPE_BUFFER_USAGE_CPU_WRITE)
|
||||||
+ dstSurf->offset;
|
+ dstSurf->offset;
|
||||||
|
|
||||||
_mesa_generate_mipmap_level(target, datatype, comps,
|
_mesa_generate_mipmap_level(target, datatype, comps,
|
||||||
|
@ -144,8 +142,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
|
||||||
dstSurf->pitch * dstSurf->cpp, /* stride in bytes */
|
dstSurf->pitch * dstSurf->cpp, /* stride in bytes */
|
||||||
dstData);
|
dstData);
|
||||||
|
|
||||||
ws->buffer_unmap(ws, srcSurf->buffer);
|
pipe_buffer_unmap(pipe, srcSurf->buffer);
|
||||||
ws->buffer_unmap(ws, dstSurf->buffer);
|
pipe_buffer_unmap(pipe, dstSurf->buffer);
|
||||||
|
|
||||||
pipe_surface_reference(&srcSurf, NULL);
|
pipe_surface_reference(&srcSurf, NULL);
|
||||||
pipe_surface_reference(&dstSurf, NULL);
|
pipe_surface_reference(&dstSurf, NULL);
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "pipe/p_util.h"
|
#include "pipe/p_util.h"
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "pipe/p_winsys.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define DBG if(0) printf
|
#define DBG if(0) printf
|
||||||
|
|
Loading…
Reference in New Issue