diff options
author | Christian König <[email protected]> | 2011-03-19 01:02:40 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2011-03-19 01:02:40 +0100 |
commit | 2bf95c519e755146704f4942b1703d47d18bfeaa (patch) | |
tree | 9d29c5d56014377013770615611f903cd5b25292 /src/gallium/drivers/softpipe | |
parent | f36846c77ee196881c0da560229279fc7ed88170 (diff) | |
parent | 8042d751debb7a8375e8bc587189fea9a5a8371d (diff) |
Merge remote branch 'origin/master' into pipe-video
Conflicts:
src/gallium/drivers/r600/r600_asm.c
src/gallium/tests/unit/SConscript
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.c | 26 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.h | 9 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_fence.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_flush.c | 80 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_flush.h | 9 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_screen.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_tex_sample.c | 54 |
7 files changed, 107 insertions, 90 deletions
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 70fdfb7ddf3..ce22f646228 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -148,13 +148,13 @@ softpipe_destroy( struct pipe_context *pipe ) /** * if (the texture is being used as a framebuffer surface) - * return PIPE_REFERENCED_FOR_WRITE + * return SP_REFERENCED_FOR_WRITE * else if (the texture is a bound texture source) - * return PIPE_REFERENCED_FOR_READ + * return SP_REFERENCED_FOR_READ * else - * return PIPE_UNREFERENCED + * return SP_UNREFERENCED */ -static unsigned int +unsigned int softpipe_is_resource_referenced( struct pipe_context *pipe, struct pipe_resource *texture, unsigned level, int layer) @@ -163,19 +163,19 @@ softpipe_is_resource_referenced( struct pipe_context *pipe, unsigned i; if (texture->target == PIPE_BUFFER) - return PIPE_UNREFERENCED; + return SP_UNREFERENCED; /* check if any of the bound drawing surfaces are this texture */ 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; + return SP_REFERENCED_FOR_WRITE; } } if (softpipe->framebuffer.zsbuf && softpipe->framebuffer.zsbuf->texture == texture) { - return PIPE_REFERENCED_FOR_WRITE; + return SP_REFERENCED_FOR_WRITE; } } @@ -183,20 +183,20 @@ softpipe_is_resource_referenced( struct pipe_context *pipe, for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { if (softpipe->fragment_tex_cache[i] && softpipe->fragment_tex_cache[i]->texture == texture) - return PIPE_REFERENCED_FOR_READ; + return SP_REFERENCED_FOR_READ; } for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { if (softpipe->vertex_tex_cache[i] && softpipe->vertex_tex_cache[i]->texture == texture) - return PIPE_REFERENCED_FOR_READ; + return SP_REFERENCED_FOR_READ; } for (i = 0; i < PIPE_MAX_GEOMETRY_SAMPLERS; i++) { if (softpipe->geometry_tex_cache[i] && softpipe->geometry_tex_cache[i]->texture == texture) - return PIPE_REFERENCED_FOR_READ; + return SP_REFERENCED_FOR_READ; } - return PIPE_UNREFERENCED; + return SP_UNREFERENCED; } @@ -255,9 +255,7 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.draw_stream_output = softpipe_draw_stream_output; softpipe->pipe.clear = softpipe_clear; - softpipe->pipe.flush = softpipe_flush; - - softpipe->pipe.is_resource_referenced = softpipe_is_resource_referenced; + softpipe->pipe.flush = softpipe_flush_wrapped; softpipe->pipe.render_condition = softpipe_render_condition; diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index c91709aef06..a572ee8cf00 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -198,4 +198,13 @@ struct pipe_context * softpipe_create_context( struct pipe_screen *, void *priv ); +#define SP_UNREFERENCED 0 +#define SP_REFERENCED_FOR_READ (1 << 0) +#define SP_REFERENCED_FOR_WRITE (1 << 1) + +unsigned int +softpipe_is_resource_referenced( struct pipe_context *pipe, + struct pipe_resource *texture, + unsigned level, int layer); + #endif /* SP_CONTEXT_H */ diff --git a/src/gallium/drivers/softpipe/sp_fence.c b/src/gallium/drivers/softpipe/sp_fence.c index 66c52141132..7b79a0df4ea 100644 --- a/src/gallium/drivers/softpipe/sp_fence.c +++ b/src/gallium/drivers/softpipe/sp_fence.c @@ -41,23 +41,22 @@ softpipe_fence_reference(struct pipe_screen *screen, } -static int +static boolean softpipe_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags) + struct pipe_fence_handle *fence) { assert(!fence); - return 0; + return TRUE; } -static int +static boolean softpipe_fence_finish(struct pipe_screen *screen, struct pipe_fence_handle *fence, - unsigned flags) + uint64_t timeout) { assert(!fence); - return 0; + return TRUE; } diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index 6f7addd441a..720fea83cb2 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -42,7 +42,7 @@ void softpipe_flush( struct pipe_context *pipe, - unsigned flags, + unsigned flags, struct pipe_fence_handle **fence ) { struct softpipe_context *softpipe = softpipe_context(pipe); @@ -50,7 +50,7 @@ softpipe_flush( struct pipe_context *pipe, draw_flush(softpipe->draw); - if (flags & PIPE_FLUSH_TEXTURE_CACHE) { + if (flags & SP_FLUSH_TEXTURE_CACHE) { for (i = 0; i < softpipe->num_fragment_sampler_views; i++) { sp_flush_tex_tile_cache(softpipe->fragment_tex_cache[i]); } @@ -62,34 +62,27 @@ softpipe_flush( struct pipe_context *pipe, } } - if (flags & PIPE_FLUSH_SWAPBUFFERS) { - /* If this is a swapbuffers, just flush color buffers. - * - * The zbuffer changes are not discarded, but held in the cache - * in the hope that a later clear will wipe them out. - */ - for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) - if (softpipe->cbuf_cache[i]) - sp_flush_tile_cache(softpipe->cbuf_cache[i]); - - /* Need this call for hardware buffers before swapbuffers. - * - * there should probably be another/different flush-type function - * that's called before swapbuffers because we don't always want - * to unmap surfaces when flushing. - */ - softpipe_unmap_transfers(softpipe); - } - else if (flags & PIPE_FLUSH_RENDER_CACHE) { - for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) - if (softpipe->cbuf_cache[i]) - sp_flush_tile_cache(softpipe->cbuf_cache[i]); - - if (softpipe->zsbuf_cache) - sp_flush_tile_cache(softpipe->zsbuf_cache); - - softpipe->dirty_render_cache = FALSE; - } + /* If this is a swapbuffers, just flush color buffers. + * + * The zbuffer changes are not discarded, but held in the cache + * in the hope that a later clear will wipe them out. + */ + for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) + if (softpipe->cbuf_cache[i]) + sp_flush_tile_cache(softpipe->cbuf_cache[i]); + + if (softpipe->zsbuf_cache) + sp_flush_tile_cache(softpipe->zsbuf_cache); + + softpipe->dirty_render_cache = FALSE; + + /* Need this call for hardware buffers before swapbuffers. + * + * there should probably be another/different flush-type function + * that's called before swapbuffers because we don't always want + * to unmap surfaces when flushing. + */ + softpipe_unmap_transfers(softpipe); /* Enable to dump BMPs of the color/depth buffers each frame */ #if 0 @@ -108,6 +101,13 @@ softpipe_flush( struct pipe_context *pipe, *fence = NULL; } +void +softpipe_flush_wrapped( struct pipe_context *pipe, + struct pipe_fence_handle **fence ) +{ + softpipe_flush(pipe, SP_FLUSH_TEXTURE_CACHE, fence); +} + /** * Flush context if necessary. @@ -129,21 +129,18 @@ softpipe_flush_resource(struct pipe_context *pipe, { unsigned referenced; - referenced = pipe->is_resource_referenced(pipe, texture, level, layer); + referenced = softpipe_is_resource_referenced(pipe, texture, level, layer); - if ((referenced & PIPE_REFERENCED_FOR_WRITE) || - ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) { + if ((referenced & SP_REFERENCED_FOR_WRITE) || + ((referenced & SP_REFERENCED_FOR_READ) && !read_only)) { /* * TODO: The semantics of these flush flags are too obtuse. They should * disappear and the pipe driver should just ensure that all visible * side-effects happen when they need to happen. */ - if (referenced & PIPE_REFERENCED_FOR_WRITE) - flush_flags |= PIPE_FLUSH_RENDER_CACHE; - - if (referenced & PIPE_REFERENCED_FOR_READ) - flush_flags |= PIPE_FLUSH_TEXTURE_CACHE; + if (referenced & SP_REFERENCED_FOR_READ) + flush_flags |= SP_FLUSH_TEXTURE_CACHE; if (cpu_access) { /* @@ -155,14 +152,15 @@ softpipe_flush_resource(struct pipe_context *pipe, if (do_not_block) return FALSE; - pipe->flush(pipe, flush_flags, &fence); + softpipe_flush(pipe, flush_flags, &fence); if (fence) { /* * This is for illustrative purposes only, as softpipe does not * have fences. */ - pipe->screen->fence_finish(pipe->screen, fence, 0); + pipe->screen->fence_finish(pipe->screen, fence, + PIPE_TIMEOUT_INFINITE); pipe->screen->fence_reference(pipe->screen, &fence, NULL); } } else { @@ -170,7 +168,7 @@ softpipe_flush_resource(struct pipe_context *pipe, * Just flush. */ - pipe->flush(pipe, flush_flags, NULL); + softpipe_flush(pipe, flush_flags, NULL); } } diff --git a/src/gallium/drivers/softpipe/sp_flush.h b/src/gallium/drivers/softpipe/sp_flush.h index 22a5ceeb9ec..ab01c249abe 100644 --- a/src/gallium/drivers/softpipe/sp_flush.h +++ b/src/gallium/drivers/softpipe/sp_flush.h @@ -33,10 +33,17 @@ struct pipe_context; struct pipe_fence_handle; +#define SP_FLUSH_TEXTURE_CACHE 0x2 + void -softpipe_flush(struct pipe_context *pipe, unsigned flags, +softpipe_flush(struct pipe_context *pipe, + unsigned flags, struct pipe_fence_handle **fence); +void +softpipe_flush_wrapped( struct pipe_context *pipe, + struct pipe_fence_handle **fence ); + boolean softpipe_flush_resource(struct pipe_context *pipe, struct pipe_resource *texture, diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 401e3177b48..26f5e1b5740 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -125,7 +125,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_SHADER_STENCIL_EXPORT: return 1; - case PIPE_CAP_INSTANCED_DRAWING: + case PIPE_CAP_TGSI_INSTANCEID: + case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: return 1; case PIPE_CAP_ARRAY_TEXTURES: return 1; @@ -181,8 +182,7 @@ softpipe_is_format_supported( struct pipe_screen *screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, - unsigned bind, - unsigned geom_flags ) + unsigned bind) { struct sw_winsys *winsys = softpipe_screen(screen)->winsys; const struct util_format_description *format_desc; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 8a4ef934348..c09ce19559c 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1795,6 +1795,7 @@ sample_compare(struct tgsi_sampler *tgsi_sampler, const struct pipe_sampler_state *sampler = samp->sampler; int j, k0, k1, k2, k3; float val; + float pc0, pc1, pc2, pc3; samp->mip_filter(tgsi_sampler, s, t, p, c0, control, rgba); @@ -1804,43 +1805,48 @@ sample_compare(struct tgsi_sampler *tgsi_sampler, * RGBA channels. We look at the red channel here. */ + pc0 = CLAMP(p[0], 0.0F, 1.0F); + pc1 = CLAMP(p[1], 0.0F, 1.0F); + pc2 = CLAMP(p[2], 0.0F, 1.0F); + pc3 = CLAMP(p[3], 0.0F, 1.0F); + /* compare four texcoords vs. four texture samples */ switch (sampler->compare_func) { case PIPE_FUNC_LESS: - k0 = p[0] < rgba[0][0]; - k1 = p[1] < rgba[0][1]; - k2 = p[2] < rgba[0][2]; - k3 = p[3] < rgba[0][3]; + k0 = pc0 < rgba[0][0]; + k1 = pc1 < rgba[0][1]; + k2 = pc2 < rgba[0][2]; + k3 = pc3 < rgba[0][3]; break; case PIPE_FUNC_LEQUAL: - k0 = p[0] <= rgba[0][0]; - k1 = p[1] <= rgba[0][1]; - k2 = p[2] <= rgba[0][2]; - k3 = p[3] <= rgba[0][3]; + k0 = pc0 <= rgba[0][0]; + k1 = pc1 <= rgba[0][1]; + k2 = pc2 <= rgba[0][2]; + k3 = pc3 <= rgba[0][3]; break; case PIPE_FUNC_GREATER: - k0 = p[0] > rgba[0][0]; - k1 = p[1] > rgba[0][1]; - k2 = p[2] > rgba[0][2]; - k3 = p[3] > rgba[0][3]; + k0 = pc0 > rgba[0][0]; + k1 = pc1 > rgba[0][1]; + k2 = pc2 > rgba[0][2]; + k3 = pc3 > rgba[0][3]; break; case PIPE_FUNC_GEQUAL: - k0 = p[0] >= rgba[0][0]; - k1 = p[1] >= rgba[0][1]; - k2 = p[2] >= rgba[0][2]; - k3 = p[3] >= rgba[0][3]; + k0 = pc0 >= rgba[0][0]; + k1 = pc1 >= rgba[0][1]; + k2 = pc2 >= rgba[0][2]; + k3 = pc3 >= rgba[0][3]; break; case PIPE_FUNC_EQUAL: - k0 = p[0] == rgba[0][0]; - k1 = p[1] == rgba[0][1]; - k2 = p[2] == rgba[0][2]; - k3 = p[3] == rgba[0][3]; + k0 = pc0 == rgba[0][0]; + k1 = pc1 == rgba[0][1]; + k2 = pc2 == rgba[0][2]; + k3 = pc3 == rgba[0][3]; break; case PIPE_FUNC_NOTEQUAL: - k0 = p[0] != rgba[0][0]; - k1 = p[1] != rgba[0][1]; - k2 = p[2] != rgba[0][2]; - k3 = p[3] != rgba[0][3]; + k0 = pc0 != rgba[0][0]; + k1 = pc1 != rgba[0][1]; + k2 = pc2 != rgba[0][2]; + k3 = pc3 != rgba[0][3]; break; case PIPE_FUNC_ALWAYS: k0 = k1 = k2 = k3 = 1; |