diff options
author | Kenneth Graunke <[email protected]> | 2015-08-18 02:07:47 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-09-11 00:05:09 -0700 |
commit | b811085b797c79396e59372085293a82fabcf069 (patch) | |
tree | 0f901453e432f5e72f16f26dff2aa24eb4408fe8 /src/glsl/nir/nir.c | |
parent | cb2b118e4017b1cd90dcc02e688d859b2709465e (diff) |
nir: Store some geometry shader data in nir_shader.
This makes it possible for NIR shaders to know the number of output
vertices and the number of invocations. Drivers could also access
these directly without going through gl_program.
We should probably add InputType and OutputType here too, but currently
those are stored as GL_* enums, and I wanted to avoid using those in
NIR, as I suspect Vulkan/SPIR-V will use different enums. (We should
probably make our own.)
We could add VerticesIn, but it's easily computable from the input
topology, so I'm not sure whether it's worth it. It's also currently
not stored in gl_shader (only gl_shader_program), which would require
changes to the glsl_to_nir interface or require us to store it there.
This is a bit of duplication of data...ideally, we would factor these
substructs out of gl_program, gl_shader_program, and nir_shader, creating
a gl_geometry_info class...but it would need to go in a new place (in
src/glsl?) that isn't mtypes.h nor nir.h.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r-- | src/glsl/nir/nir.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index ab06ea2bc19..1dc7e12445f 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -54,6 +54,9 @@ nir_shader_create(void *mem_ctx, shader->stage = stage; + shader->gs.vertices_out = 0; + shader->gs.invocations = 0; + return shader; } |