#include "st_atom.h"
#include "st_atom_constbuf.h"
#include "st_program.h"
-
+#include "st_inlines.h"
/**
* Pass the given program parameters to the graphics pipe as a
/* load Mesa constants into the constant buffer */
if (cbuf->buffer)
- pipe_buffer_write(pipe->screen, cbuf->buffer,
- 0, paramBytes,
- params->ParameterValues);
+ st_no_flush_pipe_buffer_write(st, cbuf->buffer,
+ 0, paramBytes,
+ params->ParameterValues);
st->pipe->set_constant_buffer(st->pipe, id, 0, cbuf);
}
#include "st_format.h"
#include "st_program.h"
#include "st_texture.h"
+#include "st_inlines.h"
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
uint *dest;
uint i, j;
- transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
- 0, 0, texSize, texSize);
+ transfer = st_cond_flush_get_tex_transfer(st_context(ctx),
+ pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
+ 0, 0, texSize, texSize);
dest = (uint *) screen->transfer_map(screen, transfer);
/* Pack four 1D maps into a 2D texture:
#include "st_public.h"
#include "st_format.h"
#include "st_texture.h"
+#include "st_inlines.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
const GLint height = ctx->DrawBuffer->_Ymax - ypos;
GLubyte *map;
- st_teximage_flush_before_map(ctx->st, acc_strb->texture, 0, 0,
- PIPE_TRANSFER_WRITE);
-
- acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
- PIPE_TRANSFER_WRITE, xpos, ypos,
- width, height);
+ acc_pt = st_cond_flush_get_tex_transfer(st_context(ctx), acc_strb->texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_WRITE, xpos, ypos,
+ width, height);
map = screen->transfer_map(screen, acc_pt);
/* note acc_strb->format might not equal acc_pt->format */
struct pipe_transfer *acc_pt;
GLubyte *map;
- st_teximage_flush_before_map(ctx->st, acc_strb->texture, 0, 0,
- PIPE_TRANSFER_READ_WRITE);
-
- acc_pt = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ_WRITE, xpos, ypos,
- width, height);
+ acc_pt = st_cond_flush_get_tex_transfer(st_context(ctx), acc_strb->texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ_WRITE,
+ xpos, ypos,
+ width, height);
map = screen->transfer_map(screen, acc_pt);
/* note acc_strb->format might not equal acc_pt->format */
GLfloat *colorBuf, *accBuf;
GLint i;
- st_teximage_flush_before_map(st, acc_strb->texture, 0, 0,
- PIPE_TRANSFER_READ);
-
- acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ, xpos, ypos,
- width, height);
-
- st_teximage_flush_before_map(st, color_strb->texture, 0, 0,
- PIPE_TRANSFER_READ);
+ acc_trans = st_cond_flush_get_tex_transfer(st, acc_strb->texture, 0, 0, 0,
+ PIPE_TRANSFER_READ, xpos, ypos,
+ width, height);
- color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ, xpos, ypos,
- width, height);
+ color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ, xpos, ypos,
+ width, height);
colorBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
accBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
}
screen->tex_transfer_destroy(acc_trans);
- acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
- PIPE_TRANSFER_WRITE, xpos, ypos,
- width, height);
+ acc_trans = st_no_flush_get_tex_transfer(st, acc_strb->texture, 0, 0, 0,
+ PIPE_TRANSFER_WRITE, xpos, ypos,
+ width, height);
acc_put_tile_rgba(pipe, acc_trans, 0, 0, width, height, accBuf);
GLfloat *buf;
GLint i;
- st_teximage_flush_before_map(st, acc_strb->texture, 0, 0,
- PIPE_TRANSFER_WRITE);
+ acc_trans = st_cond_flush_get_tex_transfer(st, acc_strb->texture, 0, 0, 0,
+ PIPE_TRANSFER_WRITE, xpos, ypos,
+ width, height);
- acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
- PIPE_TRANSFER_WRITE, xpos, ypos,
- width, height);
-
- st_teximage_flush_before_map(st, color_strb->texture, 0, 0,
- PIPE_TRANSFER_READ);
-
- color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ, xpos, ypos,
- width, height);
+ color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ, xpos, ypos,
+ width, height);
buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
abuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
- st_teximage_flush_before_map(ctx->st, acc_strb->texture, 0, 0,
- PIPE_TRANSFER_READ);
-
- acc_trans = screen->get_tex_transfer(screen, acc_strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ, xpos, ypos,
- width, height);
-
- st_teximage_flush_before_map(ctx->st, color_strb->texture, 0, 0,
- PIPE_TRANSFER_READ_WRITE);
+ acc_trans = st_cond_flush_get_tex_transfer(st_context(ctx),
+ acc_strb->texture, 0, 0, 0,
+ PIPE_TRANSFER_READ, xpos, ypos,
+ width, height);
- color_trans = screen->get_tex_transfer(screen, color_strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ_WRITE, xpos, ypos,
- width, height);
+ color_trans = st_cond_flush_get_tex_transfer(st_context(ctx),
+ color_strb->texture, 0, 0, 0,
+ PIPE_TRANSFER_READ_WRITE,
+ xpos, ypos,
+ width, height);
acc_get_tile_rgba(pipe, acc_trans, 0, 0, width, height, abuf);
#include "st_cb_program.h"
#include "st_mesa_to_tgsi.h"
#include "st_texture.h"
+#include "st_inlines.h"
+
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
return NULL;
}
- transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
- 0, 0, width, height);
+ transfer = st_no_flush_get_tex_transfer(st_context(ctx), pt, 0, 0, 0,
+ PIPE_TRANSFER_WRITE,
+ 0, 0, width, height);
dest = screen->transfer_map(screen, transfer);
}
/* put vertex data into vbuf */
- pipe_buffer_write(pipe->screen,
- st->bitmap.vbuf,
- st->bitmap.vbuf_slot * sizeof st->bitmap.vertices,
- sizeof st->bitmap.vertices,
- st->bitmap.vertices);
+ st_no_flush_pipe_buffer_write(st,
+ st->bitmap.vbuf,
+ st->bitmap.vbuf_slot * sizeof st->bitmap.vertices,
+ sizeof st->bitmap.vertices,
+ st->bitmap.vertices);
return st->bitmap.vbuf_slot++ * sizeof st->bitmap.vertices;
}
/* Map the texture transfer.
* Subsequent glBitmap calls will write into the texture image.
*/
- cache->trans = screen->get_tex_transfer(screen, cache->texture, 0, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0,
- BITMAP_CACHE_WIDTH,
- BITMAP_CACHE_HEIGHT);
+ cache->trans = st_no_flush_get_tex_transfer(st, cache->texture, 0, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ BITMAP_CACHE_WIDTH,
+ BITMAP_CACHE_HEIGHT);
cache->buffer = screen->transfer_map(screen, cache->trans);
/* init image to all 0xff */
#include "main/mtypes.h"
#include "main/bufferobj.h"
+#include "st_inlines.h"
#include "st_context.h"
#include "st_cb_bufferobjects.h"
-#include "st_public.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
GLsizeiptrARB size,
const GLvoid * data, struct gl_buffer_object *obj)
{
- struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
if (offset >= st_obj->size || size > (st_obj->size - offset))
return;
- if (pipe->is_buffer_referenced(pipe, st_obj->buffer))
- st_flush(st_context(ctx), PIPE_FLUSH_RENDER_CACHE, NULL);
-
- pipe_buffer_write(pipe->screen, st_obj->buffer, offset, size, data);
+ st_cond_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer,
+ offset, size, data);
}
GLsizeiptrARB size,
GLvoid * data, struct gl_buffer_object *obj)
{
- struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
if (offset >= st_obj->size || size > (st_obj->size - offset))
return;
- if (pipe->is_buffer_referenced(pipe, st_obj->buffer) &
- PIPE_REFERENCED_FOR_WRITE)
- st_flush(st_context(ctx), PIPE_FLUSH_RENDER_CACHE, NULL);
-
- pipe_buffer_read(pipe->screen, st_obj->buffer, offset, size, data);
+ st_cond_flush_pipe_buffer_read(st_context(ctx), st_obj->buffer,
+ offset, size, data);
}
st_obj->size = size;
if (data)
- pipe_buffer_write(pipe->screen, st_obj->buffer, 0, size, data);
+ st_no_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, 0,
+ size, data);
}
st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
struct gl_buffer_object *obj)
{
- struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
GLuint flags;
- unsigned referenced;
switch (access) {
case GL_WRITE_ONLY:
break;
}
- referenced = pipe->is_buffer_referenced(pipe, st_obj->buffer);
- if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
- (flags & PIPE_BUFFER_USAGE_CPU_WRITE)))
- st_flush(st_context(ctx), PIPE_FLUSH_RENDER_CACHE, NULL);
-
- obj->Pointer = pipe_buffer_map(pipe->screen, st_obj->buffer, flags);
+ obj->Pointer = st_cond_flush_pipe_buffer_map(st_context(ctx),
+ st_obj->buffer,
+ flags);
if(obj->Pointer) {
obj->Offset = 0;
obj->Length = obj->Size;
#include "st_program.h"
#include "st_public.h"
#include "st_mesa_to_tgsi.h"
+#include "st_inlines.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
}
/* put vertex data into vbuf */
- pipe_buffer_write(pipe->screen, st->clear.vbuf,
- st->clear.vbuf_slot * sizeof(st->clear.vertices),
- sizeof(st->clear.vertices),
- st->clear.vertices);
+ st_no_flush_pipe_buffer_write(st, st->clear.vbuf,
+ st->clear.vbuf_slot * sizeof(st->clear.vertices),
+ sizeof(st->clear.vertices),
+ st->clear.vertices);
/* draw */
util_draw_vertex_buffer(pipe,
#include "st_format.h"
#include "st_mesa_to_tgsi.h"
#include "st_texture.h"
+#include "st_inlines.h"
+
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
/* we'll do pixel transfer in a fragment shader */
ctx->_ImageTransferState = 0x0;
- transfer = screen->get_tex_transfer(screen, pt, 0, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0,
- width, height);
+ transfer = st_no_flush_get_tex_transfer(st, pt, 0, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ width, height);
/* map texture transfer */
dest = screen->transfer_map(screen, transfer);
/* allocate/load buffer object with vertex data */
buf = pipe_buffer_create(pipe->screen, 32, PIPE_BUFFER_USAGE_VERTEX,
sizeof(verts));
- pipe_buffer_write(pipe->screen, buf, 0, sizeof(verts), verts);
+ st_no_flush_pipe_buffer_write(st, buf, 0, sizeof(verts), verts);
util_draw_vertex_buffer(pipe, buf, 0,
PIPE_PRIM_QUADS,
y = ctx->DrawBuffer->Height - y - height;
}
- st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0,
- PIPE_TRANSFER_WRITE);
-
- pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
- PIPE_TRANSFER_WRITE, x, y,
- width, height);
+ pt = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture, 0, 0, 0,
+ PIPE_TRANSFER_WRITE, x, y,
+ width, height);
stmap = screen->transfer_map(screen, pt);
GL_STENCIL_INDEX, GL_UNSIGNED_BYTE,
&ctx->DefaultPacking, buffer);
- st_teximage_flush_before_map(ctx->st, rbDraw->texture, 0, 0,
- PIPE_TRANSFER_WRITE);
-
- ptDraw = screen->get_tex_transfer(screen, rbDraw->texture, 0, 0, 0,
- PIPE_TRANSFER_WRITE, dstx, dsty,
- width, height);
+ ptDraw = st_cond_flush_get_tex_transfer(st_context(ctx),
+ rbDraw->texture, 0, 0, 0,
+ PIPE_TRANSFER_WRITE, dstx, dsty,
+ width, height);
assert(ptDraw->block.width == 1);
assert(ptDraw->block.height == 1);
GLfloat *color;
enum pipe_format srcFormat, texFormat;
- /* make sure rendering has completed */
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
-
st_validate_state(st);
if (type == GL_STENCIL) {
else {
/* CPU-based fallback/conversion */
struct pipe_transfer *ptRead =
- screen->get_tex_transfer(screen, rbRead->texture, 0, 0, 0,
- PIPE_TRANSFER_READ, srcx, srcy, width,
- height);
+ st_cond_flush_get_tex_transfer(st, rbRead->texture, 0, 0, 0,
+ PIPE_TRANSFER_READ, srcx, srcy, width,
+ height);
struct pipe_transfer *ptTex =
- screen->get_tex_transfer(screen, pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
- 0, 0, width, height);
+ st_cond_flush_get_tex_transfer(st, pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
+ 0, 0, width, height);
if (type == GL_COLOR) {
/* alternate path using get/put_tile() */
#include "st_format.h"
#include "st_public.h"
#include "st_texture.h"
+#include "st_inlines.h"
/**
* Special case for reading stencil buffer.
/* Create a read transfer from the renderbuffer's texture */
- st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0,
- PIPE_TRANSFER_READ);
-
- pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ, x, y, width, height);
+ pt = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ, x, y,
+ width, height);
/* map the stencil buffer */
stmap = screen->transfer_map(screen, pt);
y = strb->texture->height[0] - y - height;
}
- st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0,
- PIPE_TRANSFER_READ);
-
- trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ, x, y, width, height);
+ trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ, x, y,
+ width, height);
if (!trans) {
return GL_FALSE;
}
if (!dest)
return;
- /* make sure rendering has completed */
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
if (format == GL_STENCIL_INDEX ||
format == GL_DEPTH_STENCIL) {
st_read_stencil_pixels(ctx, x, y, width, height,
}
/* Create a read transfer from the renderbuffer's texture */
- trans = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ, x, y, width, height);
+ trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ, x, y,
+ width, height);
/* determine bottom-to-top vs. top-to-bottom order */
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
#include "state_tracker/st_public.h"
#include "state_tracker/st_texture.h"
#include "state_tracker/st_gen_mipmap.h"
+#include "state_tracker/st_inlines.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
/* Put user's tex data into the temporary texture
*/
- tex_xfer = screen->get_tex_transfer(screen, src_tex,
- face, level, 0,
- PIPE_TRANSFER_WRITE,
- 0, 0, width, height); /* x, y, w, h */
+ tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx), src_tex,
+ face, level, 0,
+ PIPE_TRANSFER_WRITE,
+ 0, 0, width, height); /* x, y, w, h */
map = screen->transfer_map(screen, tex_xfer);
mesa_format->StoreImage(ctx, 2, GL_RGBA, mesa_format,
PIPE_TEX_MIPFILTER_NEAREST);
/* map the dst_surface so we can read from it */
- tex_xfer = screen->get_tex_transfer(screen, dst_texture, 0, 0, 0,
- PIPE_TRANSFER_READ,
- 0, 0, width, height);
+ tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx),
+ dst_texture, 0, 0, 0,
+ PIPE_TRANSFER_READ,
+ 0, 0, width, height);
pixels = _mesa_map_readpix_pbo(ctx, &ctx->Pack, pixels);
srcY = strb->Base.Height - srcY - height;
}
- st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0,
- PIPE_TRANSFER_READ);
-
- src_trans = screen->get_tex_transfer( screen,
- strb->texture,
- 0, 0, 0,
- PIPE_TRANSFER_READ,
- srcX, srcY,
- width, height);
+ src_trans = st_cond_flush_get_tex_transfer( st_context(ctx),
+ strb->texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ,
+ srcX, srcY,
+ width, height);
st_teximage_flush_before_map(ctx->st, stImage->pt, 0, 0,
PIPE_TRANSFER_WRITE);
PIPE_TRANSFER_WRITE);
- st_texture_image_data(st->pipe,
+ st_texture_image_data(st,
stObj->pt,
stImage->face,
dstLevel,
#include "st_program.h"
#include "st_texture.h"
#include "st_cb_texture.h"
+#include "st_inlines.h"
/**
const ubyte *srcData;
ubyte *dstData;
- st_teximage_flush_before_map(ctx->st, pt, face, srcLevel,
- PIPE_TRANSFER_READ);
-
- srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
- PIPE_TRANSFER_READ, 0, 0,
- pt->width[srcLevel],
- pt->height[srcLevel]);
-
- st_teximage_flush_before_map(ctx->st, pt, face, dstLevel,
- PIPE_TRANSFER_WRITE);
-
- dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
- PIPE_TRANSFER_WRITE, 0, 0,
- pt->width[dstLevel],
- pt->height[dstLevel]);
+ srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
+ srcLevel, zslice,
+ PIPE_TRANSFER_READ, 0, 0,
+ pt->width[srcLevel],
+ pt->height[srcLevel]);
+
+ dstTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
+ dstLevel, zslice,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ pt->width[dstLevel],
+ pt->height[dstLevel]);
srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
--- /dev/null
+#ifndef ST_INLINES_H
+#define ST_INLINES_H
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_inlines.h"
+#include "pipe/p_state.h"
+
+#include "st_context.h"
+#include "st_texture.h"
+#include "st_public.h"
+
+static INLINE struct pipe_transfer *
+st_cond_flush_get_tex_transfer(struct st_context *st,
+ struct pipe_texture *pt,
+ unsigned int face,
+ unsigned int level,
+ unsigned int zslice,
+ enum pipe_transfer_usage usage,
+ unsigned int x, unsigned int y,
+ unsigned int w, unsigned int h)
+{
+ struct pipe_screen *screen = st->pipe->screen;
+
+ st_teximage_flush_before_map(st, pt, face, level, usage);
+ return screen->get_tex_transfer(screen, pt, face, level, zslice, usage,
+ x, y, w, h);
+}
+
+static INLINE struct pipe_transfer *
+st_no_flush_get_tex_transfer(struct st_context *st,
+ struct pipe_texture *pt,
+ unsigned int face,
+ unsigned int level,
+ unsigned int zslice,
+ enum pipe_transfer_usage usage,
+ unsigned int x, unsigned int y,
+ unsigned int w, unsigned int h)
+{
+ struct pipe_screen *screen = st->pipe->screen;
+
+ return screen->get_tex_transfer(screen, pt, face, level,
+ zslice, usage, x, y, w, h);
+}
+
+static INLINE void *
+st_cond_flush_pipe_buffer_map(struct st_context *st,
+ struct pipe_buffer *buf,
+ unsigned int map_flags)
+{
+ struct pipe_context *pipe = st->pipe;
+ unsigned int referenced = pipe->is_buffer_referenced(pipe, buf);
+
+ if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
+ (map_flags & PIPE_BUFFER_USAGE_CPU_WRITE)))
+ st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ return pipe_buffer_map(pipe->screen, buf, map_flags);
+}
+
+static INLINE void *
+st_no_flush_pipe_buffer_map(struct st_context *st,
+ struct pipe_buffer *buf,
+ unsigned int map_flags)
+{
+ return pipe_buffer_map(st->pipe->screen, buf, map_flags);
+}
+
+
+static INLINE void
+st_cond_flush_pipe_buffer_write(struct st_context *st,
+ struct pipe_buffer *buf,
+ unsigned int offset,
+ unsigned int size,
+ const void * data)
+{
+ struct pipe_context *pipe = st->pipe;
+
+ if (pipe->is_buffer_referenced(pipe, buf))
+ st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ pipe_buffer_write(pipe->screen, buf, offset, size, data);
+}
+
+static INLINE void
+st_no_flush_pipe_buffer_write(struct st_context *st,
+ struct pipe_buffer *buf,
+ unsigned int offset,
+ unsigned int size,
+ const void * data)
+{
+ pipe_buffer_write(st->pipe->screen, buf, offset, size, data);
+}
+
+static INLINE void
+st_cond_flush_pipe_buffer_read(struct st_context *st,
+ struct pipe_buffer *buf,
+ unsigned int offset,
+ unsigned int size,
+ void * data)
+{
+ struct pipe_context *pipe = st->pipe;
+
+ if (pipe->is_buffer_referenced(pipe, buf) & PIPE_REFERENCED_FOR_WRITE)
+ st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ pipe_buffer_read(pipe->screen, buf, offset, size, data);
+}
+
+static INLINE void
+st_no_flush_pipe_buffer_read(struct st_context *st,
+ struct pipe_buffer *buf,
+ unsigned int offset,
+ unsigned int size,
+ void * data)
+{
+ pipe_buffer_read(st->pipe->screen, buf, offset, size, data);
+}
+
+#endif
+
#include "st_public.h"
#include "st_texture.h"
#include "st_cb_fbo.h"
+#include "st_inlines.h"
#include "main/enums.h"
#include "main/teximage.h"
#include "main/texstore.h"
DBG("%s \n", __FUNCTION__);
- stImage->transfer = screen->get_tex_transfer(screen, pt, stImage->face,
- stImage->level, zoffset,
- usage, x, y, w, h);
+ stImage->transfer = st_no_flush_get_tex_transfer(st, pt, stImage->face,
+ stImage->level, zoffset,
+ usage, x, y, w, h);
if (stImage->transfer)
return screen->transfer_map(screen, stImage->transfer);
/* Upload data for a particular image.
*/
void
-st_texture_image_data(struct pipe_context *pipe,
+st_texture_image_data(struct st_context *st,
struct pipe_texture *dst,
GLuint face,
GLuint level,
void *src,
GLuint src_row_stride, GLuint src_image_stride)
{
+ struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
GLuint depth = dst->depth[level];
GLuint i;
DBG("%s\n", __FUNCTION__);
for (i = 0; i < depth; i++) {
- dst_transfer = screen->get_tex_transfer(screen, dst, face, level, i,
- PIPE_TRANSFER_WRITE, 0, 0,
- dst->width[level],
- dst->height[level]);
+ dst_transfer = st_no_flush_get_tex_transfer(st, dst, face, level, i,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ dst->width[level],
+ dst->height[level]);
st_surface_data(pipe, dst_transfer,
0, 0, /* dstx, dsty */
/* Upload an image into a texture
*/
extern void
-st_texture_image_data(struct pipe_context *pipe,
+st_texture_image_data(struct st_context *st,
struct pipe_texture *dst,
GLuint face, GLuint level, void *src,
GLuint src_row_pitch, GLuint src_image_pitch);