[Mesa-dev] [PATCH 3/3] mesa: GL_ARB_half_float_pixel is not optional
Ian Romanick
idr at freedesktop.org
Thu Jan 16 10:44:51 PST 2014
From: Ian Romanick <ian.d.romanick at intel.com>
Almost every driver already supported it. All current and future
Gallium drivers always support it, and most existing classic drivers
support it.
This only changes radeon and nouveau.
This extension only adds data types that can be passed to, for example,
glTexImage2D. It does not add internal formats. Since you can already
pass GL_FLOAT to glTexImage2D this shouldn't pose any additional issues
with those drivers. Note that r200 and i915 already supported this
extension, and they don't support floating-point textures either.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
docs/GL3.txt | 2 +-
src/mesa/drivers/dri/i915/intel_extensions.c | 1 -
src/mesa/drivers/dri/i965/intel_extensions.c | 1 -
src/mesa/drivers/dri/r200/r200_context.c | 1 -
src/mesa/main/extensions.c | 3 +--
src/mesa/main/glformats.c | 24 ++++++------------------
src/mesa/main/mtypes.h | 1 -
src/mesa/main/teximage.c | 17 ++---------------
src/mesa/main/version.c | 1 -
src/mesa/state_tracker/st_extensions.c | 1 -
10 files changed, 10 insertions(+), 42 deletions(-)
diff --git a/docs/GL3.txt b/docs/GL3.txt
index be78652..4902f76b 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -30,7 +30,7 @@ GL 3.0 --- all DONE: i965, nv50, nvc0, r600, radeonsi
GL_EXT_texture_shared_exponent DONE (swrast)
Float depth buffers (GL_ARB_depth_buffer_float) DONE ()
Framebuffer objects (GL_ARB_framebuffer_object) DONE (r300, swrast)
- GL_ARB_half_float_pixel DONE (r300, swrast)
+ GL_ARB_half_float_pixel DONE (all drivers)
GL_ARB_half_float_vertex DONE (r300, swrast)
GL_EXT_texture_integer DONE ()
GL_EXT_texture_array DONE ()
diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c b/src/mesa/drivers/dri/i915/intel_extensions.c
index a5cff70..13a5c82 100644
--- a/src/mesa/drivers/dri/i915/intel_extensions.c
+++ b/src/mesa/drivers/dri/i915/intel_extensions.c
@@ -47,7 +47,6 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_draw_elements_base_vertex = true;
ctx->Extensions.ARB_explicit_attrib_location = true;
ctx->Extensions.ARB_framebuffer_object = true;
- ctx->Extensions.ARB_half_float_pixel = true;
ctx->Extensions.ARB_internalformat_query = true;
ctx->Extensions.ARB_map_buffer_range = true;
ctx->Extensions.ARB_point_sprite = true;
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index de07b7f..cdafba8 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -174,7 +174,6 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_fragment_program_shadow = true;
ctx->Extensions.ARB_fragment_shader = true;
ctx->Extensions.ARB_framebuffer_object = true;
- ctx->Extensions.ARB_half_float_pixel = true;
ctx->Extensions.ARB_half_float_vertex = true;
ctx->Extensions.ARB_instanced_arrays = true;
ctx->Extensions.ARB_internalformat_query = true;
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index f82424b..a6fff09 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -365,7 +365,6 @@ GLboolean r200CreateContext( gl_api api,
_math_matrix_ctr( &rmesa->tmpmat );
_math_matrix_set_identity( &rmesa->tmpmat );
- ctx->Extensions.ARB_half_float_pixel = true;
ctx->Extensions.ARB_occlusion_query = true;
ctx->Extensions.ARB_point_sprite = true;
ctx->Extensions.ARB_texture_border_clamp = true;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 2e0ccc3..7882bb6 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -104,7 +104,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 },
{ "GL_ARB_get_program_binary", o(dummy_true), GL, 2010 },
{ "GL_ARB_gpu_shader5", o(ARB_gpu_shader5), GL, 2010 },
- { "GL_ARB_half_float_pixel", o(ARB_half_float_pixel), GL, 2003 },
+ { "GL_ARB_half_float_pixel", o(dummy_true), GL, 2003 },
{ "GL_ARB_half_float_vertex", o(ARB_half_float_vertex), GL, 2008 },
{ "GL_ARB_instanced_arrays", o(ARB_instanced_arrays), GL, 2008 },
{ "GL_ARB_internalformat_query", o(ARB_internalformat_query), GL, 2011 },
@@ -398,7 +398,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
ctx->Extensions.ARB_fragment_program_shadow = GL_TRUE;
ctx->Extensions.ARB_fragment_shader = GL_TRUE;
ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
- ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
ctx->Extensions.ARB_occlusion_query = GL_TRUE;
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index bec7a9b..dd0e56d 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1341,10 +1341,8 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
- return GL_NO_ERROR;
case GL_HALF_FLOAT:
- return ctx->Extensions.ARB_half_float_pixel
- ? GL_NO_ERROR : GL_INVALID_ENUM;
+ return GL_NO_ERROR;
default:
return GL_INVALID_ENUM;
}
@@ -1367,10 +1365,8 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
- return GL_NO_ERROR;
case GL_HALF_FLOAT:
- return ctx->Extensions.ARB_half_float_pixel
- ? GL_NO_ERROR : GL_INVALID_ENUM;
+ return GL_NO_ERROR;
default:
return GL_INVALID_ENUM;
}
@@ -1386,10 +1382,8 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
- return GL_NO_ERROR;
case GL_HALF_FLOAT:
- return ctx->Extensions.ARB_half_float_pixel
- ? GL_NO_ERROR : GL_INVALID_ENUM;
+ return GL_NO_ERROR;
default:
return GL_INVALID_ENUM;
}
@@ -1407,14 +1401,12 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_BYTE_2_3_3_REV:
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_HALF_FLOAT:
return GL_NO_ERROR;
case GL_UNSIGNED_INT_2_10_10_10_REV:
/* OK by GL_EXT_texture_type_2_10_10_10_REV */
return (ctx->API == API_OPENGLES2)
? GL_NO_ERROR : GL_INVALID_ENUM;
- case GL_HALF_FLOAT:
- return ctx->Extensions.ARB_half_float_pixel
- ? GL_NO_ERROR : GL_INVALID_ENUM;
case GL_UNSIGNED_INT_5_9_9_9_REV:
return ctx->Extensions.EXT_texture_shared_exponent
? GL_NO_ERROR : GL_INVALID_ENUM;
@@ -1437,10 +1429,8 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_INT:
case GL_UNSIGNED_INT:
case GL_FLOAT:
- return GL_NO_ERROR;
case GL_HALF_FLOAT:
- return ctx->Extensions.ARB_half_float_pixel
- ? GL_NO_ERROR : GL_INVALID_ENUM;
+ return GL_NO_ERROR;
default:
return GL_INVALID_ENUM;
}
@@ -1464,10 +1454,8 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_INT_8_8_8_8_REV:
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
- return GL_NO_ERROR;
case GL_HALF_FLOAT:
- return ctx->Extensions.ARB_half_float_pixel
- ? GL_NO_ERROR : GL_INVALID_ENUM;
+ return GL_NO_ERROR;
default:
return GL_INVALID_ENUM;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 33df682..96f6ab5 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3385,7 +3385,6 @@ struct gl_extensions
GLboolean ARB_explicit_attrib_location;
GLboolean ARB_geometry_shader4;
GLboolean ARB_gpu_shader5;
- GLboolean ARB_half_float_pixel;
GLboolean ARB_half_float_vertex;
GLboolean ARB_instanced_arrays;
GLboolean ARB_internalformat_query;
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index bbd5006..395acc8 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -397,11 +397,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
if (ctx->Extensions.ARB_texture_rg) {
switch (internalFormat) {
case GL_R16F:
- /* R16F depends on both ARB_half_float_pixel and ARB_texture_float.
- */
- if (!ctx->Extensions.ARB_half_float_pixel)
- break;
- /* FALLTHROUGH */
case GL_R32F:
if (!ctx->Extensions.ARB_texture_float)
break;
@@ -422,11 +417,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
return GL_RED;
case GL_RG16F:
- /* RG16F depends on both ARB_half_float_pixel and ARB_texture_float.
- */
- if (!ctx->Extensions.ARB_half_float_pixel)
- break;
- /* FALLTHROUGH */
case GL_RG32F:
if (!ctx->Extensions.ARB_texture_float)
break;
@@ -4147,8 +4137,6 @@ _mesa_validate_texbuffer_format(const struct gl_context *ctx,
return MESA_FORMAT_NONE;
datatype = _mesa_get_format_datatype(format);
- if (datatype == GL_FLOAT && !ctx->Extensions.ARB_texture_float)
- return MESA_FORMAT_NONE;
/* The GL_ARB_texture_buffer_object spec says:
*
@@ -4159,9 +4147,8 @@ _mesa_validate_texbuffer_format(const struct gl_context *ctx,
* As a result, GL_HALF_FLOAT internal format depends on both
* GL_ARB_texture_float and GL_ARB_half_float_pixel.
*/
- if (datatype == GL_HALF_FLOAT &&
- !(ctx->Extensions.ARB_half_float_pixel
- && ctx->Extensions.ARB_texture_float))
+ if ((datatype == GL_FLOAT || datatype == GL_HALF_FLOAT) &&
+ !ctx->Extensions.ARB_texture_float)
return MESA_FORMAT_NONE;
if (!ctx->Extensions.ARB_texture_rg) {
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 9af5f09..1c0bedf 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -232,7 +232,6 @@ compute_version(struct gl_context *ctx)
(ctx->API == API_OPENGL_CORE ||
ctx->Extensions.ARB_color_buffer_float) &&
ctx->Extensions.ARB_depth_buffer_float &&
- ctx->Extensions.ARB_half_float_pixel &&
ctx->Extensions.ARB_half_float_vertex &&
ctx->Extensions.ARB_map_buffer_range &&
ctx->Extensions.ARB_shader_texture_lod &&
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index c17601a..3dd7ab5 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -522,7 +522,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
ctx->Extensions.ARB_fragment_program = GL_TRUE;
ctx->Extensions.ARB_fragment_shader = GL_TRUE;
- ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
ctx->Extensions.ARB_internalformat_query = GL_TRUE;
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
--
1.8.1.4
More information about the mesa-dev
mailing list