Mesa (softpipe-opt): softpipe: minor code refactoring to remove softpipe/ tile cache dependencies
Brian Paul
brianp at kemper.freedesktop.org
Fri Aug 21 20:08:31 UTC 2009
Module: Mesa
Branch: softpipe-opt
Commit: 3adc8c3779895c483ba8a1004939e7dd7d76fa9a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3adc8c3779895c483ba8a1004939e7dd7d76fa9a
Author: Brian Paul <brianp at vmware.com>
Date: Fri Aug 21 14:01:58 2009 -0600
softpipe: minor code refactoring to remove softpipe/tile cache dependencies
The tile cache code now has no hard dependencies on softpipe.
---
src/gallium/drivers/softpipe/sp_state_derived.c | 13 ++++++++++-
src/gallium/drivers/softpipe/sp_tile_cache.c | 26 ++++++++++------------
src/gallium/drivers/softpipe/sp_tile_cache.h | 1 -
3 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c
index 5310928..202a2bc 100644
--- a/src/gallium/drivers/softpipe/sp_state_derived.c
+++ b/src/gallium/drivers/softpipe/sp_state_derived.c
@@ -34,6 +34,8 @@
#include "sp_context.h"
#include "sp_screen.h"
#include "sp_state.h"
+#include "sp_texture.h"
+#include "sp_tile_cache.h"
/**
@@ -201,10 +203,19 @@ update_tgsi_samplers( struct softpipe_context *softpipe )
softpipe_reset_sampler_varients( softpipe );
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- sp_tile_cache_validate_texture( softpipe->tex_cache[i] );
+ struct softpipe_tile_cache *tc = softpipe->tex_cache[i];
+ if (tc->texture) {
+ struct softpipe_texture *spt = softpipe_texture(tc->texture);
+ if (spt->timestamp != tc->timestamp) {
+ sp_tile_cache_validate_texture( tc );
+ _debug_printf("INV %d %d\n", tc->timestamp, spt->timestamp);
+ tc->timestamp = spt->timestamp;
+ }
+ }
}
}
+
/* Hopefully this will remain quite simple, otherwise need to pull in
* something like the state tracker mechanism.
*/
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 77d02fa..e075ab6 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -35,9 +35,6 @@
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
#include "util/u_tile.h"
-#include "sp_context.h"
-#include "sp_surface.h"
-#include "sp_texture.h"
#include "sp_tile_cache.h"
@@ -200,24 +197,25 @@ sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc)
}
}
+
+/**
+ * Invalidate all cached tiles for the cached texture.
+ * Should be called when the texture is modified.
+ */
void
sp_tile_cache_validate_texture(struct softpipe_tile_cache *tc)
{
- if (tc->texture) {
- struct softpipe_texture *spt = softpipe_texture(tc->texture);
- if (spt->timestamp != tc->timestamp) {
- /* texture was modified, invalidate all cached tiles */
- uint i;
- _debug_printf("INV %d %d\n", tc->timestamp, spt->timestamp);
- for (i = 0; i < NUM_ENTRIES; i++) {
- tc->entries[i].addr.bits.invalid = 1;
- }
+ uint i;
- tc->timestamp = spt->timestamp;
- }
+ assert(tc);
+ assert(tc->texture);
+
+ for (i = 0; i < NUM_ENTRIES; i++) {
+ tc->entries[i].addr.bits.invalid = 1;
}
}
+
/**
* Specify the texture to cache.
*/
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h
index ac2aae5..1596cd0 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.h
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.h
@@ -34,7 +34,6 @@
#include "pipe/p_compiler.h"
-struct softpipe_context;
struct softpipe_tile_cache;
More information about the mesa-commit
mailing list