aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Raszkowski <[email protected]>2019-08-09 17:04:57 +0200
committerKrzysztof Raszkowski <[email protected]>2019-08-09 18:56:13 +0200
commitc0ab268f9c2f5a608eaa5102a0aca4ba34c85a1a (patch)
treea27d6e0768a92629a48d25e445ee7c46f283ad73
parentd6f8ce1c96e39f4d0309a337b7839aee3b330a87 (diff)
gallium/swr: Fix glClear when it's used with glEnable/glDisable GL_SCISSOR_TEST
When GL_SCISSOR_TEST is enabled glClear is handled by state tracker and there is no need to do this in gallium driver. Reviewed-by: Alok Hota [email protected]
-rw-r--r--src/gallium/drivers/swr/swr_clear.cpp69
1 files changed, 5 insertions, 64 deletions
diff --git a/src/gallium/drivers/swr/swr_clear.cpp b/src/gallium/drivers/swr/swr_clear.cpp
index 3e02bda19c9..4473f76a0a2 100644
--- a/src/gallium/drivers/swr/swr_clear.cpp
+++ b/src/gallium/drivers/swr/swr_clear.cpp
@@ -68,13 +68,11 @@ swr_clear(struct pipe_context *pipe,
((union pipe_color_union *)color)->f[3] = 1.0; /* cast off your const'd-ness */
#endif
- SWR_RECT clear_rect;
- /* If enabled, clear to scissor; otherwise clear full surface */
- if (ctx->rasterizer && ctx->rasterizer->scissor) {
- clear_rect = ctx->swr_scissors[0];
- } else {
- clear_rect = {0, 0, (int32_t)fb->width, (int32_t)fb->height};
- }
+ /*
+ * Always clear full surface. When GL_SCISSOR_TEST is enabled
+ * glClear is handled by state tracker and there is no need to do this here
+ */
+ SWR_RECT clear_rect = {0, 0, (int32_t)fb->width, (int32_t)fb->height};
for (unsigned i = 0; i < layers; ++i) {
swr_update_draw_context(ctx);
@@ -94,65 +92,8 @@ swr_clear(struct pipe_context *pipe,
}
}
-
-#if 0 // XXX, these don't get called. how to get these called? Do we need
- // them? Docs?
-static void
-swr_clear_render_target(struct pipe_context *pipe, struct pipe_surface *ps,
- const union pipe_color_union *color,
- unsigned x, unsigned y, unsigned w, unsigned h,
- bool render_condition_enabled)
-{
- struct swr_context *ctx = swr_context(pipe);
- fprintf(stderr, "SWR swr_clear_render_target!\n");
-
- ctx->dirty |= SWR_NEW_FRAMEBUFFER | SWR_NEW_SCISSOR;
-}
-
-static void
-swr_clear_depth_stencil(struct pipe_context *pipe, struct pipe_surface *ps,
- unsigned buffers, double depth, unsigned stencil,
- unsigned x, unsigned y, unsigned w, unsigned h,
- bool render_condition_enabled)
-{
- struct swr_context *ctx = swr_context(pipe);
- fprintf(stderr, "SWR swr_clear_depth_stencil!\n");
-
- ctx->dirty |= SWR_NEW_FRAMEBUFFER | SWR_NEW_SCISSOR;
-}
-
-static void
-swr_clear_buffer(struct pipe_context *pipe,
- struct pipe_resource *res,
- unsigned offset, unsigned size,
- const void *data, int data_size)
-{
- fprintf(stderr, "SWR swr_clear_buffer!\n");
- struct swr_context *ctx = swr_context(pipe);
- struct swr_resource *buf = swr_resource(res);
- union pipe_color_union color;
- enum pipe_format dst_fmt;
- unsigned width, height, elements;
-
- assert(res->target == PIPE_BUFFER);
- assert(buf);
- assert(size % data_size == 0);
-
- SWR_SURFACE_STATE &swr_buffer = buf->swr;
-
- ctx->dirty |= SWR_NEW_FRAMEBUFFER | SWR_NEW_SCISSOR;
-}
-#endif
-
-
void
swr_clear_init(struct pipe_context *pipe)
{
pipe->clear = swr_clear;
-#if 0 // XXX, these don't get called. how to get these called? Do we need
- // them? Docs?
- pipe->clear_render_target = swr_clear_render_target;
- pipe->clear_depth_stencil = swr_clear_depth_stencil;
- pipe->clear_buffer = swr_clear_buffer;
-#endif
}