<div class="gmail_quote">On Sun, Apr 3, 2011 at 5:52 AM, Kenneth Graunke <span dir="ltr">&lt;<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im">On 04/02/2011 07:18 PM, Ian Romanick wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
From: Ian Romanick&lt;<a href="mailto:ian.d.romanick@intel.com" target="_blank">ian.d.romanick@intel.com</a>&gt;<br>
<br>
This is always the way the real hardware and desktop OpenGL.  Some<br>
</blockquote>
<br></div>
Err...what?<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
hardware can&#39;t do some formats natively.  The alpha-only, luminance,<br>
and intensity formats are usually the most problematic.  Some sized<br>
formats can also be problematic.  This patch provides fall-back<br>
formats for those that are not natively supported.<br>
<br>
At some point it would be interesting to try providing<br>
device-independent conversions using EXT_texture_swizzle.  The drivers<br>
that support EXT_texture_swizzle could, for example, see<br>
GL_LUMINANCE16_SNORM as MESA_FORMAT_SIGNED_R16 with a { r, r, r, 1 }<br>
swizzle.  Care would need to be taken to prevent issues with using<br>
those textures for FBO rendering.<br>
<br>
This is the rest of the fix for glean&#39;s pixelFormats test on i965.<br>
<br>
Cc: Marek Ol ák&lt;<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>&gt;<br>
</blockquote>
<br></div>
&#39;s&#39; please!  ^^^<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
---<br>
  src/mesa/main/texformat.c |   26 +++++++++++++++++++++++---<br>
  1 files changed, 23 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c<br>
index 8b7b4ff..da90745 100644<br>
--- a/src/mesa/main/texformat.c<br>
+++ b/src/mesa/main/texformat.c<br>
@@ -402,7 +402,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,<br>
           case GL_RGB_SNORM:<br>
           case GL_RGB8_SNORM:<br>
            RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888);<br>
-           break;<br>
+           /* FALLTHROUGH */<br>
           case GL_RGBA_SNORM:<br>
           case GL_RGBA8_SNORM:<br>
            RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);<br>
@@ -411,18 +411,27 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,<br>
           case GL_ALPHA_SNORM:<br>
           case GL_ALPHA8_SNORM:<br>
              RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A8);<br>
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);<br>
+           RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);<br>
</blockquote>
<br></div>
I&#39;m probably being dense here, but if RGBA8888 works as a fallback, couldn&#39;t R8 work as well?</blockquote><div><br>A8 is 000A, R8 is R001. If you don&#39;t have swizzling, you cannot replace A8 with R8. LA8 and RGBA8 are the only possible fallback formats there. BTW Gallium overrides the ChooseTextureFormat hook, so this patch has no effect on Gallium drivers.<br>

<br>Other than that, it looks good to me.<br><br>Reviewed-by: Marek Olšák &lt;<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>&gt;<br></div></div><br>Marek<br>