<div dir="ltr">On 1 May 2013 14:10, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
---<br>
src/mesa/main/extensions.c | 1 +<br>
src/mesa/main/fbobject.c | 17 ++++++++++++++---<br>
src/mesa/main/mtypes.h | 1 +<br>
3 files changed, 16 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c<br>
index d8c5f53..15c9026 100644<br>
--- a/src/mesa/main/extensions.c<br>
+++ b/src/mesa/main/extensions.c<br>
@@ -183,6 +183,7 @@ static const struct extension extension_table[] = {<br>
{ "GL_EXT_fog_coord", o(EXT_fog_coord), GLL, 1999 },<br>
{ "GL_EXT_framebuffer_blit", o(EXT_framebuffer_blit), GL, 2005 },<br>
{ "GL_EXT_framebuffer_multisample", o(EXT_framebuffer_multisample), GL, 2005 },<br>
+ { "GL_EXT_framebuffer_multisample_blit_scaled", o(EXT_framebuffer_multisample_blit_scaled), GL, 2011 },<br>
{ "GL_EXT_framebuffer_object", o(EXT_framebuffer_object), GL, 2000 },<br>
{ "GL_EXT_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 },<br>
{ "GL_EXT_gpu_program_parameters", o(EXT_gpu_program_parameters), GLL, 2006 },<br>
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c<br>
index 645a8a3..f5696b1 100644<br>
--- a/src/mesa/main/fbobject.c<br>
+++ b/src/mesa/main/fbobject.c<br>
@@ -2940,8 +2940,18 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,<br>
return;<br>
}<br>
<br>
- if (filter != GL_NEAREST && filter != GL_LINEAR) {<br>
- _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(filter)");<br>
+ if (filter != GL_NEAREST && filter != GL_LINEAR &&<br>
+ ((filter != GL_SCALED_RESOLVE_FASTEST_EXT &&<br>
+ filter != GL_SCALED_RESOLVE_NICEST_EXT) ||<br>
+ !ctx->Extensions.EXT_framebuffer_multisample_blit_scaled)) {<br>
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(filter)");<br>
+ return;<br></blockquote><div><br></div><div>I believe this is correct, but I find deeply nested conditionals like this really hard to follow. How about adding a function like:<br><br>bool<br>is_valid_blit_filter(const struct gl_context *ctx, GLenum filter)<br>
{<br> switch (filter) {<br> case GL_NEAREST:<br> case GL_LINEAR:<br> return true;<br> case GL_SCALED_RESOLVE_FASTEST_EXT:<br> case GL_SCALED_RESOLVE_NICEST_EXT:<br> return ctx->Extensions.EXT_framebuffer_multisample_blit_scaled;<br>
default:<br> return false;<br> }<br>}<br><br></div><div>In any case, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div><div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ }<br>
+<br>
+ if ((filter == GL_SCALED_RESOLVE_FASTEST_EXT ||<br>
+ filter == GL_SCALED_RESOLVE_NICEST_EXT) &&<br>
+ (readFb->Visual.samples == 0 || drawFb->Visual.samples > 0)) {<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT(filter)");<br>
return;<br>
}<br>
<br>
@@ -3174,7 +3184,8 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,<br>
}<br>
<br>
/* extra checks for multisample copies... */<br>
- if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) {<br>
+ if ((readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) &&<br>
+ (filter == GL_NEAREST || filter == GL_LINEAR)) {<br>
/* src and dest region sizes must be the same */<br>
if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) ||<br>
abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) {<br>
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
index 139c6af..9ec0c7d 100644<br>
--- a/src/mesa/main/mtypes.h<br>
+++ b/src/mesa/main/mtypes.h<br>
@@ -3020,6 +3020,7 @@ struct gl_extensions<br>
GLboolean EXT_fog_coord;<br>
GLboolean EXT_framebuffer_blit;<br>
GLboolean EXT_framebuffer_multisample;<br>
+ GLboolean EXT_framebuffer_multisample_blit_scaled;<br>
GLboolean EXT_framebuffer_object;<br>
GLboolean EXT_framebuffer_sRGB;<br>
GLboolean EXT_gpu_program_parameters;<br>
<span class=""><font color="#888888">--<br>
1.8.1.4<br>
<br>
</font></span></blockquote></div><br></div></div>