[Mesa-dev] [PATCH 3/6] mesa: finish up ARB_texture_float
Marek Olšák
maraeo at gmail.com
Fri Apr 1 06:57:01 PDT 2011
Squashed commit of the following:
Author: Marek Olšák <maraeo at gmail.com>
mesa: handle floating-point formats in _mesa_base_fbo_format
mesa: add ARB/ATI_texture_float, remove MESAX_texture_float
commit 123bb110852739dffadcc81ad80b005b1c4f586d
Author: Luca Barbieri <luca at luca-barbieri.com>
Date: Wed Aug 25 01:35:42 2010 +0200
mesa: compute floatMode for FBOs and return it on RGBA_FLOAT_MODE
---
src/mesa/drivers/dri/r300/r300_context.c | 1 -
src/mesa/drivers/dri/r600/r600_context.c | 1 -
src/mesa/main/extensions.c | 3 +-
src/mesa/main/fbobject.c | 32 +++++++++++++++++++++++++++++-
src/mesa/main/framebuffer.c | 14 ++++++++++++-
5 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 0d8bd4f..213d3c0 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -133,7 +133,6 @@ static const struct dri_extension card_extensions[] = {
{"GL_ATI_texture_mirror_once", NULL},
{"GL_MESA_pack_invert", NULL},
{"GL_MESA_ycbcr_texture", NULL},
- {"GL_MESAX_texture_float", NULL},
{"GL_NV_blend_square", NULL},
{"GL_NV_vertex_program", GL_NV_vertex_program_functions},
#if FEATURE_OES_EGL_image
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index 00708be..1b96761 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -145,7 +145,6 @@ static const struct dri_extension card_extensions[] = {
{"GL_ATI_texture_mirror_once", NULL},
{"GL_MESA_pack_invert", NULL},
{"GL_MESA_ycbcr_texture", NULL},
- {"GL_MESAX_texture_float", NULL},
{"GL_NV_blend_square", NULL},
{"GL_NV_vertex_program", GL_NV_vertex_program_functions},
{"GL_ARB_pixel_buffer_object", NULL},
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 285e08d..f89de2a 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -124,6 +124,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_env_combine", o(ARB_texture_env_combine), GL, 2001 },
{ "GL_ARB_texture_env_crossbar", o(ARB_texture_env_crossbar), GL, 2001 },
{ "GL_ARB_texture_env_dot3", o(ARB_texture_env_dot3), GL, 2001 },
+ { "GL_ARB_texture_float", o(ARB_texture_float), GL, 2004 },
{ "GL_ARB_texture_mirrored_repeat", o(ARB_texture_mirrored_repeat), GL, 2001 },
{ "GL_ARB_texture_multisample", o(ARB_texture_multisample), GL, 2009 },
{ "GL_ARB_texture_non_power_of_two", o(ARB_texture_non_power_of_two), GL, 2003 },
@@ -267,6 +268,7 @@ static const struct extension extension_table[] = {
{ "GL_ATI_separate_stencil", o(ATI_separate_stencil), GL, 2006 },
{ "GL_ATI_texture_compression_3dc", o(ATI_texture_compression_3dc), GL, 2004 },
{ "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), GL, 2002 },
+ { "GL_ATI_texture_float", o(ARB_texture_float), GL, 2002 },
{ "GL_ATI_texture_mirror_once", o(ATI_texture_mirror_once), GL, 2006 },
{ "GL_IBM_multimode_draw_arrays", o(IBM_multimode_draw_arrays), GL, 1998 },
{ "GL_IBM_rasterpos_clip", o(IBM_rasterpos_clip), GL, 1996 },
@@ -277,7 +279,6 @@ static const struct extension extension_table[] = {
{ "GL_MESA_texture_array", o(MESA_texture_array), GL, 2007 },
{ "GL_MESA_texture_signed_rgba", o(EXT_texture_snorm), GL, 2009 },
{ "GL_MESA_window_pos", o(ARB_window_pos), GL, 2000 },
- { "GL_MESAX_texture_float", o(ARB_texture_float), GL, 2009 },
{ "GL_MESA_ycbcr_texture", o(MESA_ycbcr_texture), GL, 2002 },
{ "GL_NV_blend_square", o(NV_blend_square), GL, 1999 },
{ "GL_NV_conditional_render", o(NV_conditional_render), GL, 2008 },
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 4eab3e1..bf5c92a 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1145,7 +1145,37 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_INTENSITY16_SNORM:
return ctx->Extensions.EXT_texture_snorm &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
- /* XXX add floating point and integer formats eventually */
+ case GL_R16F:
+ case GL_R32F:
+ return ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.ARB_texture_float ? GL_RED : 0;
+ case GL_RG16F:
+ case GL_RG32F:
+ return ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.ARB_texture_float ? GL_RG : 0;
+ case GL_RGB16F:
+ case GL_RGB32F:
+ return ctx->Extensions.ARB_texture_float ? GL_RGB : 0;
+ case GL_RGBA16F:
+ case GL_RGBA32F:
+ return ctx->Extensions.ARB_texture_float ? GL_RGBA : 0;
+ case GL_ALPHA16F_ARB:
+ case GL_ALPHA32F_ARB:
+ return ctx->Extensions.ARB_texture_float &&
+ ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
+ case GL_LUMINANCE16F_ARB:
+ case GL_LUMINANCE32F_ARB:
+ return ctx->Extensions.ARB_texture_float &&
+ ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
+ case GL_LUMINANCE_ALPHA16F_ARB:
+ case GL_LUMINANCE_ALPHA32F_ARB:
+ return ctx->Extensions.ARB_texture_float &&
+ ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
+ case GL_INTENSITY16F_ARB:
+ case GL_INTENSITY32F_ARB:
+ return ctx->Extensions.ARB_texture_float &&
+ ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
+ /* XXX add integer formats eventually */
default:
return 0;
}
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 430e013..7e9828b 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -551,7 +551,6 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
fb->Visual.alphaBits = _mesa_get_format_bits(fmt, GL_ALPHA_BITS);
fb->Visual.rgbBits = fb->Visual.redBits
+ fb->Visual.greenBits + fb->Visual.blueBits;
- fb->Visual.floatMode = GL_FALSE;
fb->Visual.samples = rb->NumSamples;
if (_mesa_get_format_color_encoding(fmt) == GL_SRGB)
fb->Visual.sRGBCapable = ctx->Const.sRGBCapable;
@@ -560,6 +559,19 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
}
}
+ fb->Visual.floatMode = GL_FALSE;
+ for (i = 0; i < BUFFER_COUNT; i++) {
+ if (fb->Attachment[i].Renderbuffer) {
+ const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
+ const gl_format fmt = rb->Format;
+
+ if (_mesa_get_format_datatype(fmt) == GL_FLOAT) {
+ fb->Visual.floatMode = GL_TRUE;
+ break;
+ }
+ }
+ }
+
if (fb->Attachment[BUFFER_DEPTH].Renderbuffer) {
const struct gl_renderbuffer *rb =
fb->Attachment[BUFFER_DEPTH].Renderbuffer;
--
1.7.1
More information about the mesa-dev
mailing list