aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2013-06-18 12:33:15 +0800
committerChia-I Wu <[email protected]>2013-06-18 16:23:13 +0800
commit443dc15cf77edcaa7804c4277f0cce5d7c1d6b25 (patch)
tree2373d502ca0da8d105400371b41f9fa6a953f912 /src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
parenteb2021507556633cd6ba64cda26653e3c43e80df (diff)
ilo: construct depth/stencil command in create_surface()
Add ilo_gpe_init_zs_surface() to construct 3DSTATE_DEPTH_BUFFER 3DSTATE_STENCIL_BUFFER 3DSTATE_HIER_DEPTH_BUFFER at surface creation time. This allows fast state emission in draw_vbo().
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c')
-rw-r--r--src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
index 96e2e187427..878f6d0434b 100644
--- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
+++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen7.c
@@ -532,9 +532,22 @@ gen7_pipeline_wm(struct ilo_3d_pipeline *p,
/* 3DSTATE_DEPTH_BUFFER and 3DSTATE_CLEAR_PARAMS */
if (DIRTY(FRAMEBUFFER) || session->batch_bo_changed) {
- p->gen7_3DSTATE_DEPTH_BUFFER(p->dev, ilo->fb.state.zsbuf, p->cp);
- p->gen6_3DSTATE_HIER_DEPTH_BUFFER(p->dev, ilo->fb.state.zsbuf, p->cp);
- p->gen6_3DSTATE_STENCIL_BUFFER(p->dev, ilo->fb.state.zsbuf, p->cp);
+ const struct ilo_zs_surface *zs;
+
+ if (ilo->fb.state.zsbuf) {
+ const struct ilo_surface_cso *surface =
+ (const struct ilo_surface_cso *) ilo->fb.state.zsbuf;
+
+ assert(!surface->is_rt);
+ zs = &surface->u.zs;
+ }
+ else {
+ zs = &ilo->fb.null_zs;
+ }
+
+ p->gen7_3DSTATE_DEPTH_BUFFER(p->dev, zs, p->cp);
+ p->gen6_3DSTATE_HIER_DEPTH_BUFFER(p->dev, zs, p->cp);
+ p->gen6_3DSTATE_STENCIL_BUFFER(p->dev, zs, p->cp);
/* TODO */
p->gen6_3DSTATE_CLEAR_PARAMS(p->dev, 0, p->cp);