summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r600/r600_texture.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-09-01 14:56:04 +1000
committerDave Airlie <airlied@redhat.com>2010-09-01 14:56:04 +1000
commit1fa7245c348cb7aced81f1672140f64cb6450e2f (patch)
treeb053fbdcd99b786eebcfe40f0f3e22d62c403c56 /src/gallium/drivers/r600/r600_texture.c
parentd7e2509692d3aa8afb8d2236a4f28b6ab502ec62 (diff)
Revert "r600g: precompute some of the hw state"
This reverts commit de0b76cab22caa9fc7260f80acb8f151ccced6c5, its pre-computes the texture state wrong, you can't just use an array of levels, since you can have FBOs to depth texture slices inside a level as well it would get really messy quickly. Probably need to split commits like this up into pieces for each piece of state, so we can revert bits easier in case of regressions. This also break 5 piglit tests, and valgrind starts to warn about invalid read/writes after this.
Diffstat (limited to 'src/gallium/drivers/r600/r600_texture.c')
-rw-r--r--src/gallium/drivers/r600/r600_texture.c43
1 files changed, 14 insertions, 29 deletions
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index ec1d50566a..77d627cdc8 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -128,25 +128,13 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
return &resource->base.b;
}
-static void r600_texture_destroy_state(struct pipe_resource *ptexture)
-{
- struct r600_resource_texture *rtexture = (struct r600_resource_texture*)ptexture;
-
- for (int i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) {
- radeon_state_decref(rtexture->scissor[i]);
- radeon_state_decref(rtexture->db[i]);
- for (int j = 0; j < 8; j++) {
- radeon_state_decref(rtexture->cb[j][i]);
- }
- }
-}
-
static void r600_texture_destroy(struct pipe_screen *screen,
struct pipe_resource *ptex)
{
struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex;
struct r600_resource *resource = &rtex->resource;
struct r600_screen *rscreen = r600_screen(screen);
+ unsigned i;
if (resource->bo) {
radeon_bo_decref(rscreen->rw, resource->bo);
@@ -154,7 +142,11 @@ static void r600_texture_destroy(struct pipe_screen *screen,
if (rtex->uncompressed) {
radeon_bo_decref(rscreen->rw, rtex->uncompressed);
}
- r600_texture_destroy_state(ptex);
+ for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) {
+ radeon_state_decref(rtex->scissor[i]);
+ radeon_state_decref(rtex->cb0[i]);
+ radeon_state_decref(rtex->db[i]);
+ }
FREE(rtex);
}
@@ -219,12 +211,9 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
pipe_reference_init(&resource->base.b.reference, 1);
resource->base.b.screen = screen;
resource->bo = bo;
- rtex->depth = 0;
rtex->pitch_override = whandle->stride;
rtex->bpt = util_format_get_blocksize(templ->format);
rtex->pitch[0] = whandle->stride;
- rtex->width[0] = templ->width0;
- rtex->height[0] = templ->height0;
rtex->offset[0] = 0;
rtex->size = align(rtex->pitch[0] * templ->height0, 64);
@@ -707,9 +696,9 @@ static struct radeon_state *r600_texture_state_scissor(struct r600_screen *rscre
return rstate;
}
-static struct radeon_state *r600_texture_state_cb(struct r600_screen *rscreen,
+static struct radeon_state *r600_texture_state_cb0(struct r600_screen *rscreen,
struct r600_resource_texture *rtexture,
- unsigned cb, unsigned level)
+ unsigned level)
{
struct radeon_state *rstate;
struct r600_resource *rbuffer;
@@ -718,7 +707,7 @@ static struct radeon_state *r600_texture_state_cb(struct r600_screen *rscreen,
unsigned format, swap, ntype;
const struct util_format_description *desc;
- rstate = radeon_state(rscreen->rw, R600_STATE_CB0 + cb, 0);
+ rstate = radeon_state(rscreen->rw, R600_STATE_CB0, 0);
if (rstate == NULL)
return NULL;
rbuffer = &rtexture->resource;
@@ -781,10 +770,6 @@ static struct radeon_state *r600_texture_state_db(struct r600_screen *rscreen,
if (rstate == NULL)
return NULL;
rbuffer = &rtexture->resource;
- rtexture->tilled = 1;
- rtexture->array_mode = 2;
- rtexture->tile_type = 1;
- rtexture->depth = 1;
/* set states (most default value are 0 and struct already
* initialized to 0, thus avoid resetting them)
@@ -853,14 +838,14 @@ static struct radeon_state *r600_texture_state_viewport(struct r600_screen *rscr
return rstate;
}
-int r600_texture_cb(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned cb, unsigned level)
+int r600_texture_cb0(struct pipe_context *ctx, struct r600_resource_texture *rtexture, unsigned level)
{
struct r600_screen *rscreen = r600_screen(ctx->screen);
- if (rtexture->cb[cb][level] == NULL) {
- rtexture->cb[cb][level] = r600_texture_state_cb(rscreen, rtexture, cb, level);
- if (rtexture->cb[cb][level] == NULL) {
- R600_ERR("failed to create cb%d state for texture\n", cb);
+ if (rtexture->cb0[level] == NULL) {
+ rtexture->cb0[level] = r600_texture_state_cb0(rscreen, rtexture, level);
+ if (rtexture->cb0[level] == NULL) {
+ R600_ERR("failed to create cb0 state for texture\n");
return -ENOMEM;
}
}