From: Brian Paul Date: Fri, 11 Apr 2014 01:00:46 +0000 (-0600) Subject: swrast: use macros to initialize texfetch_funcs[] table X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c5631b341e9b8f693ed42e4a487cb5d0c476bb9f;p=mesa.git swrast: use macros to initialize texfetch_funcs[] table Reviewed-by: Ian Romanick --- diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index 2a6eee049a0..90a514c168f 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -129,9 +129,24 @@ static void fetch_null_texelf( const struct swrast_texture_image *texImage, } +#define FETCH_FUNCS(NAME) \ + { \ + MESA_FORMAT_ ## NAME, \ + fetch_texel_1d_ ## NAME, \ + fetch_texel_2d_ ## NAME, \ + fetch_texel_3d_ ## NAME, \ + } + +#define FETCH_NULL(NAME) \ + { \ + MESA_FORMAT_ ## NAME, \ + NULL, \ + NULL, \ + NULL \ + } + /** * Table to map MESA_FORMAT_ to texel fetch/store funcs. - * XXX this is somewhat temporary. */ static struct { mesa_format Name; @@ -149,632 +164,132 @@ texfetch_funcs[] = }, /* Packed unorm formats */ - { - MESA_FORMAT_A8B8G8R8_UNORM, - fetch_texel_1d_A8B8G8R8_UNORM, - fetch_texel_2d_A8B8G8R8_UNORM, - fetch_texel_3d_A8B8G8R8_UNORM - }, - { - MESA_FORMAT_X8B8G8R8_UNORM, - fetch_texel_1d_X8B8G8R8_UNORM, - fetch_texel_2d_X8B8G8R8_UNORM, - fetch_texel_3d_X8B8G8R8_UNORM - }, - { - MESA_FORMAT_R8G8B8A8_UNORM, - fetch_texel_1d_R8G8B8A8_UNORM, - fetch_texel_2d_R8G8B8A8_UNORM, - fetch_texel_3d_R8G8B8A8_UNORM - }, - { - MESA_FORMAT_R8G8B8X8_UNORM, - fetch_texel_1d_R8G8B8X8_UNORM, - fetch_texel_2d_R8G8B8X8_UNORM, - fetch_texel_3d_R8G8B8X8_UNORM - }, - { - MESA_FORMAT_B8G8R8A8_UNORM, - fetch_texel_1d_B8G8R8A8_UNORM, - fetch_texel_2d_B8G8R8A8_UNORM, - fetch_texel_3d_B8G8R8A8_UNORM - }, - { - MESA_FORMAT_B8G8R8X8_UNORM, - fetch_texel_1d_B8G8R8X8_UNORM, - fetch_texel_2d_B8G8R8X8_UNORM, - fetch_texel_3d_B8G8R8X8_UNORM - }, - { - MESA_FORMAT_A8R8G8B8_UNORM, - fetch_texel_1d_A8R8G8B8_UNORM, - fetch_texel_2d_A8R8G8B8_UNORM, - fetch_texel_3d_A8R8G8B8_UNORM - }, - { - MESA_FORMAT_X8R8G8B8_UNORM, - fetch_texel_1d_X8R8G8B8_UNORM, - fetch_texel_2d_X8R8G8B8_UNORM, - fetch_texel_3d_X8R8G8B8_UNORM - }, - { - MESA_FORMAT_L16A16_UNORM, - fetch_texel_1d_L16A16_UNORM, - fetch_texel_2d_L16A16_UNORM, - fetch_texel_3d_L16A16_UNORM - }, - { - MESA_FORMAT_A16L16_UNORM, - fetch_texel_1d_A16L16_UNORM, - fetch_texel_2d_A16L16_UNORM, - fetch_texel_3d_A16L16_UNORM - }, - { - MESA_FORMAT_B5G6R5_UNORM, - fetch_texel_1d_B5G6R5_UNORM, - fetch_texel_2d_B5G6R5_UNORM, - fetch_texel_3d_B5G6R5_UNORM - }, - { - MESA_FORMAT_R5G6B5_UNORM, - fetch_texel_1d_R5G6B5_UNORM, - fetch_texel_2d_R5G6B5_UNORM, - fetch_texel_3d_R5G6B5_UNORM - }, - { - MESA_FORMAT_B4G4R4A4_UNORM, - fetch_texel_1d_B4G4R4A4_UNORM, - fetch_texel_2d_B4G4R4A4_UNORM, - fetch_texel_3d_B4G4R4A4_UNORM - }, - { - MESA_FORMAT_B4G4R4X4_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A4R4G4B4_UNORM, - fetch_texel_1d_A4R4G4B4_UNORM, - fetch_texel_2d_A4R4G4B4_UNORM, - fetch_texel_3d_A4R4G4B4_UNORM - }, - { - MESA_FORMAT_A1B5G5R5_UNORM, - fetch_texel_1d_A1B5G5R5_UNORM, - fetch_texel_2d_A1B5G5R5_UNORM, - fetch_texel_3d_A1B5G5R5_UNORM - }, - { - MESA_FORMAT_B5G5R5A1_UNORM, - fetch_texel_1d_B5G5R5A1_UNORM, - fetch_texel_2d_B5G5R5A1_UNORM, - fetch_texel_3d_B5G5R5A1_UNORM - }, - { - MESA_FORMAT_B5G5R5X1_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A1R5G5B5_UNORM, - fetch_texel_1d_A1R5G5B5_UNORM, - fetch_texel_2d_A1R5G5B5_UNORM, - fetch_texel_3d_A1R5G5B5_UNORM - }, - { - MESA_FORMAT_L8A8_UNORM, - fetch_texel_1d_L8A8_UNORM, - fetch_texel_2d_L8A8_UNORM, - fetch_texel_3d_L8A8_UNORM - }, - { - MESA_FORMAT_A8L8_UNORM, - fetch_texel_1d_A8L8_UNORM, - fetch_texel_2d_A8L8_UNORM, - fetch_texel_3d_A8L8_UNORM - }, - { - MESA_FORMAT_R8G8_UNORM, - fetch_texel_1d_R8G8_UNORM, - fetch_texel_2d_R8G8_UNORM, - fetch_texel_3d_R8G8_UNORM - }, - { - MESA_FORMAT_G8R8_UNORM, - fetch_texel_1d_G8R8_UNORM, - fetch_texel_2d_G8R8_UNORM, - fetch_texel_3d_G8R8_UNORM - }, - { - MESA_FORMAT_L4A4_UNORM, - fetch_texel_1d_L4A4_UNORM, - fetch_texel_2d_L4A4_UNORM, - fetch_texel_3d_L4A4_UNORM - }, - { - MESA_FORMAT_B2G3R3_UNORM, - fetch_texel_1d_B2G3R3_UNORM, - fetch_texel_2d_B2G3R3_UNORM, - fetch_texel_3d_B2G3R3_UNORM - }, - { - MESA_FORMAT_R16G16_UNORM, - fetch_texel_1d_R16G16_UNORM, - fetch_texel_2d_R16G16_UNORM, - fetch_texel_3d_R16G16_UNORM - }, - { - MESA_FORMAT_G16R16_UNORM, - fetch_texel_1d_G16R16_UNORM, - fetch_texel_2d_G16R16_UNORM, - fetch_texel_3d_G16R16_UNORM - }, - { - MESA_FORMAT_B10G10R10A2_UNORM, - fetch_texel_1d_B10G10R10A2_UNORM, - fetch_texel_2d_B10G10R10A2_UNORM, - fetch_texel_3d_B10G10R10A2_UNORM - }, - { - MESA_FORMAT_B10G10R10X2_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R10G10B10A2_UNORM, - fetch_texel_1d_R10G10B10A2_UNORM, - fetch_texel_2d_R10G10B10A2_UNORM, - fetch_texel_3d_R10G10B10A2_UNORM - }, - { - MESA_FORMAT_S8_UINT_Z24_UNORM, - fetch_texel_1d_S8_UINT_Z24_UNORM, - fetch_texel_2d_S8_UINT_Z24_UNORM, - fetch_texel_3d_S8_UINT_Z24_UNORM - }, + FETCH_FUNCS(A8B8G8R8_UNORM), + FETCH_FUNCS(X8B8G8R8_UNORM), + FETCH_FUNCS(R8G8B8A8_UNORM), + FETCH_FUNCS(R8G8B8X8_UNORM), + FETCH_FUNCS(B8G8R8A8_UNORM), + 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), + FETCH_NULL(B4G4R4X4_UNORM), + FETCH_FUNCS(A4R4G4B4_UNORM), + FETCH_FUNCS(A1B5G5R5_UNORM), + FETCH_FUNCS(B5G5R5A1_UNORM), + FETCH_NULL(B5G5R5X1_UNORM), + FETCH_FUNCS(A1R5G5B5_UNORM), + FETCH_FUNCS(L8A8_UNORM), + FETCH_FUNCS(A8L8_UNORM), + FETCH_FUNCS(R8G8_UNORM), + FETCH_FUNCS(G8R8_UNORM), + FETCH_FUNCS(L4A4_UNORM), + FETCH_FUNCS(B2G3R3_UNORM), + FETCH_FUNCS(R16G16_UNORM), + FETCH_FUNCS(G16R16_UNORM), + FETCH_FUNCS(B10G10R10A2_UNORM), + FETCH_NULL(B10G10R10X2_UNORM), + FETCH_FUNCS(R10G10B10A2_UNORM), + FETCH_FUNCS(S8_UINT_Z24_UNORM), { MESA_FORMAT_X8_UINT_Z24_UNORM, fetch_texel_1d_S8_UINT_Z24_UNORM, fetch_texel_2d_S8_UINT_Z24_UNORM, fetch_texel_3d_S8_UINT_Z24_UNORM }, - { - MESA_FORMAT_Z24_UNORM_S8_UINT, - fetch_texel_1d_Z24_UNORM_S8_UINT, - fetch_texel_2d_Z24_UNORM_S8_UINT, - fetch_texel_3d_Z24_UNORM_S8_UINT - }, + FETCH_FUNCS(Z24_UNORM_S8_UINT), { MESA_FORMAT_Z24_UNORM_X8_UINT, fetch_texel_1d_Z24_UNORM_S8_UINT, fetch_texel_2d_Z24_UNORM_S8_UINT, fetch_texel_3d_Z24_UNORM_S8_UINT }, - { - MESA_FORMAT_YCBCR, - fetch_texel_1d_YCBCR, - fetch_texel_2d_YCBCR, - fetch_texel_3d_YCBCR - }, - { - MESA_FORMAT_YCBCR_REV, - fetch_texel_1d_YCBCR_REV, - fetch_texel_2d_YCBCR_REV, - fetch_texel_3d_YCBCR_REV - }, - { - MESA_FORMAT_DUDV8, - fetch_texel_1d_DUDV8, - fetch_texel_2d_DUDV8, - fetch_texel_3d_DUDV8 - }, + FETCH_FUNCS(YCBCR), + FETCH_FUNCS(YCBCR_REV), + FETCH_FUNCS(DUDV8), /* Array unorm formats */ - { - MESA_FORMAT_A_UNORM8, - fetch_texel_1d_A_UNORM8, - fetch_texel_2d_A_UNORM8, - fetch_texel_3d_A_UNORM8 - }, - { - MESA_FORMAT_A_UNORM16, - fetch_texel_1d_A_UNORM16, - fetch_texel_2d_A_UNORM16, - fetch_texel_3d_A_UNORM16 - }, - { - MESA_FORMAT_L_UNORM8, - fetch_texel_1d_L_UNORM8, - fetch_texel_2d_L_UNORM8, - fetch_texel_3d_L_UNORM8 - }, - { - MESA_FORMAT_L_UNORM16, - fetch_texel_1d_L_UNORM16, - fetch_texel_2d_L_UNORM16, - fetch_texel_3d_L_UNORM16 - }, - { - MESA_FORMAT_I_UNORM8, - fetch_texel_1d_I_UNORM8, - fetch_texel_2d_I_UNORM8, - fetch_texel_3d_I_UNORM8 - }, - { - MESA_FORMAT_I_UNORM16, - fetch_texel_1d_I_UNORM16, - fetch_texel_2d_I_UNORM16, - fetch_texel_3d_I_UNORM16 - }, - { - MESA_FORMAT_R_UNORM8, - fetch_texel_1d_R_UNORM8, - fetch_texel_2d_R_UNORM8, - fetch_texel_3d_R_UNORM8 - }, - { - MESA_FORMAT_R_UNORM16, - fetch_texel_1d_R_UNORM16, - fetch_texel_2d_R_UNORM16, - fetch_texel_3d_R_UNORM16 - }, - { - MESA_FORMAT_BGR_UNORM8, - fetch_texel_1d_BGR_UNORM8, - fetch_texel_2d_BGR_UNORM8, - fetch_texel_3d_BGR_UNORM8 - }, - { - MESA_FORMAT_RGB_UNORM8, - fetch_texel_1d_RGB_UNORM8, - fetch_texel_2d_RGB_UNORM8, - fetch_texel_3d_RGB_UNORM8 - }, - { - MESA_FORMAT_RGBA_UNORM16, - fetch_texel_1d_RGBA_UNORM16, - fetch_texel_2d_RGBA_UNORM16, - fetch_texel_3d_RGBA_UNORM16 - }, - { - MESA_FORMAT_RGBX_UNORM16, - fetch_texel_1d_RGBX_UNORM16, - fetch_texel_2d_RGBX_UNORM16, - fetch_texel_3d_RGBX_UNORM16 - }, - { - MESA_FORMAT_Z_UNORM16, - fetch_texel_1d_Z_UNORM16, - fetch_texel_2d_Z_UNORM16, - fetch_texel_3d_Z_UNORM16 - }, - { - MESA_FORMAT_Z_UNORM32, - fetch_texel_1d_Z_UNORM32, - fetch_texel_2d_Z_UNORM32, - fetch_texel_3d_Z_UNORM32 - }, - { - MESA_FORMAT_S_UINT8, - NULL, - NULL, - NULL - }, + FETCH_FUNCS(A_UNORM8), + FETCH_FUNCS(A_UNORM16), + FETCH_FUNCS(L_UNORM8), + FETCH_FUNCS(L_UNORM16), + FETCH_FUNCS(I_UNORM8), + FETCH_FUNCS(I_UNORM16), + FETCH_FUNCS(R_UNORM8), + FETCH_FUNCS(R_UNORM16), + FETCH_FUNCS(BGR_UNORM8), + FETCH_FUNCS(RGB_UNORM8), + FETCH_FUNCS(RGBA_UNORM16), + FETCH_FUNCS(RGBX_UNORM16), + FETCH_FUNCS(Z_UNORM16), + FETCH_FUNCS(Z_UNORM32), + FETCH_NULL(S_UINT8), /* Packed signed/normalized formats */ - { - MESA_FORMAT_A8B8G8R8_SNORM, - fetch_texel_1d_A8B8G8R8_SNORM, - fetch_texel_2d_A8B8G8R8_SNORM, - fetch_texel_3d_A8B8G8R8_SNORM - }, - { - MESA_FORMAT_X8B8G8R8_SNORM, - fetch_texel_1d_X8B8G8R8_SNORM, - fetch_texel_2d_X8B8G8R8_SNORM, - fetch_texel_3d_X8B8G8R8_SNORM - }, - { - MESA_FORMAT_R8G8B8A8_SNORM, - fetch_texel_1d_R8G8B8A8_SNORM, - fetch_texel_2d_R8G8B8A8_SNORM, - fetch_texel_3d_R8G8B8A8_SNORM - }, - { - MESA_FORMAT_R8G8B8X8_SNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R16G16_SNORM, - fetch_texel_1d_R16G16_SNORM, - fetch_texel_2d_R16G16_SNORM, - fetch_texel_3d_R16G16_SNORM - }, - { - MESA_FORMAT_G16R16_SNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R8G8_SNORM, - fetch_texel_1d_R8G8_SNORM, - fetch_texel_2d_R8G8_SNORM, - fetch_texel_3d_R8G8_SNORM - }, - { - MESA_FORMAT_G8R8_SNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L8A8_SNORM, - fetch_texel_1d_L8A8_SNORM, - fetch_texel_2d_L8A8_SNORM, - fetch_texel_3d_L8A8_SNORM - }, + FETCH_FUNCS(A8B8G8R8_SNORM), + FETCH_FUNCS(X8B8G8R8_SNORM), + FETCH_FUNCS(R8G8B8A8_SNORM), + FETCH_NULL(R8G8B8X8_SNORM), + FETCH_FUNCS(R16G16_SNORM), + FETCH_NULL(G16R16_SNORM), + FETCH_FUNCS(R8G8_SNORM), + FETCH_NULL(G8R8_SNORM), + FETCH_FUNCS(L8A8_SNORM), /* Array signed/normalized formats */ - { - MESA_FORMAT_A_SNORM8, - fetch_texel_1d_A_SNORM8, - fetch_texel_2d_A_SNORM8, - fetch_texel_3d_A_SNORM8 - }, - { - MESA_FORMAT_A_SNORM16, - fetch_texel_1d_A_SNORM16, - fetch_texel_2d_A_SNORM16, - fetch_texel_3d_A_SNORM16 - }, - { - MESA_FORMAT_L_SNORM8, - fetch_texel_1d_L_SNORM8, - fetch_texel_2d_L_SNORM8, - fetch_texel_3d_L_SNORM8 - }, - { - MESA_FORMAT_L_SNORM16, - fetch_texel_1d_L_SNORM16, - fetch_texel_2d_L_SNORM16, - fetch_texel_3d_L_SNORM16 - }, - { - MESA_FORMAT_I_SNORM8, - fetch_texel_1d_I_SNORM8, - fetch_texel_2d_I_SNORM8, - fetch_texel_3d_I_SNORM8 - }, - { - MESA_FORMAT_I_SNORM16, - fetch_texel_1d_I_SNORM16, - fetch_texel_2d_I_SNORM16, - fetch_texel_3d_I_SNORM16 - }, - { - MESA_FORMAT_R_SNORM8, - fetch_texel_1d_R_SNORM8, - fetch_texel_2d_R_SNORM8, - fetch_texel_3d_R_SNORM8 - }, - { - MESA_FORMAT_R_SNORM16, - fetch_texel_1d_R_SNORM16, - fetch_texel_2d_R_SNORM16, - fetch_texel_3d_R_SNORM16 - }, - { - MESA_FORMAT_LA_SNORM16, - fetch_texel_1d_LA_SNORM16, - fetch_texel_2d_LA_SNORM16, - fetch_texel_3d_LA_SNORM16 - }, - { - MESA_FORMAT_RGB_SNORM16, - fetch_texel_1d_RGB_SNORM16, - fetch_texel_2d_RGB_SNORM16, - fetch_texel_3d_RGB_SNORM16 - }, - { - MESA_FORMAT_RGBA_SNORM16, - fetch_texel_1d_RGBA_SNORM16, - fetch_texel_2d_RGBA_SNORM16, - fetch_texel_3d_RGBA_SNORM16 - }, - { - MESA_FORMAT_RGBX_SNORM16, - NULL, - NULL, - NULL - }, + FETCH_FUNCS(A_SNORM8), + FETCH_FUNCS(A_SNORM16), + FETCH_FUNCS(L_SNORM8), + FETCH_FUNCS(L_SNORM16), + FETCH_FUNCS(I_SNORM8), + FETCH_FUNCS(I_SNORM16), + FETCH_FUNCS(R_SNORM8), + FETCH_FUNCS(R_SNORM16), + FETCH_FUNCS(LA_SNORM16), + FETCH_FUNCS(RGB_SNORM16), + FETCH_FUNCS(RGBA_SNORM16), + FETCH_NULL(RGBX_SNORM16), /* Packed sRGB formats */ - { - MESA_FORMAT_A8B8G8R8_SRGB, - fetch_texel_1d_A8B8G8R8_SRGB, - fetch_texel_2d_A8B8G8R8_SRGB, - fetch_texel_3d_A8B8G8R8_SRGB - }, - { - MESA_FORMAT_B8G8R8A8_SRGB, - fetch_texel_1d_B8G8R8A8_SRGB, - fetch_texel_2d_B8G8R8A8_SRGB, - fetch_texel_3d_B8G8R8A8_SRGB - }, - { - MESA_FORMAT_B8G8R8X8_SRGB, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R8G8B8A8_SRGB, - fetch_texel_1d_R8G8B8A8_SRGB, - fetch_texel_2d_R8G8B8A8_SRGB, - fetch_texel_3d_R8G8B8A8_SRGB - }, - { - MESA_FORMAT_R8G8B8X8_SRGB, - fetch_texel_1d_R8G8B8X8_SRGB, - fetch_texel_2d_R8G8B8X8_SRGB, - fetch_texel_3d_R8G8B8X8_SRGB - }, - { - MESA_FORMAT_L8A8_SRGB, - fetch_texel_1d_L8A8_SRGB, - fetch_texel_2d_L8A8_SRGB, - fetch_texel_3d_L8A8_SRGB - }, + FETCH_FUNCS(A8B8G8R8_SRGB), + FETCH_FUNCS(B8G8R8A8_SRGB), + FETCH_NULL(B8G8R8X8_SRGB), + FETCH_FUNCS(R8G8B8A8_SRGB), + FETCH_FUNCS(R8G8B8X8_SRGB), + FETCH_FUNCS(L8A8_SRGB), /* Array sRGB formats */ - { - MESA_FORMAT_L_SRGB8, - fetch_texel_1d_L_SRGB8, - fetch_texel_2d_L_SRGB8, - fetch_texel_3d_L_SRGB8 - }, - { - MESA_FORMAT_BGR_SRGB8, - fetch_texel_1d_BGR_SRGB8, - fetch_texel_2d_BGR_SRGB8, - fetch_texel_3d_BGR_SRGB8 - }, + FETCH_FUNCS(L_SRGB8), + FETCH_FUNCS(BGR_SRGB8), /* Packed float formats */ - { - MESA_FORMAT_R9G9B9E5_FLOAT, - fetch_texel_1d_R9G9B9E5_FLOAT, - fetch_texel_2d_R9G9B9E5_FLOAT, - fetch_texel_3d_R9G9B9E5_FLOAT - }, - { - MESA_FORMAT_R11G11B10_FLOAT, - fetch_texel_1d_R11G11B10_FLOAT, - fetch_texel_2d_R11G11B10_FLOAT, - fetch_texel_3d_R11G11B10_FLOAT - }, - { - MESA_FORMAT_Z32_FLOAT_S8X24_UINT, - fetch_texel_1d_Z32_FLOAT_S8X24_UINT, - fetch_texel_2d_Z32_FLOAT_S8X24_UINT, - fetch_texel_3d_Z32_FLOAT_S8X24_UINT - }, + FETCH_FUNCS(R9G9B9E5_FLOAT), + FETCH_FUNCS(R11G11B10_FLOAT), + FETCH_FUNCS(Z32_FLOAT_S8X24_UINT), /* Array float formats */ - { - MESA_FORMAT_A_FLOAT16, - fetch_texel_1d_A_FLOAT16, - fetch_texel_2d_A_FLOAT16, - fetch_texel_3d_A_FLOAT16 - }, - { - MESA_FORMAT_A_FLOAT32, - fetch_texel_1d_A_FLOAT32, - fetch_texel_2d_A_FLOAT32, - fetch_texel_3d_A_FLOAT32 - }, - { - MESA_FORMAT_L_FLOAT16, - fetch_texel_1d_L_FLOAT16, - fetch_texel_2d_L_FLOAT16, - fetch_texel_3d_L_FLOAT16 - }, - { - MESA_FORMAT_L_FLOAT32, - fetch_texel_1d_L_FLOAT32, - fetch_texel_2d_L_FLOAT32, - fetch_texel_3d_L_FLOAT32 - }, - { - MESA_FORMAT_LA_FLOAT16, - fetch_texel_1d_LA_FLOAT16, - fetch_texel_2d_LA_FLOAT16, - fetch_texel_3d_LA_FLOAT16 - }, - { - MESA_FORMAT_LA_FLOAT32, - fetch_texel_1d_LA_FLOAT32, - fetch_texel_2d_LA_FLOAT32, - fetch_texel_3d_LA_FLOAT32 - }, - { - MESA_FORMAT_I_FLOAT16, - fetch_texel_1d_I_FLOAT16, - fetch_texel_2d_I_FLOAT16, - fetch_texel_3d_I_FLOAT16 - }, - { - MESA_FORMAT_I_FLOAT32, - fetch_texel_1d_I_FLOAT32, - fetch_texel_2d_I_FLOAT32, - fetch_texel_3d_I_FLOAT32 - }, - { - MESA_FORMAT_R_FLOAT16, - fetch_texel_1d_R_FLOAT16, - fetch_texel_2d_R_FLOAT16, - fetch_texel_3d_R_FLOAT16 - }, - { - MESA_FORMAT_R_FLOAT32, - fetch_texel_1d_R_FLOAT32, - fetch_texel_2d_R_FLOAT32, - fetch_texel_3d_R_FLOAT32 - }, - { - MESA_FORMAT_RG_FLOAT16, - fetch_texel_1d_RG_FLOAT16, - fetch_texel_2d_RG_FLOAT16, - fetch_texel_3d_RG_FLOAT16 - }, - { - MESA_FORMAT_RG_FLOAT32, - fetch_texel_1d_RG_FLOAT32, - fetch_texel_2d_RG_FLOAT32, - fetch_texel_3d_RG_FLOAT32 - }, - { - MESA_FORMAT_RGB_FLOAT16, - fetch_texel_1d_RGB_FLOAT16, - fetch_texel_2d_RGB_FLOAT16, - fetch_texel_3d_RGB_FLOAT16 - }, - { - MESA_FORMAT_RGB_FLOAT32, - fetch_texel_1d_RGB_FLOAT32, - fetch_texel_2d_RGB_FLOAT32, - fetch_texel_3d_RGB_FLOAT32 - }, - { - MESA_FORMAT_RGBA_FLOAT16, - fetch_texel_1d_RGBA_FLOAT16, - fetch_texel_2d_RGBA_FLOAT16, - fetch_texel_3d_RGBA_FLOAT16 - }, - { - MESA_FORMAT_RGBA_FLOAT32, - fetch_texel_1d_RGBA_FLOAT32, - fetch_texel_2d_RGBA_FLOAT32, - fetch_texel_3d_RGBA_FLOAT32 - }, - { - MESA_FORMAT_RGBX_FLOAT16, - fetch_texel_1d_RGBX_FLOAT16, - fetch_texel_2d_RGBX_FLOAT16, - fetch_texel_3d_RGBX_FLOAT16 - }, - { - MESA_FORMAT_RGBX_FLOAT32, - fetch_texel_1d_RGBX_FLOAT32, - fetch_texel_2d_RGBX_FLOAT32, - fetch_texel_3d_RGBX_FLOAT32 - }, + FETCH_FUNCS(A_FLOAT16), + FETCH_FUNCS(A_FLOAT32), + FETCH_FUNCS(L_FLOAT16), + FETCH_FUNCS(L_FLOAT32), + FETCH_FUNCS(LA_FLOAT16), + FETCH_FUNCS(LA_FLOAT32), + FETCH_FUNCS(I_FLOAT16), + FETCH_FUNCS(I_FLOAT32), + FETCH_FUNCS(R_FLOAT16), + FETCH_FUNCS(R_FLOAT32), + FETCH_FUNCS(RG_FLOAT16), + FETCH_FUNCS(RG_FLOAT32), + FETCH_FUNCS(RGB_FLOAT16), + FETCH_FUNCS(RGB_FLOAT32), + FETCH_FUNCS(RGBA_FLOAT16), + FETCH_FUNCS(RGBA_FLOAT32), + FETCH_FUNCS(RGBX_FLOAT16), + FETCH_FUNCS(RGBX_FLOAT32), { MESA_FORMAT_Z_FLOAT32, fetch_texel_1d_R_FLOAT32, /* Reuse the R32F functions. */ @@ -783,344 +298,64 @@ texfetch_funcs[] = }, /* Packed signed/unsigned non-normalized integer formats */ - { - MESA_FORMAT_B10G10R10A2_UINT, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R10G10B10A2_UINT, - NULL, - NULL, - NULL - }, + FETCH_NULL(B10G10R10A2_UINT), + FETCH_NULL(R10G10B10A2_UINT), /* Array signed/unsigned non-normalized integer formats */ - { - MESA_FORMAT_A_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_A_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_I_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_L_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_LA_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RG_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_UINT8, - fetch_texel_1d_RGBA_UINT8, - fetch_texel_2d_RGBA_UINT8, - fetch_texel_3d_RGBA_UINT8 - }, - { - MESA_FORMAT_RGBA_UINT16, - fetch_texel_1d_RGBA_UINT16, - fetch_texel_2d_RGBA_UINT16, - fetch_texel_3d_RGBA_UINT16 - }, - { - MESA_FORMAT_RGBA_UINT32, - fetch_texel_1d_RGBA_UINT32, - fetch_texel_2d_RGBA_UINT32, - fetch_texel_3d_RGBA_UINT32 - }, - { - MESA_FORMAT_RGBA_SINT8, - fetch_texel_1d_RGBA_SINT8, - fetch_texel_2d_RGBA_SINT8, - fetch_texel_3d_RGBA_SINT8 - }, - { - MESA_FORMAT_RGBA_SINT16, - fetch_texel_1d_RGBA_SINT16, - fetch_texel_2d_RGBA_SINT16, - fetch_texel_3d_RGBA_SINT16 - }, - { - MESA_FORMAT_RGBA_SINT32, - fetch_texel_1d_RGBA_SINT32, - fetch_texel_2d_RGBA_SINT32, - fetch_texel_3d_RGBA_SINT32 - }, - { - MESA_FORMAT_RGBX_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_SINT32, - NULL, - NULL, - NULL - }, + FETCH_NULL(A_UINT8), + FETCH_NULL(A_UINT16), + FETCH_NULL(A_UINT32), + FETCH_NULL(A_SINT8), + FETCH_NULL(A_SINT16), + FETCH_NULL(A_SINT32), + FETCH_NULL(I_UINT8), + FETCH_NULL(I_UINT16), + FETCH_NULL(I_UINT32), + FETCH_NULL(I_SINT8), + FETCH_NULL(I_SINT16), + FETCH_NULL(I_SINT32), + FETCH_NULL(L_UINT8), + FETCH_NULL(L_UINT16), + FETCH_NULL(L_UINT32), + FETCH_NULL(L_SINT8), + FETCH_NULL(L_SINT16), + FETCH_NULL(L_SINT32), + FETCH_NULL(LA_UINT8), + FETCH_NULL(LA_UINT16), + FETCH_NULL(LA_UINT32), + FETCH_NULL(LA_SINT8), + FETCH_NULL(LA_SINT16), + FETCH_NULL(LA_SINT32), + FETCH_NULL(R_UINT8), + FETCH_NULL(R_UINT16), + FETCH_NULL(R_UINT32), + FETCH_NULL(R_SINT8), + FETCH_NULL(R_SINT16), + FETCH_NULL(R_SINT32), + FETCH_NULL(RG_UINT8), + FETCH_NULL(RG_UINT16), + FETCH_NULL(RG_UINT32), + FETCH_NULL(RG_SINT8), + FETCH_NULL(RG_SINT16), + FETCH_NULL(RG_SINT32), + FETCH_NULL(RGB_UINT8), + FETCH_NULL(RGB_UINT16), + FETCH_NULL(RGB_UINT32), + FETCH_NULL(RGB_SINT8), + FETCH_NULL(RGB_SINT16), + FETCH_NULL(RGB_SINT32), + FETCH_FUNCS(RGBA_UINT8), + FETCH_FUNCS(RGBA_UINT16), + FETCH_FUNCS(RGBA_UINT32), + FETCH_FUNCS(RGBA_SINT8), + FETCH_FUNCS(RGBA_SINT16), + FETCH_FUNCS(RGBA_SINT32), + FETCH_NULL(RGBX_UINT8), + FETCH_NULL(RGBX_UINT16), + FETCH_NULL(RGBX_UINT32), + FETCH_NULL(RGBX_SINT8), + FETCH_NULL(RGBX_SINT16), + FETCH_NULL(RGBX_SINT32), /* DXT compressed formats */ {