aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-08-29 15:45:18 -0700
committerEric Anholt <[email protected]>2019-10-20 04:39:48 +0000
commit236b478b2ec0d65ef5dfe1165ae8ab027dde0a42 (patch)
treeba0825512a12788b3a95e07251a2a1b8e27fbaee
parent1165e3f36084ff0c4ff0c4f5a069185b0f28386f (diff)
mesa: Replace the LA16_UNORM packed formats with one array format.
The array format is what the GL API wants (and we made a mistake in the format returned for texbos on big-endian!), and it's exactly what the gallium-side PIPE_FORMAT_L16A16 is. The only downside is that dri_util tries to fall back to sampling RG16 using LA16, which doesn't have a match for big-endian any more. No HW drivers supported A16L16 anyway. Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_surface_formats.c2
-rw-r--r--src/mesa/main/formats.c3
-rw-r--r--src/mesa/main/formats.csv3
-rw-r--r--src/mesa/main/formats.h3
-rw-r--r--src/mesa/main/texformat.c2
-rw-r--r--src/mesa/main/teximage.c2
-rw-r--r--src/mesa/state_tracker/st_format.c12
-rw-r--r--src/mesa/swrast/s_texfetch.c3
-rw-r--r--src/mesa/swrast/s_texfetch_tmp.h3
10 files changed, 16 insertions, 22 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 45f614bf720..55abacd6714 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -42,6 +42,7 @@
#include <stdbool.h>
#include "dri_util.h"
#include "utils.h"
+#include "util/u_endian.h"
#include "util/xmlpool.h"
#include "main/mtypes.h"
#include "main/framebuffer.h"
@@ -959,10 +960,12 @@ static const struct {
.image_format = __DRI_IMAGE_FORMAT_GR1616,
.mesa_format = MESA_FORMAT_R16G16_UNORM,
},
+#ifdef PIPE_ARCH_LITTLE_ENDIAN
{
.image_format = __DRI_IMAGE_FORMAT_GR1616,
- .mesa_format = MESA_FORMAT_L16A16_UNORM,
+ .mesa_format = MESA_FORMAT_LA_UNORM16,
},
+#endif
};
uint32_t
diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c
index 77476a8c7eb..059b2f4bb62 100644
--- a/src/mesa/drivers/dri/i965/brw_surface_formats.c
+++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c
@@ -48,7 +48,7 @@ brw_isl_format_for_mesa_format(mesa_format mesa_format)
[MESA_FORMAT_B4G4R4A4_UNORM] = ISL_FORMAT_B4G4R4A4_UNORM,
[MESA_FORMAT_B5G5R5A1_UNORM] = ISL_FORMAT_B5G5R5A1_UNORM,
[MESA_FORMAT_L8A8_UNORM] = ISL_FORMAT_L8A8_UNORM,
- [MESA_FORMAT_L16A16_UNORM] = ISL_FORMAT_L16A16_UNORM,
+ [MESA_FORMAT_LA_UNORM16] = ISL_FORMAT_L16A16_UNORM,
[MESA_FORMAT_A_UNORM8] = ISL_FORMAT_A8_UNORM,
[MESA_FORMAT_A_UNORM16] = ISL_FORMAT_A16_UNORM,
[MESA_FORMAT_L_UNORM8] = ISL_FORMAT_L8_UNORM,
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index aba12fc9f0b..31c63d6497b 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -954,8 +954,7 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format,
*comps = 2;
return;
- case MESA_FORMAT_L16A16_UNORM:
- case MESA_FORMAT_A16L16_UNORM:
+ case MESA_FORMAT_LA_UNORM16:
case MESA_FORMAT_R16G16_UNORM:
case MESA_FORMAT_G16R16_UNORM:
*datatype = GL_UNSIGNED_SHORT;
diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv
index 90d9bf07ece..f123ab2ba73 100644
--- a/src/mesa/main/formats.csv
+++ b/src/mesa/main/formats.csv
@@ -60,8 +60,6 @@ MESA_FORMAT_B8G8R8A8_UNORM , packed, 1, 1, 1, un8 , un8 , un8 , u
MESA_FORMAT_B8G8R8X8_UNORM , packed, 1, 1, 1, un8 , un8 , un8 , x8 , zyx1, rgb
MESA_FORMAT_A8R8G8B8_UNORM , packed, 1, 1, 1, un8 , un8 , un8 , un8 , yzwx, rgb
MESA_FORMAT_X8R8G8B8_UNORM , packed, 1, 1, 1, x8 , un8 , un8 , un8 , yzw1, rgb
-MESA_FORMAT_L16A16_UNORM , packed, 1, 1, 1, un16, un16, , , xxxy, rgb
-MESA_FORMAT_A16L16_UNORM , packed, 1, 1, 1, un16, un16, , , yyyx, rgb
MESA_FORMAT_B5G6R5_UNORM , packed, 1, 1, 1, un5 , un6 , un5 , , zyx1, rgb
MESA_FORMAT_R5G6B5_UNORM , packed, 1, 1, 1, un5 , un6 , un5 , , xyz1, rgb
MESA_FORMAT_B4G4R4A4_UNORM , packed, 1, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb
@@ -106,6 +104,7 @@ MESA_FORMAT_A_UNORM8 , array , 1, 1, 1, un8 , , ,
MESA_FORMAT_A_UNORM16 , array , 1, 1, 1, un16, , , , 000x, rgb
MESA_FORMAT_L_UNORM8 , array , 1, 1, 1, un8 , , , , xxx1, rgb
MESA_FORMAT_L_UNORM16 , array , 1, 1, 1, un16, , , , xxx1, rgb
+MESA_FORMAT_LA_UNORM16 , array , 1, 1, 1, un16, un16, , , xxxy, rgb
MESA_FORMAT_I_UNORM8 , array , 1, 1, 1, un8 , , , , xxxx, rgb
MESA_FORMAT_I_UNORM16 , array , 1, 1, 1, un16, , , , xxxx, rgb
MESA_FORMAT_R_UNORM8 , array , 1, 1, 1, un8 , , , , x001, rgb
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index cbeb237fba0..d1ee8ab5cb6 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -357,8 +357,6 @@ typedef enum
MESA_FORMAT_B8G8R8X8_UNORM, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
MESA_FORMAT_A8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
MESA_FORMAT_X8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
- MESA_FORMAT_L16A16_UNORM, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
- MESA_FORMAT_A16L16_UNORM, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */
MESA_FORMAT_B5G6R5_UNORM, /* RRRR RGGG GGGB BBBB */
MESA_FORMAT_R5G6B5_UNORM, /* BBBB BGGG GGGR RRRR */
MESA_FORMAT_B4G4R4A4_UNORM, /* AAAA RRRR GGGG BBBB */
@@ -404,6 +402,7 @@ typedef enum
MESA_FORMAT_A_UNORM16, /* ushort[i] = A */
MESA_FORMAT_L_UNORM8, /* ubyte[i] = L */
MESA_FORMAT_L_UNORM16, /* ushort[i] = L */
+ MESA_FORMAT_LA_UNORM16, /* ushort[i * 2] = L, ushort[i*2+1] = A */
MESA_FORMAT_I_UNORM8, /* ubyte[i] = I */
MESA_FORMAT_I_UNORM16, /* ushort[i] = I */
MESA_FORMAT_R_UNORM8, /* ubyte[i] = R */
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 381edd55451..4c8ded7e211 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -202,7 +202,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_L16A16_UNORM);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LA_UNORM16);
RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM);
break;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 67500830853..5b6afcfa985 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -6008,7 +6008,7 @@ _mesa_get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat)
case GL_LUMINANCE8_ALPHA8:
return MESA_FORMAT_L8A8_UNORM;
case GL_LUMINANCE16_ALPHA16:
- return MESA_FORMAT_L16A16_UNORM;
+ return MESA_FORMAT_LA_UNORM16;
case GL_LUMINANCE_ALPHA16F_ARB:
return MESA_FORMAT_LA_FLOAT16;
case GL_LUMINANCE_ALPHA32F_ARB:
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 38ea51b02cd..462e93ff1d0 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -109,10 +109,6 @@ st_mesa_format_to_pipe_format(const struct st_context *st,
return PIPE_FORMAT_LA88_UNORM;
case MESA_FORMAT_A8L8_UNORM:
return PIPE_FORMAT_AL88_UNORM;
- case MESA_FORMAT_L16A16_UNORM:
- return PIPE_FORMAT_LA1616_UNORM;
- case MESA_FORMAT_A16L16_UNORM:
- return PIPE_FORMAT_AL1616_UNORM;
case MESA_FORMAT_A_UNORM8:
return PIPE_FORMAT_A8_UNORM;
case MESA_FORMAT_A_UNORM16:
@@ -121,6 +117,8 @@ st_mesa_format_to_pipe_format(const struct st_context *st,
return PIPE_FORMAT_L8_UNORM;
case MESA_FORMAT_L_UNORM16:
return PIPE_FORMAT_L16_UNORM;
+ case MESA_FORMAT_LA_UNORM16:
+ return PIPE_FORMAT_L16A16_UNORM;
case MESA_FORMAT_I_UNORM8:
return PIPE_FORMAT_I8_UNORM;
case MESA_FORMAT_I_UNORM16:
@@ -703,10 +701,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
return MESA_FORMAT_L8A8_UNORM;
case PIPE_FORMAT_AL88_UNORM:
return MESA_FORMAT_A8L8_UNORM;
- case PIPE_FORMAT_LA1616_UNORM:
- return MESA_FORMAT_L16A16_UNORM;
- case PIPE_FORMAT_AL1616_UNORM:
- return MESA_FORMAT_A16L16_UNORM;
+ case PIPE_FORMAT_L16A16_UNORM:
+ return MESA_FORMAT_LA_UNORM16;
case PIPE_FORMAT_A8_UNORM:
return MESA_FORMAT_A_UNORM8;
case PIPE_FORMAT_A16_UNORM:
diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
index 5f0b06e915c..1fe5e21162a 100644
--- a/src/mesa/swrast/s_texfetch.c
+++ b/src/mesa/swrast/s_texfetch.c
@@ -134,8 +134,6 @@ texfetch_funcs[] =
FETCH_FUNCS(B8G8R8X8_UNORM),
FETCH_FUNCS(A8R8G8B8_UNORM),
FETCH_FUNCS(X8R8G8B8_UNORM),
- FETCH_FUNCS(L16A16_UNORM),
- FETCH_FUNCS(A16L16_UNORM),
FETCH_FUNCS(B5G6R5_UNORM),
FETCH_FUNCS(R5G6B5_UNORM),
FETCH_FUNCS(B4G4R4A4_UNORM),
@@ -175,6 +173,7 @@ texfetch_funcs[] =
FETCH_FUNCS(A_UNORM16),
FETCH_FUNCS(L_UNORM8),
FETCH_FUNCS(L_UNORM16),
+ FETCH_FUNCS(LA_UNORM16),
FETCH_FUNCS(I_UNORM8),
FETCH_FUNCS(I_UNORM16),
FETCH_FUNCS(R_UNORM8),
diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h
index 8261ebf46ef..72bb13498af 100644
--- a/src/mesa/swrast/s_texfetch_tmp.h
+++ b/src/mesa/swrast/s_texfetch_tmp.h
@@ -137,13 +137,12 @@ FETCH_RGBA(R_UNORM16, GLushort, 1)
FETCH_RGBA(A8L8_UNORM, GLushort, 1)
FETCH_RGBA(R16G16_UNORM, GLuint, 1)
FETCH_RGBA(G16R16_UNORM, GLuint, 1)
-FETCH_RGBA(L16A16_UNORM, GLuint, 1)
-FETCH_RGBA(A16L16_UNORM, GLuint, 1)
FETCH_RGBA(B2G3R3_UNORM, GLubyte, 1)
FETCH_RGBA(A_UNORM8, GLubyte, 1)
FETCH_RGBA(A_UNORM16, GLushort, 1)
FETCH_RGBA(L_UNORM8, GLubyte, 1)
FETCH_RGBA(L_UNORM16, GLushort, 1)
+FETCH_RGBA(LA_UNORM16, GLushort, 2)
FETCH_RGBA(I_UNORM8, GLubyte, 1)
FETCH_RGBA(I_UNORM16, GLushort, 1)
FETCH_RGBA(BGR_SRGB8, GLubyte, 3)