[Mesa-dev] [PATCH 1/3] mesa: Implement ext_framebuffer_multisample_blit_scaled extension
Paul Berry
stereotype441 at gmail.com
Tue May 7 10:18:05 PDT 2013
On 1 May 2013 14:10, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
> src/mesa/main/extensions.c | 1 +
> src/mesa/main/fbobject.c | 17 ++++++++++++++---
> src/mesa/main/mtypes.h | 1 +
> 3 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index d8c5f53..15c9026 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -183,6 +183,7 @@ static const struct extension extension_table[] = {
> { "GL_EXT_fog_coord", o(EXT_fog_coord),
> GLL, 1999 },
> { "GL_EXT_framebuffer_blit",
> o(EXT_framebuffer_blit), GL, 2005 },
> { "GL_EXT_framebuffer_multisample",
> o(EXT_framebuffer_multisample), GL, 2005 },
> + { "GL_EXT_framebuffer_multisample_blit_scaled",
> o(EXT_framebuffer_multisample_blit_scaled), GL, 2011 },
> { "GL_EXT_framebuffer_object",
> o(EXT_framebuffer_object), GL, 2000 },
> { "GL_EXT_framebuffer_sRGB",
> o(EXT_framebuffer_sRGB), GL, 1998 },
> { "GL_EXT_gpu_program_parameters",
> o(EXT_gpu_program_parameters), GLL, 2006 },
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 645a8a3..f5696b1 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2940,8 +2940,18 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0,
> GLint srcX1, GLint srcY1,
> return;
> }
>
> - if (filter != GL_NEAREST && filter != GL_LINEAR) {
> - _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(filter)");
> + if (filter != GL_NEAREST && filter != GL_LINEAR &&
> + ((filter != GL_SCALED_RESOLVE_FASTEST_EXT &&
> + filter != GL_SCALED_RESOLVE_NICEST_EXT) ||
> + !ctx->Extensions.EXT_framebuffer_multisample_blit_scaled)) {
> + _mesa_error(ctx, GL_INVALID_ENUM,
> "glBlitFramebufferEXT(filter)");
> + return;
>
I believe this is correct, but I find deeply nested conditionals like this
really hard to follow. How about adding a function like:
bool
is_valid_blit_filter(const struct gl_context *ctx, GLenum filter)
{
switch (filter) {
case GL_NEAREST:
case GL_LINEAR:
return true;
case GL_SCALED_RESOLVE_FASTEST_EXT:
case GL_SCALED_RESOLVE_NICEST_EXT:
return ctx->Extensions.EXT_framebuffer_multisample_blit_scaled;
default:
return false;
}
}
In any case, this patch is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
> + }
> +
> + if ((filter == GL_SCALED_RESOLVE_FASTEST_EXT ||
> + filter == GL_SCALED_RESOLVE_NICEST_EXT) &&
> + (readFb->Visual.samples == 0 || drawFb->Visual.samples > 0)) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> "glBlitFramebufferEXT(filter)");
> return;
> }
>
> @@ -3174,7 +3184,8 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0,
> GLint srcX1, GLint srcY1,
> }
>
> /* extra checks for multisample copies... */
> - if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) {
> + if ((readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) &&
> + (filter == GL_NEAREST || filter == GL_LINEAR)) {
> /* src and dest region sizes must be the same */
> if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) ||
> abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) {
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 139c6af..9ec0c7d 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3020,6 +3020,7 @@ struct gl_extensions
> GLboolean EXT_fog_coord;
> GLboolean EXT_framebuffer_blit;
> GLboolean EXT_framebuffer_multisample;
> + GLboolean EXT_framebuffer_multisample_blit_scaled;
> GLboolean EXT_framebuffer_object;
> GLboolean EXT_framebuffer_sRGB;
> GLboolean EXT_gpu_program_parameters;
> --
> 1.8.1.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130507/2455d941/attachment-0001.html>
More information about the mesa-dev
mailing list