util: Eliminate pipe from the arguments to pipe_get/put_tile_xxx functions.
You don't need a pipe_context * for this, and all other necessary info is already inside pipe_surface.
This commit is contained in:
@@ -45,12 +45,10 @@
|
|||||||
* This should be usable by any hw driver that has mappable surfaces.
|
* This should be usable by any hw driver that has mappable surfaces.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pipe_get_tile_raw(struct pipe_context *pipe,
|
pipe_get_tile_raw(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
void *dst, int dst_stride)
|
void *dst, int dst_stride)
|
||||||
{
|
{
|
||||||
struct pipe_screen *screen = pipe->screen;
|
|
||||||
const void *src;
|
const void *src;
|
||||||
|
|
||||||
if (pipe_clip_tile(x, y, &w, &h, ps))
|
if (pipe_clip_tile(x, y, &w, &h, ps))
|
||||||
@@ -59,14 +57,14 @@ pipe_get_tile_raw(struct pipe_context *pipe,
|
|||||||
if (dst_stride == 0)
|
if (dst_stride == 0)
|
||||||
dst_stride = pf_get_nblocksx(&ps->block, w) * ps->block.size;
|
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);
|
assert(src);
|
||||||
if(!src)
|
if(!src)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pipe_copy_rect(dst, &ps->block, dst_stride, 0, 0, w, h, src, ps->stride, x, y);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -75,12 +73,10 @@ pipe_get_tile_raw(struct pipe_context *pipe,
|
|||||||
* This should be usable by any hw driver that has mappable surfaces.
|
* This should be usable by any hw driver that has mappable surfaces.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pipe_put_tile_raw(struct pipe_context *pipe,
|
pipe_put_tile_raw(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
const void *src, int src_stride)
|
const void *src, int src_stride)
|
||||||
{
|
{
|
||||||
struct pipe_screen *screen = pipe->screen;
|
|
||||||
void *dst;
|
void *dst;
|
||||||
|
|
||||||
if (pipe_clip_tile(x, y, &w, &h, ps))
|
if (pipe_clip_tile(x, y, &w, &h, ps))
|
||||||
@@ -89,14 +85,14 @@ pipe_put_tile_raw(struct pipe_context *pipe,
|
|||||||
if (src_stride == 0)
|
if (src_stride == 0)
|
||||||
src_stride = pf_get_nblocksx(&ps->block, w) * ps->block.size;
|
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);
|
assert(dst);
|
||||||
if(!dst)
|
if(!dst)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pipe_copy_rect(dst, &ps->block, ps->stride, x, y, w, h, src, src_stride, 0, 0);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -686,8 +682,7 @@ ycbcr_get_tile_rgba(ushort *src,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pipe_get_tile_rgba(struct pipe_context *pipe,
|
pipe_get_tile_rgba(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
float *p)
|
float *p)
|
||||||
{
|
{
|
||||||
@@ -702,7 +697,7 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
|
|||||||
if (!packed)
|
if (!packed)
|
||||||
return;
|
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) {
|
switch (ps->format) {
|
||||||
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
||||||
@@ -768,8 +763,7 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pipe_put_tile_rgba(struct pipe_context *pipe,
|
pipe_put_tile_rgba(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
const float *p)
|
const float *p)
|
||||||
{
|
{
|
||||||
@@ -838,7 +832,7 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
|
|||||||
assert(0);
|
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);
|
FREE(packed);
|
||||||
}
|
}
|
||||||
@@ -848,12 +842,10 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
|
|||||||
* Get a block of Z values, converted to 32-bit range.
|
* Get a block of Z values, converted to 32-bit range.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pipe_get_tile_z(struct pipe_context *pipe,
|
pipe_get_tile_z(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
uint *z)
|
uint *z)
|
||||||
{
|
{
|
||||||
struct pipe_screen *screen = pipe->screen;
|
|
||||||
const uint dstStride = w;
|
const uint dstStride = w;
|
||||||
ubyte *map;
|
ubyte *map;
|
||||||
uint *pDest = z;
|
uint *pDest = z;
|
||||||
@@ -862,7 +854,7 @@ pipe_get_tile_z(struct pipe_context *pipe,
|
|||||||
if (pipe_clip_tile(x, y, &w, &h, ps))
|
if (pipe_clip_tile(x, y, &w, &h, ps))
|
||||||
return;
|
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) {
|
if (!map) {
|
||||||
assert(0);
|
assert(0);
|
||||||
return;
|
return;
|
||||||
@@ -913,17 +905,15 @@ pipe_get_tile_z(struct pipe_context *pipe,
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->surface_unmap(screen, ps);
|
pipe_surface_unmap(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pipe_put_tile_z(struct pipe_context *pipe,
|
pipe_put_tile_z(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
const uint *zSrc)
|
const uint *zSrc)
|
||||||
{
|
{
|
||||||
struct pipe_screen *screen = pipe->screen;
|
|
||||||
const uint srcStride = w;
|
const uint srcStride = w;
|
||||||
const uint *pSrc = zSrc;
|
const uint *pSrc = zSrc;
|
||||||
ubyte *map;
|
ubyte *map;
|
||||||
@@ -932,7 +922,7 @@ pipe_put_tile_z(struct pipe_context *pipe,
|
|||||||
if (pipe_clip_tile(x, y, &w, &h, ps))
|
if (pipe_clip_tile(x, y, &w, &h, ps))
|
||||||
return;
|
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) {
|
if (!map) {
|
||||||
assert(0);
|
assert(0);
|
||||||
return;
|
return;
|
||||||
@@ -980,7 +970,7 @@ pipe_put_tile_z(struct pipe_context *pipe,
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->surface_unmap(screen, ps);
|
pipe_surface_unmap(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "pipe/p_compiler.h"
|
#include "pipe/p_compiler.h"
|
||||||
|
|
||||||
struct pipe_context;
|
|
||||||
struct pipe_surface;
|
struct pipe_surface;
|
||||||
|
|
||||||
|
|
||||||
@@ -57,40 +56,34 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
pipe_get_tile_raw(struct pipe_context *pipe,
|
pipe_get_tile_raw(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
void *p, int dst_stride);
|
void *p, int dst_stride);
|
||||||
|
|
||||||
void
|
void
|
||||||
pipe_put_tile_raw(struct pipe_context *pipe,
|
pipe_put_tile_raw(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
const void *p, int src_stride);
|
const void *p, int src_stride);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pipe_get_tile_rgba(struct pipe_context *pipe,
|
pipe_get_tile_rgba(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
float *p);
|
float *p);
|
||||||
|
|
||||||
void
|
void
|
||||||
pipe_put_tile_rgba(struct pipe_context *pipe,
|
pipe_put_tile_rgba(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
const float *p);
|
const float *p);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pipe_get_tile_z(struct pipe_context *pipe,
|
pipe_get_tile_z(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
uint *z);
|
uint *z);
|
||||||
|
|
||||||
void
|
void
|
||||||
pipe_put_tile_z(struct pipe_context *pipe,
|
pipe_put_tile_z(struct pipe_surface *ps,
|
||||||
struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h,
|
uint x, uint y, uint w, uint h,
|
||||||
const uint *z);
|
const uint *z);
|
||||||
|
|
||||||
|
@@ -339,7 +339,7 @@ sp_tile_cache_flush_clear(struct pipe_context *pipe,
|
|||||||
for (y = 0; y < h; y += TILE_SIZE) {
|
for (y = 0; y < h; y += TILE_SIZE) {
|
||||||
for (x = 0; x < w; x += TILE_SIZE) {
|
for (x = 0; x < w; x += TILE_SIZE) {
|
||||||
if (is_clear_flag_set(tc->clear_flags, x, y)) {
|
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,
|
x, y, TILE_SIZE, TILE_SIZE,
|
||||||
tc->tile.data.color32, 0/*STRIDE*/);
|
tc->tile.data.color32, 0/*STRIDE*/);
|
||||||
|
|
||||||
@@ -374,12 +374,12 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
|
|||||||
struct softpipe_cached_tile *tile = tc->entries + pos;
|
struct softpipe_cached_tile *tile = tc->entries + pos;
|
||||||
if (tile->x >= 0) {
|
if (tile->x >= 0) {
|
||||||
if (tc->depth_stencil) {
|
if (tc->depth_stencil) {
|
||||||
pipe_put_tile_raw(pipe, ps,
|
pipe_put_tile_raw(ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
tile->data.depth32, 0/*STRIDE*/);
|
tile->data.depth32, 0/*STRIDE*/);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pipe_put_tile_rgba(pipe, ps,
|
pipe_put_tile_rgba(ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
(float *) tile->data.color);
|
(float *) tile->data.color);
|
||||||
}
|
}
|
||||||
@@ -431,12 +431,12 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
|
|||||||
if (tile->x != -1) {
|
if (tile->x != -1) {
|
||||||
/* put dirty tile back in framebuffer */
|
/* put dirty tile back in framebuffer */
|
||||||
if (tc->depth_stencil) {
|
if (tc->depth_stencil) {
|
||||||
pipe_put_tile_raw(pipe, ps,
|
pipe_put_tile_raw(ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
tile->data.depth32, 0/*STRIDE*/);
|
tile->data.depth32, 0/*STRIDE*/);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pipe_put_tile_rgba(pipe, ps,
|
pipe_put_tile_rgba(ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
(float *) tile->data.color);
|
(float *) tile->data.color);
|
||||||
}
|
}
|
||||||
@@ -458,12 +458,12 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
|
|||||||
else {
|
else {
|
||||||
/* get new tile data from surface */
|
/* get new tile data from surface */
|
||||||
if (tc->depth_stencil) {
|
if (tc->depth_stencil) {
|
||||||
pipe_get_tile_raw(pipe, ps,
|
pipe_get_tile_raw(ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
tile->data.depth32, 0/*STRIDE*/);
|
tile->data.depth32, 0/*STRIDE*/);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pipe_get_tile_rgba(pipe, ps,
|
pipe_get_tile_rgba(ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
(float *) tile->data.color);
|
(float *) tile->data.color);
|
||||||
}
|
}
|
||||||
@@ -544,7 +544,7 @@ sp_get_cached_tile_tex(struct pipe_context *pipe,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get tile from the surface (view into texture) */
|
/* 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,
|
tile_x, tile_y, TILE_SIZE, TILE_SIZE,
|
||||||
(float *) tile->data.color);
|
(float *) tile->data.color);
|
||||||
tile->x = tile_x;
|
tile->x = tile_x;
|
||||||
|
@@ -106,7 +106,7 @@ xmesa_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* other softpipe surface */
|
/* other softpipe surface */
|
||||||
softpipe_get_tile_rgba(pipe, ps, x, y, w, h, p);
|
softpipe_get_tile_rgba(ps, x, y, w, h, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ xmesa_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* other softpipe surface */
|
/* other softpipe surface */
|
||||||
softpipe_put_tile_rgba(pipe, ps, x, y, w, h, p);
|
softpipe_put_tile_rgba(ps, x, y, w, h, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,7 +73,7 @@ acc_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
|
|||||||
acc_ps->block.width = 1;
|
acc_ps->block.width = 1;
|
||||||
acc_ps->block.height = 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->format = f;
|
||||||
acc_ps->block = b;
|
acc_ps->block = b;
|
||||||
@@ -97,7 +97,7 @@ acc_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *acc_ps,
|
|||||||
acc_ps->block.width = 1;
|
acc_ps->block.width = 1;
|
||||||
acc_ps->block.height = 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->format = f;
|
||||||
acc_ps->block = b;
|
acc_ps->block = b;
|
||||||
@@ -208,7 +208,7 @@ accum_accum(struct pipe_context *pipe, GLfloat value,
|
|||||||
colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
|
colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
|
||||||
accBuf = (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);
|
acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
|
||||||
|
|
||||||
for (i = 0; i < 4 * width * height; i++) {
|
for (i = 0; i < 4 * width * height; i++) {
|
||||||
@@ -243,7 +243,7 @@ accum_load(struct pipe_context *pipe, GLfloat value,
|
|||||||
|
|
||||||
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
|
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++) {
|
for (i = 0; i < 4 * width * height; i++) {
|
||||||
buf[i] = buf[i] * value;
|
buf[i] = buf[i] * value;
|
||||||
@@ -283,7 +283,7 @@ accum_return(GLcontext *ctx, GLfloat value,
|
|||||||
|
|
||||||
if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) {
|
if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) {
|
||||||
cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
|
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++) {
|
for (i = 0; i < width * height; i++) {
|
||||||
@@ -298,7 +298,7 @@ accum_return(GLcontext *ctx, GLfloat value,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
free(abuf);
|
||||||
if (cbuf)
|
if (cbuf)
|
||||||
|
@@ -1049,16 +1049,16 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||||||
/* alternate path using get/put_tile() */
|
/* alternate path using get/put_tile() */
|
||||||
GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
|
GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
|
||||||
|
|
||||||
pipe_get_tile_rgba(pipe, psRead, srcx, srcy, width, height, buf);
|
pipe_get_tile_rgba(psRead, srcx, srcy, width, height, buf);
|
||||||
pipe_put_tile_rgba(pipe, psTex, 0, 0, width, height, buf);
|
pipe_put_tile_rgba(psTex, 0, 0, width, height, buf);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* GL_DEPTH */
|
/* GL_DEPTH */
|
||||||
GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
|
GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
|
||||||
pipe_get_tile_z(pipe, psRead, srcx, srcy, width, height, buf);
|
pipe_get_tile_z(psRead, srcx, srcy, width, height, buf);
|
||||||
pipe_put_tile_z(pipe, psTex, 0, 0, width, height, buf);
|
pipe_put_tile_z(psTex, 0, 0, width, height, buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
pipe_surface_reference(&psRead, NULL);
|
pipe_surface_reference(&psRead, NULL);
|
||||||
|
@@ -262,7 +262,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
GLuint ztemp[MAX_WIDTH];
|
GLuint ztemp[MAX_WIDTH];
|
||||||
GLfloat zfloat[MAX_WIDTH];
|
GLfloat zfloat[MAX_WIDTH];
|
||||||
const double scale = 1.0 / ((1 << 24) - 1);
|
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;
|
y += yStep;
|
||||||
for (j = 0; j < width; j++) {
|
for (j = 0; j < width; j++) {
|
||||||
zfloat[j] = (float) (scale * (ztemp[j] & 0xffffff));
|
zfloat[j] = (float) (scale * (ztemp[j] & 0xffffff));
|
||||||
@@ -276,7 +276,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
/* untested, but simple: */
|
/* untested, but simple: */
|
||||||
assert(format == GL_DEPTH_STENCIL_EXT);
|
assert(format == GL_DEPTH_STENCIL_EXT);
|
||||||
for (i = 0; i < height; i++) {
|
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;
|
y += yStep;
|
||||||
dst += dstStride;
|
dst += dstStride;
|
||||||
}
|
}
|
||||||
@@ -287,7 +287,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
GLushort ztemp[MAX_WIDTH];
|
GLushort ztemp[MAX_WIDTH];
|
||||||
GLfloat zfloat[MAX_WIDTH];
|
GLfloat zfloat[MAX_WIDTH];
|
||||||
const double scale = 1.0 / 0xffff;
|
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;
|
y += yStep;
|
||||||
for (j = 0; j < width; j++) {
|
for (j = 0; j < width; j++) {
|
||||||
zfloat[j] = (float) (scale * ztemp[j]);
|
zfloat[j] = (float) (scale * ztemp[j]);
|
||||||
@@ -302,7 +302,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
GLuint ztemp[MAX_WIDTH];
|
GLuint ztemp[MAX_WIDTH];
|
||||||
GLfloat zfloat[MAX_WIDTH];
|
GLfloat zfloat[MAX_WIDTH];
|
||||||
const double scale = 1.0 / 0xffffffff;
|
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;
|
y += yStep;
|
||||||
for (j = 0; j < width; j++) {
|
for (j = 0; j < width; j++) {
|
||||||
zfloat[j] = (float) (scale * ztemp[j]);
|
zfloat[j] = (float) (scale * ztemp[j]);
|
||||||
@@ -316,7 +316,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
/* RGBA format */
|
/* RGBA format */
|
||||||
/* Do a row at a time to flip image data vertically */
|
/* Do a row at a time to flip image data vertically */
|
||||||
for (i = 0; i < height; i++) {
|
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;
|
y += yStep;
|
||||||
df += dfStride;
|
df += dfStride;
|
||||||
if (!dfStride) {
|
if (!dfStride) {
|
||||||
|
@@ -1100,25 +1100,25 @@ fallback_copy_texsubimage(GLcontext *ctx,
|
|||||||
|
|
||||||
for (row = 0; row < height; row++, srcY++, destY += yStep) {
|
for (row = 0; row < height; row++, srcY++, destY += yStep) {
|
||||||
uint data[MAX_WIDTH];
|
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) {
|
if (scaleOrBias) {
|
||||||
_mesa_scale_and_bias_depth_uint(ctx, width, data);
|
_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 {
|
else {
|
||||||
/* RGBA format */
|
/* RGBA format */
|
||||||
for (row = 0; row < height; row++, srcY++, destY += yStep) {
|
for (row = 0; row < height; row++, srcY++, destY += yStep) {
|
||||||
float data[4 * MAX_WIDTH];
|
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 */
|
/* XXX we're ignoring convolution for now */
|
||||||
if (ctx->_ImageTransferState) {
|
if (ctx->_ImageTransferState) {
|
||||||
_mesa_apply_rgba_transfer_ops(ctx,
|
_mesa_apply_rgba_transfer_ops(ctx,
|
||||||
ctx->_ImageTransferState & ~IMAGE_CONVOLUTION_BIT,
|
ctx->_ImageTransferState & ~IMAGE_CONVOLUTION_BIT,
|
||||||
width, (GLfloat (*)[4]) data);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user