}
-static void softpipe_destroy( struct pipe_context *pipe )
+static void
+softpipe_destroy( struct pipe_context *pipe )
{
struct softpipe_context *softpipe = softpipe_context( pipe );
uint i;
FREE( softpipe );
}
+
+/**
+ * if (the texture is being used as a framebuffer surface)
+ * return PIPE_REFERENCED_FOR_WRITE
+ * else if (the texture is a bound texture source)
+ * return PIPE_REFERENCED_FOR_READ XXX not done yet
+ * else
+ * return PIPE_UNREFERENCED
+ */
static unsigned int
softpipe_is_texture_referenced( struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level)
{
+ struct softpipe_context *softpipe = softpipe_context( pipe );
+ unsigned i;
+
+ if (softpipe->dirty_render_cache) {
+ for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
+ if (softpipe->framebuffer.cbufs[i] &&
+ softpipe->framebuffer.cbufs[i]->texture == texture) {
+ return PIPE_REFERENCED_FOR_WRITE;
+ }
+ }
+ if (softpipe->framebuffer.zsbuf &&
+ softpipe->framebuffer.zsbuf->texture == texture) {
+ return PIPE_REFERENCED_FOR_WRITE;
+ }
+ }
+
+ /* FIXME: we also need to do the same for the texture cache */
+
return PIPE_UNREFERENCED;
}
+
static unsigned int
softpipe_is_buffer_referenced( struct pipe_context *pipe,
struct pipe_buffer *buf)
return PIPE_UNREFERENCED;
}
+
struct pipe_context *
-softpipe_create( struct pipe_screen *screen,
- struct pipe_winsys *pipe_winsys,
- void *unused )
+softpipe_create( struct pipe_screen *screen )
{
struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context);
uint i;
softpipe->dump_fs = debug_get_bool_option( "GALLIUM_DUMP_FS", FALSE );
- softpipe->pipe.winsys = pipe_winsys;
+ softpipe->pipe.winsys = screen->winsys;
softpipe->pipe.screen = screen;
softpipe->pipe.destroy = softpipe_destroy;
softpipe->pipe.is_buffer_referenced = softpipe_is_buffer_referenced;
softpipe_init_query_funcs( softpipe );
- softpipe_init_texture_funcs( softpipe );
/*
* Alloc caches for accessing drawing surfaces and textures.