X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexfetch.c;h=8aa1e4970d5feb88c8e49b512adad55b557f73dc;hb=751fe9058bc15f4f8608f0fdc02209542991ff23;hp=aa3a6961b6442be0931005187bf39863757f4c60;hpb=5d1387b2da3626326410804026f8b92f1a121fdc;p=mesa.git diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index aa3a6961b64..8aa1e4970d5 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -39,6 +39,7 @@ #include "texcompress_fxt1.h" #include "texcompress_s3tc.h" #include "texfetch.h" +#include "teximage.h" /** @@ -236,6 +237,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_argb1555_rev, store_texel_argb1555_rev }, + { + MESA_FORMAT_AL44, + fetch_texel_1d_f_al44, + fetch_texel_2d_f_al44, + fetch_texel_3d_f_al44, + store_texel_al44 + }, { MESA_FORMAT_AL88, fetch_texel_1d_f_al88, @@ -278,6 +286,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_a8, store_texel_a8 }, + { + MESA_FORMAT_A16, + fetch_texel_1d_f_a16, + fetch_texel_2d_f_a16, + fetch_texel_3d_f_a16, + store_texel_a16 + }, { MESA_FORMAT_L8, fetch_texel_1d_f_l8, @@ -285,6 +300,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_l8, store_texel_l8 }, + { + MESA_FORMAT_L16, + fetch_texel_1d_f_l16, + fetch_texel_2d_f_l16, + fetch_texel_3d_f_l16, + store_texel_l16 + }, { MESA_FORMAT_I8, fetch_texel_1d_f_i8, @@ -292,6 +314,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_i8, store_texel_i8 }, + { + MESA_FORMAT_I16, + fetch_texel_1d_f_i16, + fetch_texel_2d_f_i16, + fetch_texel_3d_f_i16, + store_texel_i16 + }, { MESA_FORMAT_CI8, fetch_texel_1d_f_ci8, @@ -355,6 +384,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_rg1616_rev, store_texel_rg1616_rev, }, + { + MESA_FORMAT_ARGB2101010, + fetch_texel_1d_f_argb2101010, + fetch_texel_2d_f_argb2101010, + fetch_texel_3d_f_argb2101010, + store_texel_argb2101010 + }, { MESA_FORMAT_Z24_S8, fetch_texel_1d_f_z24_s8, @@ -724,7 +760,7 @@ texfetch_funcs[MESA_FORMAT_COUNT] = }; -static FetchTexelFuncF +FetchTexelFuncF _mesa_get_texel_fetch_func(gl_format format, GLuint dims) { #ifdef DEBUG @@ -822,19 +858,36 @@ fetch_texel_chan_to_float(const struct gl_texture_image *texImage, void _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) { + gl_format format = texImage->TexFormat; + ASSERT(dims == 1 || dims == 2 || dims == 3); - ASSERT(texImage->TexFormat); - if (!texImage->FetchTexelf) { - texImage->FetchTexelf = - _mesa_get_texel_fetch_func(texImage->TexFormat, dims); + if (texImage->TexObject->sRGBDecode == GL_SKIP_DECODE_EXT && + _mesa_get_format_color_encoding(format) == GL_SRGB) { + format = _mesa_get_srgb_format_linear(format); } - /* now check if we need to use a float/chan adaptor */ - if (!texImage->FetchTexelc) { - texImage->FetchTexelc = fetch_texel_float_to_chan; - } + texImage->FetchTexelf = _mesa_get_texel_fetch_func(format, dims); + + texImage->FetchTexelc = fetch_texel_float_to_chan; ASSERT(texImage->FetchTexelc); ASSERT(texImage->FetchTexelf); } + +void +_mesa_update_fetch_functions(struct gl_texture_object *texObj) +{ + GLuint face, i; + GLuint dims; + + dims = _mesa_get_texture_dimensions(texObj->Target); + + for (face = 0; face < 6; face++) { + for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { + if (texObj->Image[face][i]) { + _mesa_set_fetch_functions(texObj->Image[face][i], dims); + } + } + } +}