[Mesa-dev] [RFC PATCH 12/26] mesa: implement GetMultisamplefv

Paul Berry stereotype441 at gmail.com
Fri Jan 4 12:53:00 PST 2013


On 29 December 2012 04:35, Chris Forbes <chrisf at ijw.co.nz> wrote:

> Actual sample locations deferred to a driverfunc since only the driver
> really knows where they will be.
>
> V2: pass the draw buffer to the driverfunc; don't fallback to pixel
> center if driverfunc is missing.
>
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
>

I'm a little bothered by the nomenclature inconsistency between the GL enum
GL_SAMPLE_POSITION and the driver function GetSampleLocation.  Can we call
the driver function GetSamplePosition to match GL terminology?


> ---
>  src/mesa/drivers/common/driverfuncs.c |  3 +++
>  src/mesa/main/dd.h                    |  8 ++++++++
>  src/mesa/main/multisample.c           | 21 +++++++++++++++++++--
>  3 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/common/driverfuncs.c
> b/src/mesa/drivers/common/driverfuncs.c
> index 93fa3c7..5ee4e7c 100644
> --- a/src/mesa/drivers/common/driverfuncs.c
> +++ b/src/mesa/drivers/common/driverfuncs.c
> @@ -209,6 +209,9 @@ _mesa_init_driver_functions(struct dd_function_table
> *driver)
>
>     /* GL_ARB_texture_storage */
>     driver->AllocTextureStorage = _swrast_AllocTextureStorage;
> +
> +   /* GL_ARB_texture_multisample */
> +   driver->GetSampleLocation = NULL;
>  }
>
>
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
> index 70c5324..69e0252 100644
> --- a/src/mesa/main/dd.h
> +++ b/src/mesa/main/dd.h
> @@ -829,6 +829,14 @@ struct dd_function_table {
>      * This should be equivalent to glGetInteger64v(GL_TIMESTAMP);
>      */
>     uint64_t (*GetTimestamp)(struct gl_context *ctx);
> +
> +   /**
> +    * \name GL_ARB_texture_multisample
> +    */
> +   void (*GetSampleLocation)(struct gl_context *ctx,
> +                             struct gl_framebuffer *fb,
> +                             GLuint index,
> +                             GLfloat *outValue);
>  };
>
>
> diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
> index 0cc8eaf..ee9e263 100644
> --- a/src/mesa/main/multisample.c
> +++ b/src/mesa/main/multisample.c
> @@ -64,8 +64,25 @@ _mesa_init_multisample(struct gl_context *ctx)
>  void GLAPIENTRY
>  _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat * val)
>  {
> -   assert(!"Not implemented");
> -   // TODO: make this work
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   switch (pname) {
> +   case GL_SAMPLE_POSITION: {
> +      int samples = ctx->DrawBuffer->Visual.samples;
> +
> +      if (index >= samples) {
> +         _mesa_error( ctx, GL_INVALID_VALUE, "glGetMultisamplefv(index)"
> );
> +         return;
> +      }
> +
> +      ctx->Driver.GetSampleLocation(ctx, ctx->DrawBuffer, index, val);
> +      return;
> +   }
> +
> +   default:
> +      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMultisamplefv(pname)" );
> +      return;
> +   }
>  }
>
>  void GLAPIENTRY
> --
> 1.8.0.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130104/f5716cea/attachment.html>


More information about the mesa-dev mailing list