From da5722bea6e2f613933d3e3da214da8cd0047d2e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:09:23 -0600 Subject: mesa: use new look-up table to get texel fetch/store funcs --- src/mesa/main/texformat.c | 822 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 659 insertions(+), 163 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index c709004784..b6c0a252d3 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -34,6 +34,9 @@ #include "colormac.h" #include "context.h" +#include "texcompress.h" +#include "texcompress_fxt1.h" +#include "texcompress_s3tc.h" #include "texformat.h" #include "texstore.h" @@ -157,9 +160,9 @@ const struct gl_texture_format _mesa_texformat_rgba = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgba, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba /* StoreTexel */ }; @@ -181,9 +184,9 @@ const struct gl_texture_format _mesa_texformat_rgb = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgb, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb /* StoreTexel */ }; @@ -205,9 +208,9 @@ const struct gl_texture_format _mesa_texformat_alpha = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_alpha, /* FetchTexel1Df */ - fetch_texel_2d_f_alpha, /* FetchTexel2Df */ - fetch_texel_3d_f_alpha, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_alpha /* StoreTexel */ }; @@ -229,9 +232,9 @@ const struct gl_texture_format _mesa_texformat_luminance = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance, /* FetchTexel1Df */ - fetch_texel_2d_f_luminance, /* FetchTexel2Df */ - fetch_texel_3d_f_luminance, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance /* StoreTexel */ }; @@ -253,9 +256,9 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance_alpha, /* FetchTexel1Df */ - fetch_texel_2d_f_luminance_alpha, /* FetchTexel2Df */ - fetch_texel_3d_f_luminance_alpha, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_alpha /* StoreTexel */ }; @@ -277,9 +280,9 @@ const struct gl_texture_format _mesa_texformat_intensity = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_intensity, /* FetchTexel1Df */ - fetch_texel_2d_f_intensity, /* FetchTexel2Df */ - fetch_texel_3d_f_intensity, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_intensity /* StoreTexel */ }; @@ -304,9 +307,9 @@ const struct gl_texture_format _mesa_texformat_srgb8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_srgb8, /* FetchTexel1Df */ - fetch_texel_2d_srgb8, /* FetchTexel2Df */ - fetch_texel_3d_srgb8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_srgb8 /* StoreTexel */ }; @@ -328,9 +331,9 @@ const struct gl_texture_format _mesa_texformat_srgba8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_srgba8, /* FetchTexel1Df */ - fetch_texel_2d_srgba8, /* FetchTexel2Df */ - fetch_texel_3d_srgba8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_srgba8 /* StoreTexel */ }; @@ -352,9 +355,9 @@ const struct gl_texture_format _mesa_texformat_sargb8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_sargb8, /* FetchTexel1Df */ - fetch_texel_2d_sargb8, /* FetchTexel2Df */ - fetch_texel_3d_sargb8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_sargb8 /* StoreTexel */ }; @@ -376,9 +379,9 @@ const struct gl_texture_format _mesa_texformat_sl8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_sl8, /* FetchTexel1Df */ - fetch_texel_2d_sl8, /* FetchTexel2Df */ - fetch_texel_3d_sl8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_sl8 /* StoreTexel */ }; @@ -401,9 +404,9 @@ const struct gl_texture_format _mesa_texformat_sla8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_sla8, /* FetchTexel1Df */ - fetch_texel_2d_sla8, /* FetchTexel2Df */ - fetch_texel_3d_sla8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_sla8 /* StoreTexel */ }; @@ -427,9 +430,9 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_rgba_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_rgba_f32 /* StoreTexel */ }; @@ -451,9 +454,9 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_rgba_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_rgba_f16 /* StoreTexel */ }; @@ -475,9 +478,9 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_rgb_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_rgb_f32 /* StoreTexel */ }; @@ -499,9 +502,9 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_rgb_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_rgb_f16 /* StoreTexel */ }; @@ -523,9 +526,9 @@ const struct gl_texture_format _mesa_texformat_alpha_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_alpha_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_alpha_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_alpha_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_alpha_f32 /* StoreTexel */ }; @@ -547,9 +550,9 @@ const struct gl_texture_format _mesa_texformat_alpha_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_alpha_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_alpha_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_alpha_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_alpha_f16 /* StoreTexel */ }; @@ -571,9 +574,9 @@ const struct gl_texture_format _mesa_texformat_luminance_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_luminance_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_luminance_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_f32 /* StoreTexel */ }; @@ -595,9 +598,9 @@ const struct gl_texture_format _mesa_texformat_luminance_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_luminance_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_luminance_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_f16 /* StoreTexel */ }; @@ -619,9 +622,9 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */ - fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */ - fetch_texel_3d_f_luminance_alpha_f32,/* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_alpha_f32 /* StoreTexel */ }; @@ -643,9 +646,9 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */ - fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */ - fetch_texel_3d_f_luminance_alpha_f16,/* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_alpha_f16 /* StoreTexel */ }; @@ -667,9 +670,9 @@ const struct gl_texture_format _mesa_texformat_intensity_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_intensity_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_intensity_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_intensity_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_intensity_f32 /* StoreTexel */ }; @@ -691,9 +694,9 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_intensity_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_intensity_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_intensity_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_intensity_f16 /* StoreTexel */ }; @@ -717,9 +720,9 @@ const struct gl_texture_format _mesa_texformat_dudv8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_dudv8, /* FetchTexel1Df */ - fetch_texel_2d_dudv8, /* FetchTexel2Df */ - fetch_texel_3d_dudv8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -741,9 +744,9 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_signed_rgba8888, /* FetchTexel1Df */ - fetch_texel_2d_signed_rgba8888, /* FetchTexel2Df */ - fetch_texel_3d_signed_rgba8888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_signed_rgba8888 /* StoreTexel */ }; @@ -765,9 +768,9 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_signed_rgba8888_rev, /* FetchTexel1Df */ - fetch_texel_2d_signed_rgba8888_rev, /* FetchTexel2Df */ - fetch_texel_3d_signed_rgba8888_rev, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_signed_rgba8888_rev /* StoreTexel */ }; @@ -796,9 +799,9 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgba8888, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba8888, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba8888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba8888 /* StoreTexel */ }; @@ -820,9 +823,9 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgba8888_rev, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba8888_rev, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba8888_rev, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba8888_rev /* StoreTexel */ }; @@ -844,9 +847,9 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_argb8888, /* FetchTexel1Df */ - fetch_texel_2d_f_argb8888, /* FetchTexel2Df */ - fetch_texel_3d_f_argb8888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb8888 /* StoreTexel */ }; @@ -868,9 +871,9 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_argb8888_rev, /* FetchTexel1Df */ - fetch_texel_2d_f_argb8888_rev, /* FetchTexel2Df */ - fetch_texel_3d_f_argb8888_rev, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb8888_rev /* StoreTexel */ }; @@ -892,9 +895,9 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgb888, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb888, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb888 /* StoreTexel */ }; @@ -916,9 +919,9 @@ const struct gl_texture_format _mesa_texformat_bgr888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_bgr888, /* FetchTexel1Df */ - fetch_texel_2d_f_bgr888, /* FetchTexel2Df */ - fetch_texel_3d_f_bgr888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_bgr888 /* StoreTexel */ }; @@ -940,9 +943,9 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgb565, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb565, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb565, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb565 /* StoreTexel */ }; @@ -964,9 +967,9 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgb565_rev, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb565_rev, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb565_rev, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb565_rev /* StoreTexel */ }; @@ -988,9 +991,9 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgba4444, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba4444, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba4444, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba4444 /* StoreTexel */ }; @@ -1012,9 +1015,9 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_argb4444, /* FetchTexel1Df */ - fetch_texel_2d_f_argb4444, /* FetchTexel2Df */ - fetch_texel_3d_f_argb4444, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb4444 /* StoreTexel */ }; @@ -1036,9 +1039,9 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_argb4444_rev, /* FetchTexel1Df */ - fetch_texel_2d_f_argb4444_rev, /* FetchTexel2Df */ - fetch_texel_3d_f_argb4444_rev, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb4444_rev /* StoreTexel */ }; @@ -1060,9 +1063,9 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgba5551, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba5551, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba5551, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba5551 /* StoreTexel */ }; @@ -1084,9 +1087,9 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_argb1555, /* FetchTexel1Df */ - fetch_texel_2d_f_argb1555, /* FetchTexel2Df */ - fetch_texel_3d_f_argb1555, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb1555 /* StoreTexel */ }; @@ -1108,9 +1111,9 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_argb1555_rev, /* FetchTexel1Df */ - fetch_texel_2d_f_argb1555_rev, /* FetchTexel2Df */ - fetch_texel_3d_f_argb1555_rev, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb1555_rev /* StoreTexel */ }; @@ -1132,9 +1135,9 @@ const struct gl_texture_format _mesa_texformat_al88 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_al88, /* FetchTexel1Df */ - fetch_texel_2d_f_al88, /* FetchTexel2Df */ - fetch_texel_3d_f_al88, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_al88 /* StoreTexel */ }; @@ -1156,9 +1159,9 @@ const struct gl_texture_format _mesa_texformat_al88_rev = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_al88_rev, /* FetchTexel1Df */ - fetch_texel_2d_f_al88_rev, /* FetchTexel2Df */ - fetch_texel_3d_f_al88_rev, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_al88_rev /* StoreTexel */ }; @@ -1180,9 +1183,9 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgb332, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb332, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb332, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb332 /* StoreTexel */ }; @@ -1204,9 +1207,9 @@ const struct gl_texture_format _mesa_texformat_a8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_a8, /* FetchTexel1Df */ - fetch_texel_2d_f_a8, /* FetchTexel2Df */ - fetch_texel_3d_f_a8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_a8 /* StoreTexel */ }; @@ -1228,9 +1231,9 @@ const struct gl_texture_format _mesa_texformat_l8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_l8, /* FetchTexel1Df */ - fetch_texel_2d_f_l8, /* FetchTexel2Df */ - fetch_texel_3d_f_l8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_l8 /* StoreTexel */ }; @@ -1252,9 +1255,9 @@ const struct gl_texture_format _mesa_texformat_i8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_i8, /* FetchTexel1Df */ - fetch_texel_2d_f_i8, /* FetchTexel2Df */ - fetch_texel_3d_f_i8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_i8 /* StoreTexel */ }; @@ -1276,9 +1279,9 @@ const struct gl_texture_format _mesa_texformat_ci8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_ci8, /* FetchTexel1Df */ - fetch_texel_2d_f_ci8, /* FetchTexel2Df */ - fetch_texel_3d_f_ci8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_ci8 /* StoreTexel */ }; @@ -1300,9 +1303,9 @@ const struct gl_texture_format _mesa_texformat_ycbcr = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_ycbcr, /* FetchTexel1Df */ - fetch_texel_2d_f_ycbcr, /* FetchTexel2Df */ - fetch_texel_3d_f_ycbcr, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_ycbcr /* StoreTexel */ }; @@ -1324,9 +1327,9 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_ycbcr_rev, /* FetchTexel1Df */ - fetch_texel_2d_f_ycbcr_rev, /* FetchTexel2Df */ - fetch_texel_3d_f_ycbcr_rev, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_ycbcr_rev /* StoreTexel */ }; @@ -1348,9 +1351,9 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_z24_s8, /* FetchTexel1Df */ - fetch_texel_2d_f_z24_s8, /* FetchTexel2Df */ - fetch_texel_3d_f_z24_s8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_z24_s8 /* StoreTexel */ }; @@ -1372,9 +1375,9 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_s8_z24, /* FetchTexel1Df */ - fetch_texel_2d_f_s8_z24, /* FetchTexel2Df */ - fetch_texel_3d_f_s8_z24, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_s8_z24 /* StoreTexel */ }; @@ -1396,9 +1399,9 @@ const struct gl_texture_format _mesa_texformat_z16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_z16, /* FetchTexel1Df */ - fetch_texel_2d_f_z16, /* FetchTexel2Df */ - fetch_texel_3d_f_z16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_z16 /* StoreTexel */ }; @@ -1420,9 +1423,9 @@ const struct gl_texture_format _mesa_texformat_z32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_z32, /* FetchTexel1Df */ - fetch_texel_2d_f_z32, /* FetchTexel2Df */ - fetch_texel_3d_f_z32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_z32 /* StoreTexel */ }; @@ -1449,11 +1452,11 @@ const struct gl_texture_format _mesa_null_texformat = { 0, /* TexelBytes */ NULL, /* StoreTexImageFunc */ fetch_null_texel, /* FetchTexel1D */ - fetch_null_texel, /* FetchTexel2D */ - fetch_null_texel, /* FetchTexel3D */ + fetch_null_texel, /* FetchTexel1D */ + fetch_null_texel, /* FetchTexel1D */ + fetch_null_texelf, /* FetchTexel1Df */ + fetch_null_texelf, /* FetchTexel1Df */ fetch_null_texelf, /* FetchTexel1Df */ - fetch_null_texelf, /* FetchTexel2Df */ - fetch_null_texelf, /* FetchTexel3Df */ store_null_texel /* StoreTexel */ }; @@ -1987,3 +1990,496 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, *comps = 1; } } + + + +/** + * Table to map MESA_FORMAT_ to texel fetch/store funcs. + * XXX this is somewhat temporary. + */ +static struct { + GLuint Name; + FetchTexelFuncF Fetch1D; + FetchTexelFuncF Fetch2D; + FetchTexelFuncF Fetch3D; + StoreTexelFunc StoreTexel; +} +texfetch_funcs[MESA_FORMAT_COUNT] = +{ + { + MESA_FORMAT_RGBA, + fetch_texel_1d_f_rgba, + fetch_texel_2d_f_rgba, + fetch_texel_3d_f_rgba, + store_texel_rgba + }, + { + MESA_FORMAT_RGB, + fetch_texel_1d_f_rgb, + fetch_texel_2d_f_rgb, + fetch_texel_3d_f_rgb, + store_texel_rgb + }, + { + MESA_FORMAT_ALPHA, + fetch_texel_1d_f_alpha, + fetch_texel_2d_f_alpha, + fetch_texel_3d_f_alpha, + store_texel_alpha + }, + { + MESA_FORMAT_LUMINANCE, + fetch_texel_1d_f_luminance, + fetch_texel_2d_f_luminance, + fetch_texel_3d_f_luminance, + store_texel_luminance + }, + { + MESA_FORMAT_LUMINANCE_ALPHA, + fetch_texel_1d_f_luminance_alpha, + fetch_texel_2d_f_luminance_alpha, + fetch_texel_3d_f_luminance_alpha, + store_texel_luminance_alpha + }, + { + MESA_FORMAT_INTENSITY, + fetch_texel_1d_f_intensity, + fetch_texel_2d_f_intensity, + fetch_texel_3d_f_intensity, + store_texel_intensity + }, + { + MESA_FORMAT_SRGB8, + fetch_texel_1d_srgb8, + fetch_texel_2d_srgb8, + fetch_texel_3d_srgb8, + store_texel_srgb8 + }, + { + MESA_FORMAT_SRGBA8, + fetch_texel_1d_srgba8, + fetch_texel_2d_srgba8, + fetch_texel_3d_srgba8, + store_texel_srgba8 + }, + { + MESA_FORMAT_SARGB8, + fetch_texel_1d_sargb8, + fetch_texel_2d_sargb8, + fetch_texel_3d_sargb8, + store_texel_sargb8 + }, + { + MESA_FORMAT_SL8, + fetch_texel_1d_sl8, + fetch_texel_2d_sl8, + fetch_texel_3d_sl8, + store_texel_sl8 + }, + { + MESA_FORMAT_SLA8, + fetch_texel_1d_sla8, + fetch_texel_2d_sla8, + fetch_texel_3d_sla8, + store_texel_sla8 + }, + { + MESA_FORMAT_RGB_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt5, + NULL, + NULL + }, + { + MESA_FORMAT_SRGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt5, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FLOAT32, + fetch_texel_1d_f_rgba_f32, + fetch_texel_2d_f_rgba_f32, + fetch_texel_3d_f_rgba_f32, + store_texel_rgba_f32 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + fetch_texel_1d_f_rgba_f16, + fetch_texel_2d_f_rgba_f16, + fetch_texel_3d_f_rgba_f16, + store_texel_rgba_f16 + }, + { + MESA_FORMAT_RGB_FLOAT32, + fetch_texel_1d_f_rgb_f32, + fetch_texel_2d_f_rgb_f32, + fetch_texel_3d_f_rgb_f32, + store_texel_rgb_f32 + }, + { + MESA_FORMAT_RGB_FLOAT16, + fetch_texel_1d_f_rgb_f16, + fetch_texel_2d_f_rgb_f16, + fetch_texel_3d_f_rgb_f16, + store_texel_rgb_f16 + }, + { + MESA_FORMAT_ALPHA_FLOAT32, + fetch_texel_1d_f_alpha_f32, + fetch_texel_2d_f_alpha_f32, + fetch_texel_3d_f_alpha_f32, + store_texel_alpha_f32 + }, + { + MESA_FORMAT_ALPHA_FLOAT16, + fetch_texel_1d_f_alpha_f16, + fetch_texel_2d_f_alpha_f16, + fetch_texel_3d_f_alpha_f16, + store_texel_alpha_f16 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT32, + fetch_texel_1d_f_luminance_f32, + fetch_texel_2d_f_luminance_f32, + fetch_texel_3d_f_luminance_f32, + store_texel_luminance_f32 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT16, + fetch_texel_1d_f_luminance_f16, + fetch_texel_2d_f_luminance_f16, + fetch_texel_3d_f_luminance_f16, + store_texel_luminance_f16 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, + fetch_texel_1d_f_luminance_alpha_f32, + fetch_texel_2d_f_luminance_alpha_f32, + fetch_texel_3d_f_luminance_alpha_f32, + store_texel_luminance_alpha_f32 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, + fetch_texel_1d_f_luminance_alpha_f16, + fetch_texel_2d_f_luminance_alpha_f16, + fetch_texel_3d_f_luminance_alpha_f16, + store_texel_luminance_alpha_f16 + }, + { + MESA_FORMAT_INTENSITY_FLOAT32, + fetch_texel_1d_f_intensity_f32, + fetch_texel_2d_f_intensity_f32, + fetch_texel_3d_f_intensity_f32, + store_texel_intensity_f32 + }, + { + MESA_FORMAT_INTENSITY_FLOAT16, + fetch_texel_1d_f_intensity_f16, + fetch_texel_2d_f_intensity_f16, + fetch_texel_3d_f_intensity_f16, + store_texel_intensity_f16 + }, + { + MESA_FORMAT_DUDV8, + fetch_texel_1d_dudv8, + fetch_texel_2d_dudv8, + fetch_texel_3d_dudv8, + NULL + }, + { + MESA_FORMAT_SIGNED_RGBA8888, + fetch_texel_1d_signed_rgba8888, + fetch_texel_2d_signed_rgba8888, + fetch_texel_3d_signed_rgba8888, + store_texel_signed_rgba8888 + }, + { + MESA_FORMAT_SIGNED_RGBA8888_REV, + fetch_texel_1d_signed_rgba8888_rev, + fetch_texel_2d_signed_rgba8888_rev, + fetch_texel_3d_signed_rgba8888_rev, + store_texel_signed_rgba8888_rev + }, + { + MESA_FORMAT_RGBA8888, + fetch_texel_1d_f_rgba8888, + fetch_texel_2d_f_rgba8888, + fetch_texel_3d_f_rgba8888, + store_texel_rgba8888 + }, + { + MESA_FORMAT_RGBA8888_REV, + fetch_texel_1d_f_rgba8888_rev, + fetch_texel_2d_f_rgba8888_rev, + fetch_texel_3d_f_rgba8888_rev, + store_texel_rgba8888_rev + }, + { + MESA_FORMAT_ARGB8888, + fetch_texel_1d_f_argb8888, + fetch_texel_2d_f_argb8888, + fetch_texel_3d_f_argb8888, + store_texel_argb8888 + }, + { + MESA_FORMAT_ARGB8888_REV, + fetch_texel_1d_f_argb8888_rev, + fetch_texel_2d_f_argb8888_rev, + fetch_texel_3d_f_argb8888_rev, + store_texel_argb8888_rev + }, + { + MESA_FORMAT_RGB888, + fetch_texel_1d_f_rgb888, + fetch_texel_2d_f_rgb888, + fetch_texel_3d_f_rgb888, + store_texel_rgb888 + }, + { + MESA_FORMAT_BGR888, + fetch_texel_1d_f_bgr888, + fetch_texel_2d_f_bgr888, + fetch_texel_3d_f_bgr888, + store_texel_bgr888 + }, + { + MESA_FORMAT_RGB565, + fetch_texel_1d_f_rgb565, + fetch_texel_2d_f_rgb565, + fetch_texel_3d_f_rgb565, + store_texel_rgb565 + }, + { + MESA_FORMAT_RGB565_REV, + fetch_texel_1d_f_rgb565_rev, + fetch_texel_2d_f_rgb565_rev, + fetch_texel_3d_f_rgb565_rev, + store_texel_rgb565_rev + }, + { + MESA_FORMAT_RGBA4444, + fetch_texel_1d_f_rgba4444, + fetch_texel_2d_f_rgba4444, + fetch_texel_3d_f_rgba4444, + store_texel_rgba4444 + }, + { + MESA_FORMAT_ARGB4444, + fetch_texel_1d_f_argb4444, + fetch_texel_2d_f_argb4444, + fetch_texel_3d_f_argb4444, + store_texel_argb4444 + }, + { + MESA_FORMAT_ARGB4444_REV, + fetch_texel_1d_f_argb4444_rev, + fetch_texel_2d_f_argb4444_rev, + fetch_texel_3d_f_argb4444_rev, + store_texel_argb4444_rev + }, + { + MESA_FORMAT_RGBA5551, + fetch_texel_1d_f_rgba5551, + fetch_texel_2d_f_rgba5551, + fetch_texel_3d_f_rgba5551, + store_texel_rgba5551 + }, + { + MESA_FORMAT_ARGB1555, + fetch_texel_1d_f_argb1555, + fetch_texel_2d_f_argb1555, + fetch_texel_3d_f_argb1555, + store_texel_argb1555 + }, + { + MESA_FORMAT_ARGB1555_REV, + fetch_texel_1d_f_argb1555_rev, + fetch_texel_2d_f_argb1555_rev, + fetch_texel_3d_f_argb1555_rev, + store_texel_argb1555_rev + }, + { + MESA_FORMAT_AL88, + fetch_texel_1d_f_al88, + fetch_texel_2d_f_al88, + fetch_texel_3d_f_al88, + store_texel_al88 + }, + { + MESA_FORMAT_AL88_REV, + fetch_texel_1d_f_al88_rev, + fetch_texel_2d_f_al88_rev, + fetch_texel_3d_f_al88_rev, + store_texel_al88_rev + }, + { + MESA_FORMAT_RGB332, + fetch_texel_1d_f_rgb332, + fetch_texel_2d_f_rgb332, + fetch_texel_3d_f_rgb332, + store_texel_rgb332 + }, + { + MESA_FORMAT_A8, + fetch_texel_1d_f_a8, + fetch_texel_2d_f_a8, + fetch_texel_3d_f_a8, + store_texel_a8 + }, + { + MESA_FORMAT_L8, + fetch_texel_1d_f_l8, + fetch_texel_2d_f_l8, + fetch_texel_3d_f_l8, + store_texel_l8 + }, + { + MESA_FORMAT_I8, + fetch_texel_1d_f_i8, + fetch_texel_2d_f_i8, + fetch_texel_3d_f_i8, + store_texel_i8 + }, + { + MESA_FORMAT_CI8, + fetch_texel_1d_f_ci8, + fetch_texel_2d_f_ci8, + fetch_texel_3d_f_ci8, + store_texel_ci8 + }, + { + MESA_FORMAT_YCBCR, + fetch_texel_1d_f_ycbcr, + fetch_texel_2d_f_ycbcr, + fetch_texel_3d_f_ycbcr, + store_texel_ycbcr + }, + { + MESA_FORMAT_YCBCR_REV, + fetch_texel_1d_f_ycbcr_rev, + fetch_texel_2d_f_ycbcr_rev, + fetch_texel_3d_f_ycbcr_rev, + store_texel_ycbcr_rev + }, + { + MESA_FORMAT_Z24_S8, + fetch_texel_1d_f_z24_s8, + fetch_texel_2d_f_z24_s8, + fetch_texel_3d_f_z24_s8, + store_texel_z24_s8 + }, + { + MESA_FORMAT_S8_Z24, + fetch_texel_1d_f_s8_z24, + fetch_texel_2d_f_s8_z24, + fetch_texel_3d_f_s8_z24, + store_texel_s8_z24 + }, + { + MESA_FORMAT_Z16, + fetch_texel_1d_f_z16, + fetch_texel_2d_f_z16, + fetch_texel_3d_f_z16, + store_texel_z16 + }, + { + MESA_FORMAT_Z32, + fetch_texel_1d_f_z32, + fetch_texel_2d_f_z32, + fetch_texel_3d_f_z32, + store_texel_z32 + } +}; + + +FetchTexelFuncF +_mesa_get_texel_fetch_func(GLuint format, GLuint dims) +{ + GLuint i; + /* XXX replace loop with direct table lookup */ + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texfetch_funcs[i].Name == format) { + switch (dims) { + case 1: + return texfetch_funcs[i].Fetch1D; + case 2: + return texfetch_funcs[i].Fetch2D; + case 3: + return texfetch_funcs[i].Fetch3D; + } + } + } + return NULL; +} + + +StoreTexelFunc +_mesa_get_texel_store_func(GLuint format) +{ + GLuint i; + /* XXX replace loop with direct table lookup */ + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texfetch_funcs[i].Name == format) { + return texfetch_funcs[i].StoreTexel; + } + } + return NULL; +} -- cgit v1.2.3 From 431ba64222ad5365dfcdac1f06d80f0e7a26dbfd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:17:32 -0600 Subject: mesa: use _mesa_get_texel_store_func() --- src/mesa/main/texformat.c | 104 +++++++++++++++++++++++----------------------- src/mesa/main/texrender.c | 2 +- 2 files changed, 53 insertions(+), 53 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index b6c0a252d3..85a7fe6e2c 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -163,7 +163,7 @@ const struct gl_texture_format _mesa_texformat_rgba = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb = { @@ -187,7 +187,7 @@ const struct gl_texture_format _mesa_texformat_rgb = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha = { @@ -211,7 +211,7 @@ const struct gl_texture_format _mesa_texformat_alpha = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_alpha /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance = { @@ -235,7 +235,7 @@ const struct gl_texture_format _mesa_texformat_luminance = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha = { @@ -259,7 +259,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_alpha /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity = { @@ -283,7 +283,7 @@ const struct gl_texture_format _mesa_texformat_intensity = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_intensity /* StoreTexel */ + NULL /* StoreTexel */ }; @@ -310,7 +310,7 @@ const struct gl_texture_format _mesa_texformat_srgb8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_srgb8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba8 = { @@ -334,7 +334,7 @@ const struct gl_texture_format _mesa_texformat_srgba8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_srgba8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_sargb8 = { @@ -358,7 +358,7 @@ const struct gl_texture_format _mesa_texformat_sargb8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_sargb8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_sl8 = { @@ -382,7 +382,7 @@ const struct gl_texture_format _mesa_texformat_sl8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_sl8 /* StoreTexel */ + NULL /* StoreTexel */ }; /* Note: this format name looks like a misnomer, make it sal8? */ @@ -407,7 +407,7 @@ const struct gl_texture_format _mesa_texformat_sla8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_sla8 /* StoreTexel */ + NULL /* StoreTexel */ }; #endif /* FEATURE_EXT_texture_sRGB */ @@ -433,7 +433,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_rgba_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_float16 = { @@ -457,7 +457,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_rgba_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float32 = { @@ -481,7 +481,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_rgb_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float16 = { @@ -505,7 +505,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_rgb_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float32 = { @@ -529,7 +529,7 @@ const struct gl_texture_format _mesa_texformat_alpha_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_alpha_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float16 = { @@ -553,7 +553,7 @@ const struct gl_texture_format _mesa_texformat_alpha_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_alpha_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float32 = { @@ -577,7 +577,7 @@ const struct gl_texture_format _mesa_texformat_luminance_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float16 = { @@ -601,7 +601,7 @@ const struct gl_texture_format _mesa_texformat_luminance_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { @@ -625,7 +625,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_alpha_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { @@ -649,7 +649,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_alpha_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float32 = { @@ -673,7 +673,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_intensity_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float16 = { @@ -697,7 +697,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_intensity_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_dudv8 = { @@ -747,7 +747,7 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_signed_rgba8888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { @@ -771,7 +771,7 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_signed_rgba8888_rev /* StoreTexel */ + NULL /* StoreTexel */ }; /*@}*/ @@ -802,7 +802,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba8888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba8888_rev = { @@ -826,7 +826,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba8888_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888 = { @@ -850,7 +850,7 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb8888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888_rev = { @@ -874,7 +874,7 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb8888_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb888 = { @@ -898,7 +898,7 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_bgr888 = { @@ -922,7 +922,7 @@ const struct gl_texture_format _mesa_texformat_bgr888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_bgr888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565 = { @@ -946,7 +946,7 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb565 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565_rev = { @@ -970,7 +970,7 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb565_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba4444 = { @@ -994,7 +994,7 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba4444 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444 = { @@ -1018,7 +1018,7 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb4444 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444_rev = { @@ -1042,7 +1042,7 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb4444_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba5551 = { @@ -1066,7 +1066,7 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba5551 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555 = { @@ -1090,7 +1090,7 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb1555 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555_rev = { @@ -1114,7 +1114,7 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb1555_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88 = { @@ -1138,7 +1138,7 @@ const struct gl_texture_format _mesa_texformat_al88 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_al88 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88_rev = { @@ -1162,7 +1162,7 @@ const struct gl_texture_format _mesa_texformat_al88_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_al88_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb332 = { @@ -1186,7 +1186,7 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb332 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_a8 = { @@ -1210,7 +1210,7 @@ const struct gl_texture_format _mesa_texformat_a8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_a8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_l8 = { @@ -1234,7 +1234,7 @@ const struct gl_texture_format _mesa_texformat_l8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_l8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_i8 = { @@ -1258,7 +1258,7 @@ const struct gl_texture_format _mesa_texformat_i8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_i8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ci8 = { @@ -1282,7 +1282,7 @@ const struct gl_texture_format _mesa_texformat_ci8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_ci8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr = { @@ -1306,7 +1306,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_ycbcr /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr_rev = { @@ -1330,7 +1330,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_ycbcr_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z24_s8 = { @@ -1354,7 +1354,7 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_z24_s8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_s8_z24 = { @@ -1378,7 +1378,7 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_s8_z24 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z16 = { @@ -1402,7 +1402,7 @@ const struct gl_texture_format _mesa_texformat_z16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_z16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z32 = { @@ -1426,7 +1426,7 @@ const struct gl_texture_format _mesa_texformat_z32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_z32 /* StoreTexel */ + NULL /* StoreTexel */ }; /*@}*/ diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 53be83b05c..50e09c5d15 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -469,7 +469,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; ASSERT(trb->TexImage); - trb->Store = trb->TexImage->TexFormat->StoreTexel; + trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat->MesaFormat); if (!trb->Store) { /* we'll never draw into some textures (compressed formats) */ trb->Store = store_nop; -- cgit v1.2.3 From 8abb984dc93235e00b5006187bf177da5db257e1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:19:24 -0600 Subject: mesa: null-out StoreTexImageFunc fields --- src/mesa/main/texformat.c | 106 +++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 53 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 85a7fe6e2c..2169d294c6 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -156,7 +156,7 @@ const struct gl_texture_format _mesa_texformat_rgba = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -180,7 +180,7 @@ const struct gl_texture_format _mesa_texformat_rgb = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -204,7 +204,7 @@ const struct gl_texture_format _mesa_texformat_alpha = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -228,7 +228,7 @@ const struct gl_texture_format _mesa_texformat_luminance = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -252,7 +252,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -276,7 +276,7 @@ const struct gl_texture_format _mesa_texformat_intensity = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -303,7 +303,7 @@ const struct gl_texture_format _mesa_texformat_srgb8 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - _mesa_texstore_srgb8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -327,7 +327,7 @@ const struct gl_texture_format _mesa_texformat_srgba8 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_srgba8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -351,7 +351,7 @@ const struct gl_texture_format _mesa_texformat_sargb8 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_sargb8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -375,7 +375,7 @@ const struct gl_texture_format _mesa_texformat_sl8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_sl8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -400,7 +400,7 @@ const struct gl_texture_format _mesa_texformat_sla8 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_sla8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -426,7 +426,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -450,7 +450,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -474,7 +474,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -498,7 +498,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -522,7 +522,7 @@ const struct gl_texture_format _mesa_texformat_alpha_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -546,7 +546,7 @@ const struct gl_texture_format _mesa_texformat_alpha_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -570,7 +570,7 @@ const struct gl_texture_format _mesa_texformat_luminance_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -594,7 +594,7 @@ const struct gl_texture_format _mesa_texformat_luminance_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -618,7 +618,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -642,7 +642,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -666,7 +666,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -690,7 +690,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -716,7 +716,7 @@ const struct gl_texture_format _mesa_texformat_dudv8 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_dudv8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -740,7 +740,7 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -764,7 +764,7 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -795,7 +795,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_rgba8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -819,7 +819,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_rgba8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -843,7 +843,7 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_argb8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -867,7 +867,7 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_argb8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -891,7 +891,7 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - _mesa_texstore_rgb888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -915,7 +915,7 @@ const struct gl_texture_format _mesa_texformat_bgr888 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - _mesa_texstore_bgr888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -939,7 +939,7 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_rgb565, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -963,7 +963,7 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_rgb565, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -987,7 +987,7 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_rgba4444, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1011,7 +1011,7 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_argb4444, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1035,7 +1035,7 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_argb4444, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1059,7 +1059,7 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_rgba5551, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1083,7 +1083,7 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_argb1555, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1107,7 +1107,7 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_argb1555, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1131,7 +1131,7 @@ const struct gl_texture_format _mesa_texformat_al88 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_al88, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1155,7 +1155,7 @@ const struct gl_texture_format _mesa_texformat_al88_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_al88, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1179,7 +1179,7 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_rgb332, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1203,7 +1203,7 @@ const struct gl_texture_format _mesa_texformat_a8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_a8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1227,7 +1227,7 @@ const struct gl_texture_format _mesa_texformat_l8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1251,7 +1251,7 @@ const struct gl_texture_format _mesa_texformat_i8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1275,7 +1275,7 @@ const struct gl_texture_format _mesa_texformat_ci8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_ci8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1299,7 +1299,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_ycbcr, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1323,7 +1323,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_ycbcr, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1347,7 +1347,7 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { 24, /* DepthBits */ 8, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_z24_s8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1371,7 +1371,7 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { 24, /* DepthBits */ 8, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_s8_z24, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1395,7 +1395,7 @@ const struct gl_texture_format _mesa_texformat_z16 = { sizeof(GLushort) * 8, /* DepthBits */ 0, /* StencilBits */ sizeof(GLushort), /* TexelBytes */ - _mesa_texstore_z16, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -1419,7 +1419,7 @@ const struct gl_texture_format _mesa_texformat_z32 = { sizeof(GLuint) * 8, /* DepthBits */ 0, /* StencilBits */ sizeof(GLuint), /* TexelBytes */ - _mesa_texstore_z32, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ -- cgit v1.2.3 From 27e201e9c4dd66bbf8fd2bc3ac3292550b94a14a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:49:14 -0600 Subject: mesa: rework null texel fetch/store funcs --- src/mesa/main/texformat.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 2169d294c6..8eb777b939 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -90,17 +90,6 @@ nonlinear_to_linear(GLubyte cs8) * * Have to have this so the FetchTexel function pointer is never NULL. */ -static void fetch_null_texel( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - (void) texImage; (void) i; (void) j; (void) k; - texel[RCOMP] = 0; - texel[GCOMP] = 0; - texel[BCOMP] = 0; - texel[ACOMP] = 0; - _mesa_warning(NULL, "fetch_null_texel() called!"); -} - static void fetch_null_texelf( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { @@ -1451,13 +1440,13 @@ const struct gl_texture_format _mesa_null_texformat = { 0, /* StencilBits */ 0, /* TexelBytes */ NULL, /* StoreTexImageFunc */ - fetch_null_texel, /* FetchTexel1D */ - fetch_null_texel, /* FetchTexel1D */ - fetch_null_texel, /* FetchTexel1D */ - fetch_null_texelf, /* FetchTexel1Df */ - fetch_null_texelf, /* FetchTexel1Df */ - fetch_null_texelf, /* FetchTexel1Df */ - store_null_texel /* StoreTexel */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* StoreTexel */ }; /*@}*/ @@ -2453,18 +2442,25 @@ texfetch_funcs[MESA_FORMAT_COUNT] = FetchTexelFuncF _mesa_get_texel_fetch_func(GLuint format, GLuint dims) { + FetchTexelFuncF f; GLuint i; /* XXX replace loop with direct table lookup */ for (i = 0; i < MESA_FORMAT_COUNT; i++) { if (texfetch_funcs[i].Name == format) { switch (dims) { case 1: - return texfetch_funcs[i].Fetch1D; + f = texfetch_funcs[i].Fetch1D; + break; case 2: - return texfetch_funcs[i].Fetch2D; + f = texfetch_funcs[i].Fetch2D; + break; case 3: - return texfetch_funcs[i].Fetch3D; + f = texfetch_funcs[i].Fetch3D; + break; } + if (!f) + f = fetch_null_texelf; + return f; } } return NULL; @@ -2478,7 +2474,10 @@ _mesa_get_texel_store_func(GLuint format) /* XXX replace loop with direct table lookup */ for (i = 0; i < MESA_FORMAT_COUNT; i++) { if (texfetch_funcs[i].Name == format) { - return texfetch_funcs[i].StoreTexel; + if (texfetch_funcs[i].StoreTexel) + return texfetch_funcs[i].StoreTexel; + else + return store_null_texel; } } return NULL; -- cgit v1.2.3 From a608257a02d2ba4e8119be462bbd40ed238b184a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:57:02 -0600 Subject: mesa: remove unused gl_texture_format fields --- src/mesa/main/mtypes.h | 16 -- src/mesa/main/texcompress_fxt1.c | 20 +- src/mesa/main/texcompress_s3tc.c | 64 ------ src/mesa/main/texformat.c | 432 --------------------------------------- 4 files changed, 2 insertions(+), 530 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 20fa6d8e3c..d448e3e158 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1167,22 +1167,6 @@ struct gl_texture_format /*@}*/ GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */ - - void *StoreImage; - - /** - * \name Texel fetch function pointers - */ - /*@{*/ - void *FetchTexel1D; - void *FetchTexel2D; - void *FetchTexel3D; - void *FetchTexel1Df; - void *FetchTexel2Df; - void *FetchTexel3Df; - /*@}*/ - - void *toreTexel; }; diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index cee1b468af..1a103ff14e 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -239,15 +239,7 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { 0, /* IndexBits */ 0, /* DepthBits */ 0, /* StencilBits */ - 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ + 0 /* TexelBytes */ }; const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { @@ -263,15 +255,7 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { 0, /* IndexBits */ 0, /* DepthBits */ 0, /* StencilBits */ - 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ + 0 /* TexelBytes */ }; diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 14046bd266..86492d05fb 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -581,14 +581,6 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { @@ -605,14 +597,6 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { @@ -629,14 +613,6 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { @@ -653,14 +629,6 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; #if FEATURE_EXT_texture_sRGB @@ -678,14 +646,6 @@ const struct gl_texture_format _mesa_texformat_srgb_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba_dxt1 = { @@ -702,14 +662,6 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba_dxt3 = { @@ -726,14 +678,6 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt3 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba_dxt5 = { @@ -750,13 +694,5 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt5 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; #endif diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 8eb777b939..dae98bcc6f 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -145,14 +145,6 @@ const struct gl_texture_format _mesa_texformat_rgba = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb = { @@ -169,14 +161,6 @@ const struct gl_texture_format _mesa_texformat_rgb = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha = { @@ -193,14 +177,6 @@ const struct gl_texture_format _mesa_texformat_alpha = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance = { @@ -217,14 +193,6 @@ const struct gl_texture_format _mesa_texformat_luminance = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha = { @@ -241,14 +209,6 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity = { @@ -265,14 +225,6 @@ const struct gl_texture_format _mesa_texformat_intensity = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; @@ -292,14 +244,6 @@ const struct gl_texture_format _mesa_texformat_srgb8 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba8 = { @@ -316,14 +260,6 @@ const struct gl_texture_format _mesa_texformat_srgba8 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_sargb8 = { @@ -340,14 +276,6 @@ const struct gl_texture_format _mesa_texformat_sargb8 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_sl8 = { @@ -364,14 +292,6 @@ const struct gl_texture_format _mesa_texformat_sl8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; /* Note: this format name looks like a misnomer, make it sal8? */ @@ -389,14 +309,6 @@ const struct gl_texture_format _mesa_texformat_sla8 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; #endif /* FEATURE_EXT_texture_sRGB */ @@ -415,14 +327,6 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_float16 = { @@ -439,14 +343,6 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float32 = { @@ -463,14 +359,6 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float16 = { @@ -487,14 +375,6 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float32 = { @@ -511,14 +391,6 @@ const struct gl_texture_format _mesa_texformat_alpha_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float16 = { @@ -535,14 +407,6 @@ const struct gl_texture_format _mesa_texformat_alpha_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float32 = { @@ -559,14 +423,6 @@ const struct gl_texture_format _mesa_texformat_luminance_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float16 = { @@ -583,14 +439,6 @@ const struct gl_texture_format _mesa_texformat_luminance_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { @@ -607,14 +455,6 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { @@ -631,14 +471,6 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float32 = { @@ -655,14 +487,6 @@ const struct gl_texture_format _mesa_texformat_intensity_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float16 = { @@ -679,14 +503,6 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_dudv8 = { @@ -705,14 +521,6 @@ const struct gl_texture_format _mesa_texformat_dudv8 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { @@ -729,14 +537,6 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { @@ -753,14 +553,6 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; /*@}*/ @@ -784,14 +576,6 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba8888_rev = { @@ -808,14 +592,6 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888 = { @@ -832,14 +608,6 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888_rev = { @@ -856,14 +624,6 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb888 = { @@ -880,14 +640,6 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_bgr888 = { @@ -904,14 +656,6 @@ const struct gl_texture_format _mesa_texformat_bgr888 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565 = { @@ -928,14 +672,6 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565_rev = { @@ -952,14 +688,6 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba4444 = { @@ -976,14 +704,6 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444 = { @@ -1000,14 +720,6 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444_rev = { @@ -1024,14 +736,6 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba5551 = { @@ -1048,14 +752,6 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555 = { @@ -1072,14 +768,6 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555_rev = { @@ -1096,14 +784,6 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88 = { @@ -1120,14 +800,6 @@ const struct gl_texture_format _mesa_texformat_al88 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88_rev = { @@ -1144,14 +816,6 @@ const struct gl_texture_format _mesa_texformat_al88_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb332 = { @@ -1168,14 +832,6 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_a8 = { @@ -1192,14 +848,6 @@ const struct gl_texture_format _mesa_texformat_a8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_l8 = { @@ -1216,14 +864,6 @@ const struct gl_texture_format _mesa_texformat_l8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_i8 = { @@ -1240,14 +880,6 @@ const struct gl_texture_format _mesa_texformat_i8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ci8 = { @@ -1264,14 +896,6 @@ const struct gl_texture_format _mesa_texformat_ci8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr = { @@ -1288,14 +912,6 @@ const struct gl_texture_format _mesa_texformat_ycbcr = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr_rev = { @@ -1312,14 +928,6 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z24_s8 = { @@ -1336,14 +944,6 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { 24, /* DepthBits */ 8, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_s8_z24 = { @@ -1360,14 +960,6 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { 24, /* DepthBits */ 8, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z16 = { @@ -1384,14 +976,6 @@ const struct gl_texture_format _mesa_texformat_z16 = { sizeof(GLushort) * 8, /* DepthBits */ 0, /* StencilBits */ sizeof(GLushort), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z32 = { @@ -1408,14 +992,6 @@ const struct gl_texture_format _mesa_texformat_z32 = { sizeof(GLuint) * 8, /* DepthBits */ 0, /* StencilBits */ sizeof(GLuint), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; /*@}*/ @@ -1439,14 +1015,6 @@ const struct gl_texture_format _mesa_null_texformat = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* StoreTexel */ }; /*@}*/ -- cgit v1.2.3 From 729ff875f4c951798d2372940608201a6b195ca6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 21:32:12 -0600 Subject: mesa: change _mesa_format_to_type_and_comps() format parameter type --- src/mesa/main/mipmap.c | 10 +++++----- src/mesa/main/texformat.c | 7 +++---- src/mesa/main/texformat.h | 2 +- src/mesa/state_tracker/st_gen_mipmap.c | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index faa6c47cb7..0950d8abea 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1495,7 +1495,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj) { const struct gl_texture_image *srcImage; - const struct gl_texture_format *convertFormat; + gl_format convertFormat; const GLubyte *srcData = NULL; GLubyte *dstData = NULL; GLint level, maxLevels; @@ -1521,11 +1521,11 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, texObj->Target == GL_TEXTURE_CUBE_MAP_ARB); if (srcImage->_BaseFormat == GL_RGB) { - convertFormat = &_mesa_texformat_rgb; + convertFormat = MESA_FORMAT_RGB; components = 3; } else if (srcImage->_BaseFormat == GL_RGBA) { - convertFormat = &_mesa_texformat_rgba; + convertFormat = MESA_FORMAT_RGBA; components = 4; } else { @@ -1561,7 +1561,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, } else { /* uncompressed */ - convertFormat = srcImage->TexFormat; + convertFormat = srcImage->TexFormat->MesaFormat; } _mesa_format_to_type_and_comps(convertFormat, &datatype, &comps); @@ -1664,7 +1664,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, if (dstImage->IsCompressed) { GLubyte *temp; /* compress image from dstData into dstImage->Data */ - const GLenum srcFormat = convertFormat->BaseFormat; + const GLenum srcFormat = _mesa_get_format_base_format(convertFormat); GLint dstRowStride = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth); const StoreTexImageFunc storeImage = diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index dae98bcc6f..60b2065a6c 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1351,14 +1351,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, /** - * Return datatype and number of components per texel for the - * given gl_texture_format. + * Return datatype and number of components per texel for the given gl_format. */ void -_mesa_format_to_type_and_comps(const struct gl_texture_format *format, +_mesa_format_to_type_and_comps(gl_format format, GLenum *datatype, GLuint *comps) { - switch (format->MesaFormat) { + switch (format) { case MESA_FORMAT_RGBA8888: case MESA_FORMAT_RGBA8888_REV: case MESA_FORMAT_ARGB8888: diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 39d5ec640a..638eadff97 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -151,7 +151,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, extern void -_mesa_format_to_type_and_comps(const struct gl_texture_format *format, +_mesa_format_to_type_and_comps(gl_format format, GLenum *datatype, GLuint *comps); extern FetchTexelFuncF diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 58f6933652..63a6956a7a 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -115,7 +115,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, assert(target != GL_TEXTURE_3D); /* not done yet */ - _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat, + _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat->MesaFormat, &datatype, &comps); for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { -- cgit v1.2.3 From 1f7c914ad0beea8a29c1a171c7cd1a12f2efe0fa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 20:28:45 -0600 Subject: mesa: replace gl_texture_format with gl_format Now gl_texture_image::TexFormat is a simple MESA_FORMAT_x enum. ctx->Driver.ChooseTexture format also returns a MESA_FORMAT_x. gl_texture_format will go away next. --- src/mesa/drivers/common/meta.c | 2 +- src/mesa/drivers/dri/common/texmem.c | 44 ++-- src/mesa/drivers/dri/common/texmem.h | 21 +- src/mesa/drivers/dri/i810/i810tex.c | 18 +- src/mesa/drivers/dri/i810/i810texmem.c | 2 +- src/mesa/drivers/dri/i810/i810texstate.c | 2 +- src/mesa/drivers/dri/i915/i830_texstate.c | 2 +- src/mesa/drivers/dri/i915/i830_vtbl.c | 4 +- src/mesa/drivers/dri/i915/i915_texstate.c | 6 +- src/mesa/drivers/dri/i915/i915_vtbl.c | 4 +- src/mesa/drivers/dri/i965/brw_wm.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 7 +- src/mesa/drivers/dri/intel/intel_blit.c | 4 +- src/mesa/drivers/dri/intel/intel_fbo.c | 47 ++-- src/mesa/drivers/dri/intel/intel_fbo.h | 3 +- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 2 +- src/mesa/drivers/dri/intel/intel_span.c | 2 +- src/mesa/drivers/dri/intel/intel_tex.h | 7 +- src/mesa/drivers/dri/intel/intel_tex_format.c | 72 ++--- src/mesa/drivers/dri/intel/intel_tex_image.c | 24 +- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 4 +- src/mesa/drivers/dri/intel/intel_tex_validate.c | 4 +- src/mesa/drivers/dri/mach64/mach64_tex.c | 34 +-- src/mesa/drivers/dri/mach64/mach64_texmem.c | 4 +- src/mesa/drivers/dri/mach64/mach64_texstate.c | 4 +- src/mesa/drivers/dri/mga/mga_texstate.c | 8 +- src/mesa/drivers/dri/mga/mgatex.c | 46 ++-- src/mesa/drivers/dri/mga/mgatexmem.c | 2 +- src/mesa/drivers/dri/r128/r128_tex.c | 8 +- src/mesa/drivers/dri/r128/r128_texmem.c | 4 +- src/mesa/drivers/dri/r128/r128_texstate.c | 4 +- src/mesa/drivers/dri/r200/r200_texstate.c | 8 +- src/mesa/drivers/dri/r300/r300_texstate.c | 8 +- src/mesa/drivers/dri/r600/r600_texstate.c | 4 +- src/mesa/drivers/dri/radeon/radeon_fbo.c | 31 +-- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 10 +- src/mesa/drivers/dri/radeon/radeon_texstate.c | 8 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 104 ++++---- src/mesa/drivers/dri/radeon/radeon_texture.h | 22 +- src/mesa/drivers/dri/savage/savagetex.c | 127 +++++---- src/mesa/drivers/dri/sis/sis_tex.c | 57 ++-- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 81 +++--- src/mesa/drivers/dri/unichrome/via_tex.c | 68 ++--- src/mesa/drivers/glide/fxddtex.c | 48 ++-- src/mesa/drivers/x11/xm_dd.c | 6 +- src/mesa/main/dd.h | 4 +- src/mesa/main/debug.c | 2 +- src/mesa/main/fbobject.c | 4 +- src/mesa/main/mipmap.c | 8 +- src/mesa/main/mtypes.h | 2 +- src/mesa/main/texcompress_fxt1.c | 12 +- src/mesa/main/texcompress_s3tc.c | 24 +- src/mesa/main/texformat.c | 147 ++++++----- src/mesa/main/texformat.h | 6 +- src/mesa/main/texformat_tmp.h | 4 +- src/mesa/main/texgetimage.c | 14 +- src/mesa/main/teximage.c | 14 +- src/mesa/main/texparam.c | 2 +- src/mesa/main/texrender.c | 10 +- src/mesa/main/texstore.c | 322 +++++++++++------------ src/mesa/main/texstore.h | 2 +- src/mesa/state_tracker/st_cb_drawpixels.c | 4 +- src/mesa/state_tracker/st_cb_texture.c | 30 +-- src/mesa/state_tracker/st_format.c | 62 ++--- src/mesa/state_tracker/st_format.h | 3 +- src/mesa/state_tracker/st_gen_mipmap.c | 2 +- src/mesa/state_tracker/st_texture.c | 2 +- src/mesa/swrast/s_texfilter.c | 28 +- src/mesa/swrast/s_triangle.c | 4 +- 69 files changed, 869 insertions(+), 822 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 94cfdfe533..6b35dbb5ad 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2407,7 +2407,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texObj, target, level); - format = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + format = _mesa_get_format_base_format(texImage->TexFormat); type = get_temp_image_type(ctx, format); bpp = _mesa_bytes_per_pixel(format, type); if (bpp <= 0) { diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index b64618a03c..c9c3324ed9 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -1306,16 +1306,16 @@ driCalculateTextureFirstLastLevel( driTextureObject * t ) * little-endian Mesa formats. */ /*@{*/ -const struct gl_texture_format *_dri_texformat_rgba8888 = NULL; -const struct gl_texture_format *_dri_texformat_argb8888 = NULL; -const struct gl_texture_format *_dri_texformat_rgb565 = NULL; -const struct gl_texture_format *_dri_texformat_argb4444 = NULL; -const struct gl_texture_format *_dri_texformat_argb1555 = NULL; -const struct gl_texture_format *_dri_texformat_al88 = NULL; -const struct gl_texture_format *_dri_texformat_a8 = &_mesa_texformat_a8; -const struct gl_texture_format *_dri_texformat_ci8 = &_mesa_texformat_ci8; -const struct gl_texture_format *_dri_texformat_i8 = &_mesa_texformat_i8; -const struct gl_texture_format *_dri_texformat_l8 = &_mesa_texformat_l8; +gl_format _dri_texformat_rgba8888 = MESA_FORMAT_NONE; +gl_format _dri_texformat_argb8888 = MESA_FORMAT_NONE; +gl_format _dri_texformat_rgb565 = MESA_FORMAT_NONE; +gl_format _dri_texformat_argb4444 = MESA_FORMAT_NONE; +gl_format _dri_texformat_argb1555 = MESA_FORMAT_NONE; +gl_format _dri_texformat_al88 = MESA_FORMAT_NONE; +gl_format _dri_texformat_a8 = MESA_FORMAT_NONE; +gl_format _dri_texformat_ci8 = MESA_FORMAT_NONE; +gl_format _dri_texformat_i8 = MESA_FORMAT_NONE; +gl_format _dri_texformat_l8 = MESA_FORMAT_NONE; /*@}*/ @@ -1329,19 +1329,19 @@ driInitTextureFormats(void) const GLubyte littleEndian = *((const GLubyte *) &ui); if (littleEndian) { - _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888; - _dri_texformat_argb8888 = &_mesa_texformat_argb8888; - _dri_texformat_rgb565 = &_mesa_texformat_rgb565; - _dri_texformat_argb4444 = &_mesa_texformat_argb4444; - _dri_texformat_argb1555 = &_mesa_texformat_argb1555; - _dri_texformat_al88 = &_mesa_texformat_al88; + _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888; + _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888; + _dri_texformat_rgb565 = MESA_FORMAT_RGB565; + _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444; + _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555; + _dri_texformat_al88 = MESA_FORMAT_AL88; } else { - _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888_rev; - _dri_texformat_argb8888 = &_mesa_texformat_argb8888_rev; - _dri_texformat_rgb565 = &_mesa_texformat_rgb565_rev; - _dri_texformat_argb4444 = &_mesa_texformat_argb4444_rev; - _dri_texformat_argb1555 = &_mesa_texformat_argb1555_rev; - _dri_texformat_al88 = &_mesa_texformat_al88_rev; + _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888_REV; + _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888_REV; + _dri_texformat_rgb565 = MESA_FORMAT_RGB565_REV; + _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444_REV; + _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555_REV; + _dri_texformat_al88 = MESA_FORMAT_AL88_REV; } } diff --git a/src/mesa/drivers/dri/common/texmem.h b/src/mesa/drivers/dri/common/texmem.h index 9c065da8b4..725ba2e119 100644 --- a/src/mesa/drivers/dri/common/texmem.h +++ b/src/mesa/drivers/dri/common/texmem.h @@ -39,6 +39,7 @@ #define DRI_TEXMEM_H #include "main/mtypes.h" +#include "main/formats.h" #include "main/mm.h" #include "xf86drm.h" @@ -317,16 +318,16 @@ GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps, extern void driCalculateTextureFirstLastLevel( driTextureObject * t ); -extern const struct gl_texture_format *_dri_texformat_rgba8888; -extern const struct gl_texture_format *_dri_texformat_argb8888; -extern const struct gl_texture_format *_dri_texformat_rgb565; -extern const struct gl_texture_format *_dri_texformat_argb4444; -extern const struct gl_texture_format *_dri_texformat_argb1555; -extern const struct gl_texture_format *_dri_texformat_al88; -extern const struct gl_texture_format *_dri_texformat_a8; -extern const struct gl_texture_format *_dri_texformat_ci8; -extern const struct gl_texture_format *_dri_texformat_i8; -extern const struct gl_texture_format *_dri_texformat_l8; +extern gl_format _dri_texformat_rgba8888; +extern gl_format _dri_texformat_argb8888; +extern gl_format _dri_texformat_rgb565; +extern gl_format _dri_texformat_argb4444; +extern gl_format _dri_texformat_argb1555; +extern gl_format _dri_texformat_al88; +extern gl_format _dri_texformat_a8; +extern gl_format _dri_texformat_ci8; +extern gl_format _dri_texformat_i8; +extern gl_format _dri_texformat_l8; extern void driInitTextureFormats( void ); diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index cd6e1a8e6e..8166393eb1 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -440,7 +440,7 @@ static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) * The i810 only supports 5 texture modes that are useful to Mesa. That * makes this routine pretty simple. */ -static const struct gl_texture_format * +static gl_format i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -458,9 +458,9 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, if ( ((format == GL_BGRA) && (type == GL_UNSIGNED_SHORT_1_5_5_5_REV)) || ((format == GL_RGBA) && (type == GL_UNSIGNED_SHORT_5_5_5_1)) || (internalFormat == GL_RGB5_A1) ) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case 3: case GL_RGB: @@ -472,7 +472,7 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB10: case GL_RGB12: case GL_RGB16: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_ALPHA: case GL_ALPHA4: @@ -502,21 +502,21 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; default: fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__); - return NULL; + return MESA_FORMAT_NONE; } - return NULL; /* never get here */ + return MESA_FORMAT_NONE; /* never get here */ } /** diff --git a/src/mesa/drivers/dri/i810/i810texmem.c b/src/mesa/drivers/dri/i810/i810texmem.c index 8cbe38f5fc..c2a5d95fc7 100644 --- a/src/mesa/drivers/dri/i810/i810texmem.c +++ b/src/mesa/drivers/dri/i810/i810texmem.c @@ -97,7 +97,7 @@ static void i810UploadTexLevel( i810ContextPtr imesa, if (!image || !image->Data) return; - texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(image->TexFormat); if (image->Width * texelBytes == t->Pitch) { GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset); diff --git a/src/mesa/drivers/dri/i810/i810texstate.c b/src/mesa/drivers/dri/i810/i810texstate.c index 0e09f54c41..b873ddbecb 100644 --- a/src/mesa/drivers/dri/i810/i810texstate.c +++ b/src/mesa/drivers/dri/i810/i810texstate.c @@ -53,7 +53,7 @@ static void i810SetTexImages( i810ContextPtr imesa, /* fprintf(stderr, "%s\n", __FUNCTION__); */ t->texelBytes = 2; - switch (baseImage->TexFormat->MesaFormat) { + switch (baseImage->TexFormat) { case MESA_FORMAT_ARGB1555: textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_ARGB1555; break; diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 6f998fa6f7..837ae57074 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -166,7 +166,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) 0, intelObj-> firstLevel); - format = translate_texture_format(firstImage->TexFormat->MesaFormat, + format = translate_texture_format(firstImage->TexFormat, firstImage->InternalFormat); pitch = intelObj->mt->pitch * intelObj->mt->cpp; } diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 983f6724c9..d53900b329 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -646,7 +646,7 @@ i830_state_draw_region(struct intel_context *intel, DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z); /* .5 */ if (irb != NULL) { - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: value |= DV_PF_8888; break; @@ -661,7 +661,7 @@ i830_state_draw_region(struct intel_context *intel, break; default: _mesa_problem(ctx, "Bad renderbuffer format: %d\n", - irb->texformat->MesaFormat); + irb->texformat); } } diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 32d4b30cf9..d6f6cfdb49 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -177,7 +177,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) 0, intelObj-> firstLevel); - format = translate_texture_format(firstImage->TexFormat->MesaFormat, + format = translate_texture_format(firstImage->TexFormat, firstImage->InternalFormat, tObj->DepthMode); pitch = intelObj->mt->pitch * intelObj->mt->cpp; @@ -263,8 +263,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) /* YUV conversion: */ - if (firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR || - firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV) + if (firstImage->TexFormat == MESA_FORMAT_YCBCR || + firstImage->TexFormat == MESA_FORMAT_YCBCR_REV) state[I915_TEXREG_SS2] |= SS2_COLORSPACE_CONVERSION; /* Shadow: diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 9a723d3cd7..1c3da63da9 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -589,7 +589,7 @@ i915_state_draw_region(struct intel_context *intel, DSTORG_VERT_BIAS(0x8) | /* .5 */ LOD_PRECLAMP_OGL | TEX_DEFAULT_COLOR_OGL); if (irb != NULL) { - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: value |= DV_PF_8888; break; @@ -604,7 +604,7 @@ i915_state_draw_region(struct intel_context *intel, break; default: _mesa_problem(ctx, "Bad renderbuffer format: %d\n", - irb->texformat->MesaFormat); + irb->texformat); } } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 2292de94c4..46df778bee 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -288,7 +288,7 @@ static void brw_wm_populate_key( struct brw_context *brw, const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; if (img->InternalFormat == GL_YCBCR_MESA) { key->yuvtex_mask |= 1 << i; - if (img->TexFormat->MesaFormat == MESA_FORMAT_YCBCR) + if (img->TexFormat == MESA_FORMAT_YCBCR) key->yuvtex_swap_mask |= 1 << i; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 51539ac1e7..855fe7593d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -287,7 +287,7 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit ) key.bo = NULL; key.offset = intelObj->textureOffset; } else { - key.format = firstImage->TexFormat->MesaFormat; + key.format = firstImage->TexFormat; key.internal_format = firstImage->InternalFormat; key.pitch = intelObj->mt->pitch; key.depth = firstImage->Depth; @@ -527,7 +527,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, region_bo = region->buffer; key.surface_type = BRW_SURFACE_2D; - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; @@ -541,8 +541,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM; break; default: - _mesa_problem(ctx, "Bad renderbuffer format: %d\n", - irb->texformat->MesaFormat); + _mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->texformat); } key.tiling = region->tiling; if (brw->intel.intelScreen->driScrnPriv->dri2.enabled) { diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 43141c509c..799b22cc90 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -496,7 +496,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]); - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: clearVal = intel->ClearColor8888; break; @@ -513,7 +513,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) break; default: _mesa_problem(ctx, "Unexpected renderbuffer format: %d\n", - irb->texformat->MesaFormat); + irb->texformat); clearVal = 0; } } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 0a3d0654d7..1be381b9ea 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -120,7 +120,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->RedBits = 5; rb->GreenBits = 6; rb->BlueBits = 5; - irb->texformat = &_mesa_texformat_rgb565; + irb->texformat = MESA_FORMAT_RGB565; cpp = 2; break; case GL_RGB: @@ -134,7 +134,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->GreenBits = 8; rb->BlueBits = 8; rb->AlphaBits = 0; - irb->texformat = &_mesa_texformat_argb8888; /* XXX: Need xrgb8888 */ + irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */ cpp = 4; break; case GL_RGBA: @@ -151,7 +151,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->GreenBits = 8; rb->BlueBits = 8; rb->AlphaBits = 8; - irb->texformat = &_mesa_texformat_argb8888; + irb->texformat = MESA_FORMAT_ARGB8888; cpp = 4; break; case GL_STENCIL_INDEX: @@ -164,14 +164,14 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->DataType = GL_UNSIGNED_INT_24_8_EXT; rb->StencilBits = 8; cpp = 4; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_COMPONENT16: rb->_ActualFormat = GL_DEPTH_COMPONENT16; rb->DataType = GL_UNSIGNED_SHORT; rb->DepthBits = 16; cpp = 2; - irb->texformat = &_mesa_texformat_z16; + irb->texformat = MESA_FORMAT_Z16; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: @@ -180,7 +180,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->DataType = GL_UNSIGNED_INT_24_8_EXT; rb->DepthBits = 24; cpp = 4; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: @@ -189,7 +189,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->DepthBits = 24; rb->StencilBits = 8; cpp = 4; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; default: _mesa_problem(ctx, @@ -331,7 +331,7 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.GreenBits = 6; irb->Base.BlueBits = 5; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = &_mesa_texformat_rgb565; + irb->texformat = MESA_FORMAT_RGB565; break; case GL_RGB8: irb->Base._ActualFormat = GL_RGB8; @@ -341,7 +341,7 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.BlueBits = 8; irb->Base.AlphaBits = 0; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = &_mesa_texformat_argb8888; /* XXX: Need xrgb8888 */ + irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: NEED XRGB8888 */ break; case GL_RGBA8: irb->Base._ActualFormat = GL_RGBA8; @@ -351,28 +351,28 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.BlueBits = 8; irb->Base.AlphaBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = &_mesa_texformat_argb8888; + irb->texformat = MESA_FORMAT_ARGB8888; break; case GL_STENCIL_INDEX8_EXT: irb->Base._ActualFormat = GL_STENCIL_INDEX8_EXT; irb->Base._BaseFormat = GL_STENCIL_INDEX; irb->Base.StencilBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_COMPONENT16: irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DepthBits = 16; irb->Base.DataType = GL_UNSIGNED_SHORT; - irb->texformat = &_mesa_texformat_z16; + irb->texformat = MESA_FORMAT_Z16; break; case GL_DEPTH_COMPONENT24: irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DepthBits = 24; irb->Base.DataType = GL_UNSIGNED_INT; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH24_STENCIL8_EXT: irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; @@ -380,7 +380,7 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.DepthBits = 24; irb->Base.StencilBits = 8; irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; default: _mesa_problem(NULL, @@ -468,49 +468,48 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->texformat = texImage->TexFormat; gl_format texFormat; - if (texImage->TexFormat == &_mesa_texformat_argb8888) { + if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { irb->Base._ActualFormat = GL_RGBA8; irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_rgb565) { + else if (texImage->TexFormat == MESA_FORMAT_RGB565) { irb->Base._ActualFormat = GL_RGB5; irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb1555) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { irb->Base._ActualFormat = GL_RGB5_A1; irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb4444) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { irb->Base._ActualFormat = GL_RGBA4; irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB4444 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_z16) { + else if (texImage->TexFormat == MESA_FORMAT_Z16) { irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_s8_z24) { + else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT; irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; DBG("Render to DEPTH_STENCIL texture OK\n"); } else { - DBG("Render to texture BAD FORMAT %d\n", - texImage->TexFormat->MesaFormat); + DBG("Render to texture BAD FORMAT %d\n", texImage->TexFormat); return GL_FALSE; } - texFormat = texImage->TexFormat->MesaFormat; + texFormat = texImage->TexFormat; irb->Base.InternalFormat = irb->Base._ActualFormat; irb->Base.Width = texImage->Width; @@ -690,7 +689,7 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) continue; } - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_RGB565: case MESA_FORMAT_ARGB1555: diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index f0665af482..e0584e3494 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -28,6 +28,7 @@ #ifndef INTEL_FBO_H #define INTEL_FBO_H +#include "main/formats.h" #include "intel_screen.h" struct intel_context; @@ -61,7 +62,7 @@ struct intel_renderbuffer struct gl_renderbuffer Base; struct intel_region *region; - const struct gl_texture_format *texformat; + gl_format texformat; GLuint vbl_pending; /**< vblank sequence number of pending flip */ diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 188333c75f..6bb7481ae4 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -307,7 +307,7 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt, if (!image->IsCompressed && !mt->compressed && - _mesa_get_format_bytes(image->TexFormat->MesaFormat) != mt->cpp) + _mesa_get_format_bytes(image->TexFormat) != mt->cpp) return GL_FALSE; /* Test image dimensions against the base level image adjusted for diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 28eabbc005..f754ce0cd1 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -578,7 +578,7 @@ intel_set_span_functions(struct intel_context *intel, else tiling = I915_TILING_NONE; - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_RGB565: switch (tiling) { case I915_TILING_NONE: diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index 471aa2a240..f67e1db9e3 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -29,6 +29,7 @@ #define INTELTEX_INC #include "main/mtypes.h" +#include "main/formats.h" #include "intel_context.h" #include "texmem.h" @@ -41,10 +42,8 @@ void intelInitTextureSubImageFuncs(struct dd_function_table *functions); void intelInitTextureCopyImageFuncs(struct dd_function_table *functions); -const struct gl_texture_format *intelChooseTextureFormat(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type); +gl_format intelChooseTextureFormat(GLcontext *ctx, GLint internalFormat, + GLenum format, GLenum type); void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index 3322a71130..22c010bbd7 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -16,7 +16,7 @@ * these if we take the step of simply swizzling the colors * immediately after sampling... */ -const struct gl_texture_format * +gl_format intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, GLenum format, GLenum type) { @@ -34,48 +34,48 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_COMPRESSED_RGBA: if (format == GL_BGRA) { if (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) { - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case 3: case GL_RGB: case GL_COMPRESSED_RGB: if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case GL_RGB5: case GL_RGB4: case GL_R3_G3_B2: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_ALPHA: case GL_ALPHA4: @@ -83,7 +83,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case 1: case GL_LUMINANCE: @@ -92,7 +92,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case 2: case GL_LUMINANCE_ALPHA: @@ -103,7 +103,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: @@ -111,41 +111,41 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: #if 0 - return &_mesa_texformat_z16; + return MESA_FORMAT_Z16; #else /* fall-through. * 16bpp depth texture can't be paired with a stencil buffer so @@ -154,7 +154,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, #endif case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - return &_mesa_texformat_s8_z24; + return MESA_FORMAT_S8_Z24; #ifndef I915 case GL_SRGB_EXT: @@ -165,41 +165,41 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_COMPRESSED_SRGB_ALPHA_EXT: case GL_COMPRESSED_SLUMINANCE_EXT: case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: - return &_mesa_texformat_sargb8; + return MESA_FORMAT_SARGB8; case GL_SLUMINANCE_EXT: case GL_SLUMINANCE8_EXT: if (IS_G4X(intel->intelScreen->deviceID)) - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; else - return &_mesa_texformat_sargb8; + return MESA_FORMAT_SARGB8; case GL_SLUMINANCE_ALPHA_EXT: case GL_SLUMINANCE8_ALPHA8_EXT: if (IS_G4X(intel->intelScreen->deviceID)) - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; else - return &_mesa_texformat_sargb8; + return MESA_FORMAT_SARGB8; case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - return &_mesa_texformat_srgb_dxt1; + return MESA_FORMAT_SRGB_DXT1; /* i915 could also do this */ case GL_DUDV_ATI: case GL_DU8DV8_ATI: - return &_mesa_texformat_dudv8; + return MESA_FORMAT_DUDV8; case GL_RGBA_SNORM: case GL_RGBA8_SNORM: - return &_mesa_texformat_signed_rgba8888_rev; + return MESA_FORMAT_SIGNED_RGBA8888_REV; #endif default: fprintf(stderr, "unexpected texture format %s in %s\n", _mesa_lookup_enum_by_nr(internalFormat), __FUNCTION__); - return NULL; + return MESA_FORMAT_NONE; } - return NULL; /* never get here */ + return MESA_FORMAT_NONE; /* never get here */ } int intel_compressed_num_bytes(GLuint mesaFormat) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 0e13f600a6..bbbeac8f7f 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -126,9 +126,9 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, assert(!intelObj->mt); if (intelImage->base.IsCompressed) - comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat); + comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat); - texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat); intelObj->mt = intel_miptree_create(intel, intelObj->base.Target, @@ -171,7 +171,7 @@ target_to_face(GLenum target) static GLboolean check_pbo_format(GLint internalFormat, GLenum format, GLenum type, - const struct gl_texture_format *mesa_format) + gl_format mesa_format) { switch (internalFormat) { case 4: @@ -179,12 +179,12 @@ check_pbo_format(GLint internalFormat, return (format == GL_BGRA && (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) && - mesa_format == &_mesa_texformat_argb8888); + mesa_format == MESA_FORMAT_ARGB8888); case 3: case GL_RGB: return (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 && - mesa_format == &_mesa_texformat_rgb565); + mesa_format == MESA_FORMAT_RGB565); case GL_YCBCR_MESA: return (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE); default: @@ -337,15 +337,15 @@ intelTexImage(GLcontext * ctx, _mesa_set_fetch_functions(texImage, dims); - if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } else { - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { @@ -403,11 +403,11 @@ intelTexImage(GLcontext * ctx, assert(intelImage->mt); } else if (intelImage->base.Border == 0) { int comp_byte = 0; - GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat); - GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat->MesaFormat); + GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat); + GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat); if (intelImage->base.IsCompressed) { comp_byte = - intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat); + intel_compressed_num_bytes(intelImage->base.TexFormat); } /* Didn't fit in the object miptree, but it's suitable for inclusion in @@ -497,7 +497,7 @@ intelTexImage(GLcontext * ctx, if (texImage->IsCompressed) { sizeInBytes = texImage->CompressedSize; dstRowStride = - _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); } else { diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index ad5c2271a1..bba1b53009 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -87,11 +87,11 @@ intelTexSubimage(GLcontext * ctx, else { if (texImage->IsCompressed) { dstRowStride = - _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); } else { - dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat); } } diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 0393d7915a..0296c92523 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -166,11 +166,11 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) } if (firstImage->base.IsCompressed) { - comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat); + comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat); cpp = comp_byte; } else - cpp = _mesa_get_format_bytes(firstImage->base.TexFormat->MesaFormat); + cpp = _mesa_get_format_bytes(firstImage->base.TexFormat); /* Check tree can hold all active levels. Check tree matches * target, imageFormat, etc. diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 225d23179e..02433e5dd8 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -138,7 +138,7 @@ mach64AllocTexObj( struct gl_texture_object *texObj ) /* Called by the _mesa_store_teximage[123]d() functions. */ -static const struct gl_texture_format * +static gl_format mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -167,15 +167,15 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGBA2: case GL_COMPRESSED_RGBA: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; else - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; else - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGBA8: case GL_RGB10_A2: @@ -183,9 +183,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGBA16: case GL_RGBA4: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; else - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case 3: case GL_RGB: @@ -198,9 +198,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB16: case GL_COMPRESSED_RGB: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; else - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case 1: case GL_LUMINANCE: @@ -210,9 +210,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; /* inefficient but accurate */ + return MESA_FORMAT_ARGB8888; /* inefficient but accurate */ else - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_INTENSITY4: case GL_INTENSITY: @@ -221,9 +221,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; /* inefficient but accurate */ + return MESA_FORMAT_ARGB8888; /* inefficient but accurate */ else - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: @@ -232,18 +232,18 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; default: _mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ ); - return NULL; + return MESA_FORMAT_NONE; } } diff --git a/src/mesa/drivers/dri/mach64/mach64_texmem.c b/src/mesa/drivers/dri/mach64/mach64_texmem.c index 843b231051..e83aeae3e1 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texmem.c +++ b/src/mesa/drivers/dri/mach64/mach64_texmem.c @@ -86,7 +86,7 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa, if ( !image ) return; - texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(image->TexFormat); switch ( texelBytes ) { case 1: texelsPerDword = 4; break; @@ -153,7 +153,7 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa, if ( !image ) return; - texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(image->TexFormat); switch ( texelBytes ) { case 1: texelsPerDword = 4; break; diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c index ff03b0c40a..c333355324 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texstate.c +++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c @@ -55,7 +55,7 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) fprintf( stderr, "%s( %p )\n", __FUNCTION__, tObj ); - switch (baseImage->TexFormat->MesaFormat) { + switch (baseImage->TexFormat) { case MESA_FORMAT_ARGB8888: t->textureFormat = MACH64_DATATYPE_ARGB8888; break; @@ -89,7 +89,7 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, totalSize = ( baseImage->Height * baseImage->Width * - _mesa_get_format_bytes(baseImage->TexFormat->MesaFormat) ); + _mesa_get_format_bytes(baseImage->TexFormat) ); totalSize = (totalSize + 31) & ~31; diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index 8f78ab9bd4..d52f0fac75 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -94,14 +94,14 @@ mgaSetTexImages( mgaContextPtr mmesa, return; } #else - if ( (baseImage->TexFormat->MesaFormat >= TMC_nr_tformat) - || (TMC_tformat[ baseImage->TexFormat->MesaFormat ] == 0) ) + if ( (baseImage->TexFormat >= TMC_nr_tformat) + || (TMC_tformat[ baseImage->TexFormat ] == 0) ) { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); return; } - txformat = TMC_tformat[ baseImage->TexFormat->MesaFormat ]; + txformat = TMC_tformat[ baseImage->TexFormat ]; #endif /* MGA_USE_TABLE_FOR_FORMAT */ @@ -131,7 +131,7 @@ mgaSetTexImages( mgaContextPtr mmesa, break; size = texImage->Width * texImage->Height * - _mesa_get_format_bytes(baseImage->TexFormat->MesaFormat); + _mesa_get_format_bytes(baseImage->TexFormat); t->offsets[i] = totalSize; t->base.dirty_images[0] |= (1<TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); length = texImage->Width * texImage->Height * texelBytes; if ( t->base.heap->heapId == MGA_CARD_HEAP ) { unsigned tex_offset = 0; diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 0920270d7b..6acda445f7 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -178,7 +178,7 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj ) /* Called by the _mesa_store_teximage[123]d() functions. */ -static const struct gl_texture_format * +static gl_format r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -282,13 +282,13 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; default: _mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ ); - return NULL; + return MESA_FORMAT_NONE; } } diff --git a/src/mesa/drivers/dri/r128/r128_texmem.c b/src/mesa/drivers/dri/r128/r128_texmem.c index c369e14bd5..84f8563b89 100644 --- a/src/mesa/drivers/dri/r128/r128_texmem.c +++ b/src/mesa/drivers/dri/r128/r128_texmem.c @@ -95,7 +95,7 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t, if ( !image ) return; - switch ( _mesa_get_format_bytes(image->TexFormat->MesaFormat) ) { + switch ( _mesa_get_format_bytes(image->TexFormat) ) { case 1: texelsPerDword = 4; break; case 2: texelsPerDword = 2; break; case 4: texelsPerDword = 1; break; @@ -216,7 +216,7 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t, /* Copy the next chunck of the texture image into the blit buffer */ { const GLuint texelBytes = - _mesa_get_format_bytes(image->TexFormat->MesaFormat); + _mesa_get_format_bytes(image->TexFormat); const GLubyte *src = (const GLubyte *) image->Data + (y * image->Width + x) * texelBytes; const GLuint bytes = width * height * texelBytes; diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index 9f4f9aea2d..2e71c25861 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -61,7 +61,7 @@ static void r128SetTexImages( r128ContextPtr rmesa, if ( R128_DEBUG & DEBUG_VERBOSE_API ) fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *) tObj ); - switch (baseImage->TexFormat->MesaFormat) { + switch (baseImage->TexFormat) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_ARGB8888_REV: t->textureFormat = R128_DATATYPE_ARGB8888; @@ -123,7 +123,7 @@ static void r128SetTexImages( r128ContextPtr rmesa, totalSize += (tObj->Image[0][i]->Height * tObj->Image[0][i]->Width * - _mesa_get_format_bytes(tObj->Image[0][i]->TexFormat->MesaFormat)); + _mesa_get_format_bytes(tObj->Image[0][i]->TexFormat)); /* Offsets must be 32-byte aligned for host data blits and tiling */ totalSize = (totalSize + 31) & ~31; diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 03f0613e7a..daca318684 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -1437,11 +1437,11 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) log2Width = firstImage->WidthLog2; log2Height = firstImage->HeightLog2; log2Depth = firstImage->DepthLog2; - texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(firstImage->TexFormat); if (!t->image_override) { - if (VALID_FORMAT(firstImage->TexFormat->MesaFormat)) { + if (VALID_FORMAT(firstImage->TexFormat)) { const struct tx_table *table = _mesa_little_endian() ? tx_table_le : tx_table_be; @@ -1449,8 +1449,8 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) R200_TXFORMAT_ALPHA_IN_MAP); t->pp_txfilter &= ~R200_YUV_TO_RGB; - t->pp_txformat |= table[ firstImage->TexFormat->MesaFormat ].format; - t->pp_txfilter |= table[ firstImage->TexFormat->MesaFormat ].filter; + t->pp_txformat |= table[ firstImage->TexFormat ].format; + t->pp_txfilter |= table[ firstImage->TexFormat ].filter; } else { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index cc40e0d1dc..cb826248f3 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -156,7 +156,7 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj) t = radeon_tex_obj(tObj); - switch (tObj->Image[0][tObj->BaseLevel]->TexFormat->MesaFormat) { + switch (tObj->Image[0][tObj->BaseLevel]->TexFormat) { case MESA_FORMAT_Z16: format = formats[0]; break; @@ -208,14 +208,14 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) firstImage = t->base.Image[0][firstlevel]; if (!t->image_override - && VALID_FORMAT(firstImage->TexFormat->MesaFormat)) { + && VALID_FORMAT(firstImage->TexFormat)) { if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) { r300SetDepthTexMode(&t->base); } else { - t->pp_txformat = tx_table[firstImage->TexFormat->MesaFormat].format; + t->pp_txformat = tx_table[firstImage->TexFormat].format; } - t->pp_txfilter |= tx_table[firstImage->TexFormat->MesaFormat].filter; + t->pp_txfilter |= tx_table[firstImage->TexFormat].filter; } else if (!t->image_override) { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 7d7e77d355..55b455edc0 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -591,7 +591,7 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj) t = radeon_tex_obj(tObj); - r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat->MesaFormat); + r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat); } @@ -616,7 +616,7 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex firstImage = t->base.Image[0][firstlevel]; if (!t->image_override) { - if (!r600GetTexFormat(texObj, firstImage->TexFormat->MesaFormat)) { + if (!r600GetTexFormat(texObj, firstImage->TexFormat)) { radeon_error("unexpected texture format in %s\n", __FUNCTION__); return; diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index f19170b612..90ea2ec335 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -390,42 +390,42 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, gl_format texFormat; restart: - if (texImage->TexFormat == &_mesa_texformat_argb8888) { + if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { rrb->cpp = 4; rrb->base._ActualFormat = GL_RGBA8; rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_rgb565) { + else if (texImage->TexFormat == MESA_FORMAT_RGB565) { rrb->cpp = 2; rrb->base._ActualFormat = GL_RGB5; rrb->base._BaseFormat = GL_RGB; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb1555) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { rrb->cpp = 2; rrb->base._ActualFormat = GL_RGB5_A1; rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb4444) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { rrb->cpp = 2; rrb->base._ActualFormat = GL_RGBA4; rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_z16) { + else if (texImage->TexFormat == MESA_FORMAT_Z16) { rrb->cpp = 2; rrb->base._ActualFormat = GL_DEPTH_COMPONENT16; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; rrb->base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_s8_z24) { + else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { rrb->cpp = 4; rrb->base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; rrb->base._BaseFormat = GL_DEPTH_STENCIL_EXT; @@ -436,29 +436,30 @@ restart: /* try redoing the FBO */ if (retry == 1) { DBG("Render to texture BAD FORMAT %d\n", - texImage->TexFormat->MesaFormat); + texImage->TexFormat); return GL_FALSE; } texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0, - _mesa_get_format_datatype(texImage->TexFormat->MesaFormat), + _mesa_get_format_datatype(texImage->TexFormat), 1); retry++; goto restart; } - texFormat = texImage->TexFormat->MesaFormat; + texFormat = texImage->TexFormat; rrb->pitch = texImage->Width * rrb->cpp; rrb->base.InternalFormat = rrb->base._ActualFormat; rrb->base.Width = texImage->Width; rrb->base.Height = texImage->Height; - rrb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); - rrb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); - rrb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); - rrb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); - rrb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); - rrb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); + rrb->base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); + rrb->base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); + rrb->base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); + rrb->base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); + rrb->base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); + rrb->base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); + rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_nop_alloc_storage; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 851474f871..b602bfb4b0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -325,7 +325,7 @@ GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, if (!texImage->IsCompressed && !mt->compressed && - _mesa_get_format_bytes(texImage->TexFormat->MesaFormat) != mt->bpp) + _mesa_get_format_bytes(texImage->TexFormat) != mt->bpp) return GL_FALSE; lvl = &mt->levels[level - mt->firstLevel]; @@ -354,8 +354,8 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu numfaces = 6; firstImage = texObj->Image[0][firstLevel]; - compressed = firstImage->IsCompressed ? firstImage->TexFormat->MesaFormat : 0; - texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat); + compressed = firstImage->IsCompressed ? firstImage->TexFormat : 0; + texelBytes = _mesa_get_format_bytes(firstImage->TexFormat); return (mt->firstLevel == firstLevel && mt->lastLevel == lastLevel && @@ -374,7 +374,7 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, radeon_texture_image *image, GLuint face, GLuint level) { - GLuint compressed = image->base.IsCompressed ? image->base.TexFormat->MesaFormat : 0; + GLuint compressed = image->base.IsCompressed ? image->base.TexFormat : 0; GLuint numfaces = 1; GLuint firstLevel, lastLevel; GLuint texelBytes; @@ -388,7 +388,7 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, if (level != firstLevel || face >= numfaces) return; - texelBytes = _mesa_get_format_bytes(image->base.TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(image->base.TexFormat); t->mt = radeon_miptree_create(rmesa, t, t->base.Target, image->base.InternalFormat, diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index a00497a8f9..1064602504 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -1031,18 +1031,18 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int log2Width = firstImage->WidthLog2; log2Height = firstImage->HeightLog2; log2Depth = firstImage->DepthLog2; - texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(firstImage->TexFormat); if (!t->image_override) { - if (VALID_FORMAT(firstImage->TexFormat->MesaFormat)) { + if (VALID_FORMAT(firstImage->TexFormat)) { const struct tx_table *table = tx_table; t->pp_txformat &= ~(RADEON_TXFORMAT_FORMAT_MASK | RADEON_TXFORMAT_ALPHA_IN_MAP); t->pp_txfilter &= ~RADEON_YUV_TO_RGB; - t->pp_txformat |= table[ firstImage->TexFormat->MesaFormat ].format; - t->pp_txfilter |= table[ firstImage->TexFormat->MesaFormat ].filter; + t->pp_txformat |= table[ firstImage->TexFormat ].format; + t->pp_txfilter |= table[ firstImage->TexFormat ].filter; } else { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 3ff8cad93e..0378b3c9fc 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -256,9 +256,9 @@ void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_objec /* try to find a format which will only need a memcopy */ -static const struct gl_texture_format *radeonChoose8888TexFormat(radeonContextPtr rmesa, - GLenum srcFormat, - GLenum srcType, GLboolean fbo) +static gl_format radeonChoose8888TexFormat(radeonContextPtr rmesa, + GLenum srcFormat, + GLenum srcType, GLboolean fbo) { const GLuint ui = 1; const GLubyte littleEndian = *((const GLubyte *)&ui); @@ -271,37 +271,37 @@ static const struct gl_texture_format *radeonChoose8888TexFormat(radeonContextPt (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) || (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && littleEndian)) { - return &_mesa_texformat_rgba8888; + return MESA_FORMAT_RGBA8888; } else if ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) || (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8) || (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && !littleEndian)) { - return &_mesa_texformat_rgba8888_rev; + return MESA_FORMAT_RGBA8888_REV; } else if (IS_R200_CLASS(rmesa->radeonScreen)) { return _dri_texformat_argb8888; } else if (srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && !littleEndian) || srcType == GL_UNSIGNED_INT_8_8_8_8)) { - return &_mesa_texformat_argb8888_rev; + return MESA_FORMAT_ARGB8888_REV; } else if (srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && littleEndian) || srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else return _dri_texformat_argb8888; } -const struct gl_texture_format *radeonChooseTextureFormat_mesa(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type) +gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type) { return radeonChooseTextureFormat(ctx, internalFormat, format, type, 0); } -const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type, GLboolean fbo) +gl_format radeonChooseTextureFormat(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type, GLboolean fbo) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); const GLboolean do32bpt = @@ -425,50 +425,50 @@ const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; case GL_ALPHA16F_ARB: - return &_mesa_texformat_alpha_float16; + return MESA_FORMAT_ALPHA_FLOAT16; case GL_ALPHA32F_ARB: - return &_mesa_texformat_alpha_float32; + return MESA_FORMAT_ALPHA_FLOAT32; case GL_LUMINANCE16F_ARB: - return &_mesa_texformat_luminance_float16; + return MESA_FORMAT_LUMINANCE_FLOAT16; case GL_LUMINANCE32F_ARB: - return &_mesa_texformat_luminance_float32; + return MESA_FORMAT_LUMINANCE_FLOAT32; case GL_LUMINANCE_ALPHA16F_ARB: - return &_mesa_texformat_luminance_alpha_float16; + return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16; case GL_LUMINANCE_ALPHA32F_ARB: - return &_mesa_texformat_luminance_alpha_float32; + return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32; case GL_INTENSITY16F_ARB: - return &_mesa_texformat_intensity_float16; + return MESA_FORMAT_INTENSITY_FLOAT16; case GL_INTENSITY32F_ARB: - return &_mesa_texformat_intensity_float32; + return MESA_FORMAT_INTENSITY_FLOAT32; case GL_RGB16F_ARB: - return &_mesa_texformat_rgba_float16; + return MESA_FORMAT_RGBA_FLOAT16; case GL_RGB32F_ARB: - return &_mesa_texformat_rgba_float32; + return MESA_FORMAT_RGBA_FLOAT32; case GL_RGBA16F_ARB: - return &_mesa_texformat_rgba_float16; + return MESA_FORMAT_RGBA_FLOAT16; case GL_RGBA32F_ARB: - return &_mesa_texformat_rgba_float32; + return MESA_FORMAT_RGBA_FLOAT32; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: @@ -476,7 +476,7 @@ const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, case GL_DEPTH_COMPONENT32: case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - return &_mesa_texformat_s8_z24; + return MESA_FORMAT_S8_Z24; /* EXT_texture_sRGB */ case GL_SRGB: @@ -485,26 +485,26 @@ const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, case GL_SRGB8_ALPHA8: case GL_COMPRESSED_SRGB: case GL_COMPRESSED_SRGB_ALPHA: - return &_mesa_texformat_srgba8; + return MESA_FORMAT_SRGBA8; case GL_SLUMINANCE: case GL_SLUMINANCE8: case GL_COMPRESSED_SLUMINANCE: - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; case GL_SLUMINANCE_ALPHA: case GL_SLUMINANCE8_ALPHA8: case GL_COMPRESSED_SLUMINANCE_ALPHA: - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; default: _mesa_problem(ctx, "unexpected internalFormat 0x%x in %s", (int)internalFormat, __func__); - return NULL; + return MESA_FORMAT_NONE; } - return NULL; /* never get here */ + return MESA_FORMAT_NONE; /* never get here */ } /** @@ -544,18 +544,18 @@ static void radeon_teximage( texImage->TexFormat = radeonChooseTextureFormat(ctx, internalFormat, format, type, 0); _mesa_set_fetch_functions(texImage, dims); - if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } else { texImage->IsCompressed = GL_FALSE; texImage->CompressedSize = 0; - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { postConvWidth = 32 / texelBytes; @@ -593,7 +593,7 @@ static void radeon_teximage( if (texImage->IsCompressed) { size = texImage->CompressedSize; } else { - size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat); } texImage->Data = _mesa_alloc_texmemory(size); } @@ -613,7 +613,7 @@ static void radeon_teximage( if (compressed) { if (image->mt) { uint32_t srcRowStride, bytesPerRow, rows; - srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); bytesPerRow = srcRowStride; rows = (height + 3) / 4; copy_rows(texImage->Data, image->mt->levels[level].rowstride, @@ -629,7 +629,7 @@ static void radeon_teximage( radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; } else { - dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat); } if (dims == 3) { @@ -640,7 +640,7 @@ static void radeon_teximage( _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); for (i = 0; i < depth; ++i) { - dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat->MesaFormat) * height * i; + dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat) * height * i; } } else { dstImageOffsets = texImage->ImageOffsets; @@ -756,23 +756,23 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; } else { - dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat); } if (compressed) { uint32_t srcRowStride, bytesPerRow, rows; GLubyte *img_start; if (!image->mt) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, texImage->Width); + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, texImage->Width); img_start = _mesa_compressed_image_address(xoffset, yoffset, 0, - texImage->TexFormat->MesaFormat, + texImage->TexFormat, texImage->Width, texImage->Data); } else { uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4); img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4); } - srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); bytesPerRow = srcRowStride; rows = (height + 3) / 4; @@ -895,10 +895,10 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_imag /* need to confirm this value is correct */ if (mt->compressed) { height = (image->base.Height + 3) / 4; - srcrowstride = _mesa_compressed_row_stride(image->base.TexFormat->MesaFormat, image->base.Width); + srcrowstride = _mesa_compressed_row_stride(image->base.TexFormat, image->base.Width); } else { height = image->base.Height * image->base.Depth; - srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat->MesaFormat); + srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat); } // if (mt->tilebits) diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h index 888a55ba91..8995546d77 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.h +++ b/src/mesa/drivers/dri/radeon/radeon_texture.h @@ -30,6 +30,10 @@ #ifndef RADEON_TEXTURE_H #define RADEON_TEXTURE_H + +#include "main/formats.h" + + struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx); void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage); @@ -40,14 +44,16 @@ void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj); void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj); int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj); GLuint radeon_face_for_target(GLenum target); -const struct gl_texture_format *radeonChooseTextureFormat_mesa(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type); -const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type, GLboolean fbo); + +gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type); + +gl_format radeonChooseTextureFormat(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type, GLboolean fbo); void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, GLint internalFormat, diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index fe239e1b05..796da4fc0d 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -527,6 +527,11 @@ savageAllocTexObj( struct gl_texture_object *texObj ) * components to white. This way we get the correct result. */ +#if 0 +/* Using MESA_FORMAT_RGBA8888 to store alpha-only textures should + * work but is space inefficient. + */ + static GLboolean _savage_texstore_a1114444(TEXSTORE_PARAMS); @@ -590,10 +595,11 @@ _savage_texstore_a1114444(TEXSTORE_PARAMS) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { + GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUI = (GLushort *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -629,10 +635,11 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { + GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -647,10 +654,11 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS) return GL_TRUE; } +#endif /* Called by the _mesa_store_teximage[123]d() functions. */ -static const struct gl_texture_format * +static gl_format savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -669,15 +677,15 @@ savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555; case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; default: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; } case 3: @@ -686,129 +694,152 @@ savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; default: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; } case GL_RGBA8: case GL_RGBA12: case GL_RGBA16: return !force16bpt ? - &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_RGB10_A2: return !force16bpt ? - &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGB5: case GL_RGB4: case GL_R3_G3_B2: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_ALPHA: case GL_COMPRESSED_ALPHA: - return isSavage4 ? &_mesa_texformat_a8 : ( +#if 0 + return isSavage4 ? MESA_FORMAT_a8 : ( do32bpt ? &_savage_texformat_a1118888 : &_savage_texformat_a1114444); +#else + if (isSavage4) + return MESA_FORMAT_A8; + else if (do32bpt) + return MESA_FORMAT_ARGB8888; + else + return MESA_FORMAT_ARGB4444; +#endif case GL_ALPHA4: - return isSavage4 ? &_mesa_texformat_a8 : &_savage_texformat_a1114444; +#if 0 + return isSavage4 ? MESA_FORMAT_a8 : &_savage_texformat_a1114444; +#else + if (isSavage4) + return MESA_FORMAT_A8; + else + return MESA_FORMAT_ARGB4444; +#endif case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: - return isSavage4 ? &_mesa_texformat_a8 : ( +#if 0 + return isSavage4 ? MESA_FORMAT_a8 : ( !force16bpt ? &_savage_texformat_a1118888 : &_savage_texformat_a1114444); - +#else + if (isSavage4) + return MESA_FORMAT_A8; + else if (force16bpt) + return MESA_FORMAT_ARGB4444; + else + return MESA_FORMAT_ARGB8888; +#endif case 1: case GL_LUMINANCE: case GL_COMPRESSED_LUMINANCE: /* no alpha, but use argb1555 in 16bit case to get pure grey values */ - return isSavage4 ? &_mesa_texformat_l8 : ( - do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555); + return isSavage4 ? MESA_FORMAT_L8 : ( + do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555); case GL_LUMINANCE4: - return isSavage4 ? &_mesa_texformat_l8 : &_mesa_texformat_argb1555; + return isSavage4 ? MESA_FORMAT_L8 : MESA_FORMAT_ARGB1555; case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: - return isSavage4 ? &_mesa_texformat_l8 : ( - !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555); + return isSavage4 ? MESA_FORMAT_L8 : ( + !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555); case 2: case GL_LUMINANCE_ALPHA: case GL_COMPRESSED_LUMINANCE_ALPHA: /* Savage4 has a al44 texture format. But it's not supported by Mesa. */ - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; #if 0 /* TFT_I8 produces garbage on ProSavageDDR and subsequent texture * disable keeps rendering garbage. Disabled for now. */ case GL_INTENSITY: case GL_COMPRESSED_INTENSITY: - return isSavage4 ? &_mesa_texformat_i8 : ( - do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444); + return isSavage4 ? MESA_FORMAT_i8 : ( + do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444); case GL_INTENSITY4: - return isSavage4 ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444; + return isSavage4 ? MESA_FORMAT_i8 : MESA_FORMAT_ARGB4444; case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: - return isSavage4 ? &_mesa_texformat_i8 : ( - !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444); + return isSavage4 ? MESA_FORMAT_i8 : ( + !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444); #else case GL_INTENSITY: case GL_COMPRESSED_INTENSITY: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_INTENSITY4: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: - return !force16bpt ? &_mesa_texformat_argb8888 : - &_mesa_texformat_argb4444; + return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; #endif case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: if (!isSavage4) /* Not the best choice but Savage3D/MX/IX don't support DXT3 or DXT5. */ - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; /* fall through */ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; /* case GL_COLOR_INDEX: @@ -822,7 +853,7 @@ savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, */ default: _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__); - return NULL; + return MESA_FORMAT_NONE; } } @@ -837,7 +868,7 @@ static void savageSetTexImages( savageContextPtr imesa, assert(t); assert(image); - switch (image->TexFormat->MesaFormat) { + switch (image->TexFormat) { case MESA_FORMAT_ARGB8888: textureFormat = TFT_ARGB8888; t->texelBytes = tileIndex = 4; @@ -2083,6 +2114,7 @@ void savageDDInitTextureFuncs( struct dd_function_table *functions ) /* Texel fetching with our custom texture formats works just like * the standard argb formats. */ +#if 0 _savage_texformat_a1114444.FetchTexel1D = _mesa_texformat_argb4444.FetchTexel1D; _savage_texformat_a1114444.FetchTexel2D = _mesa_texformat_argb4444.FetchTexel2D; _savage_texformat_a1114444.FetchTexel3D = _mesa_texformat_argb4444.FetchTexel3D; @@ -2096,4 +2128,5 @@ void savageDDInitTextureFuncs( struct dd_function_table *functions ) _savage_texformat_a1118888.FetchTexel1Df= _mesa_texformat_argb8888.FetchTexel1Df; _savage_texformat_a1118888.FetchTexel2Df= _mesa_texformat_argb8888.FetchTexel2Df; _savage_texformat_a1118888.FetchTexel3Df= _mesa_texformat_argb8888.FetchTexel3Df; +#endif } diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index 38a309d41f..5dc05146b1 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -65,7 +65,7 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level, if (t->format == 0) { t->format = image->_BaseFormat; - switch (image->TexFormat->MesaFormat) + switch (image->TexFormat) { case MESA_FORMAT_ARGB8888: t->hwformat = TEXEL_ARGB_8888_32; @@ -101,13 +101,12 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level, t->hwformat = TEXEL_VUY422; break; default: - sis_fatal_error("Bad texture format 0x%x.\n", - image->TexFormat->MesaFormat); + sis_fatal_error("Bad texture format 0x%x.\n", image->TexFormat); } } assert(t->format == image->_BaseFormat); - texel_size = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + texel_size = _mesa_get_format_bytes(image->TexFormat); size = image->Width * image->Height * texel_size + TEXTURE_HW_PLUS; addr = sisAllocFB( smesa, size, &t->image[level].handle ); @@ -230,7 +229,7 @@ static GLboolean sisIsTextureResident( GLcontext * ctx, return (texObj->DriverData != NULL); } -static const struct gl_texture_format * +static gl_format sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -248,15 +247,15 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555; case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; default: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; } case 3: @@ -265,46 +264,46 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; default: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; } case GL_RGBA8: case GL_RGBA12: case GL_RGBA16: return !force16bpt ? - &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_RGB10_A2: return !force16bpt ? - &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGB5: case GL_RGB4: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_R3_G3_B2: - return &_mesa_texformat_rgb332; + return MESA_FORMAT_RGB332; case GL_ALPHA: case GL_ALPHA4: /* FIXME: This could use its own texstore */ @@ -312,7 +311,7 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case 1: case GL_LUMINANCE: @@ -321,7 +320,7 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case 2: case GL_LUMINANCE_ALPHA: @@ -332,7 +331,7 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: @@ -340,19 +339,19 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; default: _mesa_problem(ctx, "unexpected format in sisDDChooseTextureFormat: %d", internalFormat); - return NULL; + return MESA_FORMAT_NONE; } } @@ -425,7 +424,7 @@ static void sisTexSubImage1D( GLcontext *ctx, /* Upload the texture */ WaitEngIdle(smesa); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); copySize = width * texelBytes; src = (char *)texImage->Data + xoffset * texelBytes; @@ -513,7 +512,7 @@ static void sisTexSubImage2D( GLcontext *ctx, /* Upload the texture */ WaitEngIdle(smesa); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); copySize = width * texelBytes; src = (char *)texImage->Data + (xoffset + yoffset * texImage->Width) * diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 51d86aea37..427d315a01 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -72,13 +72,13 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, GLubyte *_d = NULL; GLenum _t = 0; - if (texImage->TexFormat->MesaFormat == MESA_FORMAT_RGB565) { + if (texImage->TexFormat == MESA_FORMAT_RGB565) { _t = GL_UNSIGNED_SHORT_5_6_5_REV; bpt = bytesPerPixel; - } else if (texImage->TexFormat->MesaFormat == MESA_FORMAT_ARGB4444) { + } else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { _t = GL_UNSIGNED_SHORT_4_4_4_4_REV; bpt = bytesPerPixel; - } else if (texImage->TexFormat->MesaFormat == MESA_FORMAT_ARGB1555) { + } else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { _t = GL_UNSIGNED_SHORT_1_5_5_5_REV; bpt = bytesPerPixel; } @@ -94,7 +94,7 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, _s = src = MALLOC(srcRowStride * srcHeight); _d = dst = MALLOC(dstWidth * bytesPerPixel * dstHeight); _mesa_texstore(ctx, 2, GL_RGBA, - &_mesa_texformat_rgba8888_rev, src, + MESA_FORMAT_RGBA8888_REV, src, 0, 0, 0, /* dstX/Y/Zoffset */ srcRowStride, /* dstRowStride */ &dstImageOffsets, @@ -190,6 +190,7 @@ tdfxGenerateMipmap(GLcontext *ctx, GLenum target, const tdfxMipMapLevel *mml; texImage = _mesa_get_tex_image(ctx, texObj, target, level); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); assert(!texImage->IsCompressed); mml = TDFX_TEXIMAGE_DATA(texImage); @@ -760,7 +761,7 @@ fxTexusError(const char *string, FxBool fatal) #endif -static const struct gl_texture_format * +static gl_format tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ) { @@ -774,7 +775,7 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case 1: case GL_LUMINANCE: case GL_LUMINANCE4: @@ -782,7 +783,7 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: @@ -792,48 +793,47 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_COMPRESSED_RGB: /* intentional fall-through */ case 3: case GL_RGB: if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) { - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; } /* intentional fall through */ case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return (allow32bpt) ? &_mesa_texformat_argb8888 - : &_mesa_texformat_rgb565; + return (allow32bpt) ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGBA2: case GL_RGBA4: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_COMPRESSED_RGBA: /* intentional fall-through */ case 4: case GL_RGBA: if ( srcFormat == GL_BGRA ) { if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; } else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } } /* intentional fall through */ @@ -841,10 +841,9 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return allow32bpt ? &_mesa_texformat_argb8888 - : &_mesa_texformat_argb4444; + return allow32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: @@ -852,29 +851,29 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; /* GL_EXT_texture_compression_s3tc */ /* GL_S3_s3tc */ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_RGB_S3TC: case GL_RGB4_S3TC: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; /* GL_3DFX_texture_compression_FXT1 */ case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; default: _mesa_problem(ctx, "unexpected format in tdfxChooseTextureFormat"); - return NULL; + return MESA_FORMAT_NONE; } } @@ -1126,7 +1125,9 @@ fetch_rgb_dxt1(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; + /* XXX Get fetch func from _mesa_get_texel_fetch_func() _mesa_texformat_rgb_dxt1.FetchTexel2D(texImage, i, j, k, rgba); + */ } @@ -1139,7 +1140,9 @@ fetch_rgba_dxt1(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; + /* XXX Get fetch func from _mesa_get_texel_fetch_func() _mesa_texformat_rgba_dxt1.FetchTexel2D(texImage, i, j, k, rgba); + */ } @@ -1152,7 +1155,9 @@ fetch_rgba_dxt3(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; + /* XXX Get fetch func from _mesa_get_texel_fetch_func() _mesa_texformat_rgba_dxt3.FetchTexel2D(texImage, i, j, k, rgba); + */ } @@ -1165,7 +1170,9 @@ fetch_rgba_dxt5(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; + /* XXX Get fetch func from _mesa_get_texel_fetch_func() _mesa_texformat_rgba_dxt5.FetchTexel2D(texImage, i, j, k, rgba); + */ } @@ -1268,7 +1275,7 @@ adjust2DRatio (GLcontext *ctx, } /* unpack image, apply transfer ops and store in rawImage */ _mesa_texstore(ctx, 2, GL_RGBA, - &_mesa_texformat_rgba8888_rev, rawImage, + MESA_FORMAT_RGBA8888_REV, rawImage, 0, 0, 0, /* dstX/Y/Zoffset */ width * rawBytes, /* dstRowStride */ &dstImageOffsets, @@ -1396,11 +1403,11 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, format, type); assert(texImage->TexFormat); - mesaFormat = texImage->TexFormat->MesaFormat; + mesaFormat = texImage->TexFormat; mml->glideFormat = fxGlideFormat(mesaFormat); ti->info.format = mml->glideFormat; texImage->FetchTexelc = fxFetchFunction(mesaFormat); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (texImage->IsCompressed) { texImage->CompressedSize = _mesa_compressed_texture_size(ctx, @@ -1408,7 +1415,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, mml->height, 1, mesaFormat); - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, mml->width); + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); texImage->Data = _mesa_alloc_texmemory(texImage->CompressedSize); } else { dstRowStride = mml->width * texelBytes; @@ -1484,9 +1491,9 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, assert(texImage->Data); /* must have an existing texture image! */ assert(texImage->_BaseFormat); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, mml->width); + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); } else { dstRowStride = mml->width * texelBytes; } @@ -1626,7 +1633,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, /* Determine the appropriate Glide texel format, * given the user's internal texture format hint. */ - mesaFormat = texImage->TexFormat->MesaFormat; + mesaFormat = texImage->TexFormat; mml->glideFormat = fxGlideFormat(mesaFormat); ti->info.format = mml->glideFormat; texImage->FetchTexelc = fxFetchFunction(mesaFormat); @@ -1661,7 +1668,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, * we replicate the data over the padded area. * For now, we take 2) + 3) but texelfetchers will be wrong! */ - const GLuint mesaFormat = texImage->TexFormat->MesaFormat; + const GLuint mesaFormat = texImage->TexFormat; GLuint srcRowStride = _mesa_compressed_row_stride(mesaFormat, width); GLuint destRowStride = _mesa_compressed_row_stride(mesaFormat, @@ -1698,7 +1705,7 @@ tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint destRowStride, srcRowStride; GLint i, rows; GLubyte *dest; - const GLuint mesaFormat = texImage->TexFormat->MesaFormat; + const GLuint mesaFormat = texImage->TexFormat; if (TDFX_DEBUG & DEBUG_VERBOSE_DRI) { fprintf(stderr, "tdfxCompressedTexSubImage2D: id=%d\n", texObj->Name); diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index f700994025..b6be06d1ee 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -49,7 +49,7 @@ #include "via_ioctl.h" #include "via_3d_reg.h" -static const struct gl_texture_format * +static gl_format viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -66,56 +66,56 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, if ( format == GL_BGRA ) { if ( type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_BYTE ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; } else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } } else if ( type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_INT_8_8_8_8 ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case 3: case GL_RGB: case GL_COMPRESSED_RGB: if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) { - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; } else if ( type == GL_UNSIGNED_BYTE ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case GL_RGB5: case GL_RGB4: case GL_R3_G3_B2: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_ALPHA: case GL_ALPHA4: @@ -123,7 +123,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case 1: case GL_LUMINANCE: @@ -132,7 +132,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case 2: case GL_LUMINANCE_ALPHA: @@ -143,7 +143,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: @@ -151,35 +151,35 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: @@ -188,16 +188,16 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; default: fprintf(stderr, "unexpected texture format %s in %s\n", _mesa_lookup_enum_by_nr(internalFormat), __FUNCTION__); - return NULL; + return MESA_FORMAT_NONE; } - return NULL; /* never get here */ + return MESA_FORMAT_NONE; /* never get here */ } static int logbase2(int n) @@ -458,7 +458,7 @@ static GLboolean viaSetTexImages(GLcontext *ctx, GLuint widthExp = 0; GLuint heightExp = 0; - switch (baseImage->image.TexFormat->MesaFormat) { + switch (baseImage->image.TexFormat) { case MESA_FORMAT_ARGB8888: texFormat = HC_HTXnFM_ARGB8888; break; @@ -692,7 +692,7 @@ static void viaTexImage(GLcontext *ctx, _mesa_set_fetch_functions(texImage, dims); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (texelBytes == 0) { /* compressed format */ @@ -700,7 +700,7 @@ static void viaTexImage(GLcontext *ctx, texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } /* Minimum pitch of 32 bytes */ @@ -794,10 +794,10 @@ static void viaTexImage(GLcontext *ctx, GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); } else { - dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, dims, texImage->_BaseFormat, diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 354015af1d..a64b6a5553 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1016,7 +1016,7 @@ PrintTexture(int w, int h, int c, const GLubyte * data) #endif -const struct gl_texture_format * +gl_format fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ) { @@ -1033,31 +1033,31 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case 3: case GL_RGB: if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) { - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; } /* intentional fall through */ case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return (allow32bpt) ? &_mesa_texformat_argb8888 - : &_mesa_texformat_rgb565; + return (allow32bpt) ? MESA_FORMAT_ARGB8888 + : MESA_FORMAT_RGB565; case GL_RGBA2: case GL_RGBA4: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_COMPRESSED_RGBA: /* intentional fall through */ case 4: case GL_RGBA: if ( srcFormat == GL_BGRA ) { if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; } else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } } /* intentional fall through */ @@ -1065,15 +1065,15 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return (allow32bpt) ? &_mesa_texformat_argb8888 - : &_mesa_texformat_argb4444; + return (allow32bpt) ? MESA_FORMAT_ARGB8888 + : MESA_FORMAT_ARGB4444; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case 1: case GL_LUMINANCE: case GL_LUMINANCE4: @@ -1081,14 +1081,14 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: @@ -1096,7 +1096,7 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: @@ -1106,35 +1106,35 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; /* GL_EXT_texture_compression_s3tc */ /* GL_S3_s3tc */ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_RGB_S3TC: case GL_RGB4_S3TC: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; /* GL_3DFX_texture_compression_FXT1 */ case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; default: _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat"); - return NULL; + return MESA_FORMAT_NONE; } } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index e2d4aa9b2d..5b00b5b82c 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1019,15 +1019,15 @@ test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, /** * In SW, we don't really compress GL_COMPRESSED_RGB[A] textures! */ -static const struct gl_texture_format * +static gl_format choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { switch (internalFormat) { case GL_COMPRESSED_RGB_ARB: - return &_mesa_texformat_rgb; + return MESA_FORMAT_RGB; case GL_COMPRESSED_RGBA_ARB: - return &_mesa_texformat_rgba; + return MESA_FORMAT_RGBA; default: return _mesa_choose_tex_format(ctx, internalFormat, format, type); } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index ce5e158626..9131f20f52 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -184,8 +184,8 @@ struct dd_function_table { * functions. The driver should examine \p internalFormat and return a * pointer to an appropriate gl_texture_format. */ - const struct gl_texture_format *(*ChooseTextureFormat)( GLcontext *ctx, - GLint internalFormat, GLenum srcFormat, GLenum srcType ); + GLuint (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat, + GLenum srcFormat, GLenum srcType ); /** * Called by glTexImage1D(). diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 8492c8561d..391180a7c6 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -315,7 +315,7 @@ dump_texture_cb(GLuint id, void *data, void *userData) if (texImg) { _mesa_printf(" Image %u: %d x %d x %d, format %u at %p\n", i, texImg->Width, texImg->Height, texImg->Depth, - texImg->TexFormat->MesaFormat, texImg->Data); + texImg->TexFormat, texImg->Data); if (DumpImages && !written) { GLuint face = 0; write_texture_image(texObj, face, i); diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 04419da6e5..6610725de8 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -384,7 +384,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, return; } - baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + baseFormat = _mesa_get_format_base_format(texImage->TexFormat); if (format == GL_COLOR) { if (baseFormat != GL_RGB && @@ -393,7 +393,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, att->Complete = GL_FALSE; return; } - if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { att_incomplete("compressed internalformat"); att->Complete = GL_FALSE; return; diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index c02c705228..7e99a5d3de 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1561,7 +1561,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, } else { /* uncompressed */ - convertFormat = srcImage->TexFormat->MesaFormat; + convertFormat = srcImage->TexFormat; } _mesa_format_to_type_and_comps(convertFormat, &datatype, &comps); @@ -1620,7 +1620,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, = ctx->Driver.CompressedTextureSize(ctx, dstImage->Width, dstImage->Height, dstImage->Depth, - dstImage->TexFormat->MesaFormat); + dstImage->TexFormat); ASSERT(dstImage->CompressedSize > 0); } @@ -1642,7 +1642,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, ASSERT(dstData); } else { - bytesPerTexel = _mesa_get_format_bytes(dstImage->TexFormat->MesaFormat); + bytesPerTexel = _mesa_get_format_bytes(dstImage->TexFormat); ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight * dstDepth * bytesPerTexel); @@ -1666,7 +1666,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, /* compress image from dstData into dstImage->Data */ const GLenum srcFormat = _mesa_get_format_base_format(convertFormat); GLint dstRowStride - = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth); + = _mesa_compressed_row_stride(dstImage->TexFormat, dstWidth); ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); _mesa_texstore(ctx, 2, dstImage->_BaseFormat, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d448e3e158..56d5e9fafd 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1200,7 +1200,7 @@ struct gl_texture_image GLboolean IsClientData; /**< Data owned by client? */ GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */ - const struct gl_texture_format *TexFormat; + GLuint TexFormat; /**< XXX Really gl_format */ struct gl_texture_object *TexObject; /**< Pointer back to parent object */ diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index c401f82be0..54e24fd297 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -74,7 +74,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgb_fxt1); + ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1); ASSERT(dstXoffset % 8 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset == 0); @@ -88,7 +88,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) /* convert image to RGB/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -106,7 +106,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride, @@ -131,7 +131,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgba_fxt1); + ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1); ASSERT(dstXoffset % 8 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset == 0); @@ -145,7 +145,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -163,7 +163,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride, diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 2294fdca73..69e43af0fd 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -165,7 +165,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgb_dxt1); + ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -179,7 +179,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) /* convert image to RGB/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -197,7 +197,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { @@ -228,7 +228,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgba_dxt1); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -242,7 +242,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -260,7 +260,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, @@ -290,7 +290,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgba_dxt3); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -304,7 +304,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -321,7 +321,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, @@ -351,7 +351,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgba_dxt5); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -365,7 +365,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -382,7 +382,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 60b2065a6c..019193f134 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -130,7 +130,7 @@ static void store_null_texel(struct gl_texture_image *texImage, /***************************************************************/ /** \name Default GLchan-based formats */ /*@{*/ - +#if 0 const struct gl_texture_format _mesa_texformat_rgba = { MESA_FORMAT_RGBA, /* MesaFormat */ GL_RGBA, /* BaseFormat */ @@ -1016,6 +1016,7 @@ const struct gl_texture_format _mesa_null_texformat = { 0, /* StencilBits */ 0, /* TexelBytes */ }; +#endif /*@}*/ @@ -1035,7 +1036,7 @@ const struct gl_texture_format _mesa_null_texformat = { * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers * will typically override this function with a specialized version. */ -const struct gl_texture_format * +gl_format _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -1049,15 +1050,15 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return &_mesa_texformat_rgba; + return MESA_FORMAT_RGBA; case GL_RGBA8: - return &_mesa_texformat_rgba8888; + return MESA_FORMAT_RGBA8888; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGBA2: - return &_mesa_texformat_argb4444_rev; /* just to test another format*/ + return MESA_FORMAT_ARGB4444_REV; /* just to test another format*/ case GL_RGBA4: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; /* RGB formats */ case 3: @@ -1065,24 +1066,24 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGB10: case GL_RGB12: case GL_RGB16: - return &_mesa_texformat_rgb; + return MESA_FORMAT_RGB; case GL_RGB8: - return &_mesa_texformat_rgb888; + return MESA_FORMAT_RGB888; case GL_R3_G3_B2: - return &_mesa_texformat_rgb332; + return MESA_FORMAT_RGB332; case GL_RGB4: - return &_mesa_texformat_rgb565_rev; /* just to test another format */ + return MESA_FORMAT_RGB565_REV; /* just to test another format */ case GL_RGB5: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; /* Alpha formats */ case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA12: case GL_ALPHA16: - return &_mesa_texformat_alpha; + return MESA_FORMAT_ALPHA; case GL_ALPHA8: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; /* Luminance formats */ case 1: @@ -1090,9 +1091,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE4: case GL_LUMINANCE12: case GL_LUMINANCE16: - return &_mesa_texformat_luminance; + return MESA_FORMAT_LUMINANCE; case GL_LUMINANCE8: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; /* Luminance/Alpha formats */ case 2: @@ -1102,17 +1103,17 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - return &_mesa_texformat_luminance_alpha; + return MESA_FORMAT_LUMINANCE_ALPHA; case GL_LUMINANCE8_ALPHA8: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY12: case GL_INTENSITY16: - return &_mesa_texformat_intensity; + return MESA_FORMAT_INTENSITY; case GL_INTENSITY8: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: @@ -1121,7 +1122,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: case GL_COLOR_INDEX8_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; default: ; /* fallthrough */ @@ -1132,9 +1133,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - return &_mesa_texformat_z32; + return MESA_FORMAT_Z32; case GL_DEPTH_COMPONENT16: - return &_mesa_texformat_z16; + return MESA_FORMAT_Z16; default: ; /* fallthrough */ } @@ -1142,35 +1143,35 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_COMPRESSED_ALPHA_ARB: - return &_mesa_texformat_alpha; + return MESA_FORMAT_ALPHA; case GL_COMPRESSED_LUMINANCE_ARB: - return &_mesa_texformat_luminance; + return MESA_FORMAT_LUMINANCE; case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - return &_mesa_texformat_luminance_alpha; + return MESA_FORMAT_LUMINANCE_ALPHA; case GL_COMPRESSED_INTENSITY_ARB: - return &_mesa_texformat_intensity; + return MESA_FORMAT_INTENSITY; case GL_COMPRESSED_RGB_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; #endif #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; #endif - return &_mesa_texformat_rgb; + return MESA_FORMAT_RGB; case GL_COMPRESSED_RGBA_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; #endif #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) - return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ + return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */ #endif - return &_mesa_texformat_rgba; + return MESA_FORMAT_RGBA; default: ; /* fallthrough */ } @@ -1178,9 +1179,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, if (ctx->Extensions.MESA_ycbcr_texture) { if (internalFormat == GL_YCBCR_MESA) { if (type == GL_UNSIGNED_SHORT_8_8_MESA) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; } } @@ -1188,9 +1189,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, if (ctx->Extensions.TDFX_texture_compression_FXT1) { switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; default: ; /* fallthrough */ } @@ -1201,13 +1202,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, if (ctx->Extensions.EXT_texture_compression_s3tc) { switch (internalFormat) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; default: ; /* fallthrough */ } @@ -1217,10 +1218,10 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_RGB_S3TC: case GL_RGB4_S3TC: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; default: ; /* fallthrough */ } @@ -1230,29 +1231,29 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, if (ctx->Extensions.ARB_texture_float) { switch (internalFormat) { case GL_ALPHA16F_ARB: - return &_mesa_texformat_alpha_float16; + return MESA_FORMAT_ALPHA_FLOAT16; case GL_ALPHA32F_ARB: - return &_mesa_texformat_alpha_float32; + return MESA_FORMAT_ALPHA_FLOAT32; case GL_LUMINANCE16F_ARB: - return &_mesa_texformat_luminance_float16; + return MESA_FORMAT_LUMINANCE_FLOAT16; case GL_LUMINANCE32F_ARB: - return &_mesa_texformat_luminance_float32; + return MESA_FORMAT_LUMINANCE_FLOAT32; case GL_LUMINANCE_ALPHA16F_ARB: - return &_mesa_texformat_luminance_alpha_float16; + return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16; case GL_LUMINANCE_ALPHA32F_ARB: - return &_mesa_texformat_luminance_alpha_float32; + return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32; case GL_INTENSITY16F_ARB: - return &_mesa_texformat_intensity_float16; + return MESA_FORMAT_INTENSITY_FLOAT16; case GL_INTENSITY32F_ARB: - return &_mesa_texformat_intensity_float32; + return MESA_FORMAT_INTENSITY_FLOAT32; case GL_RGB16F_ARB: - return &_mesa_texformat_rgb_float16; + return MESA_FORMAT_RGB_FLOAT16; case GL_RGB32F_ARB: - return &_mesa_texformat_rgb_float32; + return MESA_FORMAT_RGB_FLOAT32; case GL_RGBA16F_ARB: - return &_mesa_texformat_rgba_float16; + return MESA_FORMAT_RGBA_FLOAT16; case GL_RGBA32F_ARB: - return &_mesa_texformat_rgba_float32; + return MESA_FORMAT_RGBA_FLOAT32; default: ; /* fallthrough */ } @@ -1262,7 +1263,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - return &_mesa_texformat_z24_s8; + return MESA_FORMAT_Z24_S8; default: ; /* fallthrough */ } @@ -1272,7 +1273,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_DUDV_ATI: case GL_DU8DV8_ATI: - return &_mesa_texformat_dudv8; + return MESA_FORMAT_DUDV8; default: ; /* fallthrough */ } @@ -1282,7 +1283,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_RGBA_SNORM: case GL_RGBA8_SNORM: - return &_mesa_texformat_signed_rgba8888; + return MESA_FORMAT_SIGNED_RGBA8888; default: ; /* fallthrough */ } @@ -1294,48 +1295,48 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_SRGB_EXT: case GL_SRGB8_EXT: - return &_mesa_texformat_srgb8; + return MESA_FORMAT_SRGB8; case GL_SRGB_ALPHA_EXT: case GL_SRGB8_ALPHA8_EXT: - return &_mesa_texformat_srgba8; + return MESA_FORMAT_SRGBA8; case GL_SLUMINANCE_EXT: case GL_SLUMINANCE8_EXT: - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; case GL_SLUMINANCE_ALPHA_EXT: case GL_SLUMINANCE8_ALPHA8_EXT: - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; case GL_COMPRESSED_SLUMINANCE_EXT: - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; case GL_COMPRESSED_SRGB_EXT: #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgb_dxt1; + return MESA_FORMAT_SRGB_DXT1; #endif - return &_mesa_texformat_srgb8; + return MESA_FORMAT_SRGB8; case GL_COMPRESSED_SRGB_ALPHA_EXT: #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgba_dxt3; /* Not srgba_dxt1, see spec */ + return MESA_FORMAT_SRGBA_DXT3; /* Not srgba_dxt1, see spec */ #endif - return &_mesa_texformat_srgba8; + return MESA_FORMAT_SRGBA8; #if FEATURE_texture_s3tc case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgb_dxt1; + return MESA_FORMAT_SRGB_DXT1; break; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgba_dxt1; + return MESA_FORMAT_SRGBA_DXT1; break; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgba_dxt3; + return MESA_FORMAT_SRGBA_DXT3; break; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgba_dxt5; + return MESA_FORMAT_SRGBA_DXT5; break; #endif default: @@ -1345,7 +1346,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, #endif /* FEATURE_EXT_texture_sRGB */ _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); - return NULL; + return MESA_FORMAT_NONE; } diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 638eadff97..9095726ac2 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -39,7 +39,7 @@ #include "mtypes.h" #include "formats.h" - +#if 0 /** GLchan-valued formats */ /*@{*/ extern const struct gl_texture_format _mesa_texformat_rgba; @@ -143,9 +143,9 @@ extern const struct gl_texture_format _mesa_texformat_rgba_dxt5; /*@{*/ extern const struct gl_texture_format _mesa_null_texformat; /*@}*/ +#endif - -extern const struct gl_texture_format * +extern gl_format _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ); diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index eb160deff9..cb8386bbc8 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1424,7 +1424,7 @@ static void FETCH(f_z24_s8)( const struct gl_texture_image *texImage, const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); const GLfloat scale = 1.0F / (GLfloat) 0xffffff; texel[0] = ((*src) >> 8) * scale; - ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8); + ASSERT(texImage->TexFormat == MESA_FORMAT_Z24_S8); ASSERT(texel[0] >= 0.0F); ASSERT(texel[0] <= 1.0F); } @@ -1451,7 +1451,7 @@ static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage, const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); const GLfloat scale = 1.0F / (GLfloat) 0xffffff; texel[0] = ((*src) & 0x00ffffff) * scale; - ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_S8_Z24); + ASSERT(texImage->TexFormat == MESA_FORMAT_S8_Z24); ASSERT(texel[0] >= 0.0F); ASSERT(texel[0] <= 1.0F); } diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 2575d0d868..e9e408d8c5 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -49,7 +49,7 @@ static GLboolean is_srgb_teximage(const struct gl_texture_image *texImage) { - switch (texImage->TexFormat->MesaFormat) { + switch (texImage->TexFormat) { case MESA_FORMAT_SRGB8: case MESA_FORMAT_SRGBA8: case MESA_FORMAT_SARGB8: @@ -160,7 +160,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, if (format == GL_COLOR_INDEX) { GLuint indexRow[MAX_WIDTH]; GLint col; - GLuint indexBits = _mesa_get_format_bits(texImage->TexFormat->MesaFormat, GL_TEXTURE_INDEX_SIZE_EXT); + GLuint indexBits = _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT); /* Can't use FetchTexel here because that returns RGBA */ if (indexBits == 8) { const GLubyte *src = (const GLubyte *) texImage->Data; @@ -210,9 +210,9 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, (const GLushort *) texImage->Data + row * rowstride, width * sizeof(GLushort)); /* check for byte swapping */ - if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR + if ((texImage->TexFormat == MESA_FORMAT_YCBCR && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || - (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV + (texImage->TexFormat == MESA_FORMAT_YCBCR_REV && type == GL_UNSIGNED_SHORT_8_8_MESA)) { if (!ctx->Pack.SwapBytes) _mesa_swap2((GLushort *) dest, width); @@ -259,7 +259,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, GLint col; GLbitfield transferOps = 0x0; GLenum dataType = - _mesa_get_format_datatype(texImage->TexFormat->MesaFormat); + _mesa_get_format_datatype(texImage->TexFormat); /* clamp does not apply to GetTexImage (final conversion)? * Looks like we need clamp though when going from format @@ -350,7 +350,7 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, /* don't use texImage->CompressedSize since that may be padded out */ size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); /* just memcpy, no pixelstore or pixel transfer */ _mesa_memcpy(img, texImage->Data, size); @@ -439,7 +439,7 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level, return GL_TRUE; } - baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + baseFormat = _mesa_get_format_base_format(texImage->TexFormat); /* Make sure the requested image format is compatible with the * texture's format. Note that a color index texture can be converted diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 465da6b046..c4e5ce2682 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -900,7 +900,7 @@ clear_teximage_fields(struct gl_texture_image *img) img->HeightLog2 = 0; img->DepthLog2 = 0; img->Data = NULL; - img->TexFormat = &_mesa_null_texformat; + img->TexFormat = MESA_FORMAT_NONE; img->FetchTexelc = NULL; img->FetchTexelf = NULL; img->IsCompressed = 0; @@ -2232,8 +2232,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, format, type); + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); } } else { @@ -2352,8 +2352,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, postConvHeight, 1, border, internalFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, format, type); + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); } } else { @@ -2456,8 +2456,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, /* no error, set the tex image parameters */ _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, format, type); + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); } } else { diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index d38d5a4c23..a9df1dac15 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -765,7 +765,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, goto out; } - texFormat = img->TexFormat->MesaFormat; + texFormat = img->TexFormat; isProxy = _mesa_is_proxy_texture(target); diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 54e5668abc..81bb1d40ff 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -470,7 +470,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; ASSERT(trb->TexImage); - trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat->MesaFormat); + trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat); if (!trb->Store) { /* we'll never draw into some textures (compressed formats) */ trb->Store = store_nop; @@ -485,21 +485,21 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->Zoffset = att->Zoffset; } - texFormat = trb->TexImage->TexFormat->MesaFormat; + texFormat = trb->TexImage->TexFormat; trb->Base.Width = trb->TexImage->Width; trb->Base.Height = trb->TexImage->Height; trb->Base.InternalFormat = trb->TexImage->InternalFormat; /* XXX may need more special cases here */ - if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8) { + if (trb->TexImage->TexFormat == MESA_FORMAT_Z24_S8) { trb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; } - else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z16) { + else if (trb->TexImage->TexFormat == MESA_FORMAT_Z16) { trb->Base._ActualFormat = GL_DEPTH_COMPONENT; trb->Base.DataType = GL_UNSIGNED_SHORT; } - else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z32) { + else if (trb->TexImage->TexFormat == MESA_FORMAT_Z32) { trb->Base._ActualFormat = GL_DEPTH_COMPONENT; trb->Base.DataType = GL_UNSIGNED_INT; } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index ca298bb237..02e3df89cf 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -932,7 +932,7 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx, static void memcpy_texture(GLcontext *ctx, GLuint dimensions, - const struct gl_texture_format *dstFormat, + gl_format dstFormat, GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, @@ -948,7 +948,7 @@ memcpy_texture(GLcontext *ctx, srcWidth, srcHeight, srcFormat, srcType); const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLint bytesPerRow = srcWidth * texelBytes; #if 0 @@ -1017,15 +1017,15 @@ static GLboolean _mesa_texstore_rgba(TEXSTORE_PARAMS) { const GLint components = _mesa_components_in_format(baseInternalFormat); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); - - ASSERT(dstFormat == &_mesa_texformat_rgba || - dstFormat == &_mesa_texformat_rgb || - dstFormat == &_mesa_texformat_alpha || - dstFormat == &_mesa_texformat_luminance || - dstFormat == &_mesa_texformat_luminance_alpha || - dstFormat == &_mesa_texformat_intensity); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_RGBA || + dstFormat == MESA_FORMAT_RGB || + dstFormat == MESA_FORMAT_ALPHA || + dstFormat == MESA_FORMAT_LUMINANCE || + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA || + dstFormat == MESA_FORMAT_INTENSITY); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -1048,7 +1048,7 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgb && + dstFormat == MESA_FORMAT_RGB && srcFormat == GL_RGBA && srcType == CHAN_TYPE) { /* extract RGB from RGBA */ @@ -1089,27 +1089,27 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if (dstFormat == &_mesa_texformat_rgba) { + if (dstFormat == MESA_FORMAT_RGBA) { dstmap = mappings[IDX_RGBA].from_rgba; components = 4; } - else if (dstFormat == &_mesa_texformat_rgb) { + else if (dstFormat == MESA_FORMAT_RGB) { dstmap = mappings[IDX_RGB].from_rgba; components = 3; } - else if (dstFormat == &_mesa_texformat_alpha) { + else if (dstFormat == MESA_FORMAT_ALPHA) { dstmap = mappings[IDX_ALPHA].from_rgba; components = 1; } - else if (dstFormat == &_mesa_texformat_luminance) { + else if (dstFormat == MESA_FORMAT_LUMINANCE) { dstmap = mappings[IDX_LUMINANCE].from_rgba; components = 1; } - else if (dstFormat == &_mesa_texformat_luminance_alpha) { + else if (dstFormat == MESA_FORMAT_LUMINANCE_ALPHA) { dstmap = mappings[IDX_LUMINANCE_ALPHA].from_rgba; components = 2; } - else if (dstFormat == &_mesa_texformat_intensity) { + else if (dstFormat == MESA_FORMAT_INTENSITY) { dstmap = mappings[IDX_INTENSITY].from_rgba; components = 1; } @@ -1168,9 +1168,9 @@ static GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffffff; - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) dims; - ASSERT(dstFormat == &_mesa_texformat_z32); + ASSERT(dstFormat == MESA_FORMAT_Z32); ASSERT(texelBytes == sizeof(GLuint)); if (ctx->Pixel.DepthScale == 1.0f && @@ -1217,9 +1217,9 @@ static GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffff; - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) dims; - ASSERT(dstFormat == &_mesa_texformat_z16); + ASSERT(dstFormat == MESA_FORMAT_Z16); ASSERT(texelBytes == sizeof(GLushort)); if (ctx->Pixel.DepthScale == 1.0f && @@ -1265,16 +1265,16 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb565(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgb565 || - dstFormat == &_mesa_texformat_rgb565_rev); + ASSERT(dstFormat == MESA_FORMAT_RGB565 || + dstFormat == MESA_FORMAT_RGB565_REV); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgb565 && + dstFormat == MESA_FORMAT_RGB565 && baseInternalFormat == GL_RGB && srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5) { @@ -1306,7 +1306,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) const GLubyte *srcUB = (const GLubyte *) src; GLushort *dstUS = (GLushort *) dst; /* check for byteswapped format */ - if (dstFormat == &_mesa_texformat_rgb565) { + if (dstFormat == MESA_FORMAT_RGB565) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_565( srcUB[0], srcUB[1], srcUB[2] ); srcUB += 3; @@ -1343,7 +1343,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; /* check for byteswapped format */ - if (dstFormat == &_mesa_texformat_rgb565) { + if (dstFormat == MESA_FORMAT_RGB565) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_565( CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), @@ -1375,16 +1375,16 @@ static GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba8888 || - dstFormat == &_mesa_texformat_rgba8888_rev); + ASSERT(dstFormat == MESA_FORMAT_RGBA8888 || + dstFormat == MESA_FORMAT_RGBA8888_REV); ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgba8888 && + dstFormat == MESA_FORMAT_RGBA8888 && baseInternalFormat == GL_RGBA && ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) || (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) || @@ -1400,7 +1400,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgba8888_rev && + dstFormat == MESA_FORMAT_RGBA8888_REV && baseInternalFormat == GL_RGBA && ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) || @@ -1425,8 +1425,8 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == &_mesa_texformat_rgba8888) || - (!littleEndian && dstFormat == &_mesa_texformat_rgba8888_rev)) { + if ((littleEndian && dstFormat == MESA_FORMAT_RGBA8888) || + (!littleEndian && dstFormat == MESA_FORMAT_RGBA8888_REV)) { dstmap[3] = 0; dstmap[2] = 1; dstmap[1] = 2; @@ -1469,7 +1469,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == &_mesa_texformat_rgba8888) { + if (dstFormat == MESA_FORMAT_RGBA8888) { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), @@ -1500,16 +1500,16 @@ static GLboolean _mesa_texstore_argb8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_argb8888 || - dstFormat == &_mesa_texformat_argb8888_rev); + ASSERT(dstFormat == MESA_FORMAT_ARGB8888 || + dstFormat == MESA_FORMAT_ARGB8888_REV); ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb8888 && + dstFormat == MESA_FORMAT_ARGB8888 && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && littleEndian) || @@ -1524,7 +1524,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb8888_rev && + dstFormat == MESA_FORMAT_ARGB8888_REV && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && !littleEndian) || @@ -1539,7 +1539,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb8888 && + dstFormat == MESA_FORMAT_ARGB8888 && srcFormat == GL_RGB && (baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB) && @@ -1569,7 +1569,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb8888 && + dstFormat == MESA_FORMAT_ARGB8888 && srcFormat == GL_RGBA && baseInternalFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { @@ -1614,16 +1614,16 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == &_mesa_texformat_argb8888) || - (!littleEndian && dstFormat == &_mesa_texformat_argb8888_rev)) { + if ((littleEndian && dstFormat == MESA_FORMAT_ARGB8888) || + (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV)) { dstmap[3] = 3; /* alpha */ dstmap[2] = 0; /* red */ dstmap[1] = 1; /* green */ dstmap[0] = 2; /* blue */ } else { - assert((littleEndian && dstFormat == &_mesa_texformat_argb8888_rev) || - (!littleEndian && dstFormat == &_mesa_texformat_argb8888)); + assert((littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) || + (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888)); dstmap[3] = 2; dstmap[2] = 1; dstmap[1] = 0; @@ -1662,7 +1662,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == &_mesa_texformat_argb8888) { + if (dstFormat == MESA_FORMAT_ARGB8888) { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), @@ -1693,10 +1693,10 @@ static GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgb888); + ASSERT(dstFormat == MESA_FORMAT_RGB888); ASSERT(texelBytes == 3); if (!ctx->_ImageTransferState && @@ -1820,10 +1820,10 @@ static GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_bgr888); + ASSERT(dstFormat == MESA_FORMAT_BGR888); ASSERT(texelBytes == 3); if (!ctx->_ImageTransferState && @@ -1926,15 +1926,15 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba4444(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba4444); + ASSERT(dstFormat == MESA_FORMAT_RGBA4444); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgba4444 && + dstFormat == MESA_FORMAT_RGBA4444 && baseInternalFormat == GL_RGBA && srcFormat == GL_RGBA && srcType == GL_UNSIGNED_SHORT_4_4_4_4){ @@ -1984,16 +1984,16 @@ _mesa_texstore_rgba4444(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb4444(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_argb4444 || - dstFormat == &_mesa_texformat_argb4444_rev); + ASSERT(dstFormat == MESA_FORMAT_ARGB4444 || + dstFormat == MESA_FORMAT_ARGB4444_REV); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb4444 && + dstFormat == MESA_FORMAT_ARGB4444 && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) { @@ -2025,7 +2025,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == &_mesa_texformat_argb4444) { + if (dstFormat == MESA_FORMAT_ARGB4444) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), @@ -2054,15 +2054,15 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba5551(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba5551); + ASSERT(dstFormat == MESA_FORMAT_RGBA5551); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgba5551 && + dstFormat == MESA_FORMAT_RGBA5551 && baseInternalFormat == GL_RGBA && srcFormat == GL_RGBA && srcType == GL_UNSIGNED_SHORT_5_5_5_1) { @@ -2112,16 +2112,16 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb1555(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_argb1555 || - dstFormat == &_mesa_texformat_argb1555_rev); + ASSERT(dstFormat == MESA_FORMAT_ARGB1555 || + dstFormat == MESA_FORMAT_ARGB1555_REV); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb1555 && + dstFormat == MESA_FORMAT_ARGB1555 && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) { @@ -2153,7 +2153,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == &_mesa_texformat_argb1555) { + if (dstFormat == MESA_FORMAT_ARGB1555) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_1555( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), @@ -2184,16 +2184,16 @@ static GLboolean _mesa_texstore_al88(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_al88 || - dstFormat == &_mesa_texformat_al88_rev); + ASSERT(dstFormat == MESA_FORMAT_AL88 || + dstFormat == MESA_FORMAT_AL88_REV); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_al88 && + dstFormat == MESA_FORMAT_AL88 && baseInternalFormat == GL_LUMINANCE_ALPHA && srcFormat == GL_LUMINANCE_ALPHA && srcType == GL_UNSIGNED_BYTE && @@ -2216,8 +2216,8 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == &_mesa_texformat_al88) || - (!littleEndian && dstFormat == &_mesa_texformat_al88_rev)) { + if ((littleEndian && dstFormat == MESA_FORMAT_AL88) || + (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) { dstmap[0] = 0; dstmap[1] = 3; } @@ -2258,7 +2258,7 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == &_mesa_texformat_al88) { + if (dstFormat == MESA_FORMAT_AL88) { for (col = 0; col < srcWidth; col++) { /* src[0] is luminance, src[1] is alpha */ dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]), @@ -2286,10 +2286,10 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgb332); + ASSERT(dstFormat == MESA_FORMAT_RGB332); ASSERT(texelBytes == 1); if (!ctx->_ImageTransferState && @@ -2344,12 +2344,12 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_a8 || - dstFormat == &_mesa_texformat_l8 || - dstFormat == &_mesa_texformat_i8); + ASSERT(dstFormat == MESA_FORMAT_A8 || + dstFormat == MESA_FORMAT_L8 || + dstFormat == MESA_FORMAT_I8); ASSERT(texelBytes == 1); if (!ctx->_ImageTransferState && @@ -2373,7 +2373,7 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if (dstFormat == &_mesa_texformat_a8) { + if (dstFormat == MESA_FORMAT_A8) { dstmap[0] = 3; } else { @@ -2429,10 +2429,10 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) dims; (void) baseInternalFormat; - ASSERT(dstFormat == &_mesa_texformat_ci8); + ASSERT(dstFormat == MESA_FORMAT_CI8); ASSERT(texelBytes == 1); ASSERT(baseInternalFormat == GL_COLOR_INDEX); @@ -2471,18 +2471,18 @@ _mesa_texstore_ci8(TEXSTORE_PARAMS) /** - * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev. + * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_REV. */ static GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) ctx; (void) dims; (void) baseInternalFormat; - ASSERT((dstFormat == &_mesa_texformat_ycbcr) || - (dstFormat == &_mesa_texformat_ycbcr_rev)); + ASSERT((dstFormat == MESA_FORMAT_YCBCR) || + (dstFormat == MESA_FORMAT_YCBCR_REV)); ASSERT(texelBytes == 2); ASSERT(ctx->Extensions.MESA_ycbcr_texture); ASSERT(srcFormat == GL_YCBCR_MESA); @@ -2502,7 +2502,7 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) /* XXX the logic here _might_ be wrong */ if (srcPacking->SwapBytes ^ (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA) ^ - (dstFormat == &_mesa_texformat_ycbcr_rev) ^ + (dstFormat == MESA_FORMAT_YCBCR_REV) ^ !littleEndian) { GLint img, row; for (img = 0; img < srcDepth; img++) { @@ -2523,9 +2523,9 @@ static GLboolean _mesa_texstore_dudv8(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_dudv8); + ASSERT(dstFormat == MESA_FORMAT_DUDV8); ASSERT(texelBytes == 2); ASSERT(ctx->Extensions.ATI_envmap_bumpmap); ASSERT((srcFormat == GL_DU8DV8_ATI) || @@ -2617,16 +2617,16 @@ static GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888 || - dstFormat == &_mesa_texformat_signed_rgba8888_rev); + ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBA8888 || + dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV); ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_signed_rgba8888 && + dstFormat == MESA_FORMAT_SIGNED_RGBA8888 && baseInternalFormat == GL_RGBA && ((srcFormat == GL_RGBA && srcType == GL_BYTE && !littleEndian) || (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && littleEndian))) { @@ -2640,7 +2640,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_signed_rgba8888_rev && + dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV && baseInternalFormat == GL_RGBA && ((srcFormat == GL_RGBA && srcType == GL_BYTE && littleEndian) || (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) { @@ -2661,8 +2661,8 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) || - (!littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888_rev)) { + if ((littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888) || + (!littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV)) { dstmap[3] = 0; dstmap[2] = 1; dstmap[1] = 2; @@ -2705,7 +2705,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == &_mesa_texformat_signed_rgba8888) { + if (dstFormat == MESA_FORMAT_SIGNED_RGBA8888) { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]), FLOAT_TO_BYTE_TEX(srcRow[GCOMP]), @@ -2743,7 +2743,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) / sizeof(GLuint); GLint img, row; - ASSERT(dstFormat == &_mesa_texformat_z24_s8); + ASSERT(dstFormat == MESA_FORMAT_Z24_S8); ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); @@ -2844,7 +2844,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) / sizeof(GLuint); GLint img, row; - ASSERT(dstFormat == &_mesa_texformat_s8_z24); + ASSERT(dstFormat == MESA_FORMAT_S8_Z24); ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); @@ -2927,16 +2927,16 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba_float32 || - dstFormat == &_mesa_texformat_rgb_float32 || - dstFormat == &_mesa_texformat_alpha_float32 || - dstFormat == &_mesa_texformat_luminance_float32 || - dstFormat == &_mesa_texformat_luminance_alpha_float32 || - dstFormat == &_mesa_texformat_intensity_float32); + ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT32 || + dstFormat == MESA_FORMAT_RGB_FLOAT32 || + dstFormat == MESA_FORMAT_ALPHA_FLOAT32 || + dstFormat == MESA_FORMAT_LUMINANCE_FLOAT32 || + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 || + dstFormat == MESA_FORMAT_INTENSITY_FLOAT32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -2996,16 +2996,16 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba_float16 || - dstFormat == &_mesa_texformat_rgb_float16 || - dstFormat == &_mesa_texformat_alpha_float16 || - dstFormat == &_mesa_texformat_luminance_float16 || - dstFormat == &_mesa_texformat_luminance_alpha_float16 || - dstFormat == &_mesa_texformat_intensity_float16); + ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT16 || + dstFormat == MESA_FORMAT_RGB_FLOAT16 || + dstFormat == MESA_FORMAT_ALPHA_FLOAT16 || + dstFormat == MESA_FORMAT_LUMINANCE_FLOAT16 || + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 || + dstFormat == MESA_FORMAT_INTENSITY_FLOAT16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -3065,13 +3065,13 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_srgb8); + ASSERT(dstFormat == MESA_FORMAT_SRGB8); /* reuse normal rgb texstore code */ - newDstFormat = &_mesa_texformat_rgb888; + newDstFormat = MESA_FORMAT_RGB888; k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, @@ -3087,13 +3087,13 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_srgba8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_srgba8); + ASSERT(dstFormat == MESA_FORMAT_SRGBA8); /* reuse normal rgba texstore code */ - newDstFormat = &_mesa_texformat_rgba8888; + newDstFormat = MESA_FORMAT_RGBA8888; k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, @@ -3108,13 +3108,13 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_sargb8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_sargb8); + ASSERT(dstFormat == MESA_FORMAT_SARGB8); /* reuse normal rgba texstore code */ - newDstFormat = &_mesa_texformat_argb8888; + newDstFormat = MESA_FORMAT_ARGB8888; k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, @@ -3130,12 +3130,12 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_sl8); + ASSERT(dstFormat == MESA_FORMAT_SL8); - newDstFormat = &_mesa_texformat_l8; + newDstFormat = MESA_FORMAT_L8; /* _mesa_textore_a8 handles luminance8 too */ k = _mesa_texstore_a8(ctx, dims, baseInternalFormat, @@ -3152,13 +3152,13 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_sla8); + ASSERT(dstFormat == MESA_FORMAT_SLA8); /* reuse normal luminance/alpha texstore code */ - newDstFormat = &_mesa_texformat_al88; + newDstFormat = MESA_FORMAT_AL88; k = _mesa_texstore_al88(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, @@ -3280,7 +3280,7 @@ _mesa_texstore(TEXSTORE_PARAMS) StoreTexImageFunc storeImage; GLboolean success; - storeImage = _mesa_get_texstore_func(dstFormat->MesaFormat); + storeImage = _mesa_get_texstore_func(dstFormat); assert(storeImage); @@ -3390,7 +3390,7 @@ fetch_texel_float_to_chan(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texelOut) { GLfloat temp[4]; - GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat); ASSERT(texImage->FetchTexelf); texImage->FetchTexelf(texImage, i, j, k, temp); @@ -3417,7 +3417,7 @@ fetch_texel_chan_to_float(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texelOut) { GLchan temp[4]; - GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat); ASSERT(texImage->FetchTexelc); texImage->FetchTexelc(texImage, i, j, k, temp); @@ -3446,7 +3446,7 @@ _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) ASSERT(texImage->TexFormat); texImage->FetchTexelf = - _mesa_get_texel_fetch_func(texImage->TexFormat->MesaFormat, dims); + _mesa_get_texel_fetch_func(texImage->TexFormat, dims); /* now check if we need to use a float/chan adaptor */ if (!texImage->FetchTexelc) { @@ -3466,13 +3466,13 @@ static void compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage) { texImage->IsCompressed = - _mesa_is_format_compressed(texImage->TexFormat->MesaFormat); + _mesa_is_format_compressed(texImage->TexFormat); if (texImage->IsCompressed) { texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } else { /* non-compressed format */ @@ -3513,7 +3513,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, if (texImage->IsCompressed) sizeInBytes = texImage->CompressedSize; else - sizeInBytes = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + sizeInBytes = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); @@ -3578,7 +3578,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, _mesa_set_fetch_functions(texImage, 2); compute_texture_size(ctx, texImage); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ if (texImage->IsCompressed) @@ -3605,7 +3605,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, if (texImage->IsCompressed) { dstRowStride - = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + = _mesa_compressed_row_stride(texImage->TexFormat, width); } else { dstRowStride = texImage->RowStride * texelBytes; @@ -3654,7 +3654,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, _mesa_set_fetch_functions(texImage, 3); compute_texture_size(ctx, texImage); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ if (texImage->IsCompressed) @@ -3681,7 +3681,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, if (texImage->IsCompressed) { dstRowStride - = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + = _mesa_compressed_row_stride(texImage->TexFormat, width); } else { dstRowStride = texImage->RowStride * texelBytes; @@ -3770,12 +3770,12 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, texImage->Width); } else { dstRowStride = texImage->RowStride * - _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, @@ -3820,12 +3820,12 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, texImage->Width); } else { dstRowStride = texImage->RowStride * - _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, @@ -3985,7 +3985,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, GLint i, rows; GLubyte *dest; const GLubyte *src; - const gl_format texFormat = texImage->TexFormat->MesaFormat; + const gl_format texFormat = texImage->TexFormat; (void) format; diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 4a217df103..2db076dfff 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -58,7 +58,7 @@ #define TEXSTORE_PARAMS \ GLcontext *ctx, GLuint dims, \ GLenum baseInternalFormat, \ - const struct gl_texture_format *dstFormat, \ + gl_format dstFormat, \ GLvoid *dstAddr, \ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \ GLint dstRowStride, const GLuint *dstImageOffsets, \ diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 6da57e817b..081c09c1fb 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -338,7 +338,7 @@ make_texture(struct st_context *st, GLcontext *ctx = st->ctx; struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; - const struct gl_texture_format *mformat; + gl_format mformat; struct pipe_texture *pt; enum pipe_format pipeFormat; GLuint cpp; @@ -350,7 +350,7 @@ make_texture(struct st_context *st, mformat = st_ChooseTextureFormat(ctx, baseFormat, format, type); assert(mformat); - pipeFormat = st_mesa_format_to_pipe_format(mformat->MesaFormat); + pipeFormat = st_mesa_format_to_pipe_format(mformat); assert(pipeFormat); cpp = st_sizeof_format(pipeFormat); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index d96484c439..716fbc8b29 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -95,9 +95,9 @@ gl_target_to_pipe(GLenum target) * format. */ static GLuint -compressed_num_bytes(GLuint mesaFormat) +compressed_num_bytes(gl_format format) { - switch(mesaFormat) { + switch (format) { #if FEATURE_texture_fxt1 case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: @@ -117,9 +117,9 @@ compressed_num_bytes(GLuint mesaFormat) static GLboolean -is_compressed_mesa_format(const struct gl_texture_format *format) +is_compressed_mesa_format(gl_format format) { - switch (format->MesaFormat) { + switch (format) { case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: case MESA_FORMAT_RGBA_DXT3: @@ -338,7 +338,7 @@ guess_and_alloc_texture(struct st_context *st, lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth); } - fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat); + fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat); usage = default_usage(fmt); @@ -411,7 +411,7 @@ compress_with_blit(GLcontext * ctx, const GLuint dstImageOffsets[1] = {0}; struct st_texture_image *stImage = st_texture_image(texImage); struct pipe_screen *screen = ctx->st->pipe->screen; - const struct gl_texture_format *mesa_format; + gl_format mesa_format; struct pipe_texture templ; struct pipe_texture *src_tex; struct pipe_surface *dst_surface; @@ -443,7 +443,7 @@ compress_with_blit(GLcontext * ctx, */ memset(&templ, 0, sizeof(templ)); templ.target = PIPE_TEXTURE_2D; - templ.format = st_mesa_format_to_pipe_format(mesa_format->MesaFormat); + templ.format = st_mesa_format_to_pipe_format(mesa_format); pf_get_block(templ.format, &templ.block); templ.width[0] = width; templ.height[0] = height; @@ -559,17 +559,17 @@ st_TexImage(GLcontext * ctx, _mesa_set_fetch_functions(texImage, dims); - if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { /* must be a compressed format */ texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } else { - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { @@ -699,7 +699,7 @@ st_TexImage(GLcontext * ctx, if (texImage->IsCompressed) { sizeInBytes = texImage->CompressedSize; dstRowStride = - _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); } else { @@ -1824,10 +1824,10 @@ st_finalize_texture(GLcontext *ctx, /* FIXME: determine format block instead of cpp */ if (firstImage->base.IsCompressed) { - cpp = compressed_num_bytes(firstImage->base.TexFormat->MesaFormat); + cpp = compressed_num_bytes(firstImage->base.TexFormat); } else { - cpp = _mesa_get_format_bytes(firstImage->base.TexFormat->MesaFormat); + cpp = _mesa_get_format_bytes(firstImage->base.TexFormat); } /* If we already have a gallium texture, check that it matches the texture @@ -1835,7 +1835,7 @@ st_finalize_texture(GLcontext *ctx, */ if (stObj->pt) { const enum pipe_format fmt = - st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat); + st_mesa_format_to_pipe_format(firstImage->base.TexFormat); if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) || stObj->pt->format != fmt || stObj->pt->last_level < stObj->lastLevel || @@ -1854,7 +1854,7 @@ st_finalize_texture(GLcontext *ctx, */ if (!stObj->pt) { const enum pipe_format fmt = - st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat); + st_mesa_format_to_pipe_format(firstImage->base.TexFormat); GLuint usage = default_usage(fmt); stObj->pt = st_texture_create(ctx->st, diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index dcb90a3107..6f76e2d8c0 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -629,74 +629,74 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat) } -static const struct gl_texture_format * +static gl_format translate_gallium_format_to_mesa_format(enum pipe_format format) { switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case PIPE_FORMAT_A1R5G5B5_UNORM: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case PIPE_FORMAT_A4R4G4B4_UNORM: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case PIPE_FORMAT_R5G6B5_UNORM: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case PIPE_FORMAT_A8L8_UNORM: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case PIPE_FORMAT_A8_UNORM: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case PIPE_FORMAT_L8_UNORM: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case PIPE_FORMAT_I8_UNORM: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case PIPE_FORMAT_Z16_UNORM: - return &_mesa_texformat_z16; + return MESA_FORMAT_Z16; case PIPE_FORMAT_Z32_UNORM: - return &_mesa_texformat_z32; + return MESA_FORMAT_Z32; case PIPE_FORMAT_Z24S8_UNORM: - return &_mesa_texformat_z24_s8; + return MESA_FORMAT_Z24_S8; case PIPE_FORMAT_S8Z24_UNORM: - return &_mesa_texformat_s8_z24; + return MESA_FORMAT_S8_Z24; case PIPE_FORMAT_YCBCR: - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; case PIPE_FORMAT_YCBCR_REV: - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; #if FEATURE_texture_s3tc case PIPE_FORMAT_DXT1_RGB: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case PIPE_FORMAT_DXT1_RGBA: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case PIPE_FORMAT_DXT3_RGBA: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case PIPE_FORMAT_DXT5_RGBA: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; #if FEATURE_EXT_texture_sRGB case PIPE_FORMAT_DXT1_SRGB: - return &_mesa_texformat_srgb_dxt1; + return MESA_FORMAT_SRGB_DXT1; case PIPE_FORMAT_DXT1_SRGBA: - return &_mesa_texformat_srgba_dxt1; + return MESA_FORMAT_SRGBA_DXT1; case PIPE_FORMAT_DXT3_SRGBA: - return &_mesa_texformat_srgba_dxt3; + return MESA_FORMAT_SRGBA_DXT3; case PIPE_FORMAT_DXT5_SRGBA: - return &_mesa_texformat_srgba_dxt5; + return MESA_FORMAT_SRGBA_DXT5; #endif #endif #if FEATURE_EXT_texture_sRGB case PIPE_FORMAT_A8L8_SRGB: - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; case PIPE_FORMAT_L8_SRGB: - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; case PIPE_FORMAT_R8G8B8_SRGB: - return &_mesa_texformat_srgb8; + return MESA_FORMAT_SRGB8; case PIPE_FORMAT_R8G8B8A8_SRGB: - return &_mesa_texformat_srgba8; + return MESA_FORMAT_SRGBA8; case PIPE_FORMAT_A8R8G8B8_SRGB: - return &_mesa_texformat_sargb8; + return MESA_FORMAT_SARGB8; #endif /* XXX add additional cases */ default: assert(0); - return NULL; + return MESA_FORMAT_NONE; } } @@ -704,7 +704,7 @@ translate_gallium_format_to_mesa_format(enum pipe_format format) /** * Called via ctx->Driver.chooseTextureFormat(). */ -const struct gl_texture_format * +gl_format st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type) { @@ -716,7 +716,7 @@ st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat, pFormat = st_choose_format(ctx->st->pipe, internalFormat, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); if (pFormat == PIPE_FORMAT_NONE) - return NULL; + return MESA_FORMAT_NONE; return translate_gallium_format_to_mesa_format(pFormat); } diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 9d9e02fe9b..1a8c6ea98f 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -29,6 +29,7 @@ #ifndef ST_FORMAT_H #define ST_FORMAT_H +#include "main/formats.h" struct pipe_format_info { @@ -71,7 +72,7 @@ extern enum pipe_format st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat); -extern const struct gl_texture_format * +extern gl_format st_ChooseTextureFormat(GLcontext * ctx, GLint internalFormat, GLenum format, GLenum type); diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 63a6956a7a..58f6933652 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -115,7 +115,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, assert(target != GL_TEXTURE_3D); /* not done yet */ - _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat->MesaFormat, + _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat, &datatype, &comps); for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index bbc2830e69..1790e1b28d 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -128,7 +128,7 @@ st_texture_match_image(const struct pipe_texture *pt, /* Check if this image's format matches the established texture's format. */ - if (st_mesa_format_to_pipe_format(image->TexFormat->MesaFormat) != pt->format) + if (st_mesa_format_to_pipe_format(image->TexFormat) != pt->format) return GL_FALSE; /* Test if this image's size matches what's expected in the diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 004d4e05ae..11c8f9256a 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -745,7 +745,7 @@ get_border_color(const struct gl_texture_object *tObj, const struct gl_texture_image *img, GLfloat rgba[4]) { - switch (img->TexFormat->BaseFormat) { + switch (img->_BaseFormat) { case GL_RGB: rgba[0] = tObj->BorderColor[0]; rgba[1] = tObj->BorderColor[1]; @@ -1152,7 +1152,7 @@ sample_2d_linear_repeat(GLcontext *ctx, ASSERT(tObj->WrapS == GL_REPEAT); ASSERT(tObj->WrapT == GL_REPEAT); ASSERT(img->Border == 0); - ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); + ASSERT(img->_BaseFormat != GL_COLOR_INDEX); ASSERT(img->_IsPowerOfTwo); linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi); @@ -1343,7 +1343,7 @@ opt_sample_rgb_2d(GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGB); + ASSERT(img->TexFormat == MESA_FORMAT_RGB); ASSERT(img->_IsPowerOfTwo); for (k=0; kWrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGBA); + ASSERT(img->TexFormat == MESA_FORMAT_RGBA); ASSERT(img->_IsPowerOfTwo); for (i = 0; i < n; i++) { @@ -1414,7 +1414,7 @@ sample_lambda_2d(GLcontext *ctx, const GLboolean repeatNoBorderPOT = (tObj->WrapS == GL_REPEAT) && (tObj->WrapT == GL_REPEAT) && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) - && (tImg->TexFormat->BaseFormat != GL_COLOR_INDEX) + && (tImg->_BaseFormat != GL_COLOR_INDEX) && tImg->_IsPowerOfTwo; ASSERT(lambda != NULL); @@ -1427,7 +1427,7 @@ sample_lambda_2d(GLcontext *ctx, switch (tObj->MinFilter) { case GL_NEAREST: if (repeatNoBorderPOT) { - switch (tImg->TexFormat->MesaFormat) { + switch (tImg->TexFormat) { case MESA_FORMAT_RGB: opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); @@ -1484,7 +1484,7 @@ sample_lambda_2d(GLcontext *ctx, switch (tObj->MagFilter) { case GL_NEAREST: if (repeatNoBorderPOT) { - switch (tImg->TexFormat->MesaFormat) { + switch (tImg->TexFormat) { case MESA_FORMAT_RGB: opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); @@ -2152,7 +2152,7 @@ sample_nearest_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); + ASSERT(img->_BaseFormat != GL_COLOR_INDEX); for (i = 0; i < n; i++) { GLint row, col; @@ -2186,7 +2186,7 @@ sample_linear_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); + ASSERT(img->_BaseFormat != GL_COLOR_INDEX); for (i = 0; i < n; i++) { GLint i0, j0, i1, j1; @@ -2973,8 +2973,8 @@ sample_depth_texture( GLcontext *ctx, (void) lambda; - ASSERT(img->TexFormat->BaseFormat == GL_DEPTH_COMPONENT || - img->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT); + ASSERT(img->_BaseFormat == GL_DEPTH_COMPONENT || + img->_BaseFormat == GL_DEPTH_STENCIL_EXT); ASSERT(tObj->Target == GL_TEXTURE_1D || tObj->Target == GL_TEXTURE_2D || @@ -3154,7 +3154,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, } else { const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); - const GLenum format = t->Image[0][t->BaseLevel]->TexFormat->BaseFormat; + const GLenum format = t->Image[0][t->BaseLevel]->_BaseFormat; switch (t->Target) { case GL_TEXTURE_1D: @@ -3189,14 +3189,14 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, t->WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && - img->TexFormat->MesaFormat == MESA_FORMAT_RGB) { + img->TexFormat == MESA_FORMAT_RGB) { return &opt_sample_rgb_2d; } else if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && - img->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { + img->TexFormat == MESA_FORMAT_RGBA) { return &opt_sample_rgba_2d; } else { diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 1ab0e19f92..7b59763f11 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1055,11 +1055,11 @@ _swrast_choose_triangle( GLcontext *ctx ) const struct gl_texture_object *texObj2D; const struct gl_texture_image *texImg; GLenum minFilter, magFilter, envMode; - GLint format; + gl_format format; texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; - format = texImg ? texImg->TexFormat->MesaFormat : -1; + format = texImg ? texImg->TexFormat : -1; minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0; envMode = ctx->Texture.Unit[0].EnvMode; -- cgit v1.2.3 From bdc761b0f9c8856193de6e8617c566851d010783 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 20:35:32 -0600 Subject: mesa: remove gl_texture_format --- src/mesa/main/mtypes.h | 34 -- src/mesa/main/texcompress_fxt1.c | 33 -- src/mesa/main/texcompress_s3tc.c | 129 ------ src/mesa/main/texformat.c | 908 --------------------------------------- src/mesa/main/texformat.h | 105 ----- 5 files changed, 1209 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 56d5e9fafd..1599a6f13f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1136,40 +1136,6 @@ typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage, const void *texel); -/** - * Texture format record - */ -struct gl_texture_format -{ - GLint MesaFormat; /**< One of the MESA_FORMAT_* values */ - - GLenum BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, - * GL_LUMINANCE, GL_LUMINANCE_ALPHA, - * GL_INTENSITY, GL_COLOR_INDEX or - * GL_DEPTH_COMPONENT. - */ - GLenum DataType; /**< GL_FLOAT or GL_UNSIGNED_NORMALIZED_ARB */ - - /** - * Bits per texel component. These are just rough approximations - * for compressed texture formats. - */ - /*@{*/ - GLubyte RedBits; - GLubyte GreenBits; - GLubyte BlueBits; - GLubyte AlphaBits; - GLubyte LuminanceBits; - GLubyte IntensityBits; - GLubyte IndexBits; - GLubyte DepthBits; - GLubyte StencilBits; /**< GL_EXT_packed_depth_stencil */ - /*@}*/ - - GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */ -}; - - /** * Texture image state. Describes the dimensions of a texture image, * the texel format and pointers to Texel Fetch functions. diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 54e24fd297..7a30806b60 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -226,39 +226,6 @@ _mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage, -const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { - MESA_FORMAT_RGB_FXT1, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0 /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { - MESA_FORMAT_RGBA_FXT1, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 1, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0 /* TexelBytes */ -}; - - /***************************************************************************\ * FXT1 encoder * diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 69e43af0fd..2f7168c622 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -567,132 +567,3 @@ _mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage, } #endif -const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { - MESA_FORMAT_RGB_DXT1, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { - MESA_FORMAT_RGBA_DXT1, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 1, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { - MESA_FORMAT_RGBA_DXT3, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 4, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { - MESA_FORMAT_RGBA_DXT5, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4,/*approx*/ /* RedBits */ - 4,/*approx*/ /* GreenBits */ - 4,/*approx*/ /* BlueBits */ - 4,/*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -#if FEATURE_EXT_texture_sRGB -const struct gl_texture_format _mesa_texformat_srgb_dxt1 = { - MESA_FORMAT_SRGB_DXT1, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_srgba_dxt1 = { - MESA_FORMAT_SRGBA_DXT1, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 1, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_srgba_dxt3 = { - MESA_FORMAT_SRGBA_DXT3, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 4, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_srgba_dxt5 = { - MESA_FORMAT_SRGBA_DXT5, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4,/*approx*/ /* RedBits */ - 4,/*approx*/ /* GreenBits */ - 4,/*approx*/ /* BlueBits */ - 4,/*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; -#endif diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 019193f134..9290210b3f 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -113,914 +113,6 @@ static void store_null_texel(struct gl_texture_image *texImage, } -/** - * Notes about the predefined gl_texture_formats: - * - * 1. There are 1D, 2D and 3D functions for fetching texels from texture - * images, returning both GLchan values and GLfloat values. (six - * functions in total) - * You don't have to provide both the GLchan and GLfloat functions; - * just one or the other is OK. Mesa will use an "adaptor" to convert - * between GLchan/GLfloat when needed. - * Since the adaptors have small performance penalty, we provide both - * GLchan and GLfloat functions for some common formats like RGB, RGBA. - */ - - -/***************************************************************/ -/** \name Default GLchan-based formats */ -/*@{*/ -#if 0 -const struct gl_texture_format _mesa_texformat_rgba = { - MESA_FORMAT_RGBA, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - CHAN_BITS, /* RedBits */ - CHAN_BITS, /* GreenBits */ - CHAN_BITS, /* BlueBits */ - CHAN_BITS, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4 * sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb = { - MESA_FORMAT_RGB, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - CHAN_BITS, /* RedBits */ - CHAN_BITS, /* GreenBits */ - CHAN_BITS, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3 * sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_alpha = { - MESA_FORMAT_ALPHA, /* MesaFormat */ - GL_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - CHAN_BITS, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance = { - MESA_FORMAT_LUMINANCE, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - CHAN_BITS, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_alpha = { - MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - CHAN_BITS, /* AlphaBits */ - CHAN_BITS, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2 * sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_intensity = { - MESA_FORMAT_INTENSITY, /* MesaFormat */ - GL_INTENSITY, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - CHAN_BITS, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLchan), /* TexelBytes */ -}; - - -#if FEATURE_EXT_texture_sRGB - -const struct gl_texture_format _mesa_texformat_srgb8 = { - MESA_FORMAT_SRGB8, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_srgba8 = { - MESA_FORMAT_SRGBA8, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_sargb8 = { - MESA_FORMAT_SARGB8, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_sl8 = { - MESA_FORMAT_SL8, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -/* Note: this format name looks like a misnomer, make it sal8? */ -const struct gl_texture_format _mesa_texformat_sla8 = { - MESA_FORMAT_SLA8, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -#endif /* FEATURE_EXT_texture_sRGB */ - -const struct gl_texture_format _mesa_texformat_rgba_float32 = { - MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 8 * sizeof(GLfloat), /* RedBits */ - 8 * sizeof(GLfloat), /* GreenBits */ - 8 * sizeof(GLfloat), /* BlueBits */ - 8 * sizeof(GLfloat), /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_float16 = { - MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 8 * sizeof(GLhalfARB), /* RedBits */ - 8 * sizeof(GLhalfARB), /* GreenBits */ - 8 * sizeof(GLhalfARB), /* BlueBits */ - 8 * sizeof(GLhalfARB), /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb_float32 = { - MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 8 * sizeof(GLfloat), /* RedBits */ - 8 * sizeof(GLfloat), /* GreenBits */ - 8 * sizeof(GLfloat), /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb_float16 = { - MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 8 * sizeof(GLhalfARB), /* RedBits */ - 8 * sizeof(GLhalfARB), /* GreenBits */ - 8 * sizeof(GLhalfARB), /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_alpha_float32 = { - MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */ - GL_ALPHA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8 * sizeof(GLfloat), /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_alpha_float16 = { - MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */ - GL_ALPHA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8 * sizeof(GLhalfARB), /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_float32 = { - MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 8 * sizeof(GLfloat), /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_float16 = { - MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 8 * sizeof(GLhalfARB), /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8 * sizeof(GLfloat), /* AlphaBits */ - 8 * sizeof(GLfloat), /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8 * sizeof(GLhalfARB), /* AlphaBits */ - 8 * sizeof(GLhalfARB), /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_intensity_float32 = { - MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */ - GL_INTENSITY, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 8 * sizeof(GLfloat), /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_intensity_float16 = { - MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */ - GL_INTENSITY, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 8 * sizeof(GLhalfARB), /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_dudv8 = { - MESA_FORMAT_DUDV8, /* MesaFormat */ - GL_DUDV_ATI, /* BaseFormat */ - GL_SIGNED_NORMALIZED, /* DataType */ - /* maybe should add dudvBits field, but spec seems to be - lacking the ability to query with GetTexLevelParameter anyway */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { - MESA_FORMAT_SIGNED_RGBA8888, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_SIGNED_NORMALIZED, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { - MESA_FORMAT_SIGNED_RGBA8888_REV, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_SIGNED_NORMALIZED, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -/*@}*/ - - -/***************************************************************/ -/** \name Hardware formats */ -/*@{*/ - -const struct gl_texture_format _mesa_texformat_rgba8888 = { - MESA_FORMAT_RGBA8888, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba8888_rev = { - MESA_FORMAT_RGBA8888_REV, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb8888 = { - MESA_FORMAT_ARGB8888, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb8888_rev = { - MESA_FORMAT_ARGB8888_REV, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb888 = { - MESA_FORMAT_RGB888, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_bgr888 = { - MESA_FORMAT_BGR888, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb565 = { - MESA_FORMAT_RGB565, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 6, /* GreenBits */ - 5, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb565_rev = { - MESA_FORMAT_RGB565_REV, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 6, /* GreenBits */ - 5, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba4444 = { - MESA_FORMAT_RGBA4444, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /* RedBits */ - 4, /* GreenBits */ - 4, /* BlueBits */ - 4, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb4444 = { - MESA_FORMAT_ARGB4444, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /* RedBits */ - 4, /* GreenBits */ - 4, /* BlueBits */ - 4, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb4444_rev = { - MESA_FORMAT_ARGB4444_REV, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /* RedBits */ - 4, /* GreenBits */ - 4, /* BlueBits */ - 4, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba5551 = { - MESA_FORMAT_RGBA5551, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 5, /* GreenBits */ - 5, /* BlueBits */ - 1, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb1555 = { - MESA_FORMAT_ARGB1555, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 5, /* GreenBits */ - 5, /* BlueBits */ - 1, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb1555_rev = { - MESA_FORMAT_ARGB1555_REV, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 5, /* GreenBits */ - 5, /* BlueBits */ - 1, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_al88 = { - MESA_FORMAT_AL88, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_al88_rev = { - MESA_FORMAT_AL88_REV, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb332 = { - MESA_FORMAT_RGB332, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 3, /* RedBits */ - 3, /* GreenBits */ - 2, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_a8 = { - MESA_FORMAT_A8, /* MesaFormat */ - GL_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_l8 = { - MESA_FORMAT_L8, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_i8 = { - MESA_FORMAT_I8, /* MesaFormat */ - GL_INTENSITY, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 8, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_ci8 = { - MESA_FORMAT_CI8, /* MesaFormat */ - GL_COLOR_INDEX, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 8, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_ycbcr = { - MESA_FORMAT_YCBCR, /* MesaFormat */ - GL_YCBCR_MESA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_ycbcr_rev = { - MESA_FORMAT_YCBCR_REV, /* MesaFormat */ - GL_YCBCR_MESA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_z24_s8 = { - MESA_FORMAT_Z24_S8, /* MesaFormat */ - GL_DEPTH_STENCIL_EXT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 24, /* DepthBits */ - 8, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_s8_z24 = { - MESA_FORMAT_S8_Z24, /* MesaFormat */ - GL_DEPTH_STENCIL_EXT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 24, /* DepthBits */ - 8, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_z16 = { - MESA_FORMAT_Z16, /* MesaFormat */ - GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - sizeof(GLushort) * 8, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLushort), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_z32 = { - MESA_FORMAT_Z32, /* MesaFormat */ - GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - sizeof(GLuint) * 8, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLuint), /* TexelBytes */ -}; - -/*@}*/ - - -/***************************************************************/ -/** \name Null format (useful for proxy textures) */ -/*@{*/ - -const struct gl_texture_format _mesa_null_texformat = { - -1, /* MesaFormat */ - 0, /* BaseFormat */ - GL_NONE, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; -#endif - -/*@}*/ - - /** * Choose an appropriate texture format given the format, type and * internalFormat parameters passed to glTexImage(). diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 9095726ac2..ed6a3a3851 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -39,111 +39,6 @@ #include "mtypes.h" #include "formats.h" -#if 0 -/** GLchan-valued formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_rgba; -extern const struct gl_texture_format _mesa_texformat_rgb; -extern const struct gl_texture_format _mesa_texformat_alpha; -extern const struct gl_texture_format _mesa_texformat_luminance; -extern const struct gl_texture_format _mesa_texformat_luminance_alpha; -extern const struct gl_texture_format _mesa_texformat_intensity; -/*@}*/ - -#if FEATURE_EXT_texture_sRGB -/** sRGB (nonlinear) formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_srgb8; -extern const struct gl_texture_format _mesa_texformat_srgba8; -extern const struct gl_texture_format _mesa_texformat_sargb8; -extern const struct gl_texture_format _mesa_texformat_sl8; -extern const struct gl_texture_format _mesa_texformat_sla8; -#if FEATURE_texture_s3tc -extern const struct gl_texture_format _mesa_texformat_srgb_dxt1; -extern const struct gl_texture_format _mesa_texformat_srgba_dxt1; -extern const struct gl_texture_format _mesa_texformat_srgba_dxt3; -extern const struct gl_texture_format _mesa_texformat_srgba_dxt5; -#endif -/*@}*/ -#endif - -/** Floating point texture formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_rgba_float32; -extern const struct gl_texture_format _mesa_texformat_rgba_float16; -extern const struct gl_texture_format _mesa_texformat_rgb_float32; -extern const struct gl_texture_format _mesa_texformat_rgb_float16; -extern const struct gl_texture_format _mesa_texformat_alpha_float32; -extern const struct gl_texture_format _mesa_texformat_alpha_float16; -extern const struct gl_texture_format _mesa_texformat_luminance_float32; -extern const struct gl_texture_format _mesa_texformat_luminance_float16; -extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float32; -extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float16; -extern const struct gl_texture_format _mesa_texformat_intensity_float32; -extern const struct gl_texture_format _mesa_texformat_intensity_float16; -/*@}*/ - -/** Signed fixed point texture formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_dudv8; -extern const struct gl_texture_format _mesa_texformat_signed_rgba8888; -extern const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev; -/*@}*/ - -/** \name Assorted hardware-friendly formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_rgba8888; -extern const struct gl_texture_format _mesa_texformat_rgba8888_rev; -extern const struct gl_texture_format _mesa_texformat_argb8888; -extern const struct gl_texture_format _mesa_texformat_argb8888_rev; -extern const struct gl_texture_format _mesa_texformat_rgb888; -extern const struct gl_texture_format _mesa_texformat_bgr888; -extern const struct gl_texture_format _mesa_texformat_rgb565; -extern const struct gl_texture_format _mesa_texformat_rgb565_rev; -extern const struct gl_texture_format _mesa_texformat_rgba4444; -extern const struct gl_texture_format _mesa_texformat_argb4444; -extern const struct gl_texture_format _mesa_texformat_argb4444_rev; -extern const struct gl_texture_format _mesa_texformat_argb1555; -extern const struct gl_texture_format _mesa_texformat_argb1555_rev; -extern const struct gl_texture_format _mesa_texformat_rgba5551; -extern const struct gl_texture_format _mesa_texformat_al88; -extern const struct gl_texture_format _mesa_texformat_al88_rev; -extern const struct gl_texture_format _mesa_texformat_rgb332; -extern const struct gl_texture_format _mesa_texformat_a8; -extern const struct gl_texture_format _mesa_texformat_l8; -extern const struct gl_texture_format _mesa_texformat_i8; -extern const struct gl_texture_format _mesa_texformat_ci8; -extern const struct gl_texture_format _mesa_texformat_z24_s8; -extern const struct gl_texture_format _mesa_texformat_s8_z24; -extern const struct gl_texture_format _mesa_texformat_z16; -extern const struct gl_texture_format _mesa_texformat_z32; -/*@}*/ - -/** \name YCbCr formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_ycbcr; -extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; -/*@}*/ - -/** \name Compressed formats */ -/*@{*/ -#if FEATURE_texture_fxt1 -extern const struct gl_texture_format _mesa_texformat_rgb_fxt1; -extern const struct gl_texture_format _mesa_texformat_rgba_fxt1; -#endif -#if FEATURE_texture_s3tc -extern const struct gl_texture_format _mesa_texformat_rgb_dxt1; -extern const struct gl_texture_format _mesa_texformat_rgba_dxt1; -extern const struct gl_texture_format _mesa_texformat_rgba_dxt3; -extern const struct gl_texture_format _mesa_texformat_rgba_dxt5; -#endif -/*@}*/ - -/** \name The null format */ -/*@{*/ -extern const struct gl_texture_format _mesa_null_texformat; -/*@}*/ -#endif extern gl_format _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, -- cgit v1.2.3 From 74ae14a2bde4f87a554c3d96e6f4a9a02591308d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 20:47:54 -0600 Subject: mesa: move texel fetch/store into new texfetch.[ch] files --- src/mesa/SConscript | 1 + src/mesa/main/texfetch.c | 616 ++++++++++++++++++++++++++++++++++++++ src/mesa/main/texfetch.h | 41 +++ src/mesa/main/texformat.c | 584 +----------------------------------- src/mesa/main/texformat.h | 22 +- src/mesa/main/texrender.c | 2 +- src/mesa/main/texstore.c | 1 + src/mesa/sources.mak | 1 + windows/VC7/mesa/mesa/mesa.vcproj | 6 + windows/VC8/mesa/mesa/mesa.vcproj | 8 + 10 files changed, 682 insertions(+), 600 deletions(-) create mode 100644 src/mesa/main/texfetch.c create mode 100644 src/mesa/main/texfetch.h (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 6dfbd26d94..8066da729b 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -91,6 +91,7 @@ if env['platform'] != 'winddk': 'main/texcompress_fxt1.c', 'main/texenv.c', 'main/texenvprogram.c', + 'main/texfetch.c', 'main/texformat.c', 'main/texgen.c', 'main/texgetimage.c', diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c new file mode 100644 index 0000000000..20ee2527f5 --- /dev/null +++ b/src/mesa/main/texfetch.c @@ -0,0 +1,616 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (c) 2009 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file texfetch.c + * + * Texel fetch/store functions + * + * \author Gareth Hughes + */ + + +#include "colormac.h" +#include "context.h" +#include "texcompress.h" +#include "texcompress_fxt1.h" +#include "texcompress_s3tc.h" +#include "texfetch.h" + + +#if FEATURE_EXT_texture_sRGB + +/** + * Convert an 8-bit sRGB value from non-linear space to a + * linear RGB value in [0, 1]. + * Implemented with a 256-entry lookup table. + */ +static INLINE GLfloat +nonlinear_to_linear(GLubyte cs8) +{ + static GLfloat table[256]; + static GLboolean tableReady = GL_FALSE; + if (!tableReady) { + /* compute lookup table now */ + GLuint i; + for (i = 0; i < 256; i++) { + const GLfloat cs = UBYTE_TO_FLOAT(i); + if (cs <= 0.04045) { + table[i] = cs / 12.92f; + } + else { + table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); + } + } + tableReady = GL_TRUE; + } + return table[cs8]; +} + + +#endif /* FEATURE_EXT_texture_sRGB */ + + +/* Texel fetch routines for all supported formats + */ +#define DIM 1 +#include "texformat_tmp.h" + +#define DIM 2 +#include "texformat_tmp.h" + +#define DIM 3 +#include "texformat_tmp.h" + +/** + * Null texel fetch function. + * + * Have to have this so the FetchTexel function pointer is never NULL. + */ +static void fetch_null_texelf( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + (void) texImage; (void) i; (void) j; (void) k; + texel[RCOMP] = 0.0; + texel[GCOMP] = 0.0; + texel[BCOMP] = 0.0; + texel[ACOMP] = 0.0; + _mesa_warning(NULL, "fetch_null_texelf() called!"); +} + +static void store_null_texel(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + (void) texImage; + (void) i; + (void) j; + (void) k; + (void) texel; + /* no-op */ +} + + + +/** + * Table to map MESA_FORMAT_ to texel fetch/store funcs. + * XXX this is somewhat temporary. + */ +static struct { + GLuint Name; + FetchTexelFuncF Fetch1D; + FetchTexelFuncF Fetch2D; + FetchTexelFuncF Fetch3D; + StoreTexelFunc StoreTexel; +} +texfetch_funcs[MESA_FORMAT_COUNT] = +{ + { + MESA_FORMAT_RGBA, + fetch_texel_1d_f_rgba, + fetch_texel_2d_f_rgba, + fetch_texel_3d_f_rgba, + store_texel_rgba + }, + { + MESA_FORMAT_RGB, + fetch_texel_1d_f_rgb, + fetch_texel_2d_f_rgb, + fetch_texel_3d_f_rgb, + store_texel_rgb + }, + { + MESA_FORMAT_ALPHA, + fetch_texel_1d_f_alpha, + fetch_texel_2d_f_alpha, + fetch_texel_3d_f_alpha, + store_texel_alpha + }, + { + MESA_FORMAT_LUMINANCE, + fetch_texel_1d_f_luminance, + fetch_texel_2d_f_luminance, + fetch_texel_3d_f_luminance, + store_texel_luminance + }, + { + MESA_FORMAT_LUMINANCE_ALPHA, + fetch_texel_1d_f_luminance_alpha, + fetch_texel_2d_f_luminance_alpha, + fetch_texel_3d_f_luminance_alpha, + store_texel_luminance_alpha + }, + { + MESA_FORMAT_INTENSITY, + fetch_texel_1d_f_intensity, + fetch_texel_2d_f_intensity, + fetch_texel_3d_f_intensity, + store_texel_intensity + }, + { + MESA_FORMAT_SRGB8, + fetch_texel_1d_srgb8, + fetch_texel_2d_srgb8, + fetch_texel_3d_srgb8, + store_texel_srgb8 + }, + { + MESA_FORMAT_SRGBA8, + fetch_texel_1d_srgba8, + fetch_texel_2d_srgba8, + fetch_texel_3d_srgba8, + store_texel_srgba8 + }, + { + MESA_FORMAT_SARGB8, + fetch_texel_1d_sargb8, + fetch_texel_2d_sargb8, + fetch_texel_3d_sargb8, + store_texel_sargb8 + }, + { + MESA_FORMAT_SL8, + fetch_texel_1d_sl8, + fetch_texel_2d_sl8, + fetch_texel_3d_sl8, + store_texel_sl8 + }, + { + MESA_FORMAT_SLA8, + fetch_texel_1d_sla8, + fetch_texel_2d_sla8, + fetch_texel_3d_sla8, + store_texel_sla8 + }, + { + MESA_FORMAT_RGB_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt5, + NULL, + NULL + }, + { + MESA_FORMAT_SRGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt5, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FLOAT32, + fetch_texel_1d_f_rgba_f32, + fetch_texel_2d_f_rgba_f32, + fetch_texel_3d_f_rgba_f32, + store_texel_rgba_f32 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + fetch_texel_1d_f_rgba_f16, + fetch_texel_2d_f_rgba_f16, + fetch_texel_3d_f_rgba_f16, + store_texel_rgba_f16 + }, + { + MESA_FORMAT_RGB_FLOAT32, + fetch_texel_1d_f_rgb_f32, + fetch_texel_2d_f_rgb_f32, + fetch_texel_3d_f_rgb_f32, + store_texel_rgb_f32 + }, + { + MESA_FORMAT_RGB_FLOAT16, + fetch_texel_1d_f_rgb_f16, + fetch_texel_2d_f_rgb_f16, + fetch_texel_3d_f_rgb_f16, + store_texel_rgb_f16 + }, + { + MESA_FORMAT_ALPHA_FLOAT32, + fetch_texel_1d_f_alpha_f32, + fetch_texel_2d_f_alpha_f32, + fetch_texel_3d_f_alpha_f32, + store_texel_alpha_f32 + }, + { + MESA_FORMAT_ALPHA_FLOAT16, + fetch_texel_1d_f_alpha_f16, + fetch_texel_2d_f_alpha_f16, + fetch_texel_3d_f_alpha_f16, + store_texel_alpha_f16 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT32, + fetch_texel_1d_f_luminance_f32, + fetch_texel_2d_f_luminance_f32, + fetch_texel_3d_f_luminance_f32, + store_texel_luminance_f32 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT16, + fetch_texel_1d_f_luminance_f16, + fetch_texel_2d_f_luminance_f16, + fetch_texel_3d_f_luminance_f16, + store_texel_luminance_f16 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, + fetch_texel_1d_f_luminance_alpha_f32, + fetch_texel_2d_f_luminance_alpha_f32, + fetch_texel_3d_f_luminance_alpha_f32, + store_texel_luminance_alpha_f32 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, + fetch_texel_1d_f_luminance_alpha_f16, + fetch_texel_2d_f_luminance_alpha_f16, + fetch_texel_3d_f_luminance_alpha_f16, + store_texel_luminance_alpha_f16 + }, + { + MESA_FORMAT_INTENSITY_FLOAT32, + fetch_texel_1d_f_intensity_f32, + fetch_texel_2d_f_intensity_f32, + fetch_texel_3d_f_intensity_f32, + store_texel_intensity_f32 + }, + { + MESA_FORMAT_INTENSITY_FLOAT16, + fetch_texel_1d_f_intensity_f16, + fetch_texel_2d_f_intensity_f16, + fetch_texel_3d_f_intensity_f16, + store_texel_intensity_f16 + }, + { + MESA_FORMAT_DUDV8, + fetch_texel_1d_dudv8, + fetch_texel_2d_dudv8, + fetch_texel_3d_dudv8, + NULL + }, + { + MESA_FORMAT_SIGNED_RGBA8888, + fetch_texel_1d_signed_rgba8888, + fetch_texel_2d_signed_rgba8888, + fetch_texel_3d_signed_rgba8888, + store_texel_signed_rgba8888 + }, + { + MESA_FORMAT_SIGNED_RGBA8888_REV, + fetch_texel_1d_signed_rgba8888_rev, + fetch_texel_2d_signed_rgba8888_rev, + fetch_texel_3d_signed_rgba8888_rev, + store_texel_signed_rgba8888_rev + }, + { + MESA_FORMAT_RGBA8888, + fetch_texel_1d_f_rgba8888, + fetch_texel_2d_f_rgba8888, + fetch_texel_3d_f_rgba8888, + store_texel_rgba8888 + }, + { + MESA_FORMAT_RGBA8888_REV, + fetch_texel_1d_f_rgba8888_rev, + fetch_texel_2d_f_rgba8888_rev, + fetch_texel_3d_f_rgba8888_rev, + store_texel_rgba8888_rev + }, + { + MESA_FORMAT_ARGB8888, + fetch_texel_1d_f_argb8888, + fetch_texel_2d_f_argb8888, + fetch_texel_3d_f_argb8888, + store_texel_argb8888 + }, + { + MESA_FORMAT_ARGB8888_REV, + fetch_texel_1d_f_argb8888_rev, + fetch_texel_2d_f_argb8888_rev, + fetch_texel_3d_f_argb8888_rev, + store_texel_argb8888_rev + }, + { + MESA_FORMAT_RGB888, + fetch_texel_1d_f_rgb888, + fetch_texel_2d_f_rgb888, + fetch_texel_3d_f_rgb888, + store_texel_rgb888 + }, + { + MESA_FORMAT_BGR888, + fetch_texel_1d_f_bgr888, + fetch_texel_2d_f_bgr888, + fetch_texel_3d_f_bgr888, + store_texel_bgr888 + }, + { + MESA_FORMAT_RGB565, + fetch_texel_1d_f_rgb565, + fetch_texel_2d_f_rgb565, + fetch_texel_3d_f_rgb565, + store_texel_rgb565 + }, + { + MESA_FORMAT_RGB565_REV, + fetch_texel_1d_f_rgb565_rev, + fetch_texel_2d_f_rgb565_rev, + fetch_texel_3d_f_rgb565_rev, + store_texel_rgb565_rev + }, + { + MESA_FORMAT_RGBA4444, + fetch_texel_1d_f_rgba4444, + fetch_texel_2d_f_rgba4444, + fetch_texel_3d_f_rgba4444, + store_texel_rgba4444 + }, + { + MESA_FORMAT_ARGB4444, + fetch_texel_1d_f_argb4444, + fetch_texel_2d_f_argb4444, + fetch_texel_3d_f_argb4444, + store_texel_argb4444 + }, + { + MESA_FORMAT_ARGB4444_REV, + fetch_texel_1d_f_argb4444_rev, + fetch_texel_2d_f_argb4444_rev, + fetch_texel_3d_f_argb4444_rev, + store_texel_argb4444_rev + }, + { + MESA_FORMAT_RGBA5551, + fetch_texel_1d_f_rgba5551, + fetch_texel_2d_f_rgba5551, + fetch_texel_3d_f_rgba5551, + store_texel_rgba5551 + }, + { + MESA_FORMAT_ARGB1555, + fetch_texel_1d_f_argb1555, + fetch_texel_2d_f_argb1555, + fetch_texel_3d_f_argb1555, + store_texel_argb1555 + }, + { + MESA_FORMAT_ARGB1555_REV, + fetch_texel_1d_f_argb1555_rev, + fetch_texel_2d_f_argb1555_rev, + fetch_texel_3d_f_argb1555_rev, + store_texel_argb1555_rev + }, + { + MESA_FORMAT_AL88, + fetch_texel_1d_f_al88, + fetch_texel_2d_f_al88, + fetch_texel_3d_f_al88, + store_texel_al88 + }, + { + MESA_FORMAT_AL88_REV, + fetch_texel_1d_f_al88_rev, + fetch_texel_2d_f_al88_rev, + fetch_texel_3d_f_al88_rev, + store_texel_al88_rev + }, + { + MESA_FORMAT_RGB332, + fetch_texel_1d_f_rgb332, + fetch_texel_2d_f_rgb332, + fetch_texel_3d_f_rgb332, + store_texel_rgb332 + }, + { + MESA_FORMAT_A8, + fetch_texel_1d_f_a8, + fetch_texel_2d_f_a8, + fetch_texel_3d_f_a8, + store_texel_a8 + }, + { + MESA_FORMAT_L8, + fetch_texel_1d_f_l8, + fetch_texel_2d_f_l8, + fetch_texel_3d_f_l8, + store_texel_l8 + }, + { + MESA_FORMAT_I8, + fetch_texel_1d_f_i8, + fetch_texel_2d_f_i8, + fetch_texel_3d_f_i8, + store_texel_i8 + }, + { + MESA_FORMAT_CI8, + fetch_texel_1d_f_ci8, + fetch_texel_2d_f_ci8, + fetch_texel_3d_f_ci8, + store_texel_ci8 + }, + { + MESA_FORMAT_YCBCR, + fetch_texel_1d_f_ycbcr, + fetch_texel_2d_f_ycbcr, + fetch_texel_3d_f_ycbcr, + store_texel_ycbcr + }, + { + MESA_FORMAT_YCBCR_REV, + fetch_texel_1d_f_ycbcr_rev, + fetch_texel_2d_f_ycbcr_rev, + fetch_texel_3d_f_ycbcr_rev, + store_texel_ycbcr_rev + }, + { + MESA_FORMAT_Z24_S8, + fetch_texel_1d_f_z24_s8, + fetch_texel_2d_f_z24_s8, + fetch_texel_3d_f_z24_s8, + store_texel_z24_s8 + }, + { + MESA_FORMAT_S8_Z24, + fetch_texel_1d_f_s8_z24, + fetch_texel_2d_f_s8_z24, + fetch_texel_3d_f_s8_z24, + store_texel_s8_z24 + }, + { + MESA_FORMAT_Z16, + fetch_texel_1d_f_z16, + fetch_texel_2d_f_z16, + fetch_texel_3d_f_z16, + store_texel_z16 + }, + { + MESA_FORMAT_Z32, + fetch_texel_1d_f_z32, + fetch_texel_2d_f_z32, + fetch_texel_3d_f_z32, + store_texel_z32 + } +}; + + +FetchTexelFuncF +_mesa_get_texel_fetch_func(gl_format format, GLuint dims) +{ + FetchTexelFuncF f; + GLuint i; + /* XXX replace loop with direct table lookup */ + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texfetch_funcs[i].Name == format) { + switch (dims) { + case 1: + f = texfetch_funcs[i].Fetch1D; + break; + case 2: + f = texfetch_funcs[i].Fetch2D; + break; + case 3: + f = texfetch_funcs[i].Fetch3D; + break; + } + if (!f) + f = fetch_null_texelf; + return f; + } + } + return NULL; +} + + +StoreTexelFunc +_mesa_get_texel_store_func(gl_format format) +{ + GLuint i; + /* XXX replace loop with direct table lookup */ + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texfetch_funcs[i].Name == format) { + if (texfetch_funcs[i].StoreTexel) + return texfetch_funcs[i].StoreTexel; + else + return store_null_texel; + } + } + return NULL; +} diff --git a/src/mesa/main/texfetch.h b/src/mesa/main/texfetch.h new file mode 100644 index 0000000000..a397b04600 --- /dev/null +++ b/src/mesa/main/texfetch.h @@ -0,0 +1,41 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (c) 2009 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef TEXFETCH_H +#define TEXFETCH_H + +#include "mtypes.h" +#include "formats.h" + + +extern FetchTexelFuncF +_mesa_get_texel_fetch_func(gl_format format, GLuint dims); + +extern StoreTexelFunc +_mesa_get_texel_store_func(gl_format format); + + +#endif diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 9290210b3f..bee7f583cf 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.7 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * Copyright (c) 2008 VMware, Inc. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (c) 2008-2009 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -29,88 +29,15 @@ * Texture formats. * * \author Gareth Hughes + * \author Brian Paul */ -#include "colormac.h" #include "context.h" #include "texcompress.h" #include "texcompress_fxt1.h" #include "texcompress_s3tc.h" #include "texformat.h" -#include "texstore.h" - - -#if FEATURE_EXT_texture_sRGB - -/** - * Convert an 8-bit sRGB value from non-linear space to a - * linear RGB value in [0, 1]. - * Implemented with a 256-entry lookup table. - */ -static INLINE GLfloat -nonlinear_to_linear(GLubyte cs8) -{ - static GLfloat table[256]; - static GLboolean tableReady = GL_FALSE; - if (!tableReady) { - /* compute lookup table now */ - GLuint i; - for (i = 0; i < 256; i++) { - const GLfloat cs = UBYTE_TO_FLOAT(i); - if (cs <= 0.04045) { - table[i] = cs / 12.92f; - } - else { - table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); - } - } - tableReady = GL_TRUE; - } - return table[cs8]; -} - - -#endif /* FEATURE_EXT_texture_sRGB */ - - -/* Texel fetch routines for all supported formats - */ -#define DIM 1 -#include "texformat_tmp.h" - -#define DIM 2 -#include "texformat_tmp.h" - -#define DIM 3 -#include "texformat_tmp.h" - -/** - * Null texel fetch function. - * - * Have to have this so the FetchTexel function pointer is never NULL. - */ -static void fetch_null_texelf( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - (void) texImage; (void) i; (void) j; (void) k; - texel[RCOMP] = 0.0; - texel[GCOMP] = 0.0; - texel[BCOMP] = 0.0; - texel[ACOMP] = 0.0; - _mesa_warning(NULL, "fetch_null_texelf() called!"); -} - -static void store_null_texel(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - (void) texImage; - (void) i; - (void) j; - (void) k; - (void) texel; - /* no-op */ -} /** @@ -639,506 +566,3 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 1; } } - - - -/** - * Table to map MESA_FORMAT_ to texel fetch/store funcs. - * XXX this is somewhat temporary. - */ -static struct { - GLuint Name; - FetchTexelFuncF Fetch1D; - FetchTexelFuncF Fetch2D; - FetchTexelFuncF Fetch3D; - StoreTexelFunc StoreTexel; -} -texfetch_funcs[MESA_FORMAT_COUNT] = -{ - { - MESA_FORMAT_RGBA, - fetch_texel_1d_f_rgba, - fetch_texel_2d_f_rgba, - fetch_texel_3d_f_rgba, - store_texel_rgba - }, - { - MESA_FORMAT_RGB, - fetch_texel_1d_f_rgb, - fetch_texel_2d_f_rgb, - fetch_texel_3d_f_rgb, - store_texel_rgb - }, - { - MESA_FORMAT_ALPHA, - fetch_texel_1d_f_alpha, - fetch_texel_2d_f_alpha, - fetch_texel_3d_f_alpha, - store_texel_alpha - }, - { - MESA_FORMAT_LUMINANCE, - fetch_texel_1d_f_luminance, - fetch_texel_2d_f_luminance, - fetch_texel_3d_f_luminance, - store_texel_luminance - }, - { - MESA_FORMAT_LUMINANCE_ALPHA, - fetch_texel_1d_f_luminance_alpha, - fetch_texel_2d_f_luminance_alpha, - fetch_texel_3d_f_luminance_alpha, - store_texel_luminance_alpha - }, - { - MESA_FORMAT_INTENSITY, - fetch_texel_1d_f_intensity, - fetch_texel_2d_f_intensity, - fetch_texel_3d_f_intensity, - store_texel_intensity - }, - { - MESA_FORMAT_SRGB8, - fetch_texel_1d_srgb8, - fetch_texel_2d_srgb8, - fetch_texel_3d_srgb8, - store_texel_srgb8 - }, - { - MESA_FORMAT_SRGBA8, - fetch_texel_1d_srgba8, - fetch_texel_2d_srgba8, - fetch_texel_3d_srgba8, - store_texel_srgba8 - }, - { - MESA_FORMAT_SARGB8, - fetch_texel_1d_sargb8, - fetch_texel_2d_sargb8, - fetch_texel_3d_sargb8, - store_texel_sargb8 - }, - { - MESA_FORMAT_SL8, - fetch_texel_1d_sl8, - fetch_texel_2d_sl8, - fetch_texel_3d_sl8, - store_texel_sl8 - }, - { - MESA_FORMAT_SLA8, - fetch_texel_1d_sla8, - fetch_texel_2d_sla8, - fetch_texel_3d_sla8, - store_texel_sla8 - }, - { - MESA_FORMAT_RGB_FXT1, - NULL, - _mesa_fetch_texel_2d_f_rgb_fxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_FXT1, - NULL, - _mesa_fetch_texel_2d_f_rgba_fxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_DXT1, - NULL, - _mesa_fetch_texel_2d_f_rgb_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_DXT1, - NULL, - _mesa_fetch_texel_2d_f_rgba_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_DXT3, - NULL, - _mesa_fetch_texel_2d_f_rgba_dxt3, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_DXT5, - NULL, - _mesa_fetch_texel_2d_f_rgba_dxt5, - NULL, - NULL - }, - { - MESA_FORMAT_SRGB_DXT1, - NULL, - _mesa_fetch_texel_2d_f_srgb_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_SRGBA_DXT1, - NULL, - _mesa_fetch_texel_2d_f_srgba_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_SRGBA_DXT3, - NULL, - _mesa_fetch_texel_2d_f_srgba_dxt3, - NULL, - NULL - }, - { - MESA_FORMAT_SRGBA_DXT5, - NULL, - _mesa_fetch_texel_2d_f_srgba_dxt5, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_FLOAT32, - fetch_texel_1d_f_rgba_f32, - fetch_texel_2d_f_rgba_f32, - fetch_texel_3d_f_rgba_f32, - store_texel_rgba_f32 - }, - { - MESA_FORMAT_RGBA_FLOAT16, - fetch_texel_1d_f_rgba_f16, - fetch_texel_2d_f_rgba_f16, - fetch_texel_3d_f_rgba_f16, - store_texel_rgba_f16 - }, - { - MESA_FORMAT_RGB_FLOAT32, - fetch_texel_1d_f_rgb_f32, - fetch_texel_2d_f_rgb_f32, - fetch_texel_3d_f_rgb_f32, - store_texel_rgb_f32 - }, - { - MESA_FORMAT_RGB_FLOAT16, - fetch_texel_1d_f_rgb_f16, - fetch_texel_2d_f_rgb_f16, - fetch_texel_3d_f_rgb_f16, - store_texel_rgb_f16 - }, - { - MESA_FORMAT_ALPHA_FLOAT32, - fetch_texel_1d_f_alpha_f32, - fetch_texel_2d_f_alpha_f32, - fetch_texel_3d_f_alpha_f32, - store_texel_alpha_f32 - }, - { - MESA_FORMAT_ALPHA_FLOAT16, - fetch_texel_1d_f_alpha_f16, - fetch_texel_2d_f_alpha_f16, - fetch_texel_3d_f_alpha_f16, - store_texel_alpha_f16 - }, - { - MESA_FORMAT_LUMINANCE_FLOAT32, - fetch_texel_1d_f_luminance_f32, - fetch_texel_2d_f_luminance_f32, - fetch_texel_3d_f_luminance_f32, - store_texel_luminance_f32 - }, - { - MESA_FORMAT_LUMINANCE_FLOAT16, - fetch_texel_1d_f_luminance_f16, - fetch_texel_2d_f_luminance_f16, - fetch_texel_3d_f_luminance_f16, - store_texel_luminance_f16 - }, - { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, - fetch_texel_1d_f_luminance_alpha_f32, - fetch_texel_2d_f_luminance_alpha_f32, - fetch_texel_3d_f_luminance_alpha_f32, - store_texel_luminance_alpha_f32 - }, - { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, - fetch_texel_1d_f_luminance_alpha_f16, - fetch_texel_2d_f_luminance_alpha_f16, - fetch_texel_3d_f_luminance_alpha_f16, - store_texel_luminance_alpha_f16 - }, - { - MESA_FORMAT_INTENSITY_FLOAT32, - fetch_texel_1d_f_intensity_f32, - fetch_texel_2d_f_intensity_f32, - fetch_texel_3d_f_intensity_f32, - store_texel_intensity_f32 - }, - { - MESA_FORMAT_INTENSITY_FLOAT16, - fetch_texel_1d_f_intensity_f16, - fetch_texel_2d_f_intensity_f16, - fetch_texel_3d_f_intensity_f16, - store_texel_intensity_f16 - }, - { - MESA_FORMAT_DUDV8, - fetch_texel_1d_dudv8, - fetch_texel_2d_dudv8, - fetch_texel_3d_dudv8, - NULL - }, - { - MESA_FORMAT_SIGNED_RGBA8888, - fetch_texel_1d_signed_rgba8888, - fetch_texel_2d_signed_rgba8888, - fetch_texel_3d_signed_rgba8888, - store_texel_signed_rgba8888 - }, - { - MESA_FORMAT_SIGNED_RGBA8888_REV, - fetch_texel_1d_signed_rgba8888_rev, - fetch_texel_2d_signed_rgba8888_rev, - fetch_texel_3d_signed_rgba8888_rev, - store_texel_signed_rgba8888_rev - }, - { - MESA_FORMAT_RGBA8888, - fetch_texel_1d_f_rgba8888, - fetch_texel_2d_f_rgba8888, - fetch_texel_3d_f_rgba8888, - store_texel_rgba8888 - }, - { - MESA_FORMAT_RGBA8888_REV, - fetch_texel_1d_f_rgba8888_rev, - fetch_texel_2d_f_rgba8888_rev, - fetch_texel_3d_f_rgba8888_rev, - store_texel_rgba8888_rev - }, - { - MESA_FORMAT_ARGB8888, - fetch_texel_1d_f_argb8888, - fetch_texel_2d_f_argb8888, - fetch_texel_3d_f_argb8888, - store_texel_argb8888 - }, - { - MESA_FORMAT_ARGB8888_REV, - fetch_texel_1d_f_argb8888_rev, - fetch_texel_2d_f_argb8888_rev, - fetch_texel_3d_f_argb8888_rev, - store_texel_argb8888_rev - }, - { - MESA_FORMAT_RGB888, - fetch_texel_1d_f_rgb888, - fetch_texel_2d_f_rgb888, - fetch_texel_3d_f_rgb888, - store_texel_rgb888 - }, - { - MESA_FORMAT_BGR888, - fetch_texel_1d_f_bgr888, - fetch_texel_2d_f_bgr888, - fetch_texel_3d_f_bgr888, - store_texel_bgr888 - }, - { - MESA_FORMAT_RGB565, - fetch_texel_1d_f_rgb565, - fetch_texel_2d_f_rgb565, - fetch_texel_3d_f_rgb565, - store_texel_rgb565 - }, - { - MESA_FORMAT_RGB565_REV, - fetch_texel_1d_f_rgb565_rev, - fetch_texel_2d_f_rgb565_rev, - fetch_texel_3d_f_rgb565_rev, - store_texel_rgb565_rev - }, - { - MESA_FORMAT_RGBA4444, - fetch_texel_1d_f_rgba4444, - fetch_texel_2d_f_rgba4444, - fetch_texel_3d_f_rgba4444, - store_texel_rgba4444 - }, - { - MESA_FORMAT_ARGB4444, - fetch_texel_1d_f_argb4444, - fetch_texel_2d_f_argb4444, - fetch_texel_3d_f_argb4444, - store_texel_argb4444 - }, - { - MESA_FORMAT_ARGB4444_REV, - fetch_texel_1d_f_argb4444_rev, - fetch_texel_2d_f_argb4444_rev, - fetch_texel_3d_f_argb4444_rev, - store_texel_argb4444_rev - }, - { - MESA_FORMAT_RGBA5551, - fetch_texel_1d_f_rgba5551, - fetch_texel_2d_f_rgba5551, - fetch_texel_3d_f_rgba5551, - store_texel_rgba5551 - }, - { - MESA_FORMAT_ARGB1555, - fetch_texel_1d_f_argb1555, - fetch_texel_2d_f_argb1555, - fetch_texel_3d_f_argb1555, - store_texel_argb1555 - }, - { - MESA_FORMAT_ARGB1555_REV, - fetch_texel_1d_f_argb1555_rev, - fetch_texel_2d_f_argb1555_rev, - fetch_texel_3d_f_argb1555_rev, - store_texel_argb1555_rev - }, - { - MESA_FORMAT_AL88, - fetch_texel_1d_f_al88, - fetch_texel_2d_f_al88, - fetch_texel_3d_f_al88, - store_texel_al88 - }, - { - MESA_FORMAT_AL88_REV, - fetch_texel_1d_f_al88_rev, - fetch_texel_2d_f_al88_rev, - fetch_texel_3d_f_al88_rev, - store_texel_al88_rev - }, - { - MESA_FORMAT_RGB332, - fetch_texel_1d_f_rgb332, - fetch_texel_2d_f_rgb332, - fetch_texel_3d_f_rgb332, - store_texel_rgb332 - }, - { - MESA_FORMAT_A8, - fetch_texel_1d_f_a8, - fetch_texel_2d_f_a8, - fetch_texel_3d_f_a8, - store_texel_a8 - }, - { - MESA_FORMAT_L8, - fetch_texel_1d_f_l8, - fetch_texel_2d_f_l8, - fetch_texel_3d_f_l8, - store_texel_l8 - }, - { - MESA_FORMAT_I8, - fetch_texel_1d_f_i8, - fetch_texel_2d_f_i8, - fetch_texel_3d_f_i8, - store_texel_i8 - }, - { - MESA_FORMAT_CI8, - fetch_texel_1d_f_ci8, - fetch_texel_2d_f_ci8, - fetch_texel_3d_f_ci8, - store_texel_ci8 - }, - { - MESA_FORMAT_YCBCR, - fetch_texel_1d_f_ycbcr, - fetch_texel_2d_f_ycbcr, - fetch_texel_3d_f_ycbcr, - store_texel_ycbcr - }, - { - MESA_FORMAT_YCBCR_REV, - fetch_texel_1d_f_ycbcr_rev, - fetch_texel_2d_f_ycbcr_rev, - fetch_texel_3d_f_ycbcr_rev, - store_texel_ycbcr_rev - }, - { - MESA_FORMAT_Z24_S8, - fetch_texel_1d_f_z24_s8, - fetch_texel_2d_f_z24_s8, - fetch_texel_3d_f_z24_s8, - store_texel_z24_s8 - }, - { - MESA_FORMAT_S8_Z24, - fetch_texel_1d_f_s8_z24, - fetch_texel_2d_f_s8_z24, - fetch_texel_3d_f_s8_z24, - store_texel_s8_z24 - }, - { - MESA_FORMAT_Z16, - fetch_texel_1d_f_z16, - fetch_texel_2d_f_z16, - fetch_texel_3d_f_z16, - store_texel_z16 - }, - { - MESA_FORMAT_Z32, - fetch_texel_1d_f_z32, - fetch_texel_2d_f_z32, - fetch_texel_3d_f_z32, - store_texel_z32 - } -}; - - -FetchTexelFuncF -_mesa_get_texel_fetch_func(GLuint format, GLuint dims) -{ - FetchTexelFuncF f; - GLuint i; - /* XXX replace loop with direct table lookup */ - for (i = 0; i < MESA_FORMAT_COUNT; i++) { - if (texfetch_funcs[i].Name == format) { - switch (dims) { - case 1: - f = texfetch_funcs[i].Fetch1D; - break; - case 2: - f = texfetch_funcs[i].Fetch2D; - break; - case 3: - f = texfetch_funcs[i].Fetch3D; - break; - } - if (!f) - f = fetch_null_texelf; - return f; - } - } - return NULL; -} - - -StoreTexelFunc -_mesa_get_texel_store_func(GLuint format) -{ - GLuint i; - /* XXX replace loop with direct table lookup */ - for (i = 0; i < MESA_FORMAT_COUNT; i++) { - if (texfetch_funcs[i].Name == format) { - if (texfetch_funcs[i].StoreTexel) - return texfetch_funcs[i].StoreTexel; - else - return store_null_texel; - } - } - return NULL; -} diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index ed6a3a3851..0711b67da1 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.75 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * Copyright (c) 2008 VMware, Inc. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (c) 2008-2009 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,15 +23,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -/** - * \file texformat.h - * Texture formats definitions. - * - * \author Gareth Hughes - */ - - #ifndef TEXFORMAT_H #define TEXFORMAT_H @@ -49,11 +40,4 @@ extern void _mesa_format_to_type_and_comps(gl_format format, GLenum *datatype, GLuint *comps); -extern FetchTexelFuncF -_mesa_get_texel_fetch_func(GLuint format, GLuint dims); - -extern StoreTexelFunc -_mesa_get_texel_store_func(GLuint format); - - #endif diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 81bb1d40ff..f47478421a 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -1,7 +1,7 @@ #include "context.h" #include "fbobject.h" -#include "texformat.h" +#include "texfetch.h" #include "texrender.h" #include "renderbuffer.h" diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 02e3df89cf..d5bc16dee4 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -64,6 +64,7 @@ #include "texcompress.h" #include "texcompress_fxt1.h" #include "texcompress_s3tc.h" +#include "texfetch.h" #include "texformat.h" #include "teximage.h" #include "texstore.h" diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index dab3e56038..8959ff5356 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -68,6 +68,7 @@ MAIN_SOURCES = \ main/texcompress_fxt1.c \ main/texenv.c \ main/texenvprogram.c \ + main/texfetch.c \ main/texformat.c \ main/texgen.c \ main/texgetimage.c \ diff --git a/windows/VC7/mesa/mesa/mesa.vcproj b/windows/VC7/mesa/mesa/mesa.vcproj index 4d7df74170..9a24acf819 100644 --- a/windows/VC7/mesa/mesa/mesa.vcproj +++ b/windows/VC7/mesa/mesa/mesa.vcproj @@ -586,6 +586,9 @@ + + @@ -1157,6 +1160,9 @@ + + diff --git a/windows/VC8/mesa/mesa/mesa.vcproj b/windows/VC8/mesa/mesa/mesa.vcproj index f15c4435f6..ec41314195 100644 --- a/windows/VC8/mesa/mesa/mesa.vcproj +++ b/windows/VC8/mesa/mesa/mesa.vcproj @@ -1026,6 +1026,10 @@ RelativePath="..\..\..\..\src\mesa\main\texenvprogram.c" > + + @@ -1875,6 +1879,10 @@ RelativePath="..\..\..\..\src\mesa\main\texenvprogram.h" > + + -- cgit v1.2.3 From 3fa7dbf368bb060220e9f78e666b00d6827166a6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 21:00:16 -0600 Subject: mesa: remove GLchan-based formats; use hw 8-bit/channel formats instead Removed: MESA_FORMAT_RGBA, RGB, ALPHA, LUMINANCE, LUMINANCE_ALPHA, INTENSITY. --- src/mesa/drivers/x11/xm_dd.c | 4 +- src/mesa/main/formats.c | 48 ------------- src/mesa/main/formats.h | 13 +--- src/mesa/main/mipmap.c | 4 +- src/mesa/main/texfetch.c | 42 ----------- src/mesa/main/texformat.c | 37 ++-------- src/mesa/main/texformat_tmp.h | 146 ------------------------------------- src/mesa/main/texstore.c | 164 ------------------------------------------ src/mesa/swrast/s_texfilter.c | 36 +++++----- src/mesa/swrast/s_triangle.c | 12 ++-- 10 files changed, 35 insertions(+), 471 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 5b00b5b82c..d757e50b5a 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1025,9 +1025,9 @@ choose_tex_format( GLcontext *ctx, GLint internalFormat, { switch (internalFormat) { case GL_COMPRESSED_RGB_ARB: - return MESA_FORMAT_RGB; + return MESA_FORMAT_RGB888; case GL_COMPRESSED_RGBA_ARB: - return MESA_FORMAT_RGBA; + return MESA_FORMAT_RGBA8888; default: return _mesa_choose_tex_format(ctx, internalFormat, format, type); } diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 2ad5685883..f915b1da91 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -401,54 +401,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, #endif - { - MESA_FORMAT_RGBA, - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - CHAN_BITS, CHAN_BITS, CHAN_BITS, CHAN_BITS, - 0, 0, 0, 0, 0, - 1, 1, 4 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_RGB, - GL_RGB, - GL_UNSIGNED_NORMALIZED, - CHAN_BITS, CHAN_BITS, CHAN_BITS, 0, - 0, 0, 0, 0, 0, - 1, 1, 3 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_ALPHA, - GL_ALPHA, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, CHAN_BITS, - 0, 0, 0, 0, 0, - 1, 1, 1 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_LUMINANCE, - GL_LUMINANCE, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, 0, - CHAN_BITS, 0, 0, 0, 0, - 1, 1, 1 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_LUMINANCE_ALPHA, - GL_LUMINANCE_ALPHA, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, CHAN_BITS, - CHAN_BITS, 0, 0, 0, 0, - 1, 1, 2 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_INTENSITY, - GL_INTENSITY, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, 0, - 0, CHAN_BITS, 0, 0, 0, - 1, 1, 1 * CHAN_BITS / 8 - }, { MESA_FORMAT_RGBA_FLOAT32, GL_RGBA, diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index dbde28e727..9235828a0f 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -43,6 +43,7 @@ typedef enum { MESA_FORMAT_NONE = 0, + /** * \name Basic hardware formats */ @@ -114,18 +115,6 @@ typedef enum #endif /*@}*/ - /** - * \name Generic GLchan-based formats. (XXX obsolete!) - */ - /*@{*/ - MESA_FORMAT_RGBA, - MESA_FORMAT_RGB, - MESA_FORMAT_ALPHA, - MESA_FORMAT_LUMINANCE, - MESA_FORMAT_LUMINANCE_ALPHA, - MESA_FORMAT_INTENSITY, - /*@}*/ - /** * \name Floating point texture formats. */ diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 7e99a5d3de..ccd153303d 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1521,11 +1521,11 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, texObj->Target == GL_TEXTURE_CUBE_MAP_ARB); if (srcImage->_BaseFormat == GL_RGB) { - convertFormat = MESA_FORMAT_RGB; + convertFormat = MESA_FORMAT_RGB888; components = 3; } else if (srcImage->_BaseFormat == GL_RGBA) { - convertFormat = MESA_FORMAT_RGBA; + convertFormat = MESA_FORMAT_RGBA8888; components = 4; } else { diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 20ee2527f5..8149166560 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -127,48 +127,6 @@ static struct { } texfetch_funcs[MESA_FORMAT_COUNT] = { - { - MESA_FORMAT_RGBA, - fetch_texel_1d_f_rgba, - fetch_texel_2d_f_rgba, - fetch_texel_3d_f_rgba, - store_texel_rgba - }, - { - MESA_FORMAT_RGB, - fetch_texel_1d_f_rgb, - fetch_texel_2d_f_rgb, - fetch_texel_3d_f_rgb, - store_texel_rgb - }, - { - MESA_FORMAT_ALPHA, - fetch_texel_1d_f_alpha, - fetch_texel_2d_f_alpha, - fetch_texel_3d_f_alpha, - store_texel_alpha - }, - { - MESA_FORMAT_LUMINANCE, - fetch_texel_1d_f_luminance, - fetch_texel_2d_f_luminance, - fetch_texel_3d_f_luminance, - store_texel_luminance - }, - { - MESA_FORMAT_LUMINANCE_ALPHA, - fetch_texel_1d_f_luminance_alpha, - fetch_texel_2d_f_luminance_alpha, - fetch_texel_3d_f_luminance_alpha, - store_texel_luminance_alpha - }, - { - MESA_FORMAT_INTENSITY, - fetch_texel_1d_f_intensity, - fetch_texel_2d_f_intensity, - fetch_texel_3d_f_intensity, - store_texel_intensity - }, { MESA_FORMAT_SRGB8, fetch_texel_1d_srgb8, diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index bee7f583cf..b1ae324050 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -69,7 +69,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return MESA_FORMAT_RGBA; case GL_RGBA8: return MESA_FORMAT_RGBA8888; case GL_RGB5_A1: @@ -85,7 +84,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGB10: case GL_RGB12: case GL_RGB16: - return MESA_FORMAT_RGB; case GL_RGB8: return MESA_FORMAT_RGB888; case GL_R3_G3_B2: @@ -100,7 +98,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_ALPHA4: case GL_ALPHA12: case GL_ALPHA16: - return MESA_FORMAT_ALPHA; case GL_ALPHA8: return MESA_FORMAT_A8; @@ -110,7 +107,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE4: case GL_LUMINANCE12: case GL_LUMINANCE16: - return MESA_FORMAT_LUMINANCE; case GL_LUMINANCE8: return MESA_FORMAT_L8; @@ -122,7 +118,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - return MESA_FORMAT_LUMINANCE_ALPHA; case GL_LUMINANCE8_ALPHA8: return MESA_FORMAT_AL88; @@ -130,7 +125,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY4: case GL_INTENSITY12: case GL_INTENSITY16: - return MESA_FORMAT_INTENSITY; case GL_INTENSITY8: return MESA_FORMAT_I8; @@ -162,13 +156,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_COMPRESSED_ALPHA_ARB: - return MESA_FORMAT_ALPHA; + return MESA_FORMAT_A8; case GL_COMPRESSED_LUMINANCE_ARB: - return MESA_FORMAT_LUMINANCE; + return MESA_FORMAT_L8; case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - return MESA_FORMAT_LUMINANCE_ALPHA; + return MESA_FORMAT_AL88; case GL_COMPRESSED_INTENSITY_ARB: - return MESA_FORMAT_INTENSITY; + return MESA_FORMAT_I8; case GL_COMPRESSED_RGB_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) @@ -179,7 +173,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, ctx->Extensions.S3_s3tc) return MESA_FORMAT_RGB_DXT1; #endif - return MESA_FORMAT_RGB; + return MESA_FORMAT_RGB888; case GL_COMPRESSED_RGBA_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) @@ -190,7 +184,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, ctx->Extensions.S3_s3tc) return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */ #endif - return MESA_FORMAT_RGBA; + return MESA_FORMAT_RGBA8888; default: ; /* fallthrough */ } @@ -504,25 +498,6 @@ _mesa_format_to_type_and_comps(gl_format format, return; #endif - case MESA_FORMAT_RGBA: - *datatype = CHAN_TYPE; - *comps = 4; - return; - case MESA_FORMAT_RGB: - *datatype = CHAN_TYPE; - *comps = 3; - return; - case MESA_FORMAT_LUMINANCE_ALPHA: - *datatype = CHAN_TYPE; - *comps = 2; - return; - case MESA_FORMAT_ALPHA: - case MESA_FORMAT_LUMINANCE: - case MESA_FORMAT_INTENSITY: - *datatype = CHAN_TYPE; - *comps = 1; - return; - case MESA_FORMAT_RGBA_FLOAT32: *datatype = GL_FLOAT; *comps = 4; diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index cb8386bbc8..939c4d0776 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -70,152 +70,6 @@ #endif -/* MESA_FORMAT_RGBA **********************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLfloats */ -static void FETCH(f_rgba)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 4); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = CHAN_TO_FLOAT(src[3]); -} - -#if DIM == 3 -/* Store a GLchan RGBA texel */ -static void store_texel_rgba(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 4); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[GCOMP]; - dst[2] = rgba[BCOMP]; - dst[3] = rgba[ACOMP]; -} -#endif - -/* MESA_FORMAT_RGB ***********************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLfloats */ -static void FETCH(f_rgb)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 3); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_rgb(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 3); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[GCOMP]; - dst[2] = rgba[BCOMP]; -} -#endif - -/* MESA_FORMAT_ALPHA *********************************************************/ - -/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */ -static void FETCH(f_alpha)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = 0.0F; - texel[ACOMP] = CHAN_TO_FLOAT(src[0]); -} - -#if DIM == 3 -static void store_texel_alpha(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - dst[0] = rgba[ACOMP]; -} -#endif - -/* MESA_FORMAT_LUMINANCE *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */ -static void FETCH(f_luminance)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = CHAN_TO_FLOAT(src[0]); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_luminance(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - dst[0] = rgba[RCOMP]; -} -#endif - -/* MESA_FORMAT_LUMINANCE_ALPHA ***********************************************/ - -/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */ -static void FETCH(f_luminance_alpha)(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 2); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = CHAN_TO_FLOAT(src[0]); - texel[ACOMP] = CHAN_TO_FLOAT(src[1]); -} - -#if DIM == 3 -static void store_texel_luminance_alpha(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 2); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[ACOMP]; -} -#endif - -/* MESA_FORMAT_INTENSITY *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */ -static void FETCH(f_intensity)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = - texel[ACOMP] = CHAN_TO_FLOAT(src[0]); -} - -#if DIM == 3 -static void store_texel_intensity(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - dst[0] = rgba[RCOMP]; -} -#endif - - /* MESA_FORMAT_Z32 ***********************************************************/ /* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index d5bc16dee4..56d6c63906 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1004,164 +1004,6 @@ memcpy_texture(GLcontext *ctx, -/** - * Store an image in any of the formats: - * _mesa_texformat_rgba - * _mesa_texformat_rgb - * _mesa_texformat_alpha - * _mesa_texformat_luminance - * _mesa_texformat_luminance_alpha - * _mesa_texformat_intensity - * - */ -static GLboolean -_mesa_texstore_rgba(TEXSTORE_PARAMS) -{ - const GLint components = _mesa_components_in_format(baseInternalFormat); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - - ASSERT(dstFormat == MESA_FORMAT_RGBA || - dstFormat == MESA_FORMAT_RGB || - dstFormat == MESA_FORMAT_ALPHA || - dstFormat == MESA_FORMAT_LUMINANCE || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA || - dstFormat == MESA_FORMAT_INTENSITY); - ASSERT(baseInternalFormat == GL_RGBA || - baseInternalFormat == GL_RGB || - baseInternalFormat == GL_ALPHA || - baseInternalFormat == GL_LUMINANCE || - baseInternalFormat == GL_LUMINANCE_ALPHA || - baseInternalFormat == GL_INTENSITY); - ASSERT(texelBytes == components * sizeof(GLchan)); - - if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - baseInternalFormat == srcFormat && - srcType == CHAN_TYPE) { - /* simple memcpy path */ - memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, - srcWidth, srcHeight, srcDepth, srcFormat, srcType, - srcAddr, srcPacking); - } - else if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_RGB && - srcFormat == GL_RGBA && - srcType == CHAN_TYPE) { - /* extract RGB from RGBA */ - GLint img, row, col; - for (img = 0; img < srcDepth; img++) { - GLchan *dstImage = (GLchan *) - ((GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes - + dstYoffset * dstRowStride - + dstXoffset * texelBytes); - - const GLint srcRowStride = _mesa_image_row_stride(srcPacking, - srcWidth, srcFormat, srcType); - GLchan *srcRow = (GLchan *) _mesa_image_address(dims, srcPacking, - srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); - GLchan *dstRow = dstImage; - for (row = 0; row < srcHeight; row++) { - for (col = 0; col < srcWidth; col++) { - dstRow[col * 3 + RCOMP] = srcRow[col * 4 + RCOMP]; - dstRow[col * 3 + GCOMP] = srcRow[col * 4 + GCOMP]; - dstRow[col * 3 + BCOMP] = srcRow[col * 4 + BCOMP]; - } - dstRow += dstRowStride / sizeof(GLchan); - srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride); - } - } - } - else if (!ctx->_ImageTransferState && - CHAN_TYPE == GL_UNSIGNED_BYTE && - (srcType == GL_UNSIGNED_BYTE || - srcType == GL_UNSIGNED_INT_8_8_8_8 || - srcType == GL_UNSIGNED_INT_8_8_8_8_REV) && - can_swizzle(baseInternalFormat) && - can_swizzle(srcFormat)) { - - const GLubyte *dstmap; - GLuint components; - - /* dstmap - how to swizzle from RGBA to dst format: - */ - if (dstFormat == MESA_FORMAT_RGBA) { - dstmap = mappings[IDX_RGBA].from_rgba; - components = 4; - } - else if (dstFormat == MESA_FORMAT_RGB) { - dstmap = mappings[IDX_RGB].from_rgba; - components = 3; - } - else if (dstFormat == MESA_FORMAT_ALPHA) { - dstmap = mappings[IDX_ALPHA].from_rgba; - components = 1; - } - else if (dstFormat == MESA_FORMAT_LUMINANCE) { - dstmap = mappings[IDX_LUMINANCE].from_rgba; - components = 1; - } - else if (dstFormat == MESA_FORMAT_LUMINANCE_ALPHA) { - dstmap = mappings[IDX_LUMINANCE_ALPHA].from_rgba; - components = 2; - } - else if (dstFormat == MESA_FORMAT_INTENSITY) { - dstmap = mappings[IDX_INTENSITY].from_rgba; - components = 1; - } - else { - _mesa_problem(ctx, "Unexpected dstFormat in _mesa_texstore_rgba"); - return GL_FALSE; - } - - _mesa_swizzle_ubyte_image(ctx, dims, - srcFormat, - srcType, - baseInternalFormat, - dstmap, components, - dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, - srcWidth, srcHeight, srcDepth, srcAddr, - srcPacking); - } - else { - /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLchan *src = tempImage; - GLint bytesPerRow; - GLint img, row; - if (!tempImage) - return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); - bytesPerRow = srcWidth * components * sizeof(GLchan); - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; - for (row = 0; row < srcHeight; row++) { - _mesa_memcpy(dstRow, src, bytesPerRow); - dstRow += dstRowStride; - src += srcWidth * components; - } - } - - _mesa_free((void *) tempImage); - } - return GL_TRUE; -} - - /** * Store a 32-bit integer depth component texture image. */ @@ -3230,12 +3072,6 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_RGBA_DXT1, _mesa_texstore_rgba_dxt1 }, { MESA_FORMAT_RGBA_DXT3, _mesa_texstore_rgba_dxt3 }, { MESA_FORMAT_RGBA_DXT5, _mesa_texstore_rgba_dxt5 }, - { MESA_FORMAT_RGBA, _mesa_texstore_rgba }, - { MESA_FORMAT_RGB, _mesa_texstore_rgba }, - { MESA_FORMAT_ALPHA, _mesa_texstore_rgba }, - { MESA_FORMAT_LUMINANCE, _mesa_texstore_rgba }, - { MESA_FORMAT_LUMINANCE_ALPHA, _mesa_texstore_rgba }, - { MESA_FORMAT_INTENSITY, _mesa_texstore_rgba }, { MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 }, { MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 }, { MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 }, diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 11c8f9256a..6cba8ed34b 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1343,17 +1343,17 @@ opt_sample_rgb_2d(GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat == MESA_FORMAT_RGB); + ASSERT(img->TexFormat == MESA_FORMAT_RGB888); ASSERT(img->_IsPowerOfTwo); for (k=0; kData) + 3*pos; - rgba[k][RCOMP] = CHAN_TO_FLOAT(texel[0]); - rgba[k][GCOMP] = CHAN_TO_FLOAT(texel[1]); - rgba[k][BCOMP] = CHAN_TO_FLOAT(texel[2]); + GLubyte *texel = ((GLubyte *) img->Data) + 3*pos; + rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[0]); + rgba[k][GCOMP] = UBYTE_TO_FLOAT(texel[1]); + rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[2]); } } @@ -1384,18 +1384,18 @@ opt_sample_rgba_2d(GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat == MESA_FORMAT_RGBA); + ASSERT(img->TexFormat == MESA_FORMAT_RGBA8888); ASSERT(img->_IsPowerOfTwo); for (i = 0; i < n; i++) { const GLint col = IFLOOR(texcoords[i][0] * width) & colMask; const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; const GLint pos = (row << shift) | col; - const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */ - rgba[i][RCOMP] = CHAN_TO_FLOAT(texel[0]); - rgba[i][GCOMP] = CHAN_TO_FLOAT(texel[1]); - rgba[i][BCOMP] = CHAN_TO_FLOAT(texel[2]); - rgba[i][ACOMP] = CHAN_TO_FLOAT(texel[3]); + const GLubyte *texel = ((GLubyte *) img->Data) + (pos << 2); /* pos*4 */ + rgba[i][RCOMP] = UBYTE_TO_FLOAT(texel[0]); + rgba[i][GCOMP] = UBYTE_TO_FLOAT(texel[1]); + rgba[i][BCOMP] = UBYTE_TO_FLOAT(texel[2]); + rgba[i][ACOMP] = UBYTE_TO_FLOAT(texel[3]); } } @@ -1428,11 +1428,11 @@ sample_lambda_2d(GLcontext *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { - case MESA_FORMAT_RGB: + case MESA_FORMAT_RGB888: opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; - case MESA_FORMAT_RGBA: + case MESA_FORMAT_RGBA8888: opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; @@ -1485,11 +1485,11 @@ sample_lambda_2d(GLcontext *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { - case MESA_FORMAT_RGB: + case MESA_FORMAT_RGB888: opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; - case MESA_FORMAT_RGBA: + case MESA_FORMAT_RGBA8888: opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; @@ -3137,7 +3137,7 @@ null_sample_func( GLcontext *ctx, rgba[i][RCOMP] = 0; rgba[i][GCOMP] = 0; rgba[i][BCOMP] = 0; - rgba[i][ACOMP] = CHAN_MAX; + rgba[i][ACOMP] = 1.0; } } @@ -3189,14 +3189,14 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, t->WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && - img->TexFormat == MESA_FORMAT_RGB) { + img->TexFormat == MESA_FORMAT_RGB888) { return &opt_sample_rgb_2d; } else if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && - img->TexFormat == MESA_FORMAT_RGBA) { + img->TexFormat == MESA_FORMAT_RGBA8888) { return &opt_sample_rgba_2d; } else { diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 7b59763f11..6a61bec245 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -140,7 +140,7 @@ _swrast_culltriangle( GLcontext *ctx, const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ - const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \ const GLint smask = obj->Image[0][b]->Width - 1; \ const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!rb || !texture) { \ @@ -149,7 +149,7 @@ _swrast_culltriangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ - GLchan rgb[MAX_WIDTH][3]; \ + GLubyte rgb[MAX_WIDTH][3]; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ for (i = 0; i < span.end; i++) { \ @@ -192,7 +192,7 @@ _swrast_culltriangle( GLcontext *ctx, const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ - const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \ const GLint smask = obj->Image[0][b]->Width - 1; \ const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!rb || !texture) { \ @@ -201,7 +201,7 @@ _swrast_culltriangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ - GLchan rgb[MAX_WIDTH][3]; \ + GLubyte rgb[MAX_WIDTH][3]; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ for (i = 0; i < span.end; i++) { \ @@ -1075,7 +1075,7 @@ _swrast_choose_triangle( GLcontext *ctx ) && texImg->_IsPowerOfTwo && texImg->Border == 0 && texImg->Width == texImg->RowStride - && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA) + && (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888) && minFilter == magFilter && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR && !swrast->_FogEnabled @@ -1083,7 +1083,7 @@ _swrast_choose_triangle( GLcontext *ctx ) && ctx->Texture.Unit[0].EnvMode != GL_COMBINE4_NV) { if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) { if (minFilter == GL_NEAREST - && format == MESA_FORMAT_RGB + && format == MESA_FORMAT_RGB888 && (envMode == GL_REPLACE || envMode == GL_DECAL) && ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT) && ctx->Depth.Func == GL_LESS -- cgit v1.2.3 From 019bc97bd900a84f5f999afdb42928e92d33814b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 17:54:20 -0600 Subject: mesa: move _mesa_format_to_type_and_comps() to formats.c --- src/mesa/main/formats.c | 257 +++++++++++++++++++++++++++++----------------- src/mesa/main/formats.h | 7 +- src/mesa/main/mipmap.c | 1 - src/mesa/main/texformat.c | 179 -------------------------------- src/mesa/main/texformat.h | 4 - 5 files changed, 168 insertions(+), 280 deletions(-) (limited to 'src/mesa/main/texformat.c') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index e38c51772d..d3c8b1213b 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -734,109 +734,182 @@ _mesa_test_formats(void) } + /** - * XXX possible replacement for _mesa_format_to_type_and_comps() - * Used for mipmap generation. + * Return datatype and number of components per texel for the given gl_format. + * Only used for mipmap generation code. */ void -_mesa_format_to_type_and_comps2(gl_format format, - GLenum *datatype, GLuint *comps) +_mesa_format_to_type_and_comps(gl_format format, + GLenum *datatype, GLuint *comps) { - const struct gl_format_info *info = _mesa_get_format_info(format); - - /* We use a bunch of heuristics here. If this gets too ugly we could - * just encode the info the in the gl_format_info structures. - */ - if (info->BaseFormat == GL_RGB || - info->BaseFormat == GL_RGBA || - info->BaseFormat == GL_ALPHA) { - *comps = ((info->RedBits > 0) + - (info->GreenBits > 0) + - (info->BlueBits > 0) + - (info->AlphaBits > 0)); - - if (info->DataType== GL_FLOAT) { - if (info->RedBits == 32) - *datatype = GL_FLOAT; - else - *datatype = GL_HALF_FLOAT; - } - else if (info->GreenBits == 3) { - *datatype = GL_UNSIGNED_BYTE_3_3_2; - } - else if (info->GreenBits == 4) { - *datatype = GL_UNSIGNED_SHORT_4_4_4_4; - } - else if (info->GreenBits == 6) { - *datatype = GL_UNSIGNED_SHORT_5_6_5; - } - else if (info->GreenBits == 5) { - *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; - } - else if (info->RedBits == 8) { - *datatype = GL_UNSIGNED_BYTE; - } - else { - ASSERT(info->RedBits == 16); - *datatype = GL_UNSIGNED_SHORT; - } - } - else if (info->BaseFormat == GL_LUMINANCE || - info->BaseFormat == GL_LUMINANCE_ALPHA) { - *comps = ((info->LuminanceBits > 0) + - (info->AlphaBits > 0)); - if (info->LuminanceBits == 8) { - *datatype = GL_UNSIGNED_BYTE; - } - else if (info->LuminanceBits == 16) { - *datatype = GL_UNSIGNED_SHORT; - } - else { - *datatype = GL_FLOAT; - } - } - else if (info->BaseFormat == GL_INTENSITY) { - *comps = 1; - if (info->IntensityBits == 8) { - *datatype = GL_UNSIGNED_BYTE; - } - else if (info->IntensityBits == 16) { - *datatype = GL_UNSIGNED_SHORT; - } - else { - *datatype = GL_FLOAT; - } - } - else if (info->BaseFormat == GL_COLOR_INDEX) { - *comps = 1; + switch (format) { + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_ARGB8888_REV: + *datatype = GL_UNSIGNED_BYTE; + *comps = 4; + return; + case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR888: + *datatype = GL_UNSIGNED_BYTE; + *comps = 3; + return; + case MESA_FORMAT_RGB565: + case MESA_FORMAT_RGB565_REV: + *datatype = GL_UNSIGNED_SHORT_5_6_5; + *comps = 3; + return; + + case MESA_FORMAT_ARGB4444: + case MESA_FORMAT_ARGB4444_REV: + *datatype = GL_UNSIGNED_SHORT_4_4_4_4; + *comps = 4; + return; + + case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_ARGB1555_REV: + *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; + *comps = 4; + return; + + case MESA_FORMAT_AL88: + case MESA_FORMAT_AL88_REV: + *datatype = GL_UNSIGNED_BYTE; + *comps = 2; + return; + case MESA_FORMAT_RGB332: + *datatype = GL_UNSIGNED_BYTE_3_3_2; + *comps = 3; + return; + + case MESA_FORMAT_A8: + case MESA_FORMAT_L8: + case MESA_FORMAT_I8: + case MESA_FORMAT_CI8: *datatype = GL_UNSIGNED_BYTE; - } - else if (info->BaseFormat == GL_DEPTH_COMPONENT) { - *comps = 1; - if (info->DepthBits == 16) { - *datatype = GL_UNSIGNED_SHORT; - } - else { - ASSERT(info->DepthBits == 32); - *datatype = GL_UNSIGNED_INT; - } - } - else if (info->BaseFormat == GL_DEPTH_STENCIL) { *comps = 1; - *datatype = GL_UNSIGNED_INT; - } - else if (info->BaseFormat == GL_YCBCR_MESA) { + return; + + case MESA_FORMAT_YCBCR: + case MESA_FORMAT_YCBCR_REV: + *datatype = GL_UNSIGNED_SHORT; *comps = 2; + return; + + case MESA_FORMAT_Z24_S8: + *datatype = GL_UNSIGNED_INT; + *comps = 1; /* XXX OK? */ + return; + + case MESA_FORMAT_S8_Z24: + *datatype = GL_UNSIGNED_INT; + *comps = 1; /* XXX OK? */ + return; + + case MESA_FORMAT_Z16: *datatype = GL_UNSIGNED_SHORT; - } - else if (info->BaseFormat == GL_DUDV_ATI) { + *comps = 1; + return; + + case MESA_FORMAT_Z32: + *datatype = GL_UNSIGNED_INT; + *comps = 1; + return; + + case MESA_FORMAT_DUDV8: + *datatype = GL_BYTE; *comps = 2; + return; + + case MESA_FORMAT_SIGNED_RGBA8888: + case MESA_FORMAT_SIGNED_RGBA8888_REV: *datatype = GL_BYTE; - } - else { - /* any other formats? */ - ASSERT(0); + *comps = 4; + return; + +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 3; + return; + case MESA_FORMAT_SRGBA8: + case MESA_FORMAT_SARGB8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 4; + return; + case MESA_FORMAT_SL8: + *datatype = GL_UNSIGNED_BYTE; *comps = 1; + return; + case MESA_FORMAT_SLA8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 2; + return; +#endif + +#if FEATURE_texture_fxt1 + case MESA_FORMAT_RGB_FXT1: + case MESA_FORMAT_RGBA_FXT1: +#endif +#if FEATURE_texture_s3tc + case MESA_FORMAT_RGB_DXT1: + case MESA_FORMAT_RGBA_DXT1: + case MESA_FORMAT_RGBA_DXT3: + case MESA_FORMAT_RGBA_DXT5: +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: +#endif + /* XXX generate error instead? */ *datatype = GL_UNSIGNED_BYTE; + *comps = 0; + return; +#endif + + case MESA_FORMAT_RGBA_FLOAT32: + *datatype = GL_FLOAT; + *comps = 4; + return; + case MESA_FORMAT_RGBA_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 4; + return; + case MESA_FORMAT_RGB_FLOAT32: + *datatype = GL_FLOAT; + *comps = 3; + return; + case MESA_FORMAT_RGB_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 3; + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + *datatype = GL_FLOAT; + *comps = 2; + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 2; + return; + case MESA_FORMAT_ALPHA_FLOAT32: + case MESA_FORMAT_LUMINANCE_FLOAT32: + case MESA_FORMAT_INTENSITY_FLOAT32: + *datatype = GL_FLOAT; + *comps = 1; + return; + case MESA_FORMAT_ALPHA_FLOAT16: + case MESA_FORMAT_LUMINANCE_FLOAT16: + case MESA_FORMAT_INTENSITY_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 1; + return; + + default: + _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); + *datatype = 0; + *comps = 1; } } diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 723e237a57..6aebb85f2b 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -152,10 +152,6 @@ _mesa_get_format_base_format(gl_format format); extern GLboolean _mesa_is_format_compressed(gl_format format); -extern void -_mesa_format_to_type_and_comps2(gl_format format, - GLenum *datatype, GLuint *comps); - extern GLuint _mesa_format_image_size(gl_format format, GLsizei width, GLsizei height, GLsizei depth); @@ -163,6 +159,9 @@ _mesa_format_image_size(gl_format format, GLsizei width, extern GLint _mesa_format_row_stride(gl_format format, GLsizei width); +extern void +_mesa_format_to_type_and_comps(gl_format format, + GLenum *datatype, GLuint *comps); extern void _mesa_test_formats(void); diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index e24e7285c3..694d593330 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -31,7 +31,6 @@ #include "formats.h" #include "mipmap.h" #include "texcompress.h" -#include "texformat.h" #include "teximage.h" #include "texstore.h" #include "image.h" diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index b1ae324050..038dc0bb50 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -362,182 +362,3 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, return MESA_FORMAT_NONE; } - - -/** - * Return datatype and number of components per texel for the given gl_format. - */ -void -_mesa_format_to_type_and_comps(gl_format format, - GLenum *datatype, GLuint *comps) -{ - switch (format) { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_ARGB8888_REV: - *datatype = CHAN_TYPE; - *comps = 4; - return; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: - *datatype = GL_UNSIGNED_BYTE; - *comps = 3; - return; - case MESA_FORMAT_RGB565: - case MESA_FORMAT_RGB565_REV: - *datatype = GL_UNSIGNED_SHORT_5_6_5; - *comps = 3; - return; - - case MESA_FORMAT_ARGB4444: - case MESA_FORMAT_ARGB4444_REV: - *datatype = GL_UNSIGNED_SHORT_4_4_4_4; - *comps = 4; - return; - - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB1555_REV: - *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; - *comps = 4; - return; - - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: - *datatype = GL_UNSIGNED_BYTE; - *comps = 2; - return; - case MESA_FORMAT_RGB332: - *datatype = GL_UNSIGNED_BYTE_3_3_2; - *comps = 3; - return; - - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: - case MESA_FORMAT_CI8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 1; - return; - - case MESA_FORMAT_YCBCR: - case MESA_FORMAT_YCBCR_REV: - *datatype = GL_UNSIGNED_SHORT; - *comps = 2; - return; - - case MESA_FORMAT_Z24_S8: - *datatype = GL_UNSIGNED_INT; - *comps = 1; /* XXX OK? */ - return; - - case MESA_FORMAT_S8_Z24: - *datatype = GL_UNSIGNED_INT; - *comps = 1; /* XXX OK? */ - return; - - case MESA_FORMAT_Z16: - *datatype = GL_UNSIGNED_SHORT; - *comps = 1; - return; - - case MESA_FORMAT_Z32: - *datatype = GL_UNSIGNED_INT; - *comps = 1; - return; - - case MESA_FORMAT_DUDV8: - *datatype = GL_BYTE; - *comps = 2; - return; - - case MESA_FORMAT_SIGNED_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - *datatype = GL_BYTE; - *comps = 4; - return; - -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGB8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 3; - return; - case MESA_FORMAT_SRGBA8: - case MESA_FORMAT_SARGB8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 4; - return; - case MESA_FORMAT_SL8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 1; - return; - case MESA_FORMAT_SLA8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 2; - return; -#endif - -#if FEATURE_texture_fxt1 - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: -#endif -#if FEATURE_texture_s3tc - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGB_DXT1: - case MESA_FORMAT_SRGBA_DXT1: - case MESA_FORMAT_SRGBA_DXT3: - case MESA_FORMAT_SRGBA_DXT5: -#endif - /* XXX generate error instead? */ - *datatype = GL_UNSIGNED_BYTE; - *comps = 0; - return; -#endif - - case MESA_FORMAT_RGBA_FLOAT32: - *datatype = GL_FLOAT; - *comps = 4; - return; - case MESA_FORMAT_RGBA_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 4; - return; - case MESA_FORMAT_RGB_FLOAT32: - *datatype = GL_FLOAT; - *comps = 3; - return; - case MESA_FORMAT_RGB_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 3; - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - *datatype = GL_FLOAT; - *comps = 2; - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 2; - return; - case MESA_FORMAT_ALPHA_FLOAT32: - case MESA_FORMAT_LUMINANCE_FLOAT32: - case MESA_FORMAT_INTENSITY_FLOAT32: - *datatype = GL_FLOAT; - *comps = 1; - return; - case MESA_FORMAT_ALPHA_FLOAT16: - case MESA_FORMAT_LUMINANCE_FLOAT16: - case MESA_FORMAT_INTENSITY_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 1; - return; - - default: - _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); - *datatype = 0; - *comps = 1; - } -} diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 0711b67da1..bda5fd6d8c 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -36,8 +36,4 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ); -extern void -_mesa_format_to_type_and_comps(gl_format format, - GLenum *datatype, GLuint *comps); - #endif -- cgit v1.2.3