[Mesa-dev] [PATCH] r600g: Implement sm5 geometry shader instancing
Marek Olšák
maraeo at gmail.com
Mon Sep 1 12:12:29 PDT 2014
Pushed, thanks.
Marek
On Mon, Aug 25, 2014 at 11:05 AM, Glenn Kennard <glenn.kennard at gmail.com> wrote:
> Requires Evergreen or later hardware.
>
> Signed-off-by: Glenn Kennard <glenn.kennard at gmail.com>
> ---
> docs/GL3.txt | 2 +-
> src/gallium/drivers/r600/evergreen_state.c | 4 ++--
> src/gallium/drivers/r600/r600_shader.c | 11 +++++++++++
> src/gallium/drivers/r600/r600_shader.h | 1 +
> 4 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/docs/GL3.txt b/docs/GL3.txt
> index 76412c3..026580f 100644
> --- a/docs/GL3.txt
> +++ b/docs/GL3.txt
> @@ -102,7 +102,7 @@ GL 4.0, GLSL 4.00:
> - Fused multiply-add DONE ()
> - Packing/bitfield/conversion functions DONE (r600)
> - Enhanced textureGather DONE (r600, radeonsi)
> - - Geometry shader instancing DONE ()
> + - Geometry shader instancing DONE (r600)
> - Geometry shader multiple streams DONE ()
> - Enhanced per-sample shading DONE (r600)
> - Interpolation functions DONE ()
> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
> index 841ad0c..bae88e5 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -2968,8 +2968,8 @@ void evergreen_update_gs_state(struct pipe_context *ctx, struct r600_pipe_shader
>
> if (rctx->screen->b.info.drm_minor >= 35) {
> r600_store_context_reg(cb, R_028B90_VGT_GS_INSTANCE_CNT,
> - S_028B90_CNT(0) |
> - S_028B90_ENABLE(0));
> + S_028B90_CNT(MIN2(rshader->gs_num_invocations, 127)) |
> + S_028B90_ENABLE(rshader->gs_num_invocations > 0));
> }
> r600_store_context_reg_seq(cb, R_02891C_SQ_GS_VERT_ITEMSIZE, 4);
> r600_store_value(cb, cp_shader->ring_item_size >> 2);
> diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
> index 3f089b4..9f10c20 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -706,6 +706,8 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx)
> break;
> } else if (d->Semantic.Name == TGSI_SEMANTIC_VERTEXID)
> break;
> + else if (d->Semantic.Name == TGSI_SEMANTIC_INVOCATIONID)
> + break;
> default:
> R600_ERR("unsupported file %d declaration\n", d->Declaration.File);
> return -EINVAL;
> @@ -811,6 +813,12 @@ static void tgsi_src(struct r600_shader_ctx *ctx,
> r600_src->swizzle[2] = 0;
> r600_src->swizzle[3] = 0;
> r600_src->sel = 0;
> + } else if (ctx->info.system_value_semantic_name[tgsi_src->Register.Index] == TGSI_SEMANTIC_INVOCATIONID) {
> + r600_src->swizzle[0] = 3;
> + r600_src->swizzle[1] = 3;
> + r600_src->swizzle[2] = 3;
> + r600_src->swizzle[3] = 3;
> + r600_src->sel = 1;
> }
> } else {
> if (tgsi_src->Register.Indirect)
> @@ -1753,6 +1761,9 @@ static int r600_shader_from_tgsi(struct r600_context *rctx,
> case TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES:
> shader->gs_max_out_vertices = property->u[0].Data;
> break;
> + case TGSI_PROPERTY_GS_INVOCATIONS:
> + shader->gs_num_invocations = property->u[0].Data;
> + break;
> }
> break;
> default:
> diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h
> index d6db8f0..4b27ede 100644
> --- a/src/gallium/drivers/r600/r600_shader.h
> +++ b/src/gallium/drivers/r600/r600_shader.h
> @@ -74,6 +74,7 @@ struct r600_shader {
> unsigned gs_input_prim;
> unsigned gs_output_prim;
> unsigned gs_max_out_vertices;
> + unsigned gs_num_invocations;
> /* size in bytes of a data item in the ring (single vertex data) */
> unsigned ring_item_size;
>
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list