summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-10-01 18:27:38 -0700
committerJason Ekstrand <[email protected]>2015-10-02 14:22:53 -0700
commit7a8d06b6dd7800caab5c5c51d16b34e03aa45f25 (patch)
tree751c2ec4a64826e88e6136327ead5e75d7f15381
parente4fea486da6ee2964ae15380bcdc8676dcc2a515 (diff)
nir: Move GS data to nir_shader_info
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/glsl/nir/glsl_to_nir.cpp4
-rw-r--r--src/glsl/nir/nir.c3
-rw-r--r--src/glsl/nir/nir.h16
-rw-r--r--src/glsl/nir/nir_lower_gs_intrinsics.c2
4 files changed, 11 insertions, 14 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 6820962b38e..4dd62870065 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -150,8 +150,6 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
if (sh->Program->SamplersUsed & (1 << i))
num_textures = i;
- shader->gs.vertices_out = sh->Geom.VerticesOut;
- shader->gs.invocations = sh->Geom.Invocations;
shader->info.name = ralloc_asprintf(shader, "GLSL%d", sh->Name);
shader->info.num_textures = num_textures;
shader->info.num_ubos = sh->NumUniformBlocks;
@@ -164,6 +162,8 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
shader->info.uses_texture_gather = sh->Program->UsesGather;
shader->info.uses_clip_distance_out = sh->Program->UsesClipDistanceOut;
shader->info.separate_shader = shader_prog->SeparateShader;
+ shader->info.gs.vertices_out = sh->Geom.VerticesOut;
+ shader->info.gs.invocations = sh->Geom.Invocations;
return shader;
}
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 7a469a6ccf8..e12da805281 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -55,9 +55,6 @@ nir_shader_create(void *mem_ctx,
shader->stage = stage;
- shader->gs.vertices_out = 0;
- shader->gs.invocations = 0;
-
return shader;
}
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 0c06d675a4d..c83ef50cee3 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1483,6 +1483,14 @@ typedef struct nir_shader_info {
/* Whether or not separate shader objects were used */
bool separate_shader;
+
+ struct {
+ /** The maximum number of vertices the geometry shader might write. */
+ unsigned vertices_out;
+
+ /** 1 .. MAX_GEOMETRY_SHADER_INVOCATIONS */
+ unsigned invocations;
+ } gs;
} nir_shader_info;
typedef struct nir_shader {
@@ -1527,14 +1535,6 @@ typedef struct nir_shader {
/** The shader stage, such as MESA_SHADER_VERTEX. */
gl_shader_stage stage;
-
- struct {
- /** The maximum number of vertices the geometry shader might write. */
- unsigned vertices_out;
-
- /** 1 .. MAX_GEOMETRY_SHADER_INVOCATIONS */
- unsigned invocations;
- } gs;
} nir_shader;
#define nir_foreach_overload(shader, overload) \
diff --git a/src/glsl/nir/nir_lower_gs_intrinsics.c b/src/glsl/nir/nir_lower_gs_intrinsics.c
index 2ee4e5c45d6..e0d067885d8 100644
--- a/src/glsl/nir/nir_lower_gs_intrinsics.c
+++ b/src/glsl/nir/nir_lower_gs_intrinsics.c
@@ -76,7 +76,7 @@ rewrite_emit_vertex(nir_intrinsic_instr *intrin, struct state *state)
b->cursor = nir_before_instr(&intrin->instr);
nir_ssa_def *count = nir_load_var(b, state->vertex_count_var);
- nir_ssa_def *max_vertices = nir_imm_int(b, b->shader->gs.vertices_out);
+ nir_ssa_def *max_vertices = nir_imm_int(b, b->shader->info.gs.vertices_out);
/* Create: if (vertex_count < max_vertices) and insert it.
*