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

Brian Paul brianp at vmware.com
Wed Jan 2 10:10:35 PST 2013


On 12/29/2012 05:35 AM, Chris Forbes 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>
> ---
>   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);
> +

Should probably have a ASSERT_OUTSIDE_BEGIN_END(ctx) here.


> +   switch (pname) {
> +   case GL_SAMPLE_POSITION: {
> +      int samples = ctx->DrawBuffer->Visual.samples;
> +
> +      if (index>= samples) {
> +         _mesa_error( ctx, GL_INVALID_VALUE, "glGetMultisamplefv(index)" );

Don't need the space after ( or before ).  Same thing below.


> +         return;
> +      }
> +
> +      ctx->Driver.GetSampleLocation(ctx, ctx->DrawBuffer, index, val);
> +      return;
> +   }
> +
> +   default:
> +      _mesa_error( ctx, GL_INVALID_ENUM, "glGetMultisamplefv(pname)" );
> +      return;
> +   }
>   }
>
>   void GLAPIENTRY



More information about the mesa-dev mailing list