This allows us to remove most of the direct references to winsys in the state tracker.
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
#include "st_context.h"
struct gl_program_parameter_list *params,
unsigned id)
{
- struct pipe_winsys *ws = st->pipe->winsys;
+ struct pipe_context *pipe = st->pipe;
struct pipe_constant_buffer *cbuf = &st->state.constants[id];
assert(id == PIPE_SHADER_VERTEX || id == PIPE_SHADER_FRAGMENT);
/* We always need to get a new buffer, to keep the drivers simple and
* avoid gratuitous rendering synchronization.
*/
- pipe_buffer_reference( ws, &cbuf->buffer, NULL );
- cbuf->buffer = ws->buffer_create( ws, 1, PIPE_BUFFER_USAGE_CONSTANT,
+ pipe_reference_buffer(pipe, &cbuf->buffer, NULL );
+ cbuf->buffer = pipe_buffer_create(pipe, 1, PIPE_BUFFER_USAGE_CONSTANT,
paramBytes );
if (0)
/* load Mesa constants into the constant buffer */
if (cbuf->buffer) {
- memcpy(ws->buffer_map(ws, cbuf->buffer, PIPE_BUFFER_USAGE_CPU_WRITE),
- params->ParameterValues, paramBytes);
- ws->buffer_unmap(ws, cbuf->buffer);
+ void *map = pipe_buffer_map(pipe, cbuf->buffer,
+ PIPE_BUFFER_USAGE_CPU_WRITE);
+ memcpy(map, params->ParameterValues, paramBytes);
+ pipe_buffer_unmap(pipe, cbuf->buffer);
}
cbuf->size = paramBytes;
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#include "util/p_tile.h"
#include "util/u_draw_quad.h"
#include "util/u_simple_shaders.h"
void *buf;
if (!st->bitmap.vbuf) {
- st->bitmap.vbuf = pipe->winsys->buffer_create(pipe->winsys, 32,
- PIPE_BUFFER_USAGE_VERTEX,
- sizeof(st->bitmap.vertices));
+ st->bitmap.vbuf = pipe_buffer_create(pipe, 32, PIPE_BUFFER_USAGE_VERTEX,
+ sizeof(st->bitmap.vertices));
}
/* Positions are in clip coords since we need to do clipping in case
}
/* put vertex data into vbuf */
- buf = pipe->winsys->buffer_map(pipe->winsys, st->bitmap.vbuf,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ buf = pipe_buffer_map(pipe, st->bitmap.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
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);
}
}
if (st->bitmap.vbuf) {
- pipe->winsys->buffer_destroy(pipe->winsys, st->bitmap.vbuf);
+ pipe_buffer_destroy(pipe, st->bitmap.vbuf);
st->bitmap.vbuf = NULL;
}
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
struct st_buffer_object *st_obj = st_buffer_object(obj);
if (st_obj->buffer)
- pipe_buffer_reference(pipe->winsys, &st_obj->buffer, NULL);
+ pipe_reference_buffer(pipe, &st_obj->buffer, NULL);
free(st_obj);
}
if (offset >= st_obj->size || size > (st_obj->size - offset))
return;
- map = pipe->winsys->buffer_map(pipe->winsys, st_obj->buffer,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ map = pipe_buffer_map(pipe, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
memcpy(map + offset, data, size);
- pipe->winsys->buffer_unmap(pipe->winsys, st_obj->buffer);
+ pipe_buffer_unmap(pipe, st_obj->buffer);
}
if (offset >= st_obj->size || size > (st_obj->size - offset))
return;
- map = pipe->winsys->buffer_map(pipe->winsys, st_obj->buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pipe, st_obj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
memcpy(data, map + offset, size);
- pipe->winsys->buffer_unmap(pipe->winsys, st_obj->buffer);
+ pipe_buffer_unmap(pipe, st_obj->buffer);
}
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,
- size );
+ st_obj->buffer = pipe_buffer_create( pipe, 32, buffer_usage, size );
st_obj->size = size;
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;
}
struct pipe_context *pipe = st_context(ctx)->pipe;
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;
return GL_TRUE;
}
#include "st_mesa_to_tgsi.h"
#include "pipe/p_context.h"
+#include "pipe/p_inlines.h"
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
#include "util/u_pack_color.h"
#include "util/u_simple_shaders.h"
#include "util/u_draw_quad.h"
st->clear.vs = NULL;
}
if (st->clear.vbuf) {
- pipe->winsys->buffer_destroy(pipe->winsys, st->clear.vbuf);
+ pipe_buffer_destroy(pipe, st->clear.vbuf);
st->clear.vbuf = NULL;
}
}
void *buf;
if (!st->clear.vbuf) {
- st->clear.vbuf = pipe->winsys->buffer_create(pipe->winsys, 32,
- PIPE_BUFFER_USAGE_VERTEX,
- sizeof(st->clear.vertices));
+ st->clear.vbuf = pipe_buffer_create(pipe, 32, PIPE_BUFFER_USAGE_VERTEX,
+ sizeof(st->clear.vertices));
}
/* positions */
}
/* put vertex data into vbuf */
- buf = pipe->winsys->buffer_map(pipe->winsys, st->clear.vbuf,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ buf = pipe_buffer_map(pipe, st->clear.vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
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 */
util_draw_vertex_buffer(pipe, st->clear.vbuf,
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#include "util/p_tile.h"
#include "util/u_draw_quad.h"
#include "shader/prog_instruction.h"
ubyte *map;
/* allocate/load buffer object with vertex data */
- buf = pipe->winsys->buffer_create(pipe->winsys, 32,
- PIPE_BUFFER_USAGE_VERTEX,
- sizeof(verts));
- map = pipe->winsys->buffer_map(pipe->winsys, buf,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ buf = pipe_buffer_create(pipe,32, PIPE_BUFFER_USAGE_VERTEX,
+ sizeof(verts));
+ map = pipe_buffer_map(pipe, buf, PIPE_BUFFER_USAGE_CPU_WRITE);
memcpy(map, verts, sizeof(verts));
- pipe->winsys->buffer_unmap(pipe->winsys, buf);
+ pipe_buffer_unmap(pipe, buf);
util_draw_vertex_buffer(pipe, buf,
PIPE_PRIM_QUADS,
4, /* verts */
3); /* attribs/vert */
- pipe->winsys->buffer_destroy(pipe->winsys, buf);
+ pipe_buffer_destroy(pipe, buf);
}
}
}
else if (strb->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 */
#include "st_gen_mipmap.h"
#include "st_program.h"
#include "pipe/p_context.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
#include "draw/draw_context.h"
#include "cso_cache/cso_cache.h"
static void st_destroy_context_priv( struct st_context *st )
{
- struct pipe_winsys *ws = st->pipe->winsys;
uint i;
draw_destroy(st->draw);
for (i = 0; i < Elements(st->state.constants); i++) {
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);
}
}
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_inlines.h"
#include "draw/draw_private.h"
if (!vec)
return NULL;
- map = pipe->winsys->buffer_map(pipe->winsys, stobj->buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pipe, stobj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
map = ADD_POINTERS(map, array->Ptr);
for (i = 0; i < count; i++) {
map += array->StrideB;
}
- pipe->winsys->buffer_unmap(pipe->winsys, stobj->buffer);
+ pipe_buffer_unmap(pipe, stobj->buffer);
pipe->set_edgeflags(pipe, vec);
GLuint max_index)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_winsys *winsys = pipe->winsys;
const struct st_vertex_program *vp;
const struct pipe_shader_state *vs;
struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
assert(stobj->buffer);
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 */
velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
assert(velements[attr].src_offset <= 2048); /* 11-bit field */
/* wrap user data */
vbuffer[attr].buffer
- = winsys->user_buffer_create(winsys,
- (void *) arrays[mesaAttr]->Ptr,
- bytes);
+ = pipe_user_buffer_create(pipe, (void *) arrays[mesaAttr]->Ptr,
+ bytes);
vbuffer[attr].buffer_offset = 0;
velements[attr].src_offset = 0;
}
if (bufobj && bufobj->Name) {
/* elements/indexes are in a real VBO */
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;
}
else {
/* element/indicies are in user space memory */
- indexBuf = winsys->user_buffer_create(winsys,
- (void *) ib->ptr,
- ib->count * indexSize);
+ indexBuf = pipe_user_buffer_create(pipe, (void *) ib->ptr,
+ ib->count * indexSize);
indexOffset = 0;
}
prims[i].start + indexOffset, prims[i].count);
}
- pipe_buffer_reference(winsys, &indexBuf, NULL);
+ pipe_reference_buffer(pipe, &indexBuf, NULL);
}
else {
/* non-indexed */
/* unreference buffers (frees wrapped user-space buffer objects) */
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);
}
pipe->set_vertex_buffers(pipe, vp->num_inputs, vbuffer);
struct st_context *st = ctx->st;
struct pipe_context *pipe = st->pipe;
struct draw_context *draw = st->draw;
- struct pipe_winsys *winsys = pipe->winsys;
const struct st_vertex_program *vp;
const struct pipe_shader_state *vs;
struct pipe_buffer *index_buffer_handle = 0;
assert(stobj->buffer);
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 */
velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
}
/* wrap user data */
vbuffers[attr].buffer
- = winsys->user_buffer_create(winsys,
- (void *) arrays[mesaAttr]->Ptr,
- bytes);
+ = pipe_user_buffer_create(pipe, (void *) arrays[mesaAttr]->Ptr,
+ bytes);
vbuffers[attr].buffer_offset = 0;
velements[attr].src_offset = 0;
}
#endif
/* map the attrib buffer */
- map = pipe->winsys->buffer_map(pipe->winsys,
- vbuffers[attr].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pipe, vbuffers[attr].buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_vertex_buffer(draw, attr, map);
}
return;
}
- map = pipe->winsys->buffer_map(pipe->winsys,
- index_buffer_handle,
- PIPE_BUFFER_USAGE_CPU_READ);
+ map = pipe_buffer_map(pipe, index_buffer_handle,
+ PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_element_buffer(draw, indexSize, map);
}
else {
/* map constant buffers */
- mapped_constants = winsys->buffer_map(winsys,
+ mapped_constants = pipe_buffer_map(pipe,
st->state.constants[PIPE_SHADER_VERTEX].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_constant_buffer(st->draw, mapped_constants);
/* 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
*/
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
if (draw->pt.vertex_buffer[i].buffer) {
- pipe->winsys->buffer_unmap(pipe->winsys,
- draw->pt.vertex_buffer[i].buffer);
- pipe_buffer_reference(winsys, &draw->pt.vertex_buffer[i].buffer, NULL);
+ pipe_buffer_unmap(pipe, draw->pt.vertex_buffer[i].buffer);
+ pipe_reference_buffer(pipe, &draw->pt.vertex_buffer[i].buffer, NULL);
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
}
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);
}
}
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#include "util/u_gen_mipmap.h"
#include "cso_cache/cso_cache.h"
{
struct pipe_context *pipe = ctx->st->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_winsys *ws = pipe->winsys;
struct pipe_texture *pt = st_get_texobj_texture(texObj);
const uint baseLevel = texObj->BaseLevel;
const uint lastLevel = pt->last_level;
srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice);
dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice);
- srcData = (ubyte *) ws->buffer_map(ws, srcSurf->buffer,
- PIPE_BUFFER_USAGE_CPU_READ)
+ srcData = (ubyte *) pipe_buffer_map(pipe, srcSurf->buffer,
+ PIPE_BUFFER_USAGE_CPU_READ)
+ srcSurf->offset;
- dstData = (ubyte *) ws->buffer_map(ws, dstSurf->buffer,
- PIPE_BUFFER_USAGE_CPU_WRITE)
+ dstData = (ubyte *) pipe_buffer_map(pipe, dstSurf->buffer,
+ PIPE_BUFFER_USAGE_CPU_WRITE)
+ dstSurf->offset;
_mesa_generate_mipmap_level(target, datatype, comps,
dstSurf->pitch * dstSurf->cpp, /* stride in bytes */
dstData);
- ws->buffer_unmap(ws, srcSurf->buffer);
- ws->buffer_unmap(ws, dstSurf->buffer);
+ pipe_buffer_unmap(pipe, srcSurf->buffer);
+ pipe_buffer_unmap(pipe, dstSurf->buffer);
pipe_surface_reference(&srcSurf, NULL);
pipe_surface_reference(&dstSurf, NULL);
#include "pipe/p_inlines.h"
#include "pipe/p_util.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#define DBG if(0) printf