summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-01-27 14:18:57 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2015-01-28 01:28:32 -0800
commit5e8468e6dadb06da061ad51e2c40e85bc1c6c3e4 (patch)
treead81a07764f494b64fb887e12612142e7fdd8156
parent34723c0861f9fa955dab4902c80afb6a6e1153c3 (diff)
i965/tex: Don't create read-write textures with non-renderable formats
I haven't actually seen this bug in the wild, but it's possible that someone could ask to do a S3TC PBO download or something. This protects us from accidentally creating a render target with a compressed or otherwise non-renderable format. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--src/mesa/drivers/dri/i965/intel_tex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c
index 184702fab9..2d3009a30d 100644
--- a/src/mesa/drivers/dri/i965/intel_tex.c
+++ b/src/mesa/drivers/dri/i965/intel_tex.c
@@ -323,6 +323,11 @@ intel_set_texture_storage_for_buffer_object(struct gl_context *ctx,
perf_debug("Bad PBO alignment; fallback to CPU mapping\n");
return false;
}
+
+ if (!brw->format_supported_as_render_target[image->TexFormat]) {
+ perf_debug("Non-renderable PBO format; fallback to CPU mapping\n");
+ return false;
+ }
}
assert(intel_texobj->mt == NULL);