From 970836c34e242d47b91206ce52b0179cf0db70b5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 9 Jan 2018 11:51:34 -0800 Subject: [PATCH] iris: scissors --- src/gallium/drivers/iris/iris_context.h | 2 ++ src/gallium/drivers/iris/iris_state.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 8cd1fc7623f..95353c8cea9 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -46,6 +46,7 @@ enum iris_dirty { IRIS_DIRTY_BLEND_STATE = (1ull << 7), IRIS_DIRTY_RASTER = (1ull << 8), IRIS_DIRTY_CLIP = (1ull << 9), + IRIS_DIRTY_SCISSOR = (1ull << 10), }; struct iris_depth_stencil_alpha_state; @@ -57,6 +58,7 @@ struct iris_context { struct { uint64_t dirty; + unsigned num_scissors; struct iris_blend_state *cso_blend; struct iris_rasterizer_state *cso_rast; struct iris_depth_stencil_alpha_state *cso_zsa; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index f7e308e6eff..a3540a2a6df 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -742,6 +742,8 @@ iris_set_scissor_states(struct pipe_context *ctx, { struct iris_context *ice = (struct iris_context *) ctx; + ice->state.num_scissors = num_scissors; + for (unsigned i = start_slot; i < start_slot + num_scissors; i++) { ice->state.scissors[i] = *state; } @@ -1117,6 +1119,17 @@ iris_upload_render_state(struct iris_context *ice, struct iris_batch *batch) iris_batch_emit(batch, cso->sf, sizeof(cso->sf)); } + if (dirty & IRIS_DIRTY_SCISSOR) { + uint32_t scissor_offset = + iris_emit_state(batch, ice->state.scissors, + sizeof(struct pipe_scissor_state) * + ice->state.num_scissors, 32); + + iris_emit_cmd(batch, GENX(3DSTATE_SCISSOR_STATE_POINTERS), ptr) { + ptr.ScissorRectPointer = scissor_offset; + } + } + #if 0 l3 configuration @@ -1124,9 +1137,6 @@ iris_upload_render_state(struct iris_context *ice, struct iris_batch *batch) -> pipe_viewport_state for matrix elements, guardband is calculated from those. can calculate screen space from matrix apparently... - 3DSTATE_SCISSOR_STATE_POINTERS - SCISSOR_RECT - -> from ice->state.scissors - 3DSTATE_PUSH_CONSTANT_ALLOC_* 3DSTATE_URB_* -> TODO -- 2.30.2