<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 1, 2019 at 10:14 AM Juan A. Suarez Romero <<a href="mailto:jasuarez@igalia.com">jasuarez@igalia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This can happen when we record a VkCmdDraw in a secondary buffer that<br>
was created inheriting from the primary buffer, but with the framebuffer<br>
set to NULL in the VkCommandBufferInheritanceInfo.<br>
<br>
CC: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>><br>
---<br>
src/intel/vulkan/gen7_cmd_buffer.c | 13 +++++++++++--<br>
1 file changed, 11 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c<br>
index 352892aee33..fe1a47f6ce6 100644<br>
--- a/src/intel/vulkan/gen7_cmd_buffer.c<br>
+++ b/src/intel/vulkan/gen7_cmd_buffer.c<br>
@@ -70,12 +70,21 @@ gen7_cmd_buffer_emit_scissor(struct anv_cmd_buffer *cmd_buffer)<br>
};<br>
<br>
const int max = 0xffff;<br>
+<br>
+ uint32_t height = 0;<br>
+ uint32_t width = 0;<br>
+<br>
+ if (fb) {<br>
+ height = fb->height;<br>
+ width = fb->width;<br>
+ }<br>
+<br>
struct GEN7_SCISSOR_RECT scissor = {<br>
/* Do this math using int64_t so overflow gets clamped correctly. */<br>
.ScissorRectangleYMin = clamp_int64(s->offset.y, 0, max),<br>
.ScissorRectangleXMin = clamp_int64(s->offset.x, 0, max),<br>
- .ScissorRectangleYMax = clamp_int64((uint64_t) s->offset.y + s->extent.height - 1, 0, fb->height - 1),<br>
- .ScissorRectangleXMax = clamp_int64((uint64_t) s->offset.x + s->extent.width - 1, 0, fb->width - 1)<br>
+ .ScissorRectangleYMax = clamp_int64((uint64_t) s->offset.y + s->extent.height - 1, 0, height - 1),<br>
+ .ScissorRectangleXMax = clamp_int64((uint64_t) s->offset.x + s->extent.width - 1, 0, width - 1)<br></blockquote><div><br></div><div>If fb == NULL, won't width/height be 0 and this be -1 and we end up clamping to -1? I think we want to rather make the clamp conditional on having the framebuffer.</div><div><br></div><div>--Jason<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 (s->extent.width <= 0 || s->extent.height <= 0) {<br>
-- <br>
2.20.1<br>
<br>
</blockquote></div></div>