iris: clears
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user