gallium: remove pipe_context->texture_create/release/get_tex_surface()
These functions are now per-screen, not per-context.
This commit is contained in:
@@ -362,6 +362,7 @@ static void
|
|||||||
aaline_create_texture(struct aaline_stage *aaline)
|
aaline_create_texture(struct aaline_stage *aaline)
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe = aaline->pipe;
|
struct pipe_context *pipe = aaline->pipe;
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
struct pipe_texture texTemp;
|
struct pipe_texture texTemp;
|
||||||
uint level;
|
uint level;
|
||||||
|
|
||||||
@@ -374,7 +375,7 @@ aaline_create_texture(struct aaline_stage *aaline)
|
|||||||
texTemp.depth[0] = 1;
|
texTemp.depth[0] = 1;
|
||||||
texTemp.cpp = 1;
|
texTemp.cpp = 1;
|
||||||
|
|
||||||
aaline->texture = pipe->texture_create(pipe, &texTemp);
|
aaline->texture = screen->texture_create(screen, &texTemp);
|
||||||
|
|
||||||
/* Fill in mipmap images.
|
/* Fill in mipmap images.
|
||||||
* Basically each level is solid opaque, except for the outermost
|
* Basically each level is solid opaque, except for the outermost
|
||||||
@@ -388,7 +389,7 @@ aaline_create_texture(struct aaline_stage *aaline)
|
|||||||
|
|
||||||
assert(aaline->texture->width[level] == aaline->texture->height[level]);
|
assert(aaline->texture->width[level] == aaline->texture->height[level]);
|
||||||
|
|
||||||
surface = pipe->get_tex_surface(pipe, aaline->texture, 0, level, 0);
|
surface = screen->get_tex_surface(screen, aaline->texture, 0, level, 0);
|
||||||
data = pipe_surface_map(surface);
|
data = pipe_surface_map(surface);
|
||||||
|
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
|
@@ -348,12 +348,13 @@ pstip_update_texture(struct pstip_stage *pstip)
|
|||||||
{
|
{
|
||||||
static const uint bit31 = 1 << 31;
|
static const uint bit31 = 1 << 31;
|
||||||
struct pipe_context *pipe = pstip->pipe;
|
struct pipe_context *pipe = pstip->pipe;
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
struct pipe_surface *surface;
|
struct pipe_surface *surface;
|
||||||
const uint *stipple = pstip->state.stipple->stipple;
|
const uint *stipple = pstip->state.stipple->stipple;
|
||||||
uint i, j;
|
uint i, j;
|
||||||
ubyte *data;
|
ubyte *data;
|
||||||
|
|
||||||
surface = pipe->get_tex_surface(pipe, pstip->texture, 0, 0, 0);
|
surface = screen->get_tex_surface(screen, pstip->texture, 0, 0, 0);
|
||||||
data = pipe_surface_map(surface);
|
data = pipe_surface_map(surface);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -389,6 +390,7 @@ static void
|
|||||||
pstip_create_texture(struct pstip_stage *pstip)
|
pstip_create_texture(struct pstip_stage *pstip)
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe = pstip->pipe;
|
struct pipe_context *pipe = pstip->pipe;
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
struct pipe_texture texTemp;
|
struct pipe_texture texTemp;
|
||||||
|
|
||||||
memset(&texTemp, 0, sizeof(texTemp));
|
memset(&texTemp, 0, sizeof(texTemp));
|
||||||
@@ -400,7 +402,7 @@ pstip_create_texture(struct pstip_stage *pstip)
|
|||||||
texTemp.depth[0] = 1;
|
texTemp.depth[0] = 1;
|
||||||
texTemp.cpp = 1;
|
texTemp.cpp = 1;
|
||||||
|
|
||||||
pstip->texture = pipe->texture_create(pipe, &texTemp);
|
pstip->texture = screen->texture_create(screen, &texTemp);
|
||||||
|
|
||||||
//pstip_update_texture(pstip);
|
//pstip_update_texture(pstip);
|
||||||
}
|
}
|
||||||
|
@@ -79,14 +79,6 @@ cell_texture_layout(struct cell_texture * spt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_texture *
|
|
||||||
cell_texture_create(struct pipe_context *pipe,
|
|
||||||
const struct pipe_texture *templat)
|
|
||||||
{
|
|
||||||
return pipe->screen->texture_create(pipe->screen, templat);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct pipe_texture *
|
static struct pipe_texture *
|
||||||
cell_texture_create_screen(struct pipe_screen *screen,
|
cell_texture_create_screen(struct pipe_screen *screen,
|
||||||
const struct pipe_texture *templat)
|
const struct pipe_texture *templat)
|
||||||
@@ -116,13 +108,6 @@ cell_texture_create_screen(struct pipe_screen *screen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
cell_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
|
|
||||||
{
|
|
||||||
return pipe->screen->texture_release(pipe->screen, pt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cell_texture_release_screen(struct pipe_screen *screen,
|
cell_texture_release_screen(struct pipe_screen *screen,
|
||||||
struct pipe_texture **pt)
|
struct pipe_texture **pt)
|
||||||
@@ -157,18 +142,6 @@ cell_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called via pipe->get_tex_surface()
|
|
||||||
*/
|
|
||||||
static struct pipe_surface *
|
|
||||||
cell_get_tex_surface(struct pipe_context *pipe,
|
|
||||||
struct pipe_texture *pt,
|
|
||||||
unsigned face, unsigned level, unsigned zslice)
|
|
||||||
{
|
|
||||||
return pipe->screen->get_tex_surface(pipe->screen, pt, face, level, zslice);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_surface *
|
static struct pipe_surface *
|
||||||
cell_get_tex_surface_screen(struct pipe_screen *screen,
|
cell_get_tex_surface_screen(struct pipe_screen *screen,
|
||||||
struct pipe_texture *pt,
|
struct pipe_texture *pt,
|
||||||
@@ -294,10 +267,7 @@ cell_update_texture_mapping(struct cell_context *cell)
|
|||||||
void
|
void
|
||||||
cell_init_texture_functions(struct cell_context *cell)
|
cell_init_texture_functions(struct cell_context *cell)
|
||||||
{
|
{
|
||||||
cell->pipe.texture_create = cell_texture_create;
|
|
||||||
cell->pipe.texture_release = cell_texture_release;
|
|
||||||
cell->pipe.texture_update = cell_texture_update;
|
cell->pipe.texture_update = cell_texture_update;
|
||||||
cell->pipe.get_tex_surface = cell_get_tex_surface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -143,10 +143,12 @@ struct pipe_context *failover_create( struct pipe_context *hw,
|
|||||||
failover->pipe.surface_copy = hw->surface_copy;
|
failover->pipe.surface_copy = hw->surface_copy;
|
||||||
failover->pipe.surface_fill = hw->surface_fill;
|
failover->pipe.surface_fill = hw->surface_fill;
|
||||||
|
|
||||||
|
#if 0
|
||||||
failover->pipe.texture_create = hw->texture_create;
|
failover->pipe.texture_create = hw->texture_create;
|
||||||
failover->pipe.texture_release = hw->texture_release;
|
failover->pipe.texture_release = hw->texture_release;
|
||||||
failover->pipe.texture_update = hw->texture_update;
|
|
||||||
failover->pipe.get_tex_surface = hw->get_tex_surface;
|
failover->pipe.get_tex_surface = hw->get_tex_surface;
|
||||||
|
#endif
|
||||||
|
failover->pipe.texture_update = hw->texture_update;
|
||||||
|
|
||||||
failover->pipe.flush = hw->flush;
|
failover->pipe.flush = hw->flush;
|
||||||
|
|
||||||
|
@@ -511,14 +511,6 @@ i915_texture_create_screen(struct pipe_screen *screen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_texture *
|
|
||||||
i915_texture_create(struct pipe_context *pipe,
|
|
||||||
const struct pipe_texture *templat)
|
|
||||||
{
|
|
||||||
return pipe->screen->texture_create(pipe->screen, templat);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i915_texture_release_screen(struct pipe_screen *screen,
|
i915_texture_release_screen(struct pipe_screen *screen,
|
||||||
struct pipe_texture **pt)
|
struct pipe_texture **pt)
|
||||||
@@ -550,13 +542,6 @@ i915_texture_release_screen(struct pipe_screen *screen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
i915_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
|
|
||||||
{
|
|
||||||
i915_texture_release_screen(pipe->screen, pt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i915_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
|
i915_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
|
||||||
{
|
{
|
||||||
@@ -606,26 +591,13 @@ i915_get_tex_surface_screen(struct pipe_screen *screen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_surface *
|
|
||||||
i915_get_tex_surface(struct pipe_context *pipe,
|
|
||||||
struct pipe_texture *pt,
|
|
||||||
unsigned face, unsigned level, unsigned zslice)
|
|
||||||
{
|
|
||||||
return i915_get_tex_surface_screen(pipe->screen, pt, face, level, zslice);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
i915_init_texture_functions(struct i915_context *i915)
|
i915_init_texture_functions(struct i915_context *i915)
|
||||||
{
|
{
|
||||||
i915->pipe.texture_create = i915_texture_create;
|
|
||||||
i915->pipe.texture_release = i915_texture_release;
|
|
||||||
i915->pipe.texture_update = i915_texture_update;
|
i915->pipe.texture_update = i915_texture_update;
|
||||||
i915->pipe.get_tex_surface = i915_get_tex_surface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
i915_init_screen_texture_functions(struct pipe_screen *screen)
|
i915_init_screen_texture_functions(struct pipe_screen *screen)
|
||||||
{
|
{
|
||||||
|
@@ -298,14 +298,6 @@ static boolean brw_miptree_layout(struct brw_texture *tex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_texture *
|
|
||||||
brw_texture_create(struct pipe_context *pipe,
|
|
||||||
const struct pipe_texture *templat)
|
|
||||||
{
|
|
||||||
return pipe->screen->texture_create(pipe->screen, templat);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_texture *
|
static struct pipe_texture *
|
||||||
brw_texture_create_screen(struct pipe_screen *screen,
|
brw_texture_create_screen(struct pipe_screen *screen,
|
||||||
const struct pipe_texture *templat)
|
const struct pipe_texture *templat)
|
||||||
@@ -333,13 +325,6 @@ brw_texture_create_screen(struct pipe_screen *screen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
brw_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
|
|
||||||
{
|
|
||||||
pipe->screen->texture_release(pipe->screen, pt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
brw_texture_release_screen(struct pipe_screen *screen,
|
brw_texture_release_screen(struct pipe_screen *screen,
|
||||||
struct pipe_texture **pt)
|
struct pipe_texture **pt)
|
||||||
@@ -379,18 +364,6 @@ brw_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* XXX note: same as code in sp_surface.c
|
|
||||||
*/
|
|
||||||
static struct pipe_surface *
|
|
||||||
brw_get_tex_surface(struct pipe_context *pipe,
|
|
||||||
struct pipe_texture *pt,
|
|
||||||
unsigned face, unsigned level, unsigned zslice)
|
|
||||||
{
|
|
||||||
return pipe->screen->get_tex_surface(pipe->screen, pt, face, level, zslice);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_surface *
|
static struct pipe_surface *
|
||||||
brw_get_tex_surface_screen(struct pipe_screen *screen,
|
brw_get_tex_surface_screen(struct pipe_screen *screen,
|
||||||
struct pipe_texture *pt,
|
struct pipe_texture *pt,
|
||||||
@@ -433,10 +406,7 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
|
|||||||
void
|
void
|
||||||
brw_init_texture_functions(struct brw_context *brw)
|
brw_init_texture_functions(struct brw_context *brw)
|
||||||
{
|
{
|
||||||
brw->pipe.texture_create = brw_texture_create;
|
|
||||||
brw->pipe.texture_release = brw_texture_release;
|
|
||||||
brw->pipe.texture_update = brw_texture_update;
|
brw->pipe.texture_update = brw_texture_update;
|
||||||
brw->pipe.get_tex_surface = brw_get_tex_surface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -80,15 +80,6 @@ softpipe_texture_layout(struct softpipe_texture * spt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* XXX temporary */
|
|
||||||
static struct pipe_texture *
|
|
||||||
softpipe_texture_create(struct pipe_context *pipe,
|
|
||||||
const struct pipe_texture *templat)
|
|
||||||
{
|
|
||||||
return pipe->screen->texture_create(pipe->screen, templat);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_texture *
|
static struct pipe_texture *
|
||||||
softpipe_texture_create_screen(struct pipe_screen *screen,
|
softpipe_texture_create_screen(struct pipe_screen *screen,
|
||||||
const struct pipe_texture *templat)
|
const struct pipe_texture *templat)
|
||||||
@@ -119,14 +110,6 @@ softpipe_texture_create_screen(struct pipe_screen *screen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* XXX temporary */
|
|
||||||
static void
|
|
||||||
softpipe_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
|
|
||||||
{
|
|
||||||
return pipe->screen->texture_release(pipe->screen, pt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
softpipe_texture_release_screen(struct pipe_screen *screen,
|
softpipe_texture_release_screen(struct pipe_screen *screen,
|
||||||
struct pipe_texture **pt)
|
struct pipe_texture **pt)
|
||||||
@@ -153,33 +136,6 @@ softpipe_texture_release_screen(struct pipe_screen *screen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
softpipe_texture_update(struct pipe_context *pipe,
|
|
||||||
struct pipe_texture *texture)
|
|
||||||
{
|
|
||||||
struct softpipe_context *softpipe = softpipe_context(pipe);
|
|
||||||
uint unit;
|
|
||||||
for (unit = 0; unit < PIPE_MAX_SAMPLERS; unit++) {
|
|
||||||
if (softpipe->texture[unit] == texture) {
|
|
||||||
sp_flush_tile_cache(softpipe, softpipe->tex_cache[unit]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called via pipe->get_tex_surface()
|
|
||||||
*/
|
|
||||||
/* XXX temporary */
|
|
||||||
static struct pipe_surface *
|
|
||||||
softpipe_get_tex_surface(struct pipe_context *pipe,
|
|
||||||
struct pipe_texture *pt,
|
|
||||||
unsigned face, unsigned level, unsigned zslice)
|
|
||||||
{
|
|
||||||
return pipe->screen->get_tex_surface(pipe->screen, pt, face, level, zslice);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct pipe_surface *
|
static struct pipe_surface *
|
||||||
softpipe_get_tex_surface_screen(struct pipe_screen *screen,
|
softpipe_get_tex_surface_screen(struct pipe_screen *screen,
|
||||||
struct pipe_texture *pt,
|
struct pipe_texture *pt,
|
||||||
@@ -217,14 +173,24 @@ softpipe_get_tex_surface_screen(struct pipe_screen *screen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
softpipe_texture_update(struct pipe_context *pipe,
|
||||||
|
struct pipe_texture *texture)
|
||||||
|
{
|
||||||
|
struct softpipe_context *softpipe = softpipe_context(pipe);
|
||||||
|
uint unit;
|
||||||
|
for (unit = 0; unit < PIPE_MAX_SAMPLERS; unit++) {
|
||||||
|
if (softpipe->texture[unit] == texture) {
|
||||||
|
sp_flush_tile_cache(softpipe, softpipe->tex_cache[unit]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
softpipe_init_texture_funcs( struct softpipe_context *softpipe )
|
softpipe_init_texture_funcs( struct softpipe_context *softpipe )
|
||||||
{
|
{
|
||||||
softpipe->pipe.texture_create = softpipe_texture_create;
|
|
||||||
softpipe->pipe.texture_release = softpipe_texture_release;
|
|
||||||
softpipe->pipe.texture_update = softpipe_texture_update;
|
softpipe->pipe.texture_update = softpipe_texture_update;
|
||||||
softpipe->pipe.get_tex_surface = softpipe_get_tex_surface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -489,6 +489,7 @@ sp_get_cached_tile_tex(struct pipe_context *pipe,
|
|||||||
struct softpipe_tile_cache *tc, int x, int y, int z,
|
struct softpipe_tile_cache *tc, int x, int y, int z,
|
||||||
int face, int level)
|
int face, int level)
|
||||||
{
|
{
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
/* tile pos in framebuffer: */
|
/* tile pos in framebuffer: */
|
||||||
const int tile_x = x & ~(TILE_SIZE - 1);
|
const int tile_x = x & ~(TILE_SIZE - 1);
|
||||||
const int tile_y = y & ~(TILE_SIZE - 1);
|
const int tile_y = y & ~(TILE_SIZE - 1);
|
||||||
@@ -514,7 +515,7 @@ sp_get_cached_tile_tex(struct pipe_context *pipe,
|
|||||||
if (tc->tex_surf_map)
|
if (tc->tex_surf_map)
|
||||||
pipe_surface_unmap(tc->tex_surf);
|
pipe_surface_unmap(tc->tex_surf);
|
||||||
|
|
||||||
tc->tex_surf = pipe->get_tex_surface(pipe, tc->texture, face, level, z);
|
tc->tex_surf = screen->get_tex_surface(screen, tc->texture, face, level, z);
|
||||||
tc->tex_surf_map = pipe_surface_map(tc->tex_surf);
|
tc->tex_surf_map = pipe_surface_map(tc->tex_surf);
|
||||||
|
|
||||||
tc->tex_face = face;
|
tc->tex_face = face;
|
||||||
|
@@ -189,30 +189,16 @@ struct pipe_context {
|
|||||||
struct pipe_surface *ps,
|
struct pipe_surface *ps,
|
||||||
unsigned clearValue);
|
unsigned clearValue);
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Texture functions
|
|
||||||
* XXX these are moving to pipe_screen...
|
|
||||||
*/
|
|
||||||
struct pipe_texture * (*texture_create)(struct pipe_context *pipe,
|
|
||||||
const struct pipe_texture *templat);
|
|
||||||
|
|
||||||
void (*texture_release)(struct pipe_context *pipe,
|
|
||||||
struct pipe_texture **pt);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when texture data is changed.
|
* Called when texture data is changed.
|
||||||
* Note: we could pass some hints about which mip levels or cube faces
|
* Note: we could pass some hints about which mip levels or cube faces
|
||||||
* have changed...
|
* have changed...
|
||||||
|
* XXX this may go away - could pass a 'write' flag to get_tex_surface()
|
||||||
*/
|
*/
|
||||||
void (*texture_update)(struct pipe_context *pipe,
|
void (*texture_update)(struct pipe_context *pipe,
|
||||||
struct pipe_texture *texture);
|
struct pipe_texture *texture);
|
||||||
|
|
||||||
/** Get a surface which is a "view" into a texture */
|
|
||||||
struct pipe_surface *(*get_tex_surface)(struct pipe_context *pipe,
|
|
||||||
struct pipe_texture *texture,
|
|
||||||
unsigned face, unsigned level,
|
|
||||||
unsigned zslice);
|
|
||||||
|
|
||||||
/* Flush rendering:
|
/* Flush rendering:
|
||||||
*/
|
*/
|
||||||
|
@@ -107,15 +107,9 @@ pipe_texture_reference(struct pipe_texture **ptr,
|
|||||||
pt->refcount++;
|
pt->refcount++;
|
||||||
|
|
||||||
if (*ptr) {
|
if (*ptr) {
|
||||||
struct pipe_context *pipe = (*ptr)->pipe;
|
struct pipe_screen *screen = (*ptr)->screen;
|
||||||
/* XXX temporary mess here */
|
assert(screen);
|
||||||
if (pipe) {
|
screen->texture_release(screen, ptr);
|
||||||
pipe->texture_release(pipe, ptr);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
struct pipe_screen *screen = (*ptr)->screen;
|
|
||||||
screen->texture_release(screen, ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(!*ptr);
|
assert(!*ptr);
|
||||||
}
|
}
|
||||||
@@ -127,10 +121,10 @@ pipe_texture_reference(struct pipe_texture **ptr,
|
|||||||
static INLINE void
|
static INLINE void
|
||||||
pipe_texture_release(struct pipe_texture **ptr)
|
pipe_texture_release(struct pipe_texture **ptr)
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe;
|
struct pipe_screen *screen;
|
||||||
assert(ptr);
|
assert(ptr);
|
||||||
pipe = (*ptr)->pipe;
|
screen = (*ptr)->screen;
|
||||||
pipe->texture_release(pipe, ptr);
|
screen->texture_release(screen, ptr);
|
||||||
*ptr = NULL;
|
*ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -456,6 +456,7 @@ make_texture(struct st_context *st,
|
|||||||
{
|
{
|
||||||
GLcontext *ctx = st->ctx;
|
GLcontext *ctx = st->ctx;
|
||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
const struct gl_texture_format *mformat;
|
const struct gl_texture_format *mformat;
|
||||||
struct pipe_texture *pt;
|
struct pipe_texture *pt;
|
||||||
enum pipe_format pipeFormat;
|
enum pipe_format pipeFormat;
|
||||||
@@ -493,7 +494,7 @@ make_texture(struct st_context *st,
|
|||||||
/* we'll do pixel transfer in a fragment shader */
|
/* we'll do pixel transfer in a fragment shader */
|
||||||
ctx->_ImageTransferState = 0x0;
|
ctx->_ImageTransferState = 0x0;
|
||||||
|
|
||||||
surface = pipe->get_tex_surface(pipe, pt, 0, 0, 0);
|
surface = screen->get_tex_surface(screen, pt, 0, 0, 0);
|
||||||
|
|
||||||
/* map texture surface */
|
/* map texture surface */
|
||||||
dest = pipe_surface_map(surface);
|
dest = pipe_surface_map(surface);
|
||||||
@@ -1031,7 +1032,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
|
|||||||
printf("st_Bitmap (sourcing from PBO not implemented yet)\n");
|
printf("st_Bitmap (sourcing from PBO not implemented yet)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
surface = pipe->get_tex_surface(pipe, pt, 0, 0, 0);
|
surface = screen->get_tex_surface(screen, pt, 0, 0, 0);
|
||||||
|
|
||||||
/* map texture surface */
|
/* map texture surface */
|
||||||
dest = pipe_surface_map(surface);
|
dest = pipe_surface_map(surface);
|
||||||
@@ -1207,6 +1208,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||||||
{
|
{
|
||||||
struct st_context *st = ctx->st;
|
struct st_context *st = ctx->st;
|
||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
struct st_renderbuffer *rbRead;
|
struct st_renderbuffer *rbRead;
|
||||||
struct st_vertex_program *stvp;
|
struct st_vertex_program *stvp;
|
||||||
struct st_fragment_program *stfp;
|
struct st_fragment_program *stfp;
|
||||||
@@ -1248,7 +1250,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||||||
if (!pt)
|
if (!pt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
psTex = pipe->get_tex_surface(pipe, pt, 0, 0, 0);
|
psTex = screen->get_tex_surface(screen, pt, 0, 0, 0);
|
||||||
|
|
||||||
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
|
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
|
||||||
srcy = ctx->DrawBuffer->Height - srcy - height;
|
srcy = ctx->DrawBuffer->Height - srcy - height;
|
||||||
|
@@ -307,6 +307,7 @@ st_render_texture(GLcontext *ctx,
|
|||||||
struct st_renderbuffer *strb;
|
struct st_renderbuffer *strb;
|
||||||
struct gl_renderbuffer *rb;
|
struct gl_renderbuffer *rb;
|
||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
struct pipe_texture *pt;
|
struct pipe_texture *pt;
|
||||||
|
|
||||||
assert(!att->Renderbuffer);
|
assert(!att->Renderbuffer);
|
||||||
@@ -332,10 +333,10 @@ st_render_texture(GLcontext *ctx,
|
|||||||
rb->Height = pt->height[att->TextureLevel];
|
rb->Height = pt->height[att->TextureLevel];
|
||||||
|
|
||||||
/* the renderbuffer's surface is inside the texture */
|
/* the renderbuffer's surface is inside the texture */
|
||||||
strb->surface = pipe->get_tex_surface(pipe, pt,
|
strb->surface = screen->get_tex_surface(screen, pt,
|
||||||
att->CubeMapFace,
|
att->CubeMapFace,
|
||||||
att->TextureLevel,
|
att->TextureLevel,
|
||||||
att->Zoffset);
|
att->Zoffset);
|
||||||
assert(strb->surface);
|
assert(strb->surface);
|
||||||
|
|
||||||
init_renderbuffer_bits(strb, pt->format);
|
init_renderbuffer_bits(strb, pt->format);
|
||||||
|
@@ -144,12 +144,11 @@ st_NewTextureObject(GLcontext * ctx, GLuint name, GLenum target)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
st_DeleteTextureObject(GLcontext *ctx,
|
st_DeleteTextureObject(GLcontext *ctx,
|
||||||
struct gl_texture_object *texObj)
|
struct gl_texture_object *texObj)
|
||||||
{
|
{
|
||||||
struct st_texture_object *stObj = st_texture_object(texObj);
|
struct st_texture_object *stObj = st_texture_object(texObj);
|
||||||
|
|
||||||
if (stObj->pt)
|
if (stObj->pt)
|
||||||
ctx->st->pipe->texture_release(ctx->st->pipe, &stObj->pt);
|
pipe_texture_release(&stObj->pt);
|
||||||
|
|
||||||
_mesa_delete_texture_object(ctx, texObj);
|
_mesa_delete_texture_object(ctx, texObj);
|
||||||
}
|
}
|
||||||
@@ -163,7 +162,7 @@ st_FreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage)
|
|||||||
DBG("%s\n", __FUNCTION__);
|
DBG("%s\n", __FUNCTION__);
|
||||||
|
|
||||||
if (stImage->pt) {
|
if (stImage->pt) {
|
||||||
ctx->st->pipe->texture_release(ctx->st->pipe, &stImage->pt);
|
pipe_texture_release(&stImage->pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texImage->Data) {
|
if (texImage->Data) {
|
||||||
@@ -537,7 +536,7 @@ st_TexImage(GLcontext * ctx,
|
|||||||
* Release any old malloced memory.
|
* Release any old malloced memory.
|
||||||
*/
|
*/
|
||||||
if (stImage->pt) {
|
if (stImage->pt) {
|
||||||
ctx->st->pipe->texture_release(ctx->st->pipe, &stImage->pt);
|
pipe_texture_release(&stImage->pt);
|
||||||
assert(!texImage->Data);
|
assert(!texImage->Data);
|
||||||
}
|
}
|
||||||
else if (texImage->Data) {
|
else if (texImage->Data) {
|
||||||
@@ -556,7 +555,7 @@ st_TexImage(GLcontext * ctx,
|
|||||||
stImage->face, stImage->level)) {
|
stImage->face, stImage->level)) {
|
||||||
|
|
||||||
DBG("release it\n");
|
DBG("release it\n");
|
||||||
ctx->st->pipe->texture_release(ctx->st->pipe, &stObj->pt);
|
pipe_texture_release(&stObj->pt);
|
||||||
assert(!stObj->pt);
|
assert(!stObj->pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1025,6 +1024,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
|
|||||||
GLsizei width, GLsizei height)
|
GLsizei width, GLsizei height)
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe = ctx->st->pipe;
|
struct pipe_context *pipe = ctx->st->pipe;
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
const uint face = texture_face(target);
|
const uint face = texture_face(target);
|
||||||
struct pipe_texture *pt = stImage->pt;
|
struct pipe_texture *pt = stImage->pt;
|
||||||
struct pipe_surface *src_surf, *dest_surf;
|
struct pipe_surface *src_surf, *dest_surf;
|
||||||
@@ -1042,8 +1042,7 @@ fallback_copy_texsubimage(GLcontext *ctx,
|
|||||||
|
|
||||||
src_surf = strb->surface;
|
src_surf = strb->surface;
|
||||||
|
|
||||||
dest_surf = pipe->get_tex_surface(pipe, pt,
|
dest_surf = screen->get_tex_surface(screen, pt, face, level, destZ);
|
||||||
face, level, destZ);
|
|
||||||
|
|
||||||
/* buffer for one row */
|
/* buffer for one row */
|
||||||
data = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
|
data = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
|
||||||
@@ -1096,6 +1095,7 @@ do_copy_texsubimage(GLcontext *ctx,
|
|||||||
struct gl_framebuffer *fb = ctx->ReadBuffer;
|
struct gl_framebuffer *fb = ctx->ReadBuffer;
|
||||||
struct st_renderbuffer *strb;
|
struct st_renderbuffer *strb;
|
||||||
struct pipe_context *pipe = ctx->st->pipe;
|
struct pipe_context *pipe = ctx->st->pipe;
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
struct pipe_surface *dest_surface;
|
struct pipe_surface *dest_surface;
|
||||||
uint dest_format, src_format;
|
uint dest_format, src_format;
|
||||||
uint do_flip = FALSE;
|
uint do_flip = FALSE;
|
||||||
@@ -1126,8 +1126,8 @@ do_copy_texsubimage(GLcontext *ctx,
|
|||||||
src_format = strb->surface->format;
|
src_format = strb->surface->format;
|
||||||
dest_format = stImage->pt->format;
|
dest_format = stImage->pt->format;
|
||||||
|
|
||||||
dest_surface = pipe->get_tex_surface(pipe, stImage->pt, stImage->face,
|
dest_surface = screen->get_tex_surface(screen, stImage->pt, stImage->face,
|
||||||
stImage->level, destZ);
|
stImage->level, destZ);
|
||||||
|
|
||||||
if (src_format == dest_format &&
|
if (src_format == dest_format &&
|
||||||
ctx->_ImageTransferState == 0x0 &&
|
ctx->_ImageTransferState == 0x0 &&
|
||||||
@@ -1352,7 +1352,7 @@ copy_image_data_to_texture(struct st_context *st,
|
|||||||
stImage->face
|
stImage->face
|
||||||
);
|
);
|
||||||
|
|
||||||
st->pipe->texture_release(st->pipe, &stImage->pt);
|
pipe_texture_release(&stImage->pt);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(stImage->base.Data != NULL);
|
assert(stImage->base.Data != NULL);
|
||||||
@@ -1408,7 +1408,7 @@ st_finalize_texture(GLcontext *ctx,
|
|||||||
*/
|
*/
|
||||||
if (firstImage->base.Border) {
|
if (firstImage->base.Border) {
|
||||||
if (stObj->pt) {
|
if (stObj->pt) {
|
||||||
ctx->st->pipe->texture_release(ctx->st->pipe, &stObj->pt);
|
pipe_texture_release(&stObj->pt);
|
||||||
}
|
}
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -1424,7 +1424,7 @@ st_finalize_texture(GLcontext *ctx,
|
|||||||
firstImage->pt->last_level >= stObj->lastLevel) {
|
firstImage->pt->last_level >= stObj->lastLevel) {
|
||||||
|
|
||||||
if (stObj->pt)
|
if (stObj->pt)
|
||||||
ctx->st->pipe->texture_release(ctx->st->pipe, &stObj->pt);
|
pipe_texture_release(&stObj->pt);
|
||||||
|
|
||||||
pipe_texture_reference(&stObj->pt, firstImage->pt);
|
pipe_texture_reference(&stObj->pt, firstImage->pt);
|
||||||
}
|
}
|
||||||
@@ -1450,7 +1450,7 @@ st_finalize_texture(GLcontext *ctx,
|
|||||||
stObj->pt->depth[0] != firstImage->base.Depth ||
|
stObj->pt->depth[0] != firstImage->base.Depth ||
|
||||||
stObj->pt->cpp != cpp ||
|
stObj->pt->cpp != cpp ||
|
||||||
stObj->pt->compressed != firstImage->base.IsCompressed)) {
|
stObj->pt->compressed != firstImage->base.IsCompressed)) {
|
||||||
ctx->st->pipe->texture_release(ctx->st->pipe, &stObj->pt);
|
pipe_texture_release(&stObj->pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -276,7 +276,7 @@ st_render_mipmap(struct st_context *st,
|
|||||||
/*
|
/*
|
||||||
* Setup framebuffer / dest surface
|
* Setup framebuffer / dest surface
|
||||||
*/
|
*/
|
||||||
fb.cbufs[0] = pipe->get_tex_surface(pipe, pt, face, dstLevel, zslice);
|
fb.cbufs[0] = screen->get_tex_surface(screen, pt, face, dstLevel, zslice);
|
||||||
pipe->set_framebuffer_state(pipe, &fb);
|
pipe->set_framebuffer_state(pipe, &fb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -325,6 +325,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||||||
struct gl_texture_object *texObj)
|
struct gl_texture_object *texObj)
|
||||||
{
|
{
|
||||||
struct pipe_context *pipe = ctx->st->pipe;
|
struct pipe_context *pipe = ctx->st->pipe;
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
struct pipe_winsys *ws = pipe->winsys;
|
struct pipe_winsys *ws = pipe->winsys;
|
||||||
struct pipe_texture *pt = st_get_texobj_texture(texObj);
|
struct pipe_texture *pt = st_get_texobj_texture(texObj);
|
||||||
const uint baseLevel = texObj->BaseLevel;
|
const uint baseLevel = texObj->BaseLevel;
|
||||||
@@ -345,8 +346,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||||||
const ubyte *srcData;
|
const ubyte *srcData;
|
||||||
ubyte *dstData;
|
ubyte *dstData;
|
||||||
|
|
||||||
srcSurf = pipe->get_tex_surface(pipe, pt, face, srcLevel, zslice);
|
srcSurf = screen->get_tex_surface(screen, pt, face, srcLevel, zslice);
|
||||||
dstSurf = pipe->get_tex_surface(pipe, pt, face, dstLevel, zslice);
|
dstSurf = screen->get_tex_surface(screen, pt, face, dstLevel, zslice);
|
||||||
|
|
||||||
srcData = (ubyte *) ws->buffer_map(ws, srcSurf->buffer,
|
srcData = (ubyte *) ws->buffer_map(ws, srcSurf->buffer,
|
||||||
PIPE_BUFFER_USAGE_CPU_READ)
|
PIPE_BUFFER_USAGE_CPU_READ)
|
||||||
|
@@ -77,6 +77,7 @@ st_texture_create(struct st_context *st,
|
|||||||
GLuint compress_byte)
|
GLuint compress_byte)
|
||||||
{
|
{
|
||||||
struct pipe_texture pt, *newtex;
|
struct pipe_texture pt, *newtex;
|
||||||
|
struct pipe_screen *screen = st->pipe->screen;
|
||||||
|
|
||||||
assert(target <= PIPE_TEXTURE_CUBE);
|
assert(target <= PIPE_TEXTURE_CUBE);
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ st_texture_create(struct st_context *st,
|
|||||||
pt.compressed = compress_byte ? 1 : 0;
|
pt.compressed = compress_byte ? 1 : 0;
|
||||||
pt.cpp = pt.compressed ? compress_byte : st_sizeof_format(format);
|
pt.cpp = pt.compressed ? compress_byte : st_sizeof_format(format);
|
||||||
|
|
||||||
newtex = st->pipe->texture_create(st->pipe, &pt);
|
newtex = screen->texture_create(screen, &pt);
|
||||||
|
|
||||||
assert(!newtex || newtex->refcount == 1);
|
assert(!newtex || newtex->refcount == 1);
|
||||||
|
|
||||||
@@ -183,11 +184,12 @@ GLubyte *
|
|||||||
st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
|
st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
|
||||||
GLuint zoffset)
|
GLuint zoffset)
|
||||||
{
|
{
|
||||||
|
struct pipe_screen *screen = st->pipe->screen;
|
||||||
struct pipe_texture *pt = stImage->pt;
|
struct pipe_texture *pt = stImage->pt;
|
||||||
DBG("%s \n", __FUNCTION__);
|
DBG("%s \n", __FUNCTION__);
|
||||||
|
|
||||||
stImage->surface = st->pipe->get_tex_surface(st->pipe, pt, stImage->face,
|
stImage->surface = screen->get_tex_surface(screen, pt, stImage->face,
|
||||||
stImage->level, zoffset);
|
stImage->level, zoffset);
|
||||||
|
|
||||||
return pipe_surface_map(stImage->surface);
|
return pipe_surface_map(stImage->surface);
|
||||||
}
|
}
|
||||||
@@ -239,6 +241,7 @@ st_texture_image_data(struct pipe_context *pipe,
|
|||||||
void *src,
|
void *src,
|
||||||
GLuint src_row_pitch, GLuint src_image_pitch)
|
GLuint src_row_pitch, GLuint src_image_pitch)
|
||||||
{
|
{
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
GLuint depth = dst->depth[level];
|
GLuint depth = dst->depth[level];
|
||||||
GLuint i;
|
GLuint i;
|
||||||
GLuint height = 0;
|
GLuint height = 0;
|
||||||
@@ -251,7 +254,7 @@ st_texture_image_data(struct pipe_context *pipe,
|
|||||||
if(dst->compressed)
|
if(dst->compressed)
|
||||||
height /= 4;
|
height /= 4;
|
||||||
|
|
||||||
dst_surface = pipe->get_tex_surface(pipe, dst, face, level, i);
|
dst_surface = screen->get_tex_surface(screen, dst, face, level, i);
|
||||||
|
|
||||||
st_surface_data(pipe, dst_surface,
|
st_surface_data(pipe, dst_surface,
|
||||||
0, 0, /* dstx, dsty */
|
0, 0, /* dstx, dsty */
|
||||||
@@ -275,6 +278,7 @@ st_texture_image_copy(struct pipe_context *pipe,
|
|||||||
struct pipe_texture *src,
|
struct pipe_texture *src,
|
||||||
GLuint face)
|
GLuint face)
|
||||||
{
|
{
|
||||||
|
struct pipe_screen *screen = pipe->screen;
|
||||||
GLuint width = dst->width[dstLevel];
|
GLuint width = dst->width[dstLevel];
|
||||||
GLuint height = dst->height[dstLevel];
|
GLuint height = dst->height[dstLevel];
|
||||||
GLuint depth = dst->depth[dstLevel];
|
GLuint depth = dst->depth[dstLevel];
|
||||||
@@ -299,8 +303,8 @@ st_texture_image_copy(struct pipe_context *pipe,
|
|||||||
assert(src->width[srcLevel] == width);
|
assert(src->width[srcLevel] == width);
|
||||||
assert(src->height[srcLevel] == height);
|
assert(src->height[srcLevel] == height);
|
||||||
|
|
||||||
dst_surface = pipe->get_tex_surface(pipe, dst, face, dstLevel, i);
|
dst_surface = screen->get_tex_surface(screen, dst, face, dstLevel, i);
|
||||||
src_surface = pipe->get_tex_surface(pipe, src, face, srcLevel, i);
|
src_surface = screen->get_tex_surface(screen, src, face, srcLevel, i);
|
||||||
|
|
||||||
pipe->surface_copy(pipe,
|
pipe->surface_copy(pipe,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
Reference in New Issue
Block a user