[Mesa-stable] [PATCH] mesa: implement missing glGet(GL_RGBA_SIGNED_COMPONENTS_EXT) query
Ian Romanick
idr at freedesktop.org
Tue Jan 7 14:35:12 PST 2014
There are fixes on top of this fix. When they get picked over to the
stable branch, I think at least this and the one from 050961.html should
get squashed together.
http://lists.freedesktop.org/archives/mesa-dev/2014-January/050961.html
http://lists.freedesktop.org/archives/mesa-dev/2014-January/050962.html
On 01/06/2014 11:57 AM, Brian Paul wrote:
> This is part of the GL_EXT_packed_float extension.
>
> Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=73096
> Cc: 10.0 <mesa-stable at lists.freedesktop.org>
> ---
> src/mesa/main/formats.c | 19 +++++++++++++++++++
> src/mesa/main/formats.h | 3 +++
> src/mesa/main/get.c | 21 +++++++++++++++++++++
> src/mesa/main/get_hash_params.py | 3 +++
> 4 files changed, 46 insertions(+)
>
> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
> index 07d2a72..eb2a07e 100644
> --- a/src/mesa/main/formats.c
> +++ b/src/mesa/main/formats.c
> @@ -1967,6 +1967,25 @@ _mesa_is_format_unsigned(gl_format format)
>
>
> /**
> + * Does the given format store signed values?
> + */
> +GLboolean
> +_mesa_is_format_signed(gl_format format)
> +{
> + if (format == MESA_FORMAT_R11_G11_B10_FLOAT) {
> + /* this packed float format only stores unsigned values */
> + return GL_FALSE;
> + }
> + else {
> + const struct gl_format_info *info = _mesa_get_format_info(format);
> + return (info->DataType == GL_SIGNED_NORMALIZED ||
> + info->DataType == GL_INT ||
> + info->DataType == GL_FLOAT);
> + }
> +}
> +
> +
> +/**
> * Return color encoding for given format.
> * \return GL_LINEAR or GL_SRGB
> */
> diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
> index 64b4b9a..0c91aea 100644
> --- a/src/mesa/main/formats.h
> +++ b/src/mesa/main/formats.h
> @@ -341,6 +341,9 @@ _mesa_is_format_integer_color(gl_format format);
> extern GLboolean
> _mesa_is_format_unsigned(gl_format format);
>
> +extern GLboolean
> +_mesa_is_format_signed(gl_format format);
> +
> extern GLenum
> _mesa_get_format_color_encoding(gl_format format);
>
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 6913808..596942c 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -327,6 +327,12 @@ static const int extra_EXT_framebuffer_sRGB_and_new_buffers[] = {
> EXTRA_END
> };
>
> +static const int extra_EXT_packed_float[] = {
> + EXT(EXT_packed_float),
> + EXTRA_NEW_BUFFERS,
> + EXTRA_END
> +};
> +
> static const int extra_EXT_texture_array_es3[] = {
> EXT(EXT_texture_array),
> EXTRA_API_ES3,
> @@ -757,6 +763,21 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
> ctx->Texture.Unit[unit].CurrentTex[d->offset]->Name;
> break;
>
> + /* GL_EXT_packed_float */
> + case GL_RGBA_SIGNED_COMPONENTS_EXT:
> + {
> + /* Note: we only check the 0th color attachment. */
> + const struct gl_renderbuffer *rb =
> + ctx->DrawBuffer->_ColorDrawBuffers[0];
> + const GLboolean signd =
> + rb ? _mesa_is_format_signed(rb->Format) : GL_FALSE;
> + v->value_int_4[0] =
> + v->value_int_4[1] =
> + v->value_int_4[2] =
> + v->value_int_4[3] = signd;
> + }
> + break;
> +
> /* GL_ARB_vertex_buffer_object */
> case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
> case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index 653bf62..f763e09 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -611,6 +611,9 @@ descriptor=[
> # GL_ARB_fragment_program
> [ "FRAGMENT_PROGRAM_ARB", "CONTEXT_BOOL(FragmentProgram.Enabled), extra_ARB_fragment_program" ],
>
> +# GL_EXT_packed_depth_stencil
> + [ "RGBA_SIGNED_COMPONENTS_EXT", "LOC_CUSTOM, TYPE_INT_4, 0, extra_EXT_packed_float" ],
> +
> # GL_EXT_depth_bounds_test
> [ "DEPTH_BOUNDS_TEST_EXT", "CONTEXT_BOOL(Depth.BoundsTest), extra_EXT_depth_bounds_test" ],
> [ "DEPTH_BOUNDS_EXT", "CONTEXT_FLOAT2(Depth.BoundsMin), extra_EXT_depth_bounds_test" ],
>
More information about the mesa-stable
mailing list