From 4ec5f8be3ea5bc344f00e5ab9356670576fb97bf Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 9 Jan 2018 11:58:28 -0800 Subject: [PATCH] iris: SF_CLIP_VIEWPORT --- src/gallium/drivers/iris/iris_context.h | 2 ++ src/gallium/drivers/iris/iris_state.c | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 95353c8cea9..184639275c7 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -58,10 +58,12 @@ struct iris_context { struct { uint64_t dirty; + unsigned num_viewports; // XXX: can viewports + scissors be different? unsigned num_scissors; struct iris_blend_state *cso_blend; struct iris_rasterizer_state *cso_rast; struct iris_depth_stencil_alpha_state *cso_zsa; + struct iris_viewport_state *cso_vp; struct pipe_blend_color blend_color; struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissors[IRIS_MAX_VIEWPORTS]; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index a3540a2a6df..19e25da0fd7 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -742,6 +742,7 @@ iris_set_scissor_states(struct pipe_context *ctx, { struct iris_context *ice = (struct iris_context *) ctx; + // XXX: start_slot ice->state.num_scissors = num_scissors; for (unsigned i = start_slot; i < start_slot + num_scissors; i++) { @@ -859,6 +860,7 @@ iris_set_viewport_states(struct pipe_context *ctx, unsigned num_viewports, const struct pipe_viewport_state *state) { + struct iris_context *ice = (struct iris_context *) ctx; struct iris_viewport_state *cso = malloc(sizeof(struct iris_viewport_state)); @@ -886,6 +888,11 @@ iris_set_viewport_states(struct pipe_context *ctx, vp.YMaxViewPort = y_extent; } } + + ice->state.cso_vp = cso; + // XXX: start_slot + ice->state.num_viewports = num_viewports; + ice->state.dirty |= IRIS_DIRTY_SF_CL_VIEWPORT; } static void @@ -1095,10 +1102,10 @@ iris_upload_render_state(struct iris_context *ice, struct iris_batch *batch) } if (dirty & IRIS_DIRTY_SF_CL_VIEWPORT) { - struct iris_depth_stencil_alpha_state *cso = ice->state.cso_zsa; - iris_emit_cmd(batch, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_CC), ptr) { - ptr.CCViewportPointer = - iris_emit_state(batch, cso->cc_vp, sizeof(cso->cc_vp), 32); + struct iris_viewport_state *cso = ice->state.cso_vp; + iris_emit_cmd(batch, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP), ptr) { + ptr.SFClipViewportPointer = + iris_emit_state(batch, cso->sf_cl_vp, sizeof(cso->sf_cl_vp), 64); } } @@ -1133,10 +1140,6 @@ iris_upload_render_state(struct iris_context *ice, struct iris_batch *batch) #if 0 l3 configuration - 3DSTATE_VIEWPORT_STATE_POINTERS_SF_CL - SF_CLIP_VIEWPORT - -> pipe_viewport_state for matrix elements, guardband is calculated - from those. can calculate screen space from matrix apparently... - 3DSTATE_PUSH_CONSTANT_ALLOC_* 3DSTATE_URB_* -> TODO -- 2.30.2