Mesa (master): mesa: Validate original image internal format rather than derived mesa format.

Francisco Jerez currojerez at kemper.freedesktop.org
Mon May 4 15:40:22 UTC 2015


Module: Mesa
Branch: master
Commit: cad0cf4ceeaac708591d064642e12d3b8daa4e05
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cad0cf4ceeaac708591d064642e12d3b8daa4e05

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Tue Jan 20 16:12:18 2015 +0200

mesa: Validate original image internal format rather than derived mesa format.

This matches what _mesa_BindImageTextures() does.  The derived image format
(gl_texture_image::TexFormat) isn't necessarily equivalent to the internal
format of the texture image.  If a forbidden internal format has been
specified we need to mark the image unit as invalid as required by the spec,
regardless of the derived format.  Fixes the "invalid"
ARB_shader_image_load_store piglit test.

Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/main/shaderimage.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index cb88d9c..8caff2f 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -353,7 +353,7 @@ validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
       return GL_FALSE;
 
    if (t->Target == GL_TEXTURE_BUFFER) {
-      tex_format = t->_BufferObjectFormat;
+      tex_format = _mesa_get_shader_image_format(t->BufferObjectFormat);
 
    } else {
       struct gl_texture_image *img = (t->Target == GL_TEXTURE_CUBE_MAP ?
@@ -363,10 +363,10 @@ validate_image_unit(struct gl_context *ctx, struct gl_image_unit *u)
       if (!img || img->Border || img->NumSamples > ctx->Const.MaxImageSamples)
          return GL_FALSE;
 
-      tex_format = img->TexFormat;
+      tex_format = _mesa_get_shader_image_format(img->InternalFormat);
    }
 
-   if (get_image_format_class(tex_format) == IMAGE_FORMAT_CLASS_NONE)
+   if (!tex_format)
       return GL_FALSE;
 
    switch (t->ImageFormatCompatibilityType) {




More information about the mesa-commit mailing list