diff options
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r-- | mesalib/src/mesa/Makefile | 78 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 7 | ||||
-rw-r--r-- | mesalib/src/mesa/gl.pc.in | 25 | ||||
-rw-r--r-- | mesalib/src/mesa/main/context.c | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/main/formats.c | 39 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texfetch.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texfetch.h | 83 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texrender.c | 37 |
10 files changed, 128 insertions, 156 deletions
diff --git a/mesalib/src/mesa/Makefile b/mesalib/src/mesa/Makefile index 1b02849fc..c9a5eaf5b 100644 --- a/mesalib/src/mesa/Makefile +++ b/mesalib/src/mesa/Makefile @@ -6,37 +6,20 @@ include $(TOP)/configs/current MESA_LIBS := libmesa.a libmesagallium.a
DEPENDS := depend
-ifeq ($(GLES_OVERLAY),1)
-ES1_LIBS := libes1gallium.a
-ES2_LIBS := libes2gallium.a
-DEPENDS += depend.es1 depend.es2
-endif
-
MESA_OBJ_DIR := .
-ES1_OBJ_DIR := objs-es1
-ES2_OBJ_DIR := objs-es2
include sources.mak
# adjust object dirs
-ES1_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_OBJECTS))
-ES2_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_OBJECTS))
MESA_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_OBJECTS))
-
-ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
-ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
MESA_GALLIUM_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
# define preprocessor flags
MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES)
-ES1_CPPFLAGS := -DFEATURE_ES1=1 $(DEFINES)
-ES2_CPPFLAGS := -DFEATURE_ES2=1 $(DEFINES)
# append include dirs
MESA_CPPFLAGS += $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
-ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
-ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
# tidy compiler flags
CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
@@ -44,8 +27,6 @@ CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS)) # LLVM is needed for the state tracker
MESA_CFLAGS := $(LLVM_CFLAGS)
-ES1_CFLAGS := $(LLVM_CFLAGS)
-ES2_CFLAGS := $(LLVM_CFLAGS)
define mesa-cc-c
@mkdir -p $(dir $@)
@@ -66,29 +47,9 @@ $(MESA_OBJ_DIR)/%.o: %.cpp $(MESA_OBJ_DIR)/%.o: %.S
$(call mesa-cc-c,MESA)
-$(ES1_OBJ_DIR)/%.o: %.c
- $(call mesa-cc-c,ES1)
-
-$(ES1_OBJ_DIR)/%.o: %.cpp
- $(call mesa-cxx-c,ES1)
-
-$(ES1_OBJ_DIR)/%.o: %.S
- $(call mesa-cc-c,ES1)
-
-$(ES2_OBJ_DIR)/%.o: %.c
- $(call mesa-cc-c,ES2)
-
-$(ES2_OBJ_DIR)/%.o: %.cpp
- $(call mesa-cxx-c,ES2)
-
-$(ES2_OBJ_DIR)/%.o: %.S
- $(call mesa-cc-c,ES2)
-
-
# Default: build dependencies, then asm_subdirs, GLSL built-in lib,
# then convenience libs (.a) and finally the device drivers:
-default: $(DEPENDS) asm_subdirs \
- $(MESA_LIBS) $(ES1_LIBS) $(ES2_LIBS) driver_subdirs
+default: $(DEPENDS) asm_subdirs $(MESA_LIBS) driver_subdirs
main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
@@ -103,22 +64,10 @@ main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py m libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
@ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS)
-libes1.a: $(ES1_OBJECTS) $(GLSL_LIBS)
- @$(MKLIB) -o es1 -static $(ES1_OBJECTS) $(GLSL_LIBS)
-
-libes2.a: $(ES2_OBJECTS) $(GLSL_LIBS)
- @$(MKLIB) -o es2 -static $(ES2_OBJECTS) $(GLSL_LIBS)
-
# Make archive of subset of core mesa object files for gallium
libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
@ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
-libes1gallium.a: $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS)
- @$(MKLIB) -o es1gallium -static $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS)
-
-libes2gallium.a: $(ES2_GALLIUM_OBJECTS) $(GLSL_LIBS)
- @$(MKLIB) -o es2gallium -static $(ES2_GALLIUM_OBJECTS) $(GLSL_LIBS)
-
######################################################################
# Device drivers
driver_subdirs: $(MESA_LIBS)
@@ -146,18 +95,6 @@ depend: $(ALL_SOURCES) @$(MKDEP) $(MKDEP_OPTIONS) -p$(MESA_OBJ_DIR)/ $(MESA_CPPFLAGS) \
$(ALL_SOURCES) > /dev/null 2>/dev/null
-depend.es1: $(ALL_SOURCES)
- @echo "running $(MKDEP) for ES1"
- @touch $@
- @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES1_OBJ_DIR)/ $(ES1_CPPFLAGS) \
- $(ALL_SOURCES) > /dev/null 2>/dev/null
-
-depend.es2: $(ALL_SOURCES)
- @echo "running $(MKDEP) for ES2"
- @touch $@
- @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES2_OBJ_DIR)/ $(ES2_CPPFLAGS) \
- $(ALL_SOURCES) > /dev/null 2>/dev/null
-
######################################################################
# Installation rules
@@ -192,6 +129,7 @@ gl_pcedit = sed \ -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
-e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
-e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
+ -e 's,@GLX_TLS@,$(GLX_TLS),' \
-e 's,@GL_LIB@,$(GL_LIB),'
gl.pc: gl.pc.in
@@ -234,17 +172,7 @@ install-dri: default tags:
etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
-clean-es1:
- -rm -f $(ES1_LIBS)
- -rm -rf $(ES1_OBJ_DIR)
- -rm -f depend.es1 depend.es1.bak
-
-clean-es2:
- -rm -f $(ES2_LIBS)
- -rm -rf $(ES2_OBJ_DIR)
- -rm -f depend.es2 depend.es2.bak
-
-clean: clean-es1 clean-es2
+clean:
-rm -f */*.o
-rm -f */*/*.o
-rm -f depend depend.bak libmesa.a libmesagallium.a
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index b2cd8dca7..9c0507bc2 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -2260,7 +2260,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, const GLuint maxLevel = texObj->MaxLevel;
const GLenum minFilterSave = texObj->MinFilter;
const GLenum magFilterSave = texObj->MagFilter;
- const GLint baseLevelSave = texObj->BaseLevel;
const GLint maxLevelSave = texObj->MaxLevel;
const GLboolean genMipmapSave = texObj->GenerateMipmap;
const GLenum wrapSSave = texObj->WrapS;
@@ -2320,7 +2319,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, }
_mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);
- _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
_mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
_mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -2496,8 +2495,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, }
}
- /* limit sampling to src level */
- _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
+ /* limit minification to src level */
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
/* Set to draw into the current dstLevel */
@@ -2549,7 +2547,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave);
_mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave);
- _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
_mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave);
diff --git a/mesalib/src/mesa/gl.pc.in b/mesalib/src/mesa/gl.pc.in index 97b86596f..616819063 100644 --- a/mesalib/src/mesa/gl.pc.in +++ b/mesalib/src/mesa/gl.pc.in @@ -1,12 +1,13 @@ -prefix=@INSTALL_DIR@ -exec_prefix=${prefix} -libdir=@INSTALL_LIB_DIR@ -includedir=@INSTALL_INC_DIR@ - -Name: gl -Description: Mesa OpenGL library -Requires.private: @GL_PC_REQ_PRIV@ -Version: @VERSION@ -Libs: -L${libdir} -l@GL_LIB@ -Libs.private: @GL_PC_LIB_PRIV@ -Cflags: -I${includedir} @GL_PC_CFLAGS@ +prefix=@INSTALL_DIR@
+exec_prefix=${prefix}
+libdir=@INSTALL_LIB_DIR@
+includedir=@INSTALL_INC_DIR@
+
+Name: gl
+Description: Mesa OpenGL library
+Requires.private: @GL_PC_REQ_PRIV@
+Version: @VERSION@
+Libs: -L${libdir} -l@GL_LIB@
+Libs.private: @GL_PC_LIB_PRIV@
+Cflags: -I${includedir} @GL_PC_CFLAGS@
+glx_tls: @GLX_TLS@
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 8a4041f68..90df5fc9e 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -96,6 +96,7 @@ #include "fbobject.h"
#include "feedback.h"
#include "fog.h"
+#include "formats.h"
#include "framebuffer.h"
#include "hint.h"
#include "hash.h"
@@ -417,6 +418,10 @@ one_time_init( struct gl_context *ctx ) MESA_VERSION_STRING, __DATE__, __TIME__);
}
#endif
+
+#ifdef DEBUG
+ _mesa_test_formats();
+#endif
}
/* per-API one-time init */
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index d17619ef1..46ac15ed7 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -802,7 +802,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = {
MESA_FORMAT_SIGNED_R8, /* Name */
"MESA_FORMAT_SIGNED_R8", /* StrName */
- GL_RGBA, /* BaseFormat */
+ GL_RED, /* BaseFormat */
GL_SIGNED_NORMALIZED, /* DataType */
8, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
@@ -811,7 +811,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = {
MESA_FORMAT_SIGNED_RG88,
"MESA_FORMAT_SIGNED_RG88",
- GL_RGBA,
+ GL_RG,
GL_SIGNED_NORMALIZED,
8, 8, 0, 0,
0, 0, 0, 0, 0,
@@ -820,7 +820,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = {
MESA_FORMAT_SIGNED_RGBX8888,
"MESA_FORMAT_SIGNED_RGBX8888",
- GL_RGBA,
+ GL_RGB,
GL_SIGNED_NORMALIZED,
8, 8, 8, 0,
0, 0, 0, 0, 0,
@@ -849,7 +849,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = {
MESA_FORMAT_SIGNED_R_16,
"MESA_FORMAT_SIGNED_R_16",
- GL_RGBA,
+ GL_RED,
GL_SIGNED_NORMALIZED,
16, 0, 0, 0,
0, 0, 0, 0, 0,
@@ -858,7 +858,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = {
MESA_FORMAT_SIGNED_RG_16,
"MESA_FORMAT_SIGNED_RG_16",
- GL_RGBA,
+ GL_RG,
GL_SIGNED_NORMALIZED,
16, 16, 0, 0,
0, 0, 0, 0, 0,
@@ -867,7 +867,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = {
MESA_FORMAT_SIGNED_RGB_16,
"MESA_FORMAT_SIGNED_RGB_16",
- GL_RGBA,
+ GL_RGB,
GL_SIGNED_NORMALIZED,
16, 16, 16, 0,
0, 0, 0, 0, 0,
@@ -1168,6 +1168,27 @@ _mesa_format_row_stride(gl_format format, GLsizei width) }
+/**
+ * Debug/test: check that all formats are handled in the
+ * _mesa_format_to_type_and_comps() function. When new pixel formats
+ * are added to Mesa, that function needs to be updated.
+ * This is a no-op after the first call.
+ */
+static void
+check_format_to_type_and_comps(void)
+{
+ gl_format f;
+
+ for (f = MESA_FORMAT_NONE + 1; f < MESA_FORMAT_COUNT; f++) {
+ GLenum datatype = 0;
+ GLuint comps = 0;
+ /* This function will emit a problem/warning if the format is
+ * not handled.
+ */
+ _mesa_format_to_type_and_comps(f, &datatype, &comps);
+ }
+}
+
/**
* Do sanity checking of the format info table.
@@ -1192,7 +1213,7 @@ _mesa_test_formats(void) if (info->RedBits > 0) {
GLuint t = info->RedBits + info->GreenBits
+ info->BlueBits + info->AlphaBits;
- assert(t / 8 == info->BytesPerBlock);
+ assert(t / 8 <= info->BytesPerBlock);
(void) t;
}
}
@@ -1200,6 +1221,7 @@ _mesa_test_formats(void) assert(info->DataType == GL_UNSIGNED_NORMALIZED ||
info->DataType == GL_SIGNED_NORMALIZED ||
info->DataType == GL_UNSIGNED_INT ||
+ info->DataType == GL_INT ||
info->DataType == GL_FLOAT);
if (info->BaseFormat == GL_RGB) {
@@ -1250,8 +1272,9 @@ _mesa_test_formats(void) assert(info->LuminanceBits == 0);
assert(info->IntensityBits > 0);
}
-
}
+
+ check_format_to_type_and_comps();
}
diff --git a/mesalib/src/mesa/main/texfetch.c b/mesalib/src/mesa/main/texfetch.c index 812243a7b..e411563be 100644 --- a/mesalib/src/mesa/main/texfetch.c +++ b/mesalib/src/mesa/main/texfetch.c @@ -759,7 +759,7 @@ texfetch_funcs[MESA_FORMAT_COUNT] = };
-static FetchTexelFuncF
+FetchTexelFuncF
_mesa_get_texel_fetch_func(gl_format format, GLuint dims)
{
#ifdef DEBUG
diff --git a/mesalib/src/mesa/main/texfetch.h b/mesalib/src/mesa/main/texfetch.h index ef13bf27f..d9e765dde 100644 --- a/mesalib/src/mesa/main/texfetch.h +++ b/mesalib/src/mesa/main/texfetch.h @@ -1,40 +1,43 @@ -/* - * 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 StoreTexelFunc -_mesa_get_texel_store_func(gl_format format); - -extern void -_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims); - -#endif +/*
+ * 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 StoreTexelFunc
+_mesa_get_texel_store_func(gl_format format);
+
+extern FetchTexelFuncF
+_mesa_get_texel_fetch_func(gl_format format, GLuint dims);
+
+extern void
+_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims);
+
+#endif
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index a4143ba45..857893866 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -932,8 +932,8 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target) /**
* Return number of dimensions per mipmap level for the given texture target.
*/
-static GLint
-get_texture_dimensions(GLenum target)
+GLint
+_mesa_get_texture_dimensions(GLenum target)
{
switch (target) {
case GL_TEXTURE_1D:
@@ -1158,7 +1158,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, img->TexFormat = format;
- dims = get_texture_dimensions(target);
+ dims = _mesa_get_texture_dimensions(target);
_mesa_set_fetch_functions(img, dims);
}
diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index e65f3cea4..6ee78c461 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -126,6 +126,8 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, extern GLuint
_mesa_tex_target_to_face(GLenum target);
+extern GLint
+_mesa_get_texture_dimensions(GLenum target);
/**
* Lock a texture for updating. See also _mesa_lock_context_textures().
diff --git a/mesalib/src/mesa/main/texrender.c b/mesalib/src/mesa/main/texrender.c index 6d5531f18..6d6e16f4a 100644 --- a/mesalib/src/mesa/main/texrender.c +++ b/mesalib/src/mesa/main/texrender.c @@ -3,6 +3,7 @@ #include "colormac.h"
#include "macros.h"
#include "texfetch.h"
+#include "teximage.h"
#include "texrender.h"
#include "renderbuffer.h"
@@ -20,6 +21,7 @@ struct texture_renderbuffer struct gl_renderbuffer Base; /**< Base class object */
struct gl_texture_image *TexImage;
StoreTexelFunc Store;
+ FetchTexelFuncF Fetchf;
GLint Yoffset; /**< Layer for 1D array textures. */
GLint Zoffset; /**< Layer for 2D array textures, or slice
* for 3D textures
@@ -48,7 +50,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count GLchan *rgbaOut = (GLchan *) values;
for (i = 0; i < count; i++) {
GLfloat rgba[4];
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, rgba);
+ trb->Fetchf(trb->TexImage, x + i, y, z, rgba);
UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
}
}
@@ -56,7 +58,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count GLushort *zValues = (GLushort *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+ trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
zValues[i] = (GLushort) (flt * 0xffff);
}
}
@@ -67,7 +69,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count */
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+ trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
#if 0
/* this should work, but doesn't (overflow due to low precision) */
zValues[i] = (GLuint) (flt * scale);
@@ -81,7 +83,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+ trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
}
}
@@ -89,7 +91,7 @@ texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
+ trb->Fetchf(trb->TexImage, x + i, y, z, &flt);
zValues[i] = (GLuint) (flt * 0xffffff);
}
}
@@ -112,7 +114,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co GLchan *rgbaOut = (GLchan *) values;
for (i = 0; i < count; i++) {
GLfloat rgba[4];
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, rgba);
UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba);
}
@@ -121,7 +123,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co GLushort *zValues = (GLushort *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, &flt);
zValues[i] = (GLushort) (flt * 0xffff);
}
@@ -130,7 +132,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, &flt);
#if 0
zValues[i] = (GLuint) (flt * 0xffffffff);
@@ -143,7 +145,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, &flt);
zValues[i] = ((GLuint) (flt * 0xffffff)) << 8;
}
@@ -152,7 +154,7 @@ texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint co GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
- trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
+ trb->Fetchf(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, &flt);
zValues[i] = (GLuint) (flt * 0xffffff);
}
@@ -517,8 +519,6 @@ wrap_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) _mesa_reference_renderbuffer(&att->Renderbuffer, &(trb->Base));
}
-
-
/**
* Update the renderbuffer wrapper for rendering to a texture.
* For example, update the width, height of the RB based on the texture size,
@@ -542,6 +542,8 @@ update_wrapper(struct gl_context *ctx, const struct gl_renderbuffer_attachment * trb->Store = store_nop;
}
+ trb->Fetchf = trb->TexImage->FetchTexelf;
+
if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) {
trb->Yoffset = att->Zoffset;
trb->Zoffset = 0;
@@ -582,6 +584,17 @@ update_wrapper(struct gl_context *ctx, const struct gl_renderbuffer_attachment * trb->Base.DataType = GL_UNSIGNED_INT;
trb->Base._BaseFormat = GL_DEPTH_COMPONENT;
break;
+ /* SRGB formats pre EXT_framebuffer_sRGB don't do sRGB translations on FBO readback */
+ case MESA_FORMAT_SRGB8:
+ trb->Fetchf = _mesa_get_texel_fetch_func(MESA_FORMAT_RGB888, _mesa_get_texture_dimensions(att->Texture->Target));
+ trb->Base.DataType = CHAN_TYPE;
+ trb->Base._BaseFormat = GL_RGBA;
+ break;
+ case MESA_FORMAT_SRGBA8:
+ trb->Fetchf = _mesa_get_texel_fetch_func(MESA_FORMAT_RGBA8888, _mesa_get_texture_dimensions(att->Texture->Target));
+ trb->Base.DataType = CHAN_TYPE;
+ trb->Base._BaseFormat = GL_RGBA;
+ break;
default:
trb->Base.DataType = CHAN_TYPE;
trb->Base._BaseFormat = GL_RGBA;
|