summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c7
-rw-r--r--src/gallium/drivers/llvmpipe/lp_surface.c14
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c11
3 files changed, 24 insertions, 8 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index 30547a69f0d..3b31d4ff5d5 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -214,6 +214,13 @@ llvmpipe_create_sampler_view(struct pipe_context *pipe,
const struct pipe_sampler_view *templ)
{
struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+ /*
+ * XXX we REALLY want to see the correct bind flag here but the OpenGL
+ * state tracker can't guarantee that at least for texture buffer objects.
+ */
+#if 0
+ assert(texture->bind & PIPE_BIND_SAMPLER_VIEW);
+#endif
if (view) {
*view = *templ;
diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
index a83a9033c40..5e6a6ebb340 100644
--- a/src/gallium/drivers/llvmpipe/lp_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_surface.c
@@ -65,13 +65,6 @@ lp_resource_copy(struct pipe_context *pipe,
unsigned depth = src_box->depth;
unsigned z;
- /* Fallback for buffers. */
- if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
- util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
- src, src_level, src_box);
- return;
- }
-
llvmpipe_flush_resource(pipe,
dst, dst_level,
FALSE, /* read_only */
@@ -86,6 +79,13 @@ lp_resource_copy(struct pipe_context *pipe,
FALSE, /* do_not_block */
"blit src");
+ /* Fallback for buffers. */
+ if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
+ util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
+ src, src_level, src_box);
+ return;
+ }
+
/*
printf("surface copy from %u lvl %u to %u lvl %u: %u,%u,%u to %u,%u,%u %u x %u x %u\n",
src_tex->id, src_level, dst_tex->id, dst_level,
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);