From 703ae84ac205b128997e949d7b8373bb102a0d5a Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 11 Nov 2014 10:21:03 +0800 Subject: [PATCH] ilo: add variants of 3DSTATE_CLIP Add gen6_disable_3DSTATE_CLIP to disable clipping. Signed-off-by: Chia-I Wu --- .../drivers/ilo/ilo_builder_3d_bottom.h | 52 +++++++++++-------- src/gallium/drivers/ilo/ilo_render_gen6.c | 2 +- src/gallium/drivers/ilo/ilo_render_gen7.c | 2 +- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h b/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h index 2397a2c7943..3207843cbcd 100644 --- a/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h +++ b/src/gallium/drivers/ilo/ilo_builder_3d_bottom.h @@ -46,35 +46,27 @@ gen6_3DSTATE_CLIP(struct ilo_builder *builder, { const uint8_t cmd_len = 4; uint32_t dw1, dw2, dw3, *dw; + int interps; ILO_DEV_ASSERT(builder->dev, 6, 7.5); - if (rasterizer) { - int interps; - - dw1 = rasterizer->clip.payload[0]; - dw2 = rasterizer->clip.payload[1]; - dw3 = rasterizer->clip.payload[2]; + dw1 = rasterizer->clip.payload[0]; + dw2 = rasterizer->clip.payload[1]; + dw3 = rasterizer->clip.payload[2]; - if (enable_guardband && rasterizer->clip.can_enable_guardband) - dw2 |= GEN6_CLIP_DW2_GB_TEST_ENABLE; + if (enable_guardband && rasterizer->clip.can_enable_guardband) + dw2 |= GEN6_CLIP_DW2_GB_TEST_ENABLE; - interps = (fs) ? ilo_shader_get_kernel_param(fs, - ILO_KERNEL_FS_BARYCENTRIC_INTERPOLATIONS) : 0; + interps = (fs) ? ilo_shader_get_kernel_param(fs, + ILO_KERNEL_FS_BARYCENTRIC_INTERPOLATIONS) : 0; - if (interps & (GEN6_INTERP_NONPERSPECTIVE_PIXEL | - GEN6_INTERP_NONPERSPECTIVE_CENTROID | - GEN6_INTERP_NONPERSPECTIVE_SAMPLE)) - dw2 |= GEN6_CLIP_DW2_NONPERSPECTIVE_BARYCENTRIC_ENABLE; + if (interps & (GEN6_INTERP_NONPERSPECTIVE_PIXEL | + GEN6_INTERP_NONPERSPECTIVE_CENTROID | + GEN6_INTERP_NONPERSPECTIVE_SAMPLE)) + dw2 |= GEN6_CLIP_DW2_NONPERSPECTIVE_BARYCENTRIC_ENABLE; - dw3 |= GEN6_CLIP_DW3_RTAINDEX_FORCED_ZERO | - (num_viewports - 1); - } - else { - dw1 = 0; - dw2 = 0; - dw3 = 0; - } + dw3 |= GEN6_CLIP_DW3_RTAINDEX_FORCED_ZERO | + (num_viewports - 1); ilo_builder_batch_pointer(builder, cmd_len, &dw); @@ -84,6 +76,22 @@ gen6_3DSTATE_CLIP(struct ilo_builder *builder, dw[3] = dw3; } +static inline void +gen6_disable_3DSTATE_CLIP(struct ilo_builder *builder) +{ + const uint8_t cmd_len = 4; + uint32_t *dw; + + ILO_DEV_ASSERT(builder->dev, 6, 7.5); + + ilo_builder_batch_pointer(builder, cmd_len, &dw); + + dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_CLIP) | (cmd_len - 2); + dw[1] = 0; + dw[2] = 0; + dw[3] = 0; +} + /** * Fill in DW2 to DW7 of 3DSTATE_SF. */ diff --git a/src/gallium/drivers/ilo/ilo_render_gen6.c b/src/gallium/drivers/ilo/ilo_render_gen6.c index deaa5150068..70a7400d5dd 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen6.c +++ b/src/gallium/drivers/ilo/ilo_render_gen6.c @@ -851,7 +851,7 @@ gen6_rectlist_vs_to_sf(struct ilo_render *r, gen6_3DSTATE_CONSTANT_GS(r->builder, NULL, NULL, 0); gen6_3DSTATE_GS(r->builder, NULL, NULL, 0); - gen6_3DSTATE_CLIP(r->builder, NULL, NULL, false, 0); + gen6_disable_3DSTATE_CLIP(r->builder); gen6_3DSTATE_SF(r->builder, NULL, NULL); } diff --git a/src/gallium/drivers/ilo/ilo_render_gen7.c b/src/gallium/drivers/ilo/ilo_render_gen7.c index e0e6d06ba99..79d147a7a25 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen7.c +++ b/src/gallium/drivers/ilo/ilo_render_gen7.c @@ -737,7 +737,7 @@ gen7_rectlist_vs_to_sf(struct ilo_render *r, gen7_3DSTATE_STREAMOUT(r->builder, 0x0, 0, false); - gen6_3DSTATE_CLIP(r->builder, NULL, NULL, false, 0); + gen6_disable_3DSTATE_CLIP(r->builder); gen7_wa_pre_3dstate_sf_depth_bias(r); -- 2.30.2