[Mesa-dev] [PATCH] mesa: replace gl_framebuffer::_IntegerColor wih _IntegerBuffers

Marek Olšák maraeo at gmail.com
Wed Oct 12 11:55:37 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

On Oct 12, 2016 4:08 AM, "Brian Paul" <brianp at vmware.com> wrote:

> Use a bitmask to indicate which color buffers are integer-valued, rather
> than a bool.  Also, the old field was mis-computed.  If an integer buffer
> was followed by a non-integer buffer, the _IntegerColor field was wrongly
> set to false.
>
> This fixes the new piglit gl-3.1-mixed-int-float-fbo test.
> ---
>  src/mesa/drivers/common/meta.c   |  2 +-
>  src/mesa/main/api_validate.c     |  2 +-
>  src/mesa/main/blend.c            |  2 +-
>  src/mesa/main/fbobject.c         | 10 ++++++----
>  src/mesa/main/get.c              |  4 ++++
>  src/mesa/main/get_hash_params.py |  2 +-
>  src/mesa/main/mtypes.h           |  3 +--
>  7 files changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/
> meta.c
> index fdc4748..890e98a 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -1750,7 +1750,7 @@ meta_clear(struct gl_context *ctx, GLbitfield
> buffers, bool glsl)
>        z = invert_z(ctx->Depth.Clear);
>     }
>
> -   if (fb->_IntegerColor) {
> +   if (fb->_IntegerBuffers) {
>        assert(glsl);
>        _mesa_meta_use_program(ctx, clear->IntegerShaderProg);
>        _mesa_Uniform4iv(0, 1, ctx->Color.ClearColor.i);
> diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
> index c3c5a69..d3b4cab 100644
> --- a/src/mesa/main/api_validate.c
> +++ b/src/mesa/main/api_validate.c
> @@ -152,7 +152,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const
> char *where)
>           /* If drawing to integer-valued color buffers, there must be an
>            * active fragment shader (GL_EXT_texture_integer).
>            */
> -         if (ctx->DrawBuffer && ctx->DrawBuffer->_IntegerColor) {
> +         if (ctx->DrawBuffer && ctx->DrawBuffer->_IntegerBuffers) {
>              _mesa_error(ctx, GL_INVALID_OPERATION,
>                          "%s(integer format but no fragment shader)",
> where);
>              return GL_FALSE;
> diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
> index ad79ee0..0322799 100644
> --- a/src/mesa/main/blend.c
> +++ b/src/mesa/main/blend.c
> @@ -945,7 +945,7 @@ _mesa_update_clamp_fragment_color(struct gl_context
> *ctx,
>      * - there is an integer colorbuffer
>      */
>     if (!drawFb || !drawFb->_HasSNormOrFloatColorBuffer ||
> -       drawFb->_IntegerColor)
> +       drawFb->_IntegerBuffers)
>        ctx->Color._ClampFragmentColor = GL_FALSE;
>     else
>        ctx->Color._ClampFragmentColor =
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 3b55e79..9204606 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -970,6 +970,7 @@ _mesa_test_framebuffer_completeness(struct gl_context
> *ctx,
>     fb->_AllColorBuffersFixedPoint = GL_TRUE;
>     fb->_HasSNormOrFloatColorBuffer = GL_FALSE;
>     fb->_HasAttachments = true;
> +   fb->_IntegerBuffers = 0;
>
>     /* Start at -2 to more easily loop over all attachment points.
>      *  -2: depth buffer
> @@ -1090,13 +1091,14 @@ _mesa_test_framebuffer_completeness(struct
> gl_context *ctx,
>           continue;
>        }
>
> -      /* check if integer color */
> -      fb->_IntegerColor = _mesa_is_format_integer_color(attFormat);
> -
> -      /* Update _AllColorBuffersFixedPoint and
> _HasSNormOrFloatColorBuffer. */
> +      /* Update flags describing color buffer datatypes */
>        if (i >= 0) {
>           GLenum type = _mesa_get_format_datatype(attFormat);
>
> +         /* check if integer color */
> +         if (_mesa_is_format_integer_color(attFormat))
> +            fb->_IntegerBuffers |= (1 << i);
> +
>           fb->_AllColorBuffersFixedPoint =
>              fb->_AllColorBuffersFixedPoint &&
>              (type == GL_UNSIGNED_NORMALIZED || type ==
> GL_SIGNED_NORMALIZED);
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index bd85bef..c11bcde 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -1076,6 +1076,10 @@ find_custom_value(struct gl_context *ctx, const
> struct value_desc *d, union valu
>     case GL_SAMPLE_BUFFERS:
>        v->value_int = _mesa_geometric_samples(ctx->DrawBuffer) > 0;
>        break;
> +   /* GL_EXT_textrue_integer */
> +   case GL_RGBA_INTEGER_MODE_EXT:
> +      v->value_int = (ctx->DrawBuffer->_IntegerBuffers != 0);
> +      break;
>     /* GL_ATI_meminfo & GL_NVX_gpu_memory_info */
>     case GL_VBO_FREE_MEMORY_ATI:
>     case GL_TEXTURE_FREE_MEMORY_ATI:
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_
> params.py
> index 6849b5b..3c6b712 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -890,7 +890,7 @@ descriptor=[
>    [ "TEXTURE_CUBE_MAP_SEAMLESS", "CONTEXT_BOOL(Texture.CubeMapSeamless),
> extra_ARB_seamless_cube_map" ],
>
>  # GL_EXT_texture_integer
> -  [ "RGBA_INTEGER_MODE_EXT", "BUFFER_BOOL(_IntegerColor),
> extra_EXT_texture_integer_and_new_buffers" ],
> +  [ "RGBA_INTEGER_MODE_EXT", "LOC_CUSTOM, TYPE_INT, 0,
> extra_EXT_texture_integer_and_new_buffers" ],
>
>  # GL_ARB_transform_feedback3
>    [ "MAX_TRANSFORM_FEEDBACK_BUFFERS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers),
> extra_ARB_transform_feedback3" ],
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index ab9839c..61d6bf1 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3334,8 +3334,7 @@ struct gl_framebuffer
>      */
>     bool _HasAttachments;
>
> -   /** Integer color values */
> -   GLboolean _IntegerColor;
> +   GLbitfield _IntegerBuffers;  /**< Which color buffers are integer
> valued */
>
>     /* ARB_color_buffer_float */
>     GLboolean _AllColorBuffersFixedPoint; /* no integer, no float */
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161012/d132b1a7/attachment-0001.html>


More information about the mesa-dev mailing list