On 26 September 2012 11:22, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The function segfaulted when a game called glTexSubImage2D on a texture<br>
with internalformat/format/type = GL_SLUMINANCE8/GL_BGRA/GL_UNSIGNED_BYTE.<br>
<br>
The function only supports MESA_FORMAT_ARGB8888 and returns early if it<br>
detects an unsupported format. Clearly, its detection condition was<br>
insufficient. This patch fixes it to explicity check for<br>
MESA_FORMAT_ARGB8888.<br>
<br>
CC: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
Signed-off-by: Chad Versace <<a href="mailto:chad.versace@linux.intel.com">chad.versace@linux.intel.com</a>><br>
---<br>
 src/mesa/drivers/dri/intel/intel_tex_subimage.c | 3 +--<br>
 1 file changed, 1 insertion(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c<br>
index d3a8736..aa6f237 100644<br>
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c<br>
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c<br>
@@ -199,8 +199,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,<br>
     * varying the arithmetic loop below.<br>
     */<br>
    if (!intel->has_llc ||<br>
-       format != GL_BGRA ||<br>
-       type != GL_UNSIGNED_BYTE ||<br>
+       texImage->TexFormat != MESA_FORMAT_ARGB8888 ||<br>
        texImage->TexObject->Target != GL_TEXTURE_2D ||<br>
        texImage->Level != 0 ||<br>
        pixels == NULL ||<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.12.1<br></font></span></blockquote><div><br>I'm not terribly familiar with this corner of the codebase, but it sounds reasonable to me.<br><br>Acked-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
<br>Since this patch fixes a bug in 413c4914129cd26ca87960852d8c0264c0fb29e7 (which is a candidate for the 9.0 branch), I'd recommend including the text "Note: This is a candidate for the 9.0 branch." in the commit message.<br>
</div></div>