[Mesa-dev] [Patch v2] Mesa: Add support for GL_OES_texture_*float* extensions.
Matt Turner
mattst88 at gmail.com
Thu Nov 27 11:42:00 PST 2014
On Thu, Nov 27, 2014 at 10:56 AM, Kalyan Kondapally
<kondapallykalyancontribute at gmail.com> wrote:
> This patch adds support for following GLES2 Texture Float extensions:
> 1)GL_OES_texture_float,
> 2)GL_OES_texture_half_float,
> 3)GL_OES_texture_float_linear,
> 4)GL_OES_texture_half_float_linear.
>
> Support for these extensions need to be explicitly enabled per driver
> and this patch enables support for i965 drivers.
>
> v2: Indentation fixes. (Brian Paul)
> Fixed Comments and added some to new private functions.(Brian Paul)
> Added assert in valid_filter_for_float.(Brian Paul)
> Renamed Float and HALF_FLOAT_OES as IsFloatOES and IsHalfFloatOES.(Brian Paul)
> adjust_for_oes_float_texture to return GLenum. (Brain Paul)
> Use RGB_32F internal floating point format for RGB base format.
>
> Signed-off-by: Kevin Rogovin <kevin.rogovin at intel.com>
> Signed-off-by: Kalyan Kondapally <kalyan.kondapally at intel.com>
> ---
> src/mesa/drivers/dri/i965/intel_extensions.c | 6 +++
> src/mesa/main/extensions.c | 4 ++
> src/mesa/main/glformats.c | 46 +++++++++++++++++--
> src/mesa/main/glformats.h | 3 +-
> src/mesa/main/mtypes.h | 6 +++
> src/mesa/main/pack.c | 16 +++++++
> src/mesa/main/teximage.c | 68 +++++++++++++++++++++++++++-
> src/mesa/main/texobj.c | 53 ++++++++++++++++++++++
> 8 files changed, 196 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
> index bbbb76f..e95eaef 100644
> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> @@ -245,6 +245,12 @@ intelInitExtensions(struct gl_context *ctx)
> ctx->Extensions.OES_standard_derivatives = true;
> ctx->Extensions.OES_EGL_image_external = true;
>
> + bool enable_opengles2_extensions = ctx->API == API_OPENGLES2;
> + ctx->Extensions.OES_texture_float = enable_opengles2_extensions;
> + ctx->Extensions.OES_texture_half_float = enable_opengles2_extensions;
> + ctx->Extensions.OES_texture_float_linear = enable_opengles2_extensions;
> + ctx->Extensions.OES_texture_half_float_linear = enable_opengles2_extensions;
Just put this in an if (ctx->API == API_OPENGLES2) block.
> if (brw->gen >= 6)
> ctx->Const.GLSLVersion = 330;
> else
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 0df04c2..6833fcf 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -314,6 +314,10 @@ static const struct extension extension_table[] = {
> { "GL_OES_texture_3D", o(EXT_texture3D), ES2, 2005 },
> { "GL_OES_texture_cube_map", o(ARB_texture_cube_map), ES1, 2007 },
> { "GL_OES_texture_env_crossbar", o(ARB_texture_env_crossbar), ES1, 2005 },
> + { "GL_OES_texture_float", o(OES_texture_float), ES2, 2005 },
> + { "GL_OES_texture_float_linear", o(OES_texture_float_linear), ES2, 2005 },
> + { "GL_OES_texture_half_float", o(OES_texture_half_float), ES2, 2005 },
> + { "GL_OES_texture_half_float_linear", o(OES_texture_half_float_linear), ES2, 2005 },
> { "GL_OES_texture_mirrored_repeat", o(dummy_true), ES1, 2005 },
> { "GL_OES_texture_npot", o(ARB_texture_non_power_of_two), ES1 | ES2, 2005 },
> { "GL_OES_vertex_array_object", o(dummy_true), ES1 | ES2, 2010 },
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 00478f9..c2e6c37 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -93,6 +93,7 @@ _mesa_sizeof_type(GLenum type)
> case GL_DOUBLE:
> return sizeof(GLdouble);
> case GL_HALF_FLOAT_ARB:
> + case GL_HALF_FLOAT_OES:
> return sizeof(GLhalfARB);
> case GL_FIXED:
> return sizeof(GLfixed);
> @@ -125,6 +126,7 @@ _mesa_sizeof_packed_type(GLenum type)
> case GL_INT:
> return sizeof(GLint);
> case GL_HALF_FLOAT_ARB:
> + case GL_HALF_FLOAT_OES:
> return sizeof(GLhalfARB);
> case GL_FLOAT:
> return sizeof(GLfloat);
> @@ -241,6 +243,7 @@ _mesa_bytes_per_pixel(GLenum format, GLenum type)
> case GL_FLOAT:
> return comps * sizeof(GLfloat);
> case GL_HALF_FLOAT_ARB:
> + case GL_HALF_FLOAT_OES:
> return comps * sizeof(GLhalfARB);
> case GL_UNSIGNED_BYTE_3_3_2:
> case GL_UNSIGNED_BYTE_2_3_3_REV:
> @@ -1448,6 +1451,18 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
> }
> return GL_NO_ERROR;
>
> + case GL_HALF_FLOAT_OES:
> + switch (format) {
> + case GL_RGBA:
> + case GL_RGB:
> + case GL_LUMINANCE_ALPHA:
> + case GL_LUMINANCE:
> + case GL_ALPHA:
> + return GL_NO_ERROR;
> + default:
> + return GL_INVALID_OPERATION;
> + }
Don't indent case. Same comment applies later in the patch as well.
More information about the mesa-dev
mailing list