[Mesa-dev] [PATCH 02/12] nvc0: add support for setting patch vertices at draw time

Ilia Mirkin imirkin at alum.mit.edu
Sat May 16 22:18:08 PDT 2015


On Sun, May 17, 2015 at 1:07 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c       | 1 +
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.h       | 1 +
>  src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c | 3 ---
>  src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c          | 6 ++++++
>  4 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index ff552ae..4bc41f2 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -1004,6 +1004,7 @@ nvc0_screen_create(struct nouveau_device *dev)
>     PUSH_DATA (push, 0x20);
>     BEGIN_NVC0(push, NVC0_3D(SP_SELECT(0)), 1);
>     PUSH_DATA (push, 0x00);
> +   screen->save_state.patch_vertices = 3;
>
>     BEGIN_NVC0(push, NVC0_3D(POINT_COORD_REPLACE), 1);
>     PUSH_DATA (push, 0);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
> index ef2bd43..c79211e 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
> @@ -38,6 +38,7 @@ struct nvc0_graph_state {
>     uint32_t constant_elts;
>     int32_t index_bias;
>     uint16_t scissor;
> +   uint8_t patch_vertices;
>     uint8_t vbo_mode; /* 0 = normal, 1 = translate, 3 = translate, forced */
>     uint8_t num_vtxbufs;
>     uint8_t num_vtxelts;
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
> index 516b33b..32f4519 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
> @@ -147,9 +147,6 @@ nvc0_tctlprog_validate(struct nvc0_context *nvc0)
>        PUSH_DATA (push, tp->code_base);
>        BEGIN_NVC0(push, NVC0_3D(SP_GPR_ALLOC(2)), 1);
>        PUSH_DATA (push, tp->num_gprs);
> -
> -      if (tp->tp.input_patch_size <= 32)
> -         IMMED_NVC0(push, NVC0_3D(PATCH_VERTICES), tp->tp.input_patch_size);
>     } else {
>        BEGIN_NVC0(push, NVC0_3D(SP_SELECT(2)), 1);
>        PUSH_DATA (push, 0x20);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
> index f8e2759..fb7b073 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
> @@ -887,6 +887,12 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
>        }
>     }
>
> +   if (info->mode == PIPE_PRIM_PATCHES &&
> +       nvc0->state.patch_vertices != info->vertices_per_patch) {
> +      IMMED_NVC0(push, NVC0_3D(PATCH_VERTICES), nvc0->state.patch_vertices);
> +      nvc0->state.patch_vertices = info->vertices_per_patch;

Naturally those lines are swapped, fixed locally. That's what I get
for last-second untested changes :(

> +   }
> +
>     /* 8 as minimum to avoid immediate double validation of new buffers */
>     nvc0_state_validate(nvc0, ~0, 8);
>
> --
> 2.3.6
>


More information about the mesa-dev mailing list