<p dir="ltr"><br>
On Mar 15, 2016 7:23 AM, "Nicolai Hähnle" <<a href="mailto:nhaehnle@gmail.com">nhaehnle@gmail.com</a>> wrote:<br>
><br>
> From: Nicolai Hähnle <<a href="mailto:nicolai.haehnle@amd.com">nicolai.haehnle@amd.com</a>><br>
><br>
> The bitcasting which is possible with shader images (and texture views?)<br>
> requires that when the user specifies a sized internal format for a<br>
> texture, we really allocate that format. To this end:<br>
><br>
> (1) find_exact_format should ignore sized internal formats and<br>
><br>
> (2) some of the entries in the mapping table corresponding to sized<br>
> internal formats are reordered to use an RGBA format instead of<br>
> a BGRA one.<br>
><br>
> This fixes arb_shader_image_load_store-bitcast in the (work in progress)<br>
> ARB_shader_image_load_store implementation for radeonsi.<br>
><br>
> v2: don't change the mapping of GL_RGB10: the change caused a regression<br>
> because it preferred a format with an alpha channel, and GL_RGB10<br>
> is not among the supported formats for shader images</p>
<p dir="ltr">Won't that break texture views? I.e. a view of rgb10 via rgb10a2 or vice versa.</p>
<p dir="ltr">><br>
> Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>> (v1)<br>
> ---<br>
> src/mesa/state_tracker/st_format.c | 27 ++++++---------------------<br>
> 1 file changed, 6 insertions(+), 21 deletions(-)<br>
><br>
> diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c<br>
> index 5392c23..161c767 100644<br>
> --- a/src/mesa/state_tracker/st_format.c<br>
> +++ b/src/mesa/state_tracker/st_format.c<br>
> @@ -1114,12 +1114,12 @@ static const struct format_mapping format_map[] = {<br>
> },<br>
> {<br>
> { GL_RGB10_A2, 0 },<br>
> - { PIPE_FORMAT_B10G10R10A2_UNORM, PIPE_FORMAT_R10G10B10A2_UNORM,<br>
> + { PIPE_FORMAT_R10G10B10A2_UNORM, PIPE_FORMAT_B10G10R10A2_UNORM,<br>
> DEFAULT_RGBA_FORMATS }<br>
> },<br>
> {<br>
> { 4, GL_RGBA, GL_RGBA8, 0 },<br>
> - { DEFAULT_RGBA_FORMATS }<br>
> + { PIPE_FORMAT_R8G8B8A8_UNORM, DEFAULT_RGBA_FORMATS }<br>
> },<br>
> {<br>
> { GL_BGRA, 0 },<br>
> @@ -1127,7 +1127,7 @@ static const struct format_mapping format_map[] = {<br>
> },<br>
> {<br>
> { 3, GL_RGB, GL_RGB8, 0 },<br>
> - { DEFAULT_RGB_FORMATS }<br>
> + { PIPE_FORMAT_R8G8B8X8_UNORM, DEFAULT_RGB_FORMATS }<br>
> },<br>
> {<br>
> { GL_RGB12, GL_RGB16, 0 },<br>
> @@ -2022,20 +2022,10 @@ static const struct exact_format_mapping rgbx8888_tbl[] =<br>
> { 0, 0, 0 }<br>
> };<br>
><br>
> -static const struct exact_format_mapping rgba1010102_tbl[] =<br>
> -{<br>
> - { GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV, PIPE_FORMAT_B10G10R10A2_UNORM },<br>
> - /* No Mesa formats for these Gallium formats:<br>
> - { GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, PIPE_FORMAT_R10G10B10A2_UNORM },<br>
> - { GL_ABGR_EXT, GL_UNSIGNED_INT_10_10_10_2, PIPE_FORMAT_R10G10B10A2_UNORM },<br>
> - { GL_ABGR_EXT, GL_UNSIGNED_INT, PIPE_FORMAT_R10G10B10A2_UNORM },<br>
> - */<br>
> - { 0, 0, 0 }<br>
> -};<br>
> -<br>
> /**<br>
> - * If there is an exact pipe_format match for {internalFormat, format, type}<br>
> - * return that, otherwise return PIPE_FORMAT_NONE so we can do fuzzy matching.<br>
> + * For unsized/base internal formats, we may choose a convenient effective<br>
> + * internal format for {format, type}. If one exists, return that, otherwise<br>
> + * return PIPE_FORMAT_NONE.<br>
> */<br>
> static enum pipe_format<br>
> find_exact_format(GLint internalFormat, GLenum format, GLenum type)<br>
> @@ -2049,17 +2039,12 @@ find_exact_format(GLint internalFormat, GLenum format, GLenum type)<br>
> switch (internalFormat) {<br>
> case 4:<br>
> case GL_RGBA:<br>
> - case GL_RGBA8:<br>
> tbl = rgba8888_tbl;<br>
> break;<br>
> case 3:<br>
> case GL_RGB:<br>
> - case GL_RGB8:<br>
> tbl = rgbx8888_tbl;<br>
> break;<br>
> - case GL_RGB10_A2:<br>
> - tbl = rgba1010102_tbl;<br>
> - break;<br>
> default:<br>
> return PIPE_FORMAT_NONE;<br>
> }<br>
> --<br>
> 2.5.0<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>