summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-06-24 15:16:34 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:07 -0800
commit72416a2d0d98038476f0bf04bb67263197a2bdfd (patch)
tree5f3828c1f7a4f89c379b18b84c14bef223c930a9
parenteef0d33cee9f3891984e2dac1d7a77c988df7de1 (diff)
iris: clears
-rw-r--r--src/gallium/drivers/iris/iris_blit.c18
-rw-r--r--src/gallium/drivers/iris/iris_clear.c38
-rw-r--r--src/gallium/drivers/iris/iris_context.h6
-rw-r--r--src/gallium/drivers/iris/iris_resource.h9
-rw-r--r--src/gallium/drivers/iris/iris_state.c9
5 files changed, 61 insertions, 19 deletions
diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c
index 9c328ac12f1..f6b6e3b1530 100644
--- a/src/gallium/drivers/iris/iris_blit.c
+++ b/src/gallium/drivers/iris/iris_blit.c
@@ -32,11 +32,11 @@
#include "iris_resource.h"
#include "iris_screen.h"
-static void
-blorp_surf_for_resource(struct blorp_surf *surf,
- struct pipe_resource *p_res,
- enum isl_aux_usage aux_usage,
- bool is_render_target)
+void
+iris_blorp_surf_for_resource(struct blorp_surf *surf,
+ struct pipe_resource *p_res,
+ enum isl_aux_usage aux_usage,
+ bool is_render_target)
{
struct iris_resource *res = (void *) p_res;
@@ -72,10 +72,10 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info)
{
struct iris_context *ice = (void *) ctx;
struct blorp_surf src_surf, dst_surf;
- blorp_surf_for_resource(&src_surf, info->src.resource, ISL_AUX_USAGE_NONE,
- false);
- blorp_surf_for_resource(&dst_surf, info->dst.resource, ISL_AUX_USAGE_NONE,
- true);
+ iris_blorp_surf_for_resource(&src_surf, info->src.resource,
+ ISL_AUX_USAGE_NONE, false);
+ iris_blorp_surf_for_resource(&dst_surf, info->dst.resource,
+ ISL_AUX_USAGE_NONE, true);
enum isl_format src_isl_format = iris_get_blorp_format(info->src.format);
enum isl_format dst_isl_format = iris_get_blorp_format(info->dst.format);
diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index 807e9ef7ec2..793777dbee3 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -38,10 +38,44 @@
static void
iris_clear(struct pipe_context *ctx,
unsigned buffers,
- const union pipe_color_union *color,
+ const union pipe_color_union *p_color,
double depth,
unsigned stencil)
{
+ struct iris_context *ice = (void *) ctx;
+ assert(buffers != 0);
+
+ struct blorp_batch blorp_batch;
+ blorp_batch_init(&ice->blorp, &blorp_batch, &ice->render_batch, 0);
+
+ if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+ fprintf(stderr, "XXX: depth/stencil clears not implemented\n");
+ }
+
+ if (buffers & PIPE_CLEAR_COLOR) {
+ struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
+ /* pipe_color_union and isl_color_value are interchangeable */
+ union isl_color_value *clear_color = (void *) p_color;
+ bool color_write_disable[4] = { false, false, false, false };
+
+ for (unsigned i = 0; i < cso_fb->nr_cbufs; i++) {
+ if (buffers & (PIPE_CLEAR_COLOR0 << i)) {
+ struct pipe_surface *psurf = cso_fb->cbufs[i];
+ struct iris_surface *isurf = (void *) psurf;
+ struct blorp_surf surf;
+
+ iris_blorp_surf_for_resource(&surf, psurf->texture,
+ ISL_AUX_USAGE_NONE, true);
+
+ blorp_clear(&blorp_batch, &surf, isurf->view.format,
+ ISL_SWIZZLE_IDENTITY, 0, 0, cso_fb->layers,
+ 0, 0, cso_fb->width, cso_fb->height,
+ *clear_color, color_write_disable);
+ }
+ }
+ }
+
+ blorp_batch_finish(&blorp_batch);
}
static void
@@ -52,6 +86,7 @@ iris_clear_render_target(struct pipe_context *ctx,
unsigned width, unsigned height,
bool render_condition_enabled)
{
+ fprintf(stderr, "XXX: iris_clear_render_target\n");
}
static void
@@ -64,6 +99,7 @@ iris_clear_depth_stencil(struct pipe_context *ctx,
unsigned width, unsigned height,
bool render_condition_enabled)
{
+ fprintf(stderr, "XXX: iris_clear_depth_stencil\n");
}
void
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h
index 14620b3be2a..b5489c7e46e 100644
--- a/src/gallium/drivers/iris/iris_context.h
+++ b/src/gallium/drivers/iris/iris_context.h
@@ -308,6 +308,12 @@ void iris_init_resource_functions(struct pipe_context *ctx);
void iris_init_query_functions(struct pipe_context *ctx);
void iris_update_compiled_shaders(struct iris_context *ice);
+/* iris_blit.c */
+void iris_blorp_surf_for_resource(struct blorp_surf *surf,
+ struct pipe_resource *p_res,
+ enum isl_aux_usage aux_usage,
+ bool is_render_target);
+
/* iris_draw.c */
void iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info);
diff --git a/src/gallium/drivers/iris/iris_resource.h b/src/gallium/drivers/iris/iris_resource.h
index 6225509aa11..45b8cf6a6c7 100644
--- a/src/gallium/drivers/iris/iris_resource.h
+++ b/src/gallium/drivers/iris/iris_resource.h
@@ -44,4 +44,13 @@ iris_resource_bo(struct pipe_resource *p_res)
return res->bo;
}
+struct iris_surface {
+ struct pipe_surface pipe;
+ struct isl_view view;
+
+ /** The resource (BO) holding our SURFACE_STATE. */
+ struct pipe_resource *surface_state_resource;
+ unsigned surface_state_offset;
+};
+
#endif
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 91ff1f811a4..67d098d601a 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -980,15 +980,6 @@ iris_create_sampler_view(struct pipe_context *ctx,
return &isv->pipe;
}
-struct iris_surface {
- struct pipe_surface pipe;
- struct isl_view view;
-
- /** The resource (BO) holding our SURFACE_STATE. */
- struct pipe_resource *surface_state_resource;
- unsigned surface_state_offset;
-};
-
static struct pipe_surface *
iris_create_surface(struct pipe_context *ctx,
struct pipe_resource *tex,