}
}
+/* 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
};
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,
#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;
// 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);
/** 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 *
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
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
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
}
}
- 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);
}
}