Move the get/put_tile() functions to pipe_context.
The _rgba versions are temporary until the state tracker is updated.
This commit is contained in:
@@ -148,8 +148,8 @@ xmesa_new_color_surface(struct pipe_context *pipe, GLuint pipeFormat)
|
|||||||
|
|
||||||
switch (pipeFormat) {
|
switch (pipeFormat) {
|
||||||
case PIPE_FORMAT_U_A8_R8_G8_B8:
|
case PIPE_FORMAT_U_A8_R8_G8_B8:
|
||||||
xms->surface.surface.get_tile = get_tile;
|
xms->surface.get_tile = get_tile;
|
||||||
xms->surface.surface.put_tile = put_tile;
|
xms->surface.put_tile = put_tile;
|
||||||
break;
|
break;
|
||||||
case PIPE_FORMAT_S8_Z24:
|
case PIPE_FORMAT_S8_Z24:
|
||||||
break;
|
break;
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
#include "i915_state.h"
|
#include "i915_state.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_util.h"
|
#include "pipe/p_util.h"
|
||||||
//#include "main/imports.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct i915_surface
|
struct i915_surface
|
||||||
@@ -44,8 +43,9 @@ struct i915_surface
|
|||||||
* Share it someday.
|
* Share it someday.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
i915_get_tile(struct pipe_surface *ps,
|
i915_get_tile_rgba(struct pipe_context *pipe,
|
||||||
unsigned x, unsigned y, unsigned w, unsigned h, float *p)
|
struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h, float *p)
|
||||||
{
|
{
|
||||||
const unsigned *src
|
const unsigned *src
|
||||||
= ((const unsigned *) (ps->region->map + ps->offset))
|
= ((const unsigned *) (ps->region->map + ps->offset))
|
||||||
@@ -82,8 +82,9 @@ i915_get_tile(struct pipe_surface *ps,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i915_put_tile(struct pipe_surface *ps,
|
i915_put_tile_rgba(struct pipe_context *pipe,
|
||||||
unsigned x, unsigned y, unsigned w, unsigned h, const float *p)
|
struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h, const float *p)
|
||||||
{
|
{
|
||||||
/* any need to put tiles into i915 surfaces? */
|
/* any need to put tiles into i915 surfaces? */
|
||||||
assert(0);
|
assert(0);
|
||||||
@@ -102,8 +103,8 @@ i915_surface_alloc(struct pipe_context *pipe, unsigned format)
|
|||||||
surf->surface.format = format;
|
surf->surface.format = format;
|
||||||
surf->surface.refcount = 1;
|
surf->surface.refcount = 1;
|
||||||
|
|
||||||
surf->surface.get_tile = i915_get_tile;
|
// surf->surface.get_tile = i915_get_tile;
|
||||||
surf->surface.put_tile = i915_put_tile;
|
// surf->surface.put_tile = i915_put_tile;
|
||||||
|
|
||||||
return &surf->surface;
|
return &surf->surface;
|
||||||
}
|
}
|
||||||
@@ -113,4 +114,6 @@ void
|
|||||||
i915_init_surface_functions(struct i915_context *i915)
|
i915_init_surface_functions(struct i915_context *i915)
|
||||||
{
|
{
|
||||||
i915->pipe.surface_alloc = i915_surface_alloc;
|
i915->pipe.surface_alloc = i915_surface_alloc;
|
||||||
|
i915->pipe.get_tile_rgba = i915_get_tile_rgba;
|
||||||
|
i915->pipe.put_tile_rgba = i915_put_tile_rgba;
|
||||||
}
|
}
|
||||||
|
@@ -188,6 +188,24 @@ struct pipe_context {
|
|||||||
unsigned face, unsigned level,
|
unsigned face, unsigned level,
|
||||||
unsigned zslice);
|
unsigned zslice);
|
||||||
|
|
||||||
|
/** Get a block of raw pixel data from a surface */
|
||||||
|
void (*get_tile)(struct pipe_context *pipe,
|
||||||
|
struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h,
|
||||||
|
void *p, int dst_stride);
|
||||||
|
/** Put a block of raw pixel data into a surface */
|
||||||
|
void (*put_tile)(struct pipe_context *pipe,
|
||||||
|
struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h,
|
||||||
|
const void *p, int src_stride);
|
||||||
|
|
||||||
|
/* XXX temporary here, move these to softpipe */
|
||||||
|
void (*get_tile_rgba)(struct pipe_context *pipe, struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h, float *p);
|
||||||
|
void (*put_tile_rgba)(struct pipe_context *pipe, struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h, const float *p);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory region functions
|
* Memory region functions
|
||||||
* Some of these may go away...
|
* Some of these may go away...
|
||||||
|
@@ -291,27 +291,6 @@ struct pipe_surface
|
|||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
unsigned offset; /**< offset from start of region, in bytes */
|
unsigned offset; /**< offset from start of region, in bytes */
|
||||||
unsigned refcount;
|
unsigned refcount;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get block/tile of pixels from surface as floats
|
|
||||||
* If color surface, return float[4]. If depth surface, return float[1].
|
|
||||||
*/
|
|
||||||
void (*get_tile)(struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h, float *p);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Put block/tile of pixels into surface as floats
|
|
||||||
* If color surface, data is float[4]. If depth surface, data is float[1].
|
|
||||||
*/
|
|
||||||
void (*put_tile)(struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h, const float *p);
|
|
||||||
|
|
||||||
/** As above, but data is raw pixel data */
|
|
||||||
void (*get_tile_raw)(struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h, void *p);
|
|
||||||
/** As above, but data is raw pixel data */
|
|
||||||
void (*put_tile_raw)(struct pipe_surface *ps,
|
|
||||||
uint x, uint y, uint w, uint h, const void *p);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -171,9 +171,9 @@ softpipe_unmap_surfaces(struct softpipe_context *sp)
|
|||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
|
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
|
||||||
sp_flush_tile_cache(sp->cbuf_cache[i]);
|
sp_flush_tile_cache(sp, sp->cbuf_cache[i]);
|
||||||
sp_flush_tile_cache(sp->zbuf_cache);
|
sp_flush_tile_cache(sp, sp->zbuf_cache);
|
||||||
sp_flush_tile_cache(sp->sbuf_cache);
|
sp_flush_tile_cache(sp, sp->sbuf_cache);
|
||||||
|
|
||||||
for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
|
for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
|
||||||
struct pipe_surface *ps = sp->framebuffer.cbufs[i];
|
struct pipe_surface *ps = sp->framebuffer.cbufs[i];
|
||||||
|
@@ -57,13 +57,13 @@ softpipe_flush( struct pipe_context *pipe,
|
|||||||
|
|
||||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
|
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
|
||||||
if (softpipe->cbuf_cache[i])
|
if (softpipe->cbuf_cache[i])
|
||||||
sp_flush_tile_cache(softpipe->cbuf_cache[i]);
|
sp_flush_tile_cache(softpipe, softpipe->cbuf_cache[i]);
|
||||||
|
|
||||||
if (softpipe->zbuf_cache)
|
if (softpipe->zbuf_cache)
|
||||||
sp_flush_tile_cache(softpipe->zbuf_cache);
|
sp_flush_tile_cache(softpipe, softpipe->zbuf_cache);
|
||||||
|
|
||||||
if (softpipe->sbuf_cache)
|
if (softpipe->sbuf_cache)
|
||||||
sp_flush_tile_cache(softpipe->sbuf_cache);
|
sp_flush_tile_cache(softpipe, softpipe->sbuf_cache);
|
||||||
|
|
||||||
/* Need this call for hardware buffers before swapbuffers.
|
/* Need this call for hardware buffers before swapbuffers.
|
||||||
*
|
*
|
||||||
|
@@ -107,7 +107,8 @@ logicop_quad(struct quad_stage *qs, struct quad_header *quad)
|
|||||||
uint *dst4 = (uint *) dst;
|
uint *dst4 = (uint *) dst;
|
||||||
uint *res4 = (uint *) res;
|
uint *res4 = (uint *) res;
|
||||||
struct softpipe_cached_tile *
|
struct softpipe_cached_tile *
|
||||||
tile = sp_get_cached_tile(softpipe->cbuf_cache[0], quad->x0, quad->y0);
|
tile = sp_get_cached_tile(softpipe, softpipe->cbuf_cache[0],
|
||||||
|
quad->x0, quad->y0);
|
||||||
uint i, j;
|
uint i, j;
|
||||||
|
|
||||||
/* get/swizzle dest colors */
|
/* get/swizzle dest colors */
|
||||||
@@ -222,8 +223,9 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
|
|||||||
static const float zero[4] = { 0, 0, 0, 0 };
|
static const float zero[4] = { 0, 0, 0, 0 };
|
||||||
static const float one[4] = { 1, 1, 1, 1 };
|
static const float one[4] = { 1, 1, 1, 1 };
|
||||||
float source[4][QUAD_SIZE], dest[4][QUAD_SIZE];
|
float source[4][QUAD_SIZE], dest[4][QUAD_SIZE];
|
||||||
struct softpipe_cached_tile *
|
struct softpipe_cached_tile *tile
|
||||||
tile = sp_get_cached_tile(softpipe->cbuf_cache[0], quad->x0, quad->y0);
|
= sp_get_cached_tile(softpipe, softpipe->cbuf_cache[0],
|
||||||
|
quad->x0, quad->y0);
|
||||||
uint i, j;
|
uint i, j;
|
||||||
|
|
||||||
if (softpipe->blend->logicop_enable) {
|
if (softpipe->blend->logicop_enable) {
|
||||||
|
@@ -48,8 +48,9 @@ colormask_quad(struct quad_stage *qs, struct quad_header *quad)
|
|||||||
{
|
{
|
||||||
struct softpipe_context *softpipe = qs->softpipe;
|
struct softpipe_context *softpipe = qs->softpipe;
|
||||||
float dest[4][QUAD_SIZE];
|
float dest[4][QUAD_SIZE];
|
||||||
struct softpipe_cached_tile *
|
struct softpipe_cached_tile *tile
|
||||||
tile = sp_get_cached_tile(softpipe->cbuf_cache[0], quad->x0, quad->y0);
|
= sp_get_cached_tile(softpipe,
|
||||||
|
softpipe->cbuf_cache[0], quad->x0, quad->y0);
|
||||||
uint i, j;
|
uint i, j;
|
||||||
|
|
||||||
/* get/swizzle dest colors */
|
/* get/swizzle dest colors */
|
||||||
|
@@ -57,7 +57,7 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
|
|||||||
unsigned zmask = 0;
|
unsigned zmask = 0;
|
||||||
unsigned j;
|
unsigned j;
|
||||||
struct softpipe_cached_tile *tile
|
struct softpipe_cached_tile *tile
|
||||||
= sp_get_cached_tile(softpipe->zbuf_cache, quad->x0, quad->y0);
|
= sp_get_cached_tile(softpipe, softpipe->zbuf_cache, quad->x0, quad->y0);
|
||||||
|
|
||||||
assert(sps); /* shouldn't get here if there's no zbuffer */
|
assert(sps); /* shouldn't get here if there's no zbuffer */
|
||||||
|
|
||||||
|
@@ -43,7 +43,8 @@ output_quad(struct quad_stage *qs, struct quad_header *quad)
|
|||||||
{
|
{
|
||||||
struct softpipe_context *softpipe = qs->softpipe;
|
struct softpipe_context *softpipe = qs->softpipe;
|
||||||
struct softpipe_cached_tile *tile
|
struct softpipe_cached_tile *tile
|
||||||
= sp_get_cached_tile(softpipe->cbuf_cache[0], quad->x0, quad->y0);
|
= sp_get_cached_tile(softpipe, softpipe->cbuf_cache[0],
|
||||||
|
quad->x0, quad->y0);
|
||||||
/* in-tile pos: */
|
/* in-tile pos: */
|
||||||
const int itx = quad->x0 % TILE_SIZE;
|
const int itx = quad->x0 % TILE_SIZE;
|
||||||
const int ity = quad->y0 % TILE_SIZE;
|
const int ity = quad->y0 % TILE_SIZE;
|
||||||
|
@@ -206,7 +206,7 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
|
|||||||
ubyte ref, wrtMask, valMask;
|
ubyte ref, wrtMask, valMask;
|
||||||
ubyte stencilVals[QUAD_SIZE];
|
ubyte stencilVals[QUAD_SIZE];
|
||||||
struct softpipe_cached_tile *tile
|
struct softpipe_cached_tile *tile
|
||||||
= sp_get_cached_tile(softpipe->sbuf_cache, quad->x0, quad->y0);
|
= sp_get_cached_tile(softpipe, softpipe->sbuf_cache, quad->x0, quad->y0);
|
||||||
uint j;
|
uint j;
|
||||||
|
|
||||||
/* choose front or back face function, operator, etc */
|
/* choose front or back face function, operator, etc */
|
||||||
|
@@ -51,7 +51,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
|
|||||||
/* check if changing cbuf */
|
/* check if changing cbuf */
|
||||||
if (sp->framebuffer.cbufs[i] != fb->cbufs[i]) {
|
if (sp->framebuffer.cbufs[i] != fb->cbufs[i]) {
|
||||||
/* flush old */
|
/* flush old */
|
||||||
sp_flush_tile_cache(sp->cbuf_cache[i]);
|
sp_flush_tile_cache(sp, sp->cbuf_cache[i]);
|
||||||
/* unmap old */
|
/* unmap old */
|
||||||
sps = softpipe_surface(sp->framebuffer.cbufs[i]);
|
sps = softpipe_surface(sp->framebuffer.cbufs[i]);
|
||||||
if (sps && sps->surface.region)
|
if (sps && sps->surface.region)
|
||||||
@@ -73,7 +73,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
|
|||||||
/* zbuf changing? */
|
/* zbuf changing? */
|
||||||
if (sp->framebuffer.zbuf != fb->zbuf) {
|
if (sp->framebuffer.zbuf != fb->zbuf) {
|
||||||
/* flush old */
|
/* flush old */
|
||||||
sp_flush_tile_cache(sp->zbuf_cache);
|
sp_flush_tile_cache(sp, sp->zbuf_cache);
|
||||||
/* unmap old */
|
/* unmap old */
|
||||||
sps = softpipe_surface(sp->framebuffer.zbuf);
|
sps = softpipe_surface(sp->framebuffer.zbuf);
|
||||||
if (sps && sps->surface.region)
|
if (sps && sps->surface.region)
|
||||||
@@ -98,7 +98,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
|
|||||||
/* sbuf changing? */
|
/* sbuf changing? */
|
||||||
if (sp->framebuffer.sbuf != fb->sbuf) {
|
if (sp->framebuffer.sbuf != fb->sbuf) {
|
||||||
/* flush old */
|
/* flush old */
|
||||||
sp_flush_tile_cache(sp->sbuf_cache_sep);
|
sp_flush_tile_cache(sp, sp->sbuf_cache_sep);
|
||||||
/* unmap old */
|
/* unmap old */
|
||||||
sps = softpipe_surface(sp->framebuffer.sbuf);
|
sps = softpipe_surface(sp->framebuffer.sbuf);
|
||||||
if (sps && sps->surface.region)
|
if (sps && sps->surface.region)
|
||||||
|
@@ -632,48 +632,48 @@ softpipe_init_surface_funcs(struct softpipe_surface *sps)
|
|||||||
|
|
||||||
switch (sps->surface.format) {
|
switch (sps->surface.format) {
|
||||||
case PIPE_FORMAT_U_A8_R8_G8_B8:
|
case PIPE_FORMAT_U_A8_R8_G8_B8:
|
||||||
sps->surface.get_tile = a8r8g8b8_get_tile;
|
sps->get_tile = a8r8g8b8_get_tile;
|
||||||
sps->surface.put_tile = a8r8g8b8_put_tile;
|
sps->put_tile = a8r8g8b8_put_tile;
|
||||||
break;
|
break;
|
||||||
case PIPE_FORMAT_U_A1_R5_G5_B5:
|
case PIPE_FORMAT_U_A1_R5_G5_B5:
|
||||||
sps->surface.get_tile = a1r5g5b5_get_tile;
|
sps->get_tile = a1r5g5b5_get_tile;
|
||||||
break;
|
break;
|
||||||
case PIPE_FORMAT_U_L8:
|
case PIPE_FORMAT_U_L8:
|
||||||
sps->surface.get_tile = l8_get_tile;
|
sps->get_tile = l8_get_tile;
|
||||||
break;
|
break;
|
||||||
case PIPE_FORMAT_U_A8:
|
case PIPE_FORMAT_U_A8:
|
||||||
sps->surface.get_tile = a8_get_tile;
|
sps->get_tile = a8_get_tile;
|
||||||
break;
|
break;
|
||||||
case PIPE_FORMAT_U_I8:
|
case PIPE_FORMAT_U_I8:
|
||||||
sps->surface.get_tile = i8_get_tile;
|
sps->get_tile = i8_get_tile;
|
||||||
break;
|
break;
|
||||||
case PIPE_FORMAT_U_A8_L8:
|
case PIPE_FORMAT_U_A8_L8:
|
||||||
sps->surface.get_tile = a8_l8_get_tile;
|
sps->get_tile = a8_l8_get_tile;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PIPE_FORMAT_S_R16_G16_B16_A16:
|
case PIPE_FORMAT_S_R16_G16_B16_A16:
|
||||||
sps->surface.get_tile = r16g16b16a16_get_tile;
|
sps->get_tile = r16g16b16a16_get_tile;
|
||||||
sps->surface.put_tile = r16g16b16a16_put_tile;
|
sps->put_tile = r16g16b16a16_put_tile;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PIPE_FORMAT_U_Z16:
|
case PIPE_FORMAT_U_Z16:
|
||||||
sps->surface.get_tile = z16_get_tile;
|
sps->get_tile = z16_get_tile;
|
||||||
sps->surface.get_tile_raw = get_tile_raw16;
|
sps->get_tile_raw = get_tile_raw16;
|
||||||
sps->surface.put_tile_raw = put_tile_raw16;
|
sps->put_tile_raw = put_tile_raw16;
|
||||||
break;
|
break;
|
||||||
case PIPE_FORMAT_U_Z32:
|
case PIPE_FORMAT_U_Z32:
|
||||||
sps->surface.get_tile = z32_get_tile;
|
sps->get_tile = z32_get_tile;
|
||||||
sps->surface.get_tile_raw = get_tile_raw32;
|
sps->get_tile_raw = get_tile_raw32;
|
||||||
sps->surface.put_tile_raw = put_tile_raw32;
|
sps->put_tile_raw = put_tile_raw32;
|
||||||
break;
|
break;
|
||||||
case PIPE_FORMAT_S8_Z24:
|
case PIPE_FORMAT_S8_Z24:
|
||||||
sps->surface.get_tile = s8z24_get_tile;
|
sps->get_tile = s8z24_get_tile;
|
||||||
sps->surface.get_tile_raw = get_tile_raw32;
|
sps->get_tile_raw = get_tile_raw32;
|
||||||
sps->surface.put_tile_raw = put_tile_raw32;
|
sps->put_tile_raw = put_tile_raw32;
|
||||||
break;
|
break;
|
||||||
case PIPE_FORMAT_U_S8:
|
case PIPE_FORMAT_U_S8:
|
||||||
sps->surface.get_tile_raw = get_tile_raw8;
|
sps->get_tile_raw = get_tile_raw8;
|
||||||
sps->surface.put_tile_raw = put_tile_raw8;
|
sps->put_tile_raw = put_tile_raw8;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
@@ -739,8 +739,59 @@ softpipe_get_tex_surface(struct pipe_context *pipe,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_tile_generic(struct pipe_context *pipe,
|
||||||
|
struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h,
|
||||||
|
void *p, int dst_stride)
|
||||||
|
{
|
||||||
|
struct softpipe_surface *sps = softpipe_surface(ps);
|
||||||
|
sps->get_tile_raw(ps, x, y, w, h, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
put_tile_generic(struct pipe_context *pipe,
|
||||||
|
struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h,
|
||||||
|
const void *p, int src_stride)
|
||||||
|
{
|
||||||
|
struct softpipe_surface *sps = softpipe_surface(ps);
|
||||||
|
sps->put_tile_raw(ps, x, y, w, h, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_tile_rgba_generic(struct pipe_context *pipe,
|
||||||
|
struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h,
|
||||||
|
float *p)
|
||||||
|
{
|
||||||
|
struct softpipe_surface *sps = softpipe_surface(ps);
|
||||||
|
sps->get_tile(ps, x, y, w, h, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
put_tile_rgba_generic(struct pipe_context *pipe,
|
||||||
|
struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h,
|
||||||
|
const float *p)
|
||||||
|
{
|
||||||
|
struct softpipe_surface *sps = softpipe_surface(ps);
|
||||||
|
sps->put_tile(ps, x, y, w, h, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sp_init_surface_functions(struct softpipe_context *sp)
|
sp_init_surface_functions(struct softpipe_context *sp)
|
||||||
{
|
{
|
||||||
sp->pipe.surface_alloc = softpipe_surface_alloc;
|
sp->pipe.surface_alloc = softpipe_surface_alloc;
|
||||||
|
|
||||||
|
sp->pipe.get_tile = get_tile_generic;
|
||||||
|
sp->pipe.put_tile = put_tile_generic;
|
||||||
|
|
||||||
|
sp->pipe.get_tile_rgba = get_tile_rgba_generic;
|
||||||
|
sp->pipe.put_tile_rgba = put_tile_rgba_generic;
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,14 @@ struct softpipe_tile_cache;
|
|||||||
struct softpipe_surface {
|
struct softpipe_surface {
|
||||||
struct pipe_surface surface;
|
struct pipe_surface surface;
|
||||||
|
|
||||||
/* no softpipe-specific extras now */
|
void (*get_tile)(struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h, float *p);
|
||||||
|
void (*put_tile)(struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h, const float *p);
|
||||||
|
void (*get_tile_raw)(struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h, void *p);
|
||||||
|
void (*put_tile_raw)(struct pipe_surface *ps,
|
||||||
|
uint x, uint y, uint w, uint h, const void *p);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -153,8 +153,10 @@ sp_tile_cache_set_texture(struct softpipe_tile_cache *tc,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sp_flush_tile_cache(struct softpipe_tile_cache *tc)
|
sp_flush_tile_cache(struct softpipe_context *softpipe,
|
||||||
|
struct softpipe_tile_cache *tc)
|
||||||
{
|
{
|
||||||
|
struct pipe_context *pipe = &softpipe->pipe;
|
||||||
struct pipe_surface *ps = &tc->surface->surface;
|
struct pipe_surface *ps = &tc->surface->surface;
|
||||||
boolean is_depth_stencil;
|
boolean is_depth_stencil;
|
||||||
int inuse = 0, pos;
|
int inuse = 0, pos;
|
||||||
@@ -171,14 +173,14 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc)
|
|||||||
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 (is_depth_stencil) {
|
if (is_depth_stencil) {
|
||||||
ps->put_tile_raw(ps,
|
pipe->put_tile(pipe, ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
tile->data.depth32);
|
tile->data.depth32, 0/*STRIDE*/);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ps->put_tile(ps,
|
pipe->put_tile_rgba(pipe, 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
tile->x = tile->y = -1; /* mark as empty */
|
tile->x = tile->y = -1; /* mark as empty */
|
||||||
@@ -193,8 +195,10 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc)
|
|||||||
|
|
||||||
|
|
||||||
struct softpipe_cached_tile *
|
struct softpipe_cached_tile *
|
||||||
sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y)
|
sp_get_cached_tile(struct softpipe_context *softpipe,
|
||||||
|
struct softpipe_tile_cache *tc, int x, int y)
|
||||||
{
|
{
|
||||||
|
struct pipe_context *pipe = &softpipe->pipe;
|
||||||
struct pipe_surface *ps = &tc->surface->surface;
|
struct pipe_surface *ps = &tc->surface->surface;
|
||||||
boolean is_depth_stencil
|
boolean is_depth_stencil
|
||||||
= (ps->format == PIPE_FORMAT_S8_Z24 ||
|
= (ps->format == PIPE_FORMAT_S8_Z24 ||
|
||||||
@@ -216,14 +220,14 @@ sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y)
|
|||||||
if (tile->x != -1) {
|
if (tile->x != -1) {
|
||||||
/* put dirty tile back in framebuffer */
|
/* put dirty tile back in framebuffer */
|
||||||
if (is_depth_stencil) {
|
if (is_depth_stencil) {
|
||||||
ps->put_tile_raw(ps,
|
pipe->put_tile(pipe, ps,
|
||||||
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
tile->x, tile->y, TILE_SIZE, TILE_SIZE,
|
||||||
tile->data.depth32);
|
tile->data.depth32, 0 /*STRIDE*/);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ps->put_tile(ps,
|
pipe->put_tile_rgba(pipe, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,14 +293,14 @@ sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y)
|
|||||||
else {
|
else {
|
||||||
/* get new tile from framebuffer */
|
/* get new tile from framebuffer */
|
||||||
if (is_depth_stencil) {
|
if (is_depth_stencil) {
|
||||||
ps->get_tile_raw(ps,
|
pipe->get_tile(pipe, ps,
|
||||||
tile_x, tile_y, TILE_SIZE, TILE_SIZE,
|
tile_x, tile_y, TILE_SIZE, TILE_SIZE,
|
||||||
tile->data.depth32);
|
tile->data.depth32, 0/*STRIDE*/);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ps->get_tile(ps,
|
pipe->get_tile_rgba(pipe, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,9 +353,9 @@ sp_get_cached_tile_tex(struct pipe_context *pipe,
|
|||||||
struct pipe_surface *ps
|
struct pipe_surface *ps
|
||||||
= pipe->get_tex_surface(pipe, tc->texture, face, level, z);
|
= pipe->get_tex_surface(pipe, tc->texture, face, level, z);
|
||||||
|
|
||||||
ps->get_tile(ps,
|
pipe->get_tile_rgba(pipe, 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);
|
||||||
|
|
||||||
pipe_surface_reference(&ps, NULL);
|
pipe_surface_reference(&ps, NULL);
|
||||||
|
|
||||||
|
@@ -74,13 +74,15 @@ sp_tile_cache_set_texture(struct softpipe_tile_cache *tc,
|
|||||||
struct pipe_mipmap_tree *texture);
|
struct pipe_mipmap_tree *texture);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
sp_flush_tile_cache(struct softpipe_tile_cache *tc);
|
sp_flush_tile_cache(struct softpipe_context *softpipe,
|
||||||
|
struct softpipe_tile_cache *tc);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float value[4]);
|
sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float value[4]);
|
||||||
|
|
||||||
extern struct softpipe_cached_tile *
|
extern struct softpipe_cached_tile *
|
||||||
sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y);
|
sp_get_cached_tile(struct softpipe_context *softpipe,
|
||||||
|
struct softpipe_tile_cache *tc, int x, int y);
|
||||||
|
|
||||||
extern const struct softpipe_cached_tile *
|
extern const struct softpipe_cached_tile *
|
||||||
sp_get_cached_tile_tex(struct pipe_context *pipe,
|
sp_get_cached_tile_tex(struct pipe_context *pipe,
|
||||||
|
@@ -79,7 +79,7 @@ st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
|
|||||||
accBuf[i * 4 + 3] = a;
|
accBuf[i * 4 + 3] = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
acc_ps->put_tile(acc_ps, xpos, ypos, width, height, accBuf);
|
pipe->put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf);
|
||||||
|
|
||||||
free(accBuf);
|
free(accBuf);
|
||||||
|
|
||||||
@@ -101,13 +101,13 @@ accum_mad(struct pipe_context *pipe, GLfloat scale, GLfloat bias,
|
|||||||
|
|
||||||
(void) pipe->region_map(pipe, acc_ps->region);
|
(void) pipe->region_map(pipe, acc_ps->region);
|
||||||
|
|
||||||
acc_ps->get_tile(acc_ps, xpos, ypos, width, height, accBuf);
|
pipe->get_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf);
|
||||||
|
|
||||||
for (i = 0; i < 4 * width * height; i++) {
|
for (i = 0; i < 4 * width * height; i++) {
|
||||||
accBuf[i] = accBuf[i] * scale + bias;
|
accBuf[i] = accBuf[i] * scale + bias;
|
||||||
}
|
}
|
||||||
|
|
||||||
acc_ps->put_tile(acc_ps, xpos, ypos, width, height, accBuf);
|
pipe->put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf);
|
||||||
|
|
||||||
free(accBuf);
|
free(accBuf);
|
||||||
|
|
||||||
@@ -131,14 +131,14 @@ accum_accum(struct pipe_context *pipe, GLfloat value,
|
|||||||
colorMap = pipe->region_map(pipe, color_ps->region);
|
colorMap = pipe->region_map(pipe, color_ps->region);
|
||||||
accMap = pipe->region_map(pipe, acc_ps->region);
|
accMap = pipe->region_map(pipe, acc_ps->region);
|
||||||
|
|
||||||
color_ps->get_tile(color_ps, xpos, ypos, width, height, colorBuf);
|
pipe->get_tile_rgba(pipe, color_ps, xpos, ypos, width, height, colorBuf);
|
||||||
acc_ps->get_tile(acc_ps, xpos, ypos, width, height, accBuf);
|
pipe->get_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf);
|
||||||
|
|
||||||
for (i = 0; i < 4 * width * height; i++) {
|
for (i = 0; i < 4 * width * height; i++) {
|
||||||
accBuf[i] = accBuf[i] + colorBuf[i] * value;
|
accBuf[i] = accBuf[i] + colorBuf[i] * value;
|
||||||
}
|
}
|
||||||
|
|
||||||
acc_ps->put_tile(acc_ps, xpos, ypos, width, height, accBuf);
|
pipe->put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, accBuf);
|
||||||
|
|
||||||
free(colorBuf);
|
free(colorBuf);
|
||||||
free(accBuf);
|
free(accBuf);
|
||||||
@@ -162,13 +162,13 @@ accum_load(struct pipe_context *pipe, GLfloat value,
|
|||||||
(void) pipe->region_map(pipe, color_ps->region);
|
(void) pipe->region_map(pipe, color_ps->region);
|
||||||
(void) pipe->region_map(pipe, acc_ps->region);
|
(void) pipe->region_map(pipe, acc_ps->region);
|
||||||
|
|
||||||
color_ps->get_tile(color_ps, xpos, ypos, width, height, buf);
|
pipe->get_tile_rgba(pipe, color_ps, 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
acc_ps->put_tile(acc_ps, xpos, ypos, width, height, buf);
|
pipe->put_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, buf);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
@@ -193,11 +193,11 @@ accum_return(GLcontext *ctx, GLfloat value,
|
|||||||
(void) pipe->region_map(pipe, color_ps->region);
|
(void) pipe->region_map(pipe, color_ps->region);
|
||||||
(void) pipe->region_map(pipe, acc_ps->region);
|
(void) pipe->region_map(pipe, acc_ps->region);
|
||||||
|
|
||||||
acc_ps->get_tile(acc_ps, xpos, ypos, width, height, abuf);
|
pipe->get_tile_rgba(pipe, acc_ps, xpos, ypos, width, height, abuf);
|
||||||
|
|
||||||
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));
|
||||||
color_ps->get_tile(color_ps, xpos, ypos, width, height, cbuf);
|
pipe->get_tile_rgba(pipe, color_ps, xpos, ypos, width, height, cbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < width * height; i++) {
|
for (i = 0; i < width * height; i++) {
|
||||||
@@ -212,7 +212,7 @@ accum_return(GLcontext *ctx, GLfloat value,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
color_ps->put_tile(color_ps, xpos, ypos, width, height, abuf);
|
pipe->put_tile_rgba(pipe, color_ps, xpos, ypos, width, height, abuf);
|
||||||
|
|
||||||
free(abuf);
|
free(abuf);
|
||||||
if (cbuf)
|
if (cbuf)
|
||||||
|
@@ -1245,8 +1245,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||||||
(void) pipe->region_map(pipe, psRead->region);
|
(void) pipe->region_map(pipe, psRead->region);
|
||||||
(void) pipe->region_map(pipe, psTex->region);
|
(void) pipe->region_map(pipe, psTex->region);
|
||||||
|
|
||||||
psRead->get_tile(psRead, srcx, srcy, width, height, buf);
|
pipe->get_tile_rgba(pipe, psRead, srcx, srcy, width, height, buf);
|
||||||
psTex->put_tile(psTex, 0, 0, width, height, buf);
|
pipe->put_tile_rgba(pipe, psTex, 0, 0, width, height, buf);
|
||||||
|
|
||||||
pipe->region_unmap(pipe, psRead->region);
|
pipe->region_unmap(pipe, psRead->region);
|
||||||
pipe->region_unmap(pipe, psTex->region);
|
pipe->region_unmap(pipe, psTex->region);
|
||||||
|
@@ -204,7 +204,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
|
|
||||||
/* 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++) {
|
||||||
strb->surface->get_tile(strb->surface, x, y, width, 1, df);
|
pipe->get_tile_rgba(pipe, strb->surface, x, y, width, 1, df);
|
||||||
y += yStep;
|
y += yStep;
|
||||||
df += dfStride;
|
df += dfStride;
|
||||||
if (!dfStride) {
|
if (!dfStride) {
|
||||||
|
@@ -1100,7 +1100,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
|
|||||||
|
|
||||||
/* do copy row by row */
|
/* do copy row by row */
|
||||||
for (row = 0; row < height; row++) {
|
for (row = 0; row < height; row++) {
|
||||||
src_surf->get_tile(src_surf, srcX, srcY + row, width, 1, data);
|
pipe->get_tile_rgba(pipe, src_surf, srcX, srcY + row, width, 1, data);
|
||||||
|
|
||||||
/* XXX we're ignoring convolution for now */
|
/* XXX we're ignoring convolution for now */
|
||||||
if (ctx->_ImageTransferState) {
|
if (ctx->_ImageTransferState) {
|
||||||
@@ -1109,7 +1109,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
|
|||||||
width, (GLfloat (*)[4])data);
|
width, (GLfloat (*)[4])data);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest_surf->put_tile(dest_surf, destX, destY, width, 1, data);
|
pipe->put_tile_rgba(pipe, dest_surf, destX, destY, width, 1, data);
|
||||||
destY += yStep;
|
destY += yStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user