summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/glsl_to_nir.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-08-05 17:14:59 -0700
committerJason Ekstrand <[email protected]>2015-10-02 14:22:53 -0700
commite4fea486da6ee2964ae15380bcdc8676dcc2a515 (patch)
treea8faca08ee04592105e464bbf922631c65fd72d1 /src/glsl/nir/glsl_to_nir.cpp
parentcd1ae6ebfac22f76d26a5b8659423969b2aeddce (diff)
nir: Add a a nir_shader_info struct
This commit also adds code to glsl_to_nir and prog_to_nir to fill it out. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/nir/glsl_to_nir.cpp')
-rw-r--r--src/glsl/nir/glsl_to_nir.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index ba08e172637..6820962b38e 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -144,8 +144,26 @@ glsl_to_nir(const struct gl_shader_program *shader_prog,
nir_lower_outputs_to_temporaries(shader);
+ /* TODO: Use _mesa_fls instead */
+ unsigned num_textures = 0;
+ for (unsigned i = 0; i < 8 * sizeof(sh->Program->SamplersUsed); i++)
+ 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;
+ shader->info.num_abos = shader_prog->NumAtomicBuffers;
+ shader->info.num_ssbos = shader_prog->NumBufferInterfaceBlocks;
+ shader->info.num_images = sh->NumImages;
+ shader->info.inputs_read = sh->Program->InputsRead;
+ shader->info.outputs_written = sh->Program->OutputsWritten;
+ shader->info.system_values_read = sh->Program->SystemValuesRead;
+ shader->info.uses_texture_gather = sh->Program->UsesGather;
+ shader->info.uses_clip_distance_out = sh->Program->UsesClipDistanceOut;
+ shader->info.separate_shader = shader_prog->SeparateShader;
return shader;
}