diff options
author | Roland Scheidegger <[email protected]> | 2013-02-28 01:25:24 +0100 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-02-28 03:39:54 +0100 |
commit | c8eb2d0e829d0d2aea6a982620da0d3cfb5982e2 (patch) | |
tree | 8ed27e8c5f72175689c56730bf5d80dd9eaa859e /src/gallium/drivers/llvmpipe/lp_texture.c | |
parent | 686f6c69bd36c537573f6e8095aaf24ec0ae4047 (diff) |
llvmpipe: check buffers in llvmpipe_is_resource_referenced.
Now that buffers can be used as textures or render targets
make sure they aren't skipped.
Fix suggested by Jose Fonseca.
v2: added a couple of assertions so we can actually guarantee
we check the resources and don't skip them. Also added some comments
that this is actually a lie due to the way the opengl buffer api works.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_texture.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_texture.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index a64139f1d91..e4ae3c1b65f 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -577,6 +577,7 @@ llvmpipe_create_surface(struct pipe_context *pipe, struct pipe_surface *ps; assert(surf_tmpl->u.tex.level <= pt->last_level); + assert(pt->bind & (PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_RENDER_TARGET)); ps = CALLOC_STRUCT(pipe_surface); if (ps) { @@ -755,7 +756,15 @@ llvmpipe_is_resource_referenced( struct pipe_context *pipe, { struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe ); - if (presource->target == PIPE_BUFFER) + /* + * XXX checking only resources with the right bind flags + * is unsafe since with opengl state tracker we can end up + * with resources bound to places they weren't supposed to be + * (buffers bound as sampler views is one possibility here). + */ + if (!(presource->bind & (PIPE_BIND_DEPTH_STENCIL | + PIPE_BIND_RENDER_TARGET | + PIPE_BIND_SAMPLER_VIEW))) return LP_UNREFERENCED; return lp_setup_is_resource_referenced(llvmpipe->setup, presource); |