summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.c1
-rw-r--r--src/mesa/main/texfetch.c81
-rw-r--r--src/mesa/main/texfetch.h2
-rw-r--r--src/mesa/main/texstore.c81
-rw-r--r--src/mesa/main/texstore.h4
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c1
-rw-r--r--src/mesa/state_tracker/st_texture.c3
9 files changed, 89 insertions, 86 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 29cca451483..9e13ba6871a 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -7,6 +7,7 @@
#include "main/convolve.h"
#include "main/context.h"
#include "main/texcompress.h"
+#include "main/texfetch.h"
#include "main/texformat.h"
#include "main/texstore.h"
#include "main/texgetimage.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 442116a2dd1..ce393ffeb6c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -34,6 +34,7 @@
#include "main/convolve.h"
#include "main/mipmap.h"
#include "main/texcompress.h"
+#include "main/texfetch.h"
#include "main/texformat.h"
#include "main/texstore.h"
#include "main/teximage.h"
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c
index a4cf5466fdb..13458aba1c2 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -37,6 +37,7 @@
#include "main/mipmap.h"
#include "main/simple_list.h"
#include "main/texcompress.h"
+#include "main/texfetch.h"
#include "main/texformat.h"
#include "main/texobj.h"
#include "main/texstore.h"
diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c
index 62a8b534099..3428f705be8 100644
--- a/src/mesa/main/texfetch.c
+++ b/src/mesa/main/texfetch.c
@@ -565,3 +565,84 @@ _mesa_get_texel_store_func(gl_format format)
}
return NULL;
}
+
+
+
+/**
+ * Adaptor for fetching a GLchan texel from a float-valued texture.
+ */
+static void
+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);
+
+ ASSERT(texImage->FetchTexelf);
+ texImage->FetchTexelf(texImage, i, j, k, temp);
+ if (baseFormat == GL_DEPTH_COMPONENT ||
+ baseFormat == GL_DEPTH_STENCIL_EXT) {
+ /* just one channel */
+ UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
+ }
+ else {
+ /* four channels */
+ UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
+ UNCLAMPED_FLOAT_TO_CHAN(texelOut[1], temp[1]);
+ UNCLAMPED_FLOAT_TO_CHAN(texelOut[2], temp[2]);
+ UNCLAMPED_FLOAT_TO_CHAN(texelOut[3], temp[3]);
+ }
+}
+
+
+/**
+ * Adaptor for fetching a float texel from a GLchan-valued texture.
+ */
+static void
+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);
+
+ ASSERT(texImage->FetchTexelc);
+ texImage->FetchTexelc(texImage, i, j, k, temp);
+ if (baseFormat == GL_DEPTH_COMPONENT ||
+ baseFormat == GL_DEPTH_STENCIL_EXT) {
+ /* just one channel */
+ texelOut[0] = CHAN_TO_FLOAT(temp[0]);
+ }
+ else {
+ /* four channels */
+ texelOut[0] = CHAN_TO_FLOAT(temp[0]);
+ texelOut[1] = CHAN_TO_FLOAT(temp[1]);
+ texelOut[2] = CHAN_TO_FLOAT(temp[2]);
+ texelOut[3] = CHAN_TO_FLOAT(temp[3]);
+ }
+}
+
+
+/**
+ * Initialize the texture image's FetchTexelc and FetchTexelf methods.
+ */
+void
+_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims)
+{
+ ASSERT(dims == 1 || dims == 2 || dims == 3);
+ ASSERT(texImage->TexFormat);
+
+ texImage->FetchTexelf =
+ _mesa_get_texel_fetch_func(texImage->TexFormat, dims);
+
+ /* now check if we need to use a float/chan adaptor */
+ if (!texImage->FetchTexelc) {
+ texImage->FetchTexelc = fetch_texel_float_to_chan;
+ }
+ else if (!texImage->FetchTexelf) {
+ texImage->FetchTexelf = fetch_texel_chan_to_float;
+ }
+
+
+ ASSERT(texImage->FetchTexelc);
+ ASSERT(texImage->FetchTexelf);
+}
diff --git a/src/mesa/main/texfetch.h b/src/mesa/main/texfetch.h
index a397b04600b..a9be530a06d 100644
--- a/src/mesa/main/texfetch.h
+++ b/src/mesa/main/texfetch.h
@@ -37,5 +37,7 @@ _mesa_get_texel_fetch_func(gl_format format, GLuint dims);
extern StoreTexelFunc
_mesa_get_texel_store_func(gl_format format);
+extern void
+_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
#endif
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 3e87e47cb16..07421b66577 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3160,87 +3160,6 @@ _mesa_unmap_teximage_pbo(GLcontext *ctx,
}
-
-/**
- * Adaptor for fetching a GLchan texel from a float-valued texture.
- */
-static void
-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);
-
- ASSERT(texImage->FetchTexelf);
- texImage->FetchTexelf(texImage, i, j, k, temp);
- if (baseFormat == GL_DEPTH_COMPONENT ||
- baseFormat == GL_DEPTH_STENCIL_EXT) {
- /* just one channel */
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
- }
- else {
- /* four channels */
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[1], temp[1]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[2], temp[2]);
- UNCLAMPED_FLOAT_TO_CHAN(texelOut[3], temp[3]);
- }
-}
-
-
-/**
- * Adaptor for fetching a float texel from a GLchan-valued texture.
- */
-static void
-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);
-
- ASSERT(texImage->FetchTexelc);
- texImage->FetchTexelc(texImage, i, j, k, temp);
- if (baseFormat == GL_DEPTH_COMPONENT ||
- baseFormat == GL_DEPTH_STENCIL_EXT) {
- /* just one channel */
- texelOut[0] = CHAN_TO_FLOAT(temp[0]);
- }
- else {
- /* four channels */
- texelOut[0] = CHAN_TO_FLOAT(temp[0]);
- texelOut[1] = CHAN_TO_FLOAT(temp[1]);
- texelOut[2] = CHAN_TO_FLOAT(temp[2]);
- texelOut[3] = CHAN_TO_FLOAT(temp[3]);
- }
-}
-
-
-/**
- * Initialize the texture image's FetchTexelc and FetchTexelf methods.
- */
-void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims)
-{
- ASSERT(dims == 1 || dims == 2 || dims == 3);
- ASSERT(texImage->TexFormat);
-
- texImage->FetchTexelf =
- _mesa_get_texel_fetch_func(texImage->TexFormat, dims);
-
- /* now check if we need to use a float/chan adaptor */
- if (!texImage->FetchTexelc) {
- texImage->FetchTexelc = fetch_texel_float_to_chan;
- }
- else if (!texImage->FetchTexelf) {
- texImage->FetchTexelf = fetch_texel_chan_to_float;
- }
-
-
- ASSERT(texImage->FetchTexelc);
- ASSERT(texImage->FetchTexelf);
-}
-
-
static void
compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage)
{
diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h
index 2db076dfff1..3211086dd63 100644
--- a/src/mesa/main/texstore.h
+++ b/src/mesa/main/texstore.h
@@ -83,10 +83,6 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
extern void
-_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
-
-
-extern void
_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index b457a8dc6ef..2574eeb996e 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -37,6 +37,7 @@
#include "main/mipmap.h"
#include "main/pixel.h"
#include "main/texcompress.h"
+#include "main/texfetch.h"
#include "main/texformat.h"
#include "main/texgetimage.h"
#include "main/teximage.h"
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 1790e1b28d8..4a883f9f0a4 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -32,8 +32,9 @@
#include "st_cb_fbo.h"
#include "st_inlines.h"
#include "main/enums.h"
-#include "main/texobj.h"
+#include "main/texfetch.h"
#include "main/teximage.h"
+#include "main/texobj.h"
#include "main/texstore.h"
#undef Elements /* fix re-defined macro warning */