<div dir="auto">Same problem as in the previous patch.<div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Gustaw<br><div dir="auto"><br><div class="gmail_extra"><br><div class="gmail_quote">1 cze 2017 15:07 "Samuel Pitoiset" <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> napisał(a):<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>><br>
---<br>
src/mesa/main/blit.c | 105 +++++++++++++++++++++++++++---<wbr>---------------------<br>
1 file changed, 56 insertions(+), 49 deletions(-)<br>
<br>
diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c<br>
index 207ce7d501..455a9a647f 100644<br>
--- a/src/mesa/main/blit.c<br>
+++ b/src/mesa/main/blit.c<br>
@@ -233,6 +233,60 @@ validate_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *readFb,<br>
}<br>
}<br>
<br>
+<br>
+static void<br>
+validate_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *readFb,<br>
+ struct gl_framebuffer *drawFb, GLbitfield *mask,<br>
+ bool no_error, const char *func)<br>
+{<br>
+ struct gl_renderbuffer *readRb =<br>
+ readFb->Attachment[BUFFER_<wbr>DEPTH].Renderbuffer;<br>
+ struct gl_renderbuffer *drawRb =<br>
+ drawFb->Attachment[BUFFER_<wbr>DEPTH].Renderbuffer;<br>
+<br>
+ /* From the EXT_framebuffer_object spec:<br>
+ *<br>
+ * "If a buffer is specified in <mask> and does not exist in both<br>
+ * the read and draw framebuffers, the corresponding bit is silently<br>
+ * ignored."<br>
+ */<br>
+ if (readRb == NULL || drawRb == NULL) {<br>
+ *mask &= ~GL_DEPTH_BUFFER_BIT;<br>
+ } else if (!no_error) {<br>
+ int read_s_bit, draw_s_bit;<br>
+<br>
+ if (_mesa_is_gles3(ctx) && (drawRb == readRb)) {<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION,<br>
+ "%s(source and destination depth buffer cannot be the "<br>
+ "same)", func);<br>
+ return;<br>
+ }<br>
+<br>
+ if ((_mesa_get_format_bits(<wbr>readRb->Format, GL_DEPTH_BITS) !=<br>
+ _mesa_get_format_bits(drawRb-><wbr>Format, GL_DEPTH_BITS)) ||<br>
+ (_mesa_get_format_datatype(<wbr>readRb->Format) !=<br>
+ _mesa_get_format_datatype(<wbr>drawRb->Format))) {<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION,<br>
+ "%s(depth attachment format mismatch)", func);<br>
+ return;<br>
+ }<br>
+<br>
+ read_s_bit = _mesa_get_format_bits(readRb-><wbr>Format, GL_STENCIL_BITS);<br>
+ draw_s_bit = _mesa_get_format_bits(drawRb-><wbr>Format, GL_STENCIL_BITS);<br>
+<br>
+ /* If both buffers also have stencil data, the stencil formats must<br>
+ * match as well. If one doesn't have stencil, it's not blitted, so<br>
+ * we should ignore the stencil format check.<br>
+ */<br>
+ if (read_s_bit > 0 && draw_s_bit > 0 && read_s_bit != draw_s_bit) {<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION,<br>
+ "%s(depth attachment stencil bits mismatch)", func);<br>
+ return;<br>
+ }<br>
+ }<br>
+}<br>
+<br>
+<br>
static void<br>
blit_framebuffer(struct gl_context *ctx,<br>
struct gl_framebuffer *readFb, struct gl_framebuffer *drawFb,<br>
@@ -376,55 +430,8 @@ blit_framebuffer(struct gl_context *ctx,<br>
if (mask & GL_STENCIL_BUFFER_BIT)<br>
validate_stencil_buffer(ctx, readFb, drawFb, &mask, false, func);<br>
<br>
- if (mask & GL_DEPTH_BUFFER_BIT) {<br>
- struct gl_renderbuffer *readRb =<br>
- readFb->Attachment[BUFFER_<wbr>DEPTH].Renderbuffer;<br>
- struct gl_renderbuffer *drawRb =<br>
- drawFb->Attachment[BUFFER_<wbr>DEPTH].Renderbuffer;<br>
-<br>
- /* From the EXT_framebuffer_object spec:<br>
- *<br>
- * "If a buffer is specified in <mask> and does not exist in both<br>
- * the read and draw framebuffers, the corresponding bit is silently<br>
- * ignored."<br>
- */<br>
- if ((readRb == NULL) || (drawRb == NULL)) {<br>
- mask &= ~GL_DEPTH_BUFFER_BIT;<br>
- }<br>
- else {<br>
- int read_s_bit, draw_s_bit;<br>
-<br>
- if (_mesa_is_gles3(ctx) && (drawRb == readRb)) {<br>
- _mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "%s(source and destination depth "<br>
- "buffer cannot be the same)", func);<br>
- return;<br>
- }<br>
-<br>
- if ((_mesa_get_format_bits(<wbr>readRb->Format, GL_DEPTH_BITS) !=<br>
- _mesa_get_format_bits(drawRb-><wbr>Format, GL_DEPTH_BITS)) ||<br>
- (_mesa_get_format_datatype(<wbr>readRb->Format) !=<br>
- _mesa_get_format_datatype(<wbr>drawRb->Format))) {<br>
- _mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "%s(depth attachment format mismatch)", func);<br>
- return;<br>
- }<br>
-<br>
- read_s_bit = _mesa_get_format_bits(readRb-><wbr>Format, GL_STENCIL_BITS);<br>
- draw_s_bit = _mesa_get_format_bits(drawRb-><wbr>Format, GL_STENCIL_BITS);<br>
-<br>
- /* If both buffers also have stencil data, the stencil formats must<br>
- * match as well. If one doesn't have stencil, it's not blitted, so<br>
- * we should ignore the stencil format check.<br>
- */<br>
- if (read_s_bit > 0 && draw_s_bit > 0 && read_s_bit != draw_s_bit) {<br>
- _mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "%s(depth attachment stencil bits mismatch)", func);<br>
- return;<br>
- }<br>
- }<br>
- }<br>
-<br>
+ if (mask & GL_DEPTH_BUFFER_BIT)<br>
+ validate_depth_buffer(ctx, readFb, drawFb, &mask, false, func);<br>
<br>
if (_mesa_is_gles3(ctx)) {<br>
/* Page 194 (page 206 of the PDF) in section 4.3.2 of the OpenGL ES<br>
<font color="#888888">--<br>
2.13.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></blockquote></div><br></div></div></div></div>