summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-10-08 11:43:29 +0200
committerErik Faye-Lund <[email protected]>2019-10-28 08:51:48 +0000
commitf26eab317571aba760868481917dea9f148a9cf5 (patch)
tree4a77573107886faf5853759161b3cf620b12ed60 /src/gallium
parentc4446098cf587f0cd7259dd0cca0b227a17bb82c (diff)
zink: fixup scissoring
Acked-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/zink/zink_context.c41
-rw-r--r--src/gallium/drivers/zink/zink_context.h6
2 files changed, 12 insertions, 35 deletions
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 773bc092bc1..74f94ee988d 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -415,7 +415,6 @@ zink_set_scissor_states(struct pipe_context *pctx,
ctx->scissor_states[start_slot + i] = states[i];
ctx->scissors[start_slot + i] = scissor;
}
- ctx->num_scissors = start_slot + num_scissors;
}
static void
@@ -788,33 +787,14 @@ zink_clear(struct pipe_context *pctx,
++num_attachments;
}
- unsigned num_layers = util_framebuffer_get_num_layers(fb);
- VkClearRect rects[PIPE_MAX_VIEWPORTS];
- uint32_t num_rects;
- if (ctx->num_scissors) {
- for (unsigned i = 0 ; i < ctx->num_scissors; ++i) {
- rects[i].rect = ctx->scissors[i];
- rects[i].rect.extent.width = MIN2(rects[i].rect.extent.width,
- fb->width);
- rects[i].rect.extent.height = MIN2(rects[i].rect.extent.height,
- fb->height);
- rects[i].baseArrayLayer = 0;
- rects[i].layerCount = num_layers;
- }
- num_rects = ctx->num_scissors;
- } else {
- rects[0].rect.offset.x = 0;
- rects[0].rect.offset.y = 0;
- rects[0].rect.extent.width = fb->width;
- rects[0].rect.extent.height = fb->height;
- rects[0].baseArrayLayer = 0;
- rects[0].layerCount = num_layers;
- num_rects = 1;
- }
-
- vkCmdClearAttachments(batch->cmdbuf,
- num_attachments, attachments,
- num_rects, rects);
+ VkClearRect cr;
+ cr.rect.offset.x = 0;
+ cr.rect.offset.y = 0;
+ cr.rect.extent.width = fb->width;
+ cr.rect.extent.height = fb->height;
+ cr.baseArrayLayer = 0;
+ cr.layerCount = util_framebuffer_get_num_layers(fb);
+ vkCmdClearAttachments(batch->cmdbuf, num_attachments, attachments, 1, &cr);
}
VkShaderStageFlagBits
@@ -1088,9 +1068,8 @@ zink_draw_vbo(struct pipe_context *pctx,
}
vkCmdSetViewport(batch->cmdbuf, 0, ctx->num_viewports, ctx->viewports);
-
- if (ctx->num_scissors)
- vkCmdSetScissor(batch->cmdbuf, 0, ctx->num_scissors, ctx->scissors);
+ if (ctx->rast_state->base.scissor)
+ vkCmdSetScissor(batch->cmdbuf, 0, ctx->num_viewports, ctx->scissors);
else if (ctx->fb_state.width && ctx->fb_state.height) {
VkRect2D fb_scissor = {};
fb_scissor.extent.width = ctx->fb_state.width;
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 147f35f6d18..173f076c0df 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -90,12 +90,10 @@ struct zink_context {
struct zink_framebuffer *framebuffer;
struct pipe_viewport_state viewport_states[PIPE_MAX_VIEWPORTS];
- VkViewport viewports[PIPE_MAX_VIEWPORTS];
- unsigned num_viewports;
-
struct pipe_scissor_state scissor_states[PIPE_MAX_VIEWPORTS];
+ VkViewport viewports[PIPE_MAX_VIEWPORTS];
VkRect2D scissors[PIPE_MAX_VIEWPORTS];
- unsigned num_scissors;
+ unsigned num_viewports;
struct pipe_vertex_buffer buffers[PIPE_MAX_ATTRIBS];
uint32_t buffers_enabled_mask;