* This should be usable by any hw driver that has mappable surfaces.
*/
void
-pipe_get_tile_raw(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_raw(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
void *dst, int dst_stride)
{
- struct pipe_screen *screen = pipe->screen;
const void *src;
if (pipe_clip_tile(x, y, &w, &h, ps))
if (dst_stride == 0)
dst_stride = pf_get_nblocksx(&ps->block, w) * ps->block.size;
- src = screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_READ);
+ src = pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_READ);
assert(src);
if(!src)
return;
pipe_copy_rect(dst, &ps->block, dst_stride, 0, 0, w, h, src, ps->stride, x, y);
- screen->surface_unmap(screen, ps);
+ pipe_surface_unmap(ps);
}
* This should be usable by any hw driver that has mappable surfaces.
*/
void
-pipe_put_tile_raw(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_raw(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const void *src, int src_stride)
{
- struct pipe_screen *screen = pipe->screen;
void *dst;
if (pipe_clip_tile(x, y, &w, &h, ps))
if (src_stride == 0)
src_stride = pf_get_nblocksx(&ps->block, w) * ps->block.size;
- dst = screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_WRITE);
+ dst = pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_WRITE);
assert(dst);
if(!dst)
return;
pipe_copy_rect(dst, &ps->block, ps->stride, x, y, w, h, src, src_stride, 0, 0);
- screen->surface_unmap(screen, ps);
+ pipe_surface_unmap(ps);
}
void
-pipe_get_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_rgba(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
float *p)
{
if (!packed)
return;
- pipe_get_tile_raw(pipe, ps, x, y, w, h, packed, 0);
+ pipe_get_tile_raw(ps, x, y, w, h, packed, 0);
switch (ps->format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
void
-pipe_put_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_rgba(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const float *p)
{
assert(0);
}
- pipe_put_tile_raw(pipe, ps, x, y, w, h, packed, 0);
+ pipe_put_tile_raw(ps, x, y, w, h, packed, 0);
FREE(packed);
}
* Get a block of Z values, converted to 32-bit range.
*/
void
-pipe_get_tile_z(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_z(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
uint *z)
{
- struct pipe_screen *screen = pipe->screen;
const uint dstStride = w;
ubyte *map;
uint *pDest = z;
if (pipe_clip_tile(x, y, &w, &h, ps))
return;
- map = (ubyte *)screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_READ);
+ map = (ubyte *)pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_READ);
if (!map) {
assert(0);
return;
assert(0);
}
- screen->surface_unmap(screen, ps);
+ pipe_surface_unmap(ps);
}
void
-pipe_put_tile_z(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_z(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const uint *zSrc)
{
- struct pipe_screen *screen = pipe->screen;
const uint srcStride = w;
const uint *pSrc = zSrc;
ubyte *map;
if (pipe_clip_tile(x, y, &w, &h, ps))
return;
- map = (ubyte *)screen->surface_map(screen, ps, PIPE_BUFFER_USAGE_CPU_WRITE);
+ map = (ubyte *)pipe_surface_map(ps, PIPE_BUFFER_USAGE_CPU_WRITE);
if (!map) {
assert(0);
return;
assert(0);
}
- screen->surface_unmap(screen, ps);
+ pipe_surface_unmap(ps);
}
#include "pipe/p_compiler.h"
-struct pipe_context;
struct pipe_surface;
#endif
void
-pipe_get_tile_raw(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_raw(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
void *p, int dst_stride);
void
-pipe_put_tile_raw(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_raw(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const void *p, int src_stride);
void
-pipe_get_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_rgba(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
float *p);
void
-pipe_put_tile_rgba(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_rgba(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const float *p);
void
-pipe_get_tile_z(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_get_tile_z(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
uint *z);
void
-pipe_put_tile_z(struct pipe_context *pipe,
- struct pipe_surface *ps,
+pipe_put_tile_z(struct pipe_surface *ps,
uint x, uint y, uint w, uint h,
const uint *z);
for (y = 0; y < h; y += TILE_SIZE) {
for (x = 0; x < w; x += TILE_SIZE) {
if (is_clear_flag_set(tc->clear_flags, x, y)) {
- pipe_put_tile_raw(pipe, ps,
+ pipe_put_tile_raw(ps,
x, y, TILE_SIZE, TILE_SIZE,
tc->tile.data.color32, 0/*STRIDE*/);
struct softpipe_cached_tile *tile = tc->entries + pos;
if (tile->x >= 0) {
if (tc->depth_stencil) {
- pipe_put_tile_raw(pipe, ps,
+ pipe_put_tile_raw(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
tile->data.depth32, 0/*STRIDE*/);
}
else {
- pipe_put_tile_rgba(pipe, ps,
+ pipe_put_tile_rgba(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
(float *) tile->data.color);
}
if (tile->x != -1) {
/* put dirty tile back in framebuffer */
if (tc->depth_stencil) {
- pipe_put_tile_raw(pipe, ps,
+ pipe_put_tile_raw(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
tile->data.depth32, 0/*STRIDE*/);
}
else {
- pipe_put_tile_rgba(pipe, ps,
+ pipe_put_tile_rgba(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
(float *) tile->data.color);
}
else {
/* get new tile data from surface */
if (tc->depth_stencil) {
- pipe_get_tile_raw(pipe, ps,
+ pipe_get_tile_raw(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
tile->data.depth32, 0/*STRIDE*/);
}
else {
- pipe_get_tile_rgba(pipe, ps,
+ pipe_get_tile_rgba(ps,
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
(float *) tile->data.color);
}
}
/* get tile from the surface (view into texture) */
- pipe_get_tile_rgba(pipe, tc->tex_surf,
+ pipe_get_tile_rgba(tc->tex_surf,
tile_x, tile_y, TILE_SIZE, TILE_SIZE,
(float *) tile->data.color);
tile->x = tile_x;
}
else {
/* other softpipe surface */
- softpipe_get_tile_rgba(pipe, ps, x, y, w, h, p);
+ softpipe_get_tile_rgba(ps, x, y, w, h, p);
}
}
}
else {
/* other softpipe surface */
- softpipe_put_tile_rgba(pipe, ps, x, y, w, h, p);
+ softpipe_put_tile_rgba(ps, x, y, w, h, p);
}
}
acc_ps->block.width = 1;
acc_ps->block.height = 1;
- pipe_get_tile_rgba(pipe, acc_ps, x, y, w, h, p);
+ pipe_get_tile_rgba(acc_ps, x, y, w, h, p);
acc_ps->format = f;
acc_ps->block = b;
acc_ps->block.width = 1;
acc_ps->block.height = 1;
- pipe_put_tile_rgba(pipe, acc_ps, x, y, w, h, p);
+ pipe_put_tile_rgba(acc_ps, x, y, w, h, p);
acc_ps->format = f;
acc_ps->block = b;
colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, color_surf, xpos, ypos, width, height, colorBuf);
+ pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, colorBuf);
acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
for (i = 0; i < 4 * width * height; i++) {
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, color_surf, xpos, ypos, width, height, buf);
+ pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, buf);
for (i = 0; i < 4 * width * height; i++) {
buf[i] = buf[i] * value;
if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) {
cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, color_surf, xpos, ypos, width, height, cbuf);
+ pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, cbuf);
}
for (i = 0; i < width * height; i++) {
}
}
- pipe_put_tile_rgba(pipe, color_surf, xpos, ypos, width, height, abuf);
+ pipe_put_tile_rgba(color_surf, xpos, ypos, width, height, abuf);
free(abuf);
if (cbuf)
/* alternate path using get/put_tile() */
GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(pipe, psRead, srcx, srcy, width, height, buf);
- pipe_put_tile_rgba(pipe, psTex, 0, 0, width, height, buf);
+ pipe_get_tile_rgba(psRead, srcx, srcy, width, height, buf);
+ pipe_put_tile_rgba(psTex, 0, 0, width, height, buf);
free(buf);
}
else {
/* GL_DEPTH */
GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
- pipe_get_tile_z(pipe, psRead, srcx, srcy, width, height, buf);
- pipe_put_tile_z(pipe, psTex, 0, 0, width, height, buf);
+ pipe_get_tile_z(psRead, srcx, srcy, width, height, buf);
+ pipe_put_tile_z(psTex, 0, 0, width, height, buf);
free(buf);
}
pipe_surface_reference(&psRead, NULL);
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / ((1 << 24) - 1);
- pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * (ztemp[j] & 0xffffff));
/* untested, but simple: */
assert(format == GL_DEPTH_STENCIL_EXT);
for (i = 0; i < height; i++) {
- pipe_get_tile_raw(pipe, surf, x, y, width, 1, dst, 0);
+ pipe_get_tile_raw(surf, x, y, width, 1, dst, 0);
y += yStep;
dst += dstStride;
}
GLushort ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / 0xffff;
- pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * ztemp[j]);
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / 0xffffffff;
- pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(surf, x, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * ztemp[j]);
/* RGBA format */
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
- pipe_get_tile_rgba(pipe, surf, x, y, width, 1, df);
+ pipe_get_tile_rgba(surf, x, y, width, 1, df);
y += yStep;
df += dfStride;
if (!dfStride) {
for (row = 0; row < height; row++, srcY++, destY += yStep) {
uint data[MAX_WIDTH];
- pipe_get_tile_z(pipe, src_surf, srcX, srcY, width, 1, data);
+ pipe_get_tile_z(src_surf, srcX, srcY, width, 1, data);
if (scaleOrBias) {
_mesa_scale_and_bias_depth_uint(ctx, width, data);
}
- pipe_put_tile_z(pipe, dest_surf, destX, destY, width, 1, data);
+ pipe_put_tile_z(dest_surf, destX, destY, width, 1, data);
}
}
else {
/* RGBA format */
for (row = 0; row < height; row++, srcY++, destY += yStep) {
float data[4 * MAX_WIDTH];
- pipe_get_tile_rgba(pipe, src_surf, srcX, srcY, width, 1, data);
+ pipe_get_tile_rgba(src_surf, srcX, srcY, width, 1, data);
/* XXX we're ignoring convolution for now */
if (ctx->_ImageTransferState) {
_mesa_apply_rgba_transfer_ops(ctx,
ctx->_ImageTransferState & ~IMAGE_CONVOLUTION_BIT,
width, (GLfloat (*)[4]) data);
}
- pipe_put_tile_rgba(pipe, dest_surf, destX, destY, width, 1, data);
+ pipe_put_tile_rgba(dest_surf, destX, destY, width, 1, data);
}
}