summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/iris/iris_binder.c11
-rw-r--r--src/gallium/drivers/iris/iris_binder.h1
-rw-r--r--src/gallium/drivers/iris/iris_context.h6
-rw-r--r--src/gallium/drivers/iris/iris_draw.c9
-rw-r--r--src/gallium/drivers/iris/iris_state.c20
5 files changed, 39 insertions, 8 deletions
diff --git a/src/gallium/drivers/iris/iris_binder.c b/src/gallium/drivers/iris/iris_binder.c
index 1b1c78380bb..02b0fab50d0 100644
--- a/src/gallium/drivers/iris/iris_binder.c
+++ b/src/gallium/drivers/iris/iris_binder.c
@@ -90,13 +90,22 @@ iris_binder_reserve_3d(struct iris_batch *batch,
}
}
+/* Avoid using offset 0, tools consider it NULL */
+#define INIT_INSERT_POINT 64
+
void
iris_init_binder(struct iris_binder *binder, struct iris_bufmgr *bufmgr)
{
binder->bo =
iris_bo_alloc(bufmgr, "binder", BINDER_SIZE, IRIS_MEMZONE_BINDER);
binder->map = iris_bo_map(NULL, binder->bo, MAP_WRITE);
- binder->insert_point = 64; // XXX: avoid null pointer, it confuses tools
+ binder->insert_point = INIT_INSERT_POINT;
+}
+
+bool
+iris_binder_is_empty(struct iris_binder *binder)
+{
+ return binder->insert_point <= INIT_INSERT_POINT;
}
void
diff --git a/src/gallium/drivers/iris/iris_binder.h b/src/gallium/drivers/iris/iris_binder.h
index ea455dd5cfd..dbb010693f5 100644
--- a/src/gallium/drivers/iris/iris_binder.h
+++ b/src/gallium/drivers/iris/iris_binder.h
@@ -49,6 +49,7 @@ struct iris_binder
};
void iris_init_binder(struct iris_binder *binder, struct iris_bufmgr *bufmgr);
+bool iris_binder_is_empty(struct iris_binder *binder);
void iris_destroy_binder(struct iris_binder *binder);
uint32_t iris_binder_reserve(struct iris_batch *batch, unsigned size);
void iris_binder_reserve_3d(struct iris_batch *batch,
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h
index 6ebb595b798..aecced3d05c 100644
--- a/src/gallium/drivers/iris/iris_context.h
+++ b/src/gallium/drivers/iris/iris_context.h
@@ -86,6 +86,12 @@ struct blorp_params;
#define IRIS_DIRTY_CONSTANTS_FS (1ull << 39)
#define IRIS_DIRTY_DEPTH_BUFFER (1ull << 40)
#define IRIS_DIRTY_WM (1ull << 41)
+#define IRIS_DIRTY_BINDINGS_VS (1ull << 42)
+#define IRIS_DIRTY_BINDINGS_TCS (1ull << 43)
+#define IRIS_DIRTY_BINDINGS_TES (1ull << 44)
+#define IRIS_DIRTY_BINDINGS_GS (1ull << 45)
+#define IRIS_DIRTY_BINDINGS_FS (1ull << 46)
+#define IRIS_DIRTY_BINDINGS_CS (1ull << 47)
struct iris_depth_stencil_alpha_state;
diff --git a/src/gallium/drivers/iris/iris_draw.c b/src/gallium/drivers/iris/iris_draw.c
index 8028c2b476b..c359c020c35 100644
--- a/src/gallium/drivers/iris/iris_draw.c
+++ b/src/gallium/drivers/iris/iris_draw.c
@@ -54,6 +54,15 @@ iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
// XXX: ^^^
iris_update_compiled_shaders(ice);
+
+ if (iris_binder_is_empty(&batch->binder)) {
+ ice->state.dirty |= IRIS_DIRTY_BINDINGS_VS |
+ IRIS_DIRTY_BINDINGS_TCS |
+ IRIS_DIRTY_BINDINGS_TES |
+ IRIS_DIRTY_BINDINGS_GS |
+ IRIS_DIRTY_BINDINGS_FS;
+ }
+
iris_binder_reserve_3d(batch, ice->shaders.prog);
ice->vtbl.upload_render_state(ice, batch, info);
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 6fca2d20217..8015da7b362 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -984,8 +984,6 @@ struct iris_surface {
/** The resource (BO) holding our SURFACE_STATE. */
struct pipe_resource *surface_state_resource;
unsigned surface_state_offset;
-
- // uint32_t surface_state[GENX(RENDER_SURFACE_STATE_length)];
};
static struct pipe_surface *
@@ -1079,7 +1077,7 @@ iris_set_sampler_views(struct pipe_context *ctx,
ice->state.num_textures[stage] = count;
- // XXX: ice->state.dirty |= (IRIS_DIRTY_BINDING_TABLE_VS << stage);
+ ice->state.dirty |= (IRIS_DIRTY_BINDINGS_VS << stage);
}
static void
@@ -1349,6 +1347,9 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
ice->state.cso_depthbuffer = cso_z;
ice->state.dirty |= IRIS_DIRTY_DEPTH_BUFFER;
+
+ /* Render target change */
+ ice->state.dirty |= IRIS_DIRTY_BINDINGS_FS;
}
static void
@@ -1396,6 +1397,9 @@ iris_set_constant_buffer(struct pipe_context *ctx,
pipe_resource_reference(&cbuf->resource, NULL);
pipe_resource_reference(&cbuf->surface_state_resource, NULL);
}
+
+ // XXX: maybe not necessary all the time...?
+ ice->state.dirty |= IRIS_DIRTY_BINDINGS_VS << stage;
}
static void
@@ -2458,17 +2462,19 @@ iris_upload_render_state(struct iris_context *ice,
}
}
- if (1) { // XXX: DIRTY BINDINGS
- const struct iris_binder *binder = &batch->binder;
+ struct iris_binder *binder = &batch->binder;
- for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
+ for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
+ if (dirty & (IRIS_DIRTY_BINDINGS_VS << stage)) {
iris_emit_cmd(batch, GENX(3DSTATE_BINDING_TABLE_POINTERS_VS), ptr) {
ptr._3DCommandSubOpcode = 38 + stage;
ptr.PointertoVSBindingTable = binder->bt_offset[stage];
}
}
+ }
- for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
+ for (int stage = 0; stage <= MESA_SHADER_FRAGMENT; stage++) {
+ if (dirty & (IRIS_DIRTY_BINDINGS_VS << stage)) {
iris_populate_binding_table(ice, batch, stage);
}
}