<div dir="ltr">On 16 May 2013 11:44, 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>
Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
Reviewed-by: Brian Paul <<a href="mailto:brianp@vmware.com">brianp@vmware.com</a>><br>
---<br>
src/mesa/main/extensions.c | 1 +<br>
src/mesa/main/fbobject.c | 30 +++++++++++++++++++++++++++---<br>
src/mesa/main/mtypes.h | 1 +<br>
3 files changed, 29 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c<br>
index db5a5ed..39aaad4 100644<br>
--- a/src/mesa/main/extensions.c<br>
+++ b/src/mesa/main/extensions.c<br>
@@ -184,6 +184,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 80485f7..e7300f6 100644<br>
--- a/src/mesa/main/fbobject.c<br>
+++ b/src/mesa/main/fbobject.c<br>
@@ -2974,6 +2974,20 @@ compatible_resolve_formats(const struct gl_renderbuffer *readRb,<br>
return GL_FALSE;<br>
}<br>
<br>
+static GLboolean<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>
/**<br>
* Blit rectangular region, optionally from one framebuffer to another.<br>
@@ -3023,8 +3037,17 @@ _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 (!is_valid_blit_filter(ctx, filter)) {<br>
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(%s)",<br>
+ _mesa_lookup_enum_by_nr(filter));<br>
+ return;<br>
+ }<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(%s)",<br>
+ _mesa_lookup_enum_by_nr(filter));<br>
return;<br>
}<br>
<br>
@@ -3257,7 +3280,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></blockquote><div><br></div><div>Later in this function, the following error check appears:<br><br> if (filter == GL_LINEAR) {<br> /* 3.1 spec, page 199:<br>
* "Calling BlitFramebuffer will result in an INVALID_OPERATION error<br> * if filter is LINEAR and read buffer contains integer data."<br> */<br> GLenum type = _mesa_get_format_datatype(colorReadRb->Format);<br>
if (type == GL_INT || type == GL_UNSIGNED_INT) {<br> _mesa_error(ctx, GL_INVALID_OPERATION,<br> "glBlitFramebufferEXT(integer color type)");<br> return;<br>
}<br> }<br><br></div><div>This needs to be changed to "if (filter != GL_NEAREST)" in accordance with the following text from the extension:<br><br> "Calling BlitFramebuffer will result in an INVALID_OPERATION error if<br>
filter is not NEAREST and read buffer contains integer data."<br><br></div><div>With that fixed, 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">
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h<br>
index b68853b..8af6dc6 100644<br>
--- a/src/mesa/main/mtypes.h<br>
+++ b/src/mesa/main/mtypes.h<br>
@@ -3023,6 +3023,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>