[Mesa-dev] [PATCH v2 1/7] nir/info: Add more information about geometry shaders

Kenneth Graunke kenneth at whitecape.org
Wed Oct 21 13:04:15 PDT 2015


On Wednesday, October 21, 2015 12:44:31 PM Jason Ekstrand wrote:
> v2: Add a uses_streams boolean
> 
> ---
>  src/glsl/nir/glsl_to_nir.cpp |  4 ++++
>  src/glsl/nir/nir.h           | 12 ++++++++++++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
> index c9cdf35..9b50a93 100644
> --- a/src/glsl/nir/glsl_to_nir.cpp
> +++ b/src/glsl/nir/glsl_to_nir.cpp
> @@ -170,8 +170,12 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
>  
>     switch (stage) {
>     case MESA_SHADER_GEOMETRY:
> +      shader->info.gs.vertices_in = shader_prog->Geom.VerticesIn;
> +      shader->info.gs.output_primitive = sh->Geom.OutputType;
>        shader->info.gs.vertices_out = sh->Geom.VerticesOut;
>        shader->info.gs.invocations = sh->Geom.Invocations;
> +      shader->info.gs.uses_end_primitive = shader_prog->Geom.UsesEndPrimitive;
> +      shader->info.gs.uses_streams = shader_prog->Geom.UsesStreams;
>        break;
>  
>     case MESA_SHADER_FRAGMENT: {
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 2ab48fb..f65d44c 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -1495,11 +1495,23 @@ typedef struct nir_shader_info {
>  
>     union {
>        struct {
> +         /** The number of vertices recieves per input primitive */
> +         unsigned vertices_in;
> +
> +         /** The output primitive type (GL enum value) */
> +         unsigned output_primitive;
> +
>           /** The maximum number of vertices the geometry shader might write. */
>           unsigned vertices_out;
>  
>           /** 1 .. MAX_GEOMETRY_SHADER_INVOCATIONS */
>           unsigned invocations;
> +
> +         /** Whether or not this shader uses EndPrimitive */
> +         bool uses_end_primitive;
> +
> +         /** Whether or not this shader uses non-zero streams */
> +         bool uses_streams;
>        } gs;
>  
>        struct {
> 

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151021/456b2103/attachment.sig>


More information about the mesa-dev mailing list