iris: scissors
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 9 Jan 2018 19:51:34 +0000 (11:51 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:04 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_state.c

index 8cd1fc7623ffd901185db43763867050ae6892f2..95353c8cea922e01b625d98d789f16b3f9fc66b3 100644 (file)
@@ -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;
index f7e308e6effa6435410001df070674b2e9686f85..a3540a2a6df424f5d25b348db058f9594bf4ccb7 100644 (file)
@@ -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