From: Jason Ekstrand Date: Tue, 27 Jan 2015 22:18:57 +0000 (-0800) Subject: i965/tex: Don't create read-write textures with non-renderable formats X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5e8468e6dadb06da061ad51e2c40e85bc1c6c3e4;p=mesa.git 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 --- diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c index 184702fab91..2d3009a30d1 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);