#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;
{
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);
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
unsigned width, unsigned height,
bool render_condition_enabled)
{
+ fprintf(stderr, "XXX: iris_clear_render_target\n");
}
static void
unsigned width, unsigned height,
bool render_condition_enabled)
{
+ fprintf(stderr, "XXX: iris_clear_depth_stencil\n");
}
void
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);