summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_tile_cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_tile_cache.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 83fb4e0d15..112a6fe0cf 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -33,6 +33,7 @@
*/
#include "pipe/p_inlines.h"
+#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_tile.h"
#include "sp_tile_cache.h"
@@ -97,7 +98,12 @@ sp_create_tile_cache( struct pipe_screen *screen )
}
tc->last_tile = &tc->entries[0]; /* any tile */
-#if TILE_CLEAR_OPTIMIZATION
+ /* XXX this code prevents valgrind warnings about use of uninitialized
+ * memory in programs that don't clear the surface before rendering.
+ * However, it breaks clearing in other situations (such as in
+ * progs/tests/drawbuffers, see bug 24402).
+ */
+#if 0 && TILE_CLEAR_OPTIMIZATION
/* set flags to indicate all the tiles are cleared */
memset(tc->clear_flags, 255, sizeof(tc->clear_flags));
#endif
@@ -233,7 +239,7 @@ clear_tile(struct softpipe_cached_tile *tile,
{
uint i, j;
- switch (pf_get_size(format)) {
+ switch (util_format_get_blocksize(format)) {
case 1:
memset(tile->data.any, clear_value, TILE_SIZE * TILE_SIZE);
break;
@@ -279,8 +285,9 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc)
uint x, y;
uint numCleared = 0;
+ assert(pt->texture);
/* clear the scratch tile to the clear value */
- clear_tile(&tc->tile, pt->format, tc->clear_val);
+ clear_tile(&tc->tile, pt->texture->format, tc->clear_val);
/* push the tile to all positions marked as clear */
for (y = 0; y < h; y += TILE_SIZE) {
@@ -367,6 +374,7 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc,
if (addr.value != tile->addr.value) {
+ assert(pt->texture);
if (tile->addr.bits.invalid == 0) {
/* put dirty tile back in framebuffer */
if (tc->depth_stencil) {
@@ -390,10 +398,10 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc,
if (is_clear_flag_set(tc->clear_flags, addr)) {
/* don't get tile from framebuffer, just clear it */
if (tc->depth_stencil) {
- clear_tile(tile, pt->format, tc->clear_val);
+ clear_tile(tile, pt->texture->format, tc->clear_val);
}
else {
- clear_tile_rgba(tile, pt->format, tc->clear_color);
+ clear_tile_rgba(tile, pt->texture->format, tc->clear_color);
}
clear_clear_flag(tc->clear_flags, addr);
}