From baeefef2c0445bfd717a3086fdd9b5bd5d9cb675 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 17 Sep 2011 14:50:48 -0600 Subject: [PATCH] mesa: move software texel fetch code into swrast It's only used by swrast now so move it out of core Mesa. --- src/mesa/SConscript | 2 +- src/mesa/drivers/dri/nouveau/nouveau_texture.c | 2 +- src/mesa/main/texparam.c | 1 - src/mesa/sources.mak | 2 +- src/mesa/swrast/s_context.c | 2 +- src/mesa/{main/texfetch.c => swrast/s_texfetch.c} | 24 +++++++++++----------- src/mesa/{main/texfetch.h => swrast/s_texfetch.h} | 11 +++++----- .../texfetch_tmp.h => swrast/s_texfetch_tmp.h} | 0 src/mesa/swrast/s_texrender.c | 6 +++++- 9 files changed, 26 insertions(+), 24 deletions(-) rename src/mesa/{main/texfetch.c => swrast/s_texfetch.c} (98%) rename src/mesa/{main/texfetch.h => swrast/s_texfetch.h} (93%) rename src/mesa/{main/texfetch_tmp.h => swrast/s_texfetch_tmp.h} (100%) diff --git a/src/mesa/SConscript b/src/mesa/SConscript index dfc8bd4..ff1ffe0 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -114,7 +114,6 @@ main_sources = [ 'main/texcompress_s3tc.c', 'main/texcompress_fxt1.c', 'main/texenv.c', - 'main/texfetch.c', 'main/texformat.c', 'main/texgen.c', 'main/texgetimage.c', @@ -173,6 +172,7 @@ swrast_sources = [ 'swrast/s_span.c', 'swrast/s_stencil.c', 'swrast/s_texcombine.c', + 'swrast/s_texfetch.c', 'swrast/s_texfilter.c', 'swrast/s_texrender.c', 'swrast/s_texture.c', diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index 2f8c2f5..320bc8c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -37,9 +37,9 @@ #include "main/texcompress.h" #include "main/texgetimage.h" #include "main/mipmap.h" -#include "main/texfetch.h" #include "main/teximage.h" #include "drivers/common/meta.h" +#include "swrast/s_texfetch.h" static struct gl_texture_object * nouveau_texture_new(struct gl_context *ctx, GLuint name, GLenum target) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index f7f0049..44dabe6 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -43,7 +43,6 @@ #include "main/texparam.h" #include "main/teximage.h" #include "main/texstate.h" -#include "main/texfetch.h" #include "program/prog_instruction.h" diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 71f708f..19a105f 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -85,7 +85,6 @@ MAIN_SOURCES = \ main/texcompress_s3tc.c \ main/texcompress_fxt1.c \ main/texenv.c \ - main/texfetch.c \ main/texformat.c \ main/texgen.c \ main/texgetimage.c \ @@ -144,6 +143,7 @@ SWRAST_SOURCES = \ swrast/s_span.c \ swrast/s_stencil.c \ swrast/s_texcombine.c \ + swrast/s_texfetch.c \ swrast/s_texfilter.c \ swrast/s_texrender.c \ swrast/s_texture.c \ diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 963b705..7651eaf 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -31,7 +31,6 @@ #include "main/colormac.h" #include "main/mtypes.h" #include "main/teximage.h" -#include "main/texfetch.h" #include "program/prog_parameter.h" #include "program/prog_statevars.h" #include "swrast.h" @@ -40,6 +39,7 @@ #include "s_lines.h" #include "s_points.h" #include "s_span.h" +#include "s_texfetch.h" #include "s_triangle.h" #include "s_texfilter.h" diff --git a/src/mesa/main/texfetch.c b/src/mesa/swrast/s_texfetch.c similarity index 98% rename from src/mesa/main/texfetch.c rename to src/mesa/swrast/s_texfetch.c index 11cc8e0..cefd68b 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -25,7 +25,7 @@ /** - * \file texfetch.c + * \file s_texfetch.c * * Texel fetch/store functions * @@ -33,14 +33,14 @@ */ -#include "colormac.h" -#include "macros.h" -#include "texcompress.h" -#include "texcompress_fxt1.h" -#include "texcompress_s3tc.h" -#include "texcompress_rgtc.h" -#include "texfetch.h" -#include "teximage.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/texcompress.h" +#include "main/texcompress_fxt1.h" +#include "main/texcompress_s3tc.h" +#include "main/texcompress_rgtc.h" +#include "main/teximage.h" +#include "s_texfetch.h" #include "../../gallium/auxiliary/util/u_format_rgb9e5.h" #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h" @@ -77,13 +77,13 @@ nonlinear_to_linear(GLubyte cs8) /* Texel fetch routines for all supported formats */ #define DIM 1 -#include "texfetch_tmp.h" +#include "s_texfetch_tmp.h" #define DIM 2 -#include "texfetch_tmp.h" +#include "s_texfetch_tmp.h" #define DIM 3 -#include "texfetch_tmp.h" +#include "s_texfetch_tmp.h" /** * Null texel fetch function. diff --git a/src/mesa/main/texfetch.h b/src/mesa/swrast/s_texfetch.h similarity index 93% rename from src/mesa/main/texfetch.h rename to src/mesa/swrast/s_texfetch.h index 002ff0c..76e4e6c 100644 --- a/src/mesa/main/texfetch.h +++ b/src/mesa/swrast/s_texfetch.h @@ -24,12 +24,10 @@ */ -#ifndef TEXFETCH_H -#define TEXFETCH_H - -#include "mtypes.h" -#include "formats.h" +#ifndef S_TEXFETCH_H +#define S_TEXFETCH_H +#include "swrast/s_context.h" extern StoreTexelFunc _mesa_get_texel_store_func(gl_format format); @@ -42,4 +40,5 @@ _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims); void _mesa_update_fetch_functions(struct gl_texture_object *texObj); -#endif + +#endif /* S_TEXFETCH_H */ diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h similarity index 100% rename from src/mesa/main/texfetch_tmp.h rename to src/mesa/swrast/s_texfetch_tmp.h diff --git a/src/mesa/swrast/s_texrender.c b/src/mesa/swrast/s_texrender.c index 52d03c9..b32b9e1 100644 --- a/src/mesa/swrast/s_texrender.c +++ b/src/mesa/swrast/s_texrender.c @@ -3,10 +3,10 @@ #include "main/colormac.h" #include "main/fbobject.h" #include "main/macros.h" -#include "main/texfetch.h" #include "main/teximage.h" #include "main/renderbuffer.h" #include "swrast/swrast.h" +#include "swrast/s_texfetch.h" /* @@ -543,7 +543,11 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) trb->Store = store_nop; } + if (!trb->TexImage->FetchTexelf) { + _mesa_update_fetch_functions(trb->TexImage->TexObject); + } trb->Fetchf = trb->TexImage->FetchTexelf; + assert(trb->Fetchf); if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) { trb->Yoffset = att->Zoffset; -- 2.7.4