[Mesa-dev] [PATCH 1/2] st_extensions: fixup GLSL 1.30 related enables

Marek Olšák maraeo at gmail.com
Tue Jan 10 08:19:36 PST 2012


On Tue, Jan 10, 2012 at 12:49 PM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This just fixes up the enables for native integers and EXT_texture_integer
> support in st/mesa.
>
> It also set the MaxClipPlanes to 8.
>
> We should consider exposing caps for MCP vs MCD, but since core
> mesa doesn't care yet maybe we can wait for now.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/state_tracker/st_extensions.c |   31 +++++++++++++++++++++++++------
>  1 files changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index a9d4054..d583c88 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -263,12 +263,6 @@ void st_init_extensions(struct st_context *st)
>    ctx->Const.GLSLVersion = 120;
>    _mesa_override_glsl_version(st->ctx);
>
> -   /* Extensions that only depend on the GLSL version:
> -    */
> -   if (ctx->Const.GLSLVersion >= 130) {
> -      ctx->Extensions.ARB_conservative_depth = GL_TRUE;
> -   }
> -
>    /*
>     * Extensions that are supported by all Gallium drivers:
>     */
> @@ -587,6 +581,23 @@ void st_init_extensions(struct st_context *st)
>  #endif
>    }
>
> +   if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
> +                                PIPE_SHADER_CAP_INTEGERS) &&
> +       screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
> +                                PIPE_SHADER_CAP_INTEGERS)) {
> +      ctx->Const.NativeIntegers = GL_TRUE;
> +   }
> +
> +   if (ctx->Const.NativeIntegers)
> +      ctx->Const.GLSLVersion = 130;
> +
> +   /* Extensions that only depend on the GLSL version:
> +    */
> +   if (ctx->Const.GLSLVersion >= 130) {
> +      ctx->Extensions.ARB_conservative_depth = GL_TRUE;
> +      ctx->Const.MaxClipPlanes = 8;
> +   }
> +
>    ctx->Extensions.NV_primitive_restart = GL_TRUE;
>    if (!screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) {
>       st->sw_primitive_restart = GL_TRUE;
> @@ -703,4 +714,12 @@ void st_init_extensions(struct st_context *st)
>          ctx->Extensions.ARB_transform_feedback2 = GL_TRUE;
>       }
>    }
> +
> +   if (ctx->Const.NativeIntegers &&
> +       screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_UINT, PIPE_TEXTURE_2D, 0,
> +                                   PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET) &&
> +       screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SINT, PIPE_TEXTURE_2D, 0,
> +                                   PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET))
> +      ctx->Extensions.EXT_texture_integer = GL_TRUE;

I think it would be better to require 32_32_32_32, because it may not
be correct to fallback into a lower-precision format. (imagine
somebody creates GL_RGBA32UI and wants to store 0x8000000 in it)

Marek


More information about the mesa-dev mailing list