Squashed commit of the following:
Author: Marek Olšák <maraeo@gmail.com>
mesa: handle floating-point formats in _mesa_base_fbo_format
mesa: add ARB/ATI_texture_float, remove MESAX_texture_float
commit 123bb11085
Author: Luca Barbieri <luca@luca-barbieri.com>
Date: Wed Aug 25 01:35:42 2010 +0200
mesa: compute floatMode for FBOs and return it on RGBA_FLOAT_MODE
tags/mesa-7.11-rc1
@@ -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 |
@@ -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}, |
@@ -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 }, | |||
@@ -268,6 +269,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 }, | |||
@@ -278,7 +280,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 }, |
@@ -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; | |||
} |
@@ -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; |