intel: emit FB-dependent states conditionally
Emit 3DSTATE_MULTISAMPLE, 3DSTATE_DRAWING_RECTANGLE, 3DSTATE_DEPTH_BUFFER, etc
only when the render pass changed.
diff --git a/icd/intel/cmd_pipeline.c b/icd/intel/cmd_pipeline.c
index c3f7c4b..ca2ecbe 100644
--- a/icd/intel/cmd_pipeline.c
+++ b/icd/intel/cmd_pipeline.c
@@ -1876,6 +1876,9 @@
{
const struct intel_fb *fb = cmd->bind.render_pass->fb;
+ if (!cmd->bind.render_pass_changed)
+ return;
+
if (fb->sample_count != cmd->bind.pipeline.graphics->sample_count)
cmd->result = XGL_ERROR_UNKNOWN;
@@ -1885,9 +1888,13 @@
static void emit_rt(struct intel_cmd *cmd)
{
+ const struct intel_fb *fb = cmd->bind.render_pass->fb;
+
+ if (!cmd->bind.render_pass_changed)
+ return;
+
cmd_wa_gen6_pre_depth_stall_write(cmd);
- gen6_3DSTATE_DRAWING_RECTANGLE(cmd, cmd->bind.render_pass->fb->width,
- cmd->bind.render_pass->fb->height);
+ gen6_3DSTATE_DRAWING_RECTANGLE(cmd, fb->width, fb->height);
}
static void emit_ds(struct intel_cmd *cmd)
@@ -1895,6 +1902,9 @@
const struct intel_fb *fb = cmd->bind.render_pass->fb;
const struct intel_ds_view *ds = fb->ds;
+ if (!cmd->bind.render_pass_changed)
+ return;
+
if (!ds) {
/* all zeros */
static const struct intel_ds_view null_ds;
@@ -3200,6 +3210,7 @@
}
cmd->bind.draw_count++;
+ cmd->bind.render_pass_changed = false;
/* need to re-emit all workarounds */
cmd->bind.wa_flags = 0;
@@ -3262,6 +3273,9 @@
cmd->bind.meta = NULL;
+ /* make the normal path believe the render pass has changed */
+ cmd->bind.render_pass_changed = true;
+
if (intel_debug & INTEL_DEBUG_NOCACHE)
cmd_batch_flush_all(cmd);
}