From c1102f3dbf9d70242230fccc891d16b6e191b7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 4 Sep 2010 01:36:37 +0200 Subject: [PATCH] r300g: allow creating 0x0x0 textures but do not bind them This is fishy, I am hiding a state tracker bug. :( --- src/gallium/drivers/r300/r300_state.c | 8 +++++++- src/gallium/drivers/r300/r300_texture.c | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 8ccb639..d6ec736 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1312,7 +1312,7 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe, /* Calculate the real number of views. */ for (i = 0; i < count; i++) { - if (views[i]) + if (views[i] && views[i]->texture->width0) real_num_views++; } @@ -1325,6 +1325,12 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe, if (!views[i]) { continue; } + /* Skip zero-sized textures. */ + if (!views[i]->texture->width0) { + pipe_sampler_view_reference( + (struct pipe_sampler_view**)&state->sampler_views[i], + NULL); + } /* A new sampler view (= texture)... */ dirty_tex = TRUE; diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 66f6d80..7df93b4 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -767,7 +767,6 @@ struct pipe_resource *r300_texture_create(struct pipe_screen *screen, fprintf(stderr, "r300: texture_create: " "Got invalid texture dimensions: %ix%ix%i\n", base->width0, base->height0, base->depth0); - return NULL; } if ((base->flags & R300_RESOURCE_FLAG_TRANSFER) || -- 1.7.0.4