diff options
author | Chia-I Wu <[email protected]> | 2015-03-07 01:44:33 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2015-03-07 01:45:52 +0800 |
commit | ba5670fc500cce59a76e241ab384caaf5502e391 (patch) | |
tree | b5ddebd9b63df3e9f9e572419ec3daede363b1a1 /src | |
parent | 8b2eecfbf8def8ef343529f7b0378dc1b8a36ff9 (diff) |
ilo: add generic ilo_render_3dprimitive()
It replaces gen[6-8]_3dprimitive().
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_gen.h | 24 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_gen6.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_gen7.c | 21 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_gen8.c | 19 |
4 files changed, 29 insertions, 53 deletions
diff --git a/src/gallium/drivers/ilo/ilo_render_gen.h b/src/gallium/drivers/ilo/ilo_render_gen.h index 96577989852..f2bcf7a09bc 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen.h +++ b/src/gallium/drivers/ilo/ilo_render_gen.h @@ -30,6 +30,7 @@ #include "ilo_common.h" #include "ilo_builder.h" +#include "ilo_builder_3d.h" #include "ilo_builder_render.h" #include "ilo_state.h" #include "ilo_render.h" @@ -374,6 +375,29 @@ ilo_render_pipe_control(struct ilo_render *r, uint32_t dw1) r->state.deferred_pipe_control_dw1 &= ~dw1; } +/** + * A convenient wrapper for gen{6,7}_3DPRIMITIVE(). + */ +static inline void +ilo_render_3dprimitive(struct ilo_render *r, + const struct pipe_draw_info *info, + const struct ilo_ib_state *ib) +{ + ILO_DEV_ASSERT(r->dev, 6, 8); + + if (r->state.deferred_pipe_control_dw1) + ilo_render_pipe_control(r, r->state.deferred_pipe_control_dw1); + + /* 3DPRIMITIVE */ + if (ilo_dev_gen(r->dev) >= ILO_GEN(7)) + gen7_3DPRIMITIVE(r->builder, info, ib); + else + gen6_3DPRIMITIVE(r->builder, info, ib); + + r->state.current_pipe_control_dw1 = 0; + assert(!r->state.deferred_pipe_control_dw1); +} + void gen6_wa_pre_pipe_control(struct ilo_render *r, uint32_t dw1); diff --git a/src/gallium/drivers/ilo/ilo_render_gen6.c b/src/gallium/drivers/ilo/ilo_render_gen6.c index 898b98a561f..902d398e0cb 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen6.c +++ b/src/gallium/drivers/ilo/ilo_render_gen6.c @@ -38,20 +38,6 @@ #include "ilo_state.h" #include "ilo_render_gen.h" -static void -gen6_3dprimitive(struct ilo_render *r, - const struct pipe_draw_info *info, - const struct ilo_ib_state *ib) -{ - ILO_DEV_ASSERT(r->dev, 6, 6); - - /* 3DPRIMITIVE */ - gen6_3DPRIMITIVE(r->builder, info, ib); - - r->state.current_pipe_control_dw1 = 0; - assert(!r->state.deferred_pipe_control_dw1); -} - /** * This should be called before PIPE_CONTROL. */ @@ -835,7 +821,7 @@ ilo_render_emit_draw_commands_gen6(struct ilo_render *render, gen6_draw_sf_rect(render, vec, session); gen6_draw_vf(render, vec, session); - gen6_3dprimitive(render, vec->draw, &vec->ib); + ilo_render_3dprimitive(render, vec->draw, &vec->ib); } static void @@ -980,7 +966,7 @@ ilo_render_emit_rectlist_commands_gen6(struct ilo_render *r, gen6_3DSTATE_DRAWING_RECTANGLE(r->builder, 0, 0, blitter->fb.width, blitter->fb.height); - gen6_3dprimitive(r, &blitter->draw, NULL); + ilo_render_3dprimitive(r, &blitter->draw, NULL); } int diff --git a/src/gallium/drivers/ilo/ilo_render_gen7.c b/src/gallium/drivers/ilo/ilo_render_gen7.c index a8a222d05ff..8801d147217 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen7.c +++ b/src/gallium/drivers/ilo/ilo_render_gen7.c @@ -36,23 +36,6 @@ #include "ilo_render_gen.h" static void -gen7_3dprimitive(struct ilo_render *r, - const struct pipe_draw_info *info, - const struct ilo_ib_state *ib) -{ - ILO_DEV_ASSERT(r->dev, 7, 7.5); - - if (r->state.deferred_pipe_control_dw1) - ilo_render_pipe_control(r, r->state.deferred_pipe_control_dw1); - - /* 3DPRIMITIVE */ - gen7_3DPRIMITIVE(r->builder, info, ib); - - r->state.current_pipe_control_dw1 = 0; - r->state.deferred_pipe_control_dw1 = 0; -} - -static void gen7_wa_post_3dstate_push_constant_alloc_ps(struct ilo_render *r) { /* @@ -671,7 +654,7 @@ ilo_render_emit_draw_commands_gen7(struct ilo_render *render, gen6_draw_sf_rect(render, vec, session); gen6_draw_vf(render, vec, session); - gen7_3dprimitive(render, vec->draw, &vec->ib); + ilo_render_3dprimitive(render, vec->draw, &vec->ib); } static void @@ -871,7 +854,7 @@ ilo_render_emit_rectlist_commands_gen7(struct ilo_render *r, if (ilo_dev_gen(r->dev) == ILO_GEN(7)) gen7_wa_post_ps_and_later(r); - gen7_3dprimitive(r, &blitter->draw, NULL); + ilo_render_3dprimitive(r, &blitter->draw, NULL); } int diff --git a/src/gallium/drivers/ilo/ilo_render_gen8.c b/src/gallium/drivers/ilo/ilo_render_gen8.c index 49c5e7a4d3b..f6d8d6666a3 100644 --- a/src/gallium/drivers/ilo/ilo_render_gen8.c +++ b/src/gallium/drivers/ilo/ilo_render_gen8.c @@ -36,23 +36,6 @@ #include "ilo_render_gen.h" static void -gen8_3dprimitive(struct ilo_render *r, - const struct pipe_draw_info *info, - const struct ilo_ib_state *ib) -{ - ILO_DEV_ASSERT(r->dev, 8, 8); - - if (r->state.deferred_pipe_control_dw1) - ilo_render_pipe_control(r, r->state.deferred_pipe_control_dw1); - - /* 3DPRIMITIVE */ - gen7_3DPRIMITIVE(r->builder, info, ib); - - r->state.current_pipe_control_dw1 = 0; - r->state.deferred_pipe_control_dw1 = 0; -} - -static void gen8_wa_pre_depth(struct ilo_render *r) { ILO_DEV_ASSERT(r->dev, 8, 8); @@ -298,7 +281,7 @@ ilo_render_emit_draw_commands_gen8(struct ilo_render *render, gen6_draw_sf_rect(render, vec, session); gen8_draw_vf(render, vec, session); - gen8_3dprimitive(render, vec->draw, &vec->ib); + ilo_render_3dprimitive(render, vec->draw, &vec->ib); } int |