[Mesa-dev] [PATCH 2/2] i965/tex: Don't create read-write textures with non-renderable formats

Kenneth Graunke kenneth at whitecape.org
Tue Jan 27 20:19:42 PST 2015


On Tuesday, January 27, 2015 02:32:20 PM Jason Ekstrand wrote:
> I haven't actually seen this bug in the wild, but it's possible that
> someone could ask to do a ST3C PBO download or something.  This protects us

                S3TC (typo) ^^^^

> from accidentally creating a render target with a compressed or otherwise
> non-renderable format.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> ---
>  src/mesa/drivers/dri/i965/intel_tex.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_tex.c b/src/mesa/drivers/dri/i965/intel_tex.c
> index 184702f..2d3009a 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150127/e96aed40/attachment-0001.sig>


More information about the mesa-dev mailing list