[Mesa-dev] [PATCH v2 7/7] i965: support instanced GS on gen7

Paul Berry stereotype441 at gmail.com
Fri Jan 31 19:14:46 PST 2014


On 28 January 2014 11:22, Jordan Justen <jordan.l.justen at intel.com> wrote:

> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_context.h           | 2 ++
>  src/mesa/drivers/dri/i965/brw_defines.h           | 1 +
>  src/mesa/drivers/dri/i965/brw_vec4_gs.c           | 2 ++
>  src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 6 ++++--
>  src/mesa/drivers/dri/i965/gen7_gs_state.c         | 2 ++
>  5 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h
> b/src/mesa/drivers/dri/i965/brw_context.h
> index 8d098e6..ade4458 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -639,6 +639,8 @@ struct brw_gs_prog_data
>
>     bool include_primitive_id;
>
> +   int invocations;
> +
>     /**
>      * True if the thread should be dispatched in DUAL_INSTANCE mode,
> false if
>      * it should be dispatched in DUAL_OBJECT mode.
> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h
> b/src/mesa/drivers/dri/i965/brw_defines.h
> index 5fe1aba..eaf6e8f 100644
> --- a/src/mesa/drivers/dri/i965/brw_defines.h
> +++ b/src/mesa/drivers/dri/i965/brw_defines.h
> @@ -1478,6 +1478,7 @@ enum brw_message_target {
>  # define GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT         0
>  # define GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_SID         1
>  # define GEN7_GS_CONTROL_DATA_HEADER_SIZE_SHIFT                20
> +# define GEN7_GS_INSTANCE_CONTROL_SHIFT                        15
>  # define GEN7_GS_DISPATCH_MODE_SINGLE                  (0 << 11)
>  # define GEN7_GS_DISPATCH_MODE_DUAL_INSTANCE           (1 << 11)
>  # define GEN7_GS_DISPATCH_MODE_DUAL_OBJECT             (2 << 11)
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs.c
> b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
> index abc181b..3c6393f 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_gs.c
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
> @@ -48,6 +48,8 @@ do_gs_prog(struct brw_context *brw,
>     c.prog_data.include_primitive_id =
>        (gp->program.Base.InputsRead & VARYING_BIT_PRIMITIVE_ID) != 0;
>
> +   c.prog_data.invocations = gp->program.Invocations;
> +
>     /* Allocate the references to the uniforms that will end up in the
>      * prog_data associated with the compiled program, and which will be
> freed
>      * by the state cache.
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
> b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
> index 12e137c..21dbc29 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
> @@ -596,9 +596,11 @@ brw_gs_emit(struct brw_context *brw,
>     }
>
>     /* Compile the geometry shader in DUAL_OBJECT dispatch mode, if we can
> do
> -    * so without spilling.
> +    * so without spilling. If the GS invocations count > 1, then we can't
> use
> +    * dual object mode.
>      */
> -   if (likely(!(INTEL_DEBUG & DEBUG_NO_DUAL_OBJECT_GS))) {
> +   if (c->prog_data.invocations <= 1 ||
> +       likely(!(INTEL_DEBUG & DEBUG_NO_DUAL_OBJECT_GS))) {
>

This should be &&, not ||.

With that fixed, this patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>

I sent comments on patches 1, 2, 4, 6, and 7.  Patches 3 and 5 are:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140131/56774d29/attachment.html>


More information about the mesa-dev mailing list