This commit also adds code to glsl_to_nir and prog_to_nir to fill it out.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
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;
}
exec_list_make_empty(&shader->outputs);
shader->options = options;
+ memset(&shader->info, 0, sizeof(shader->info));
exec_list_make_empty(&shader->functions);
exec_list_make_empty(&shader->registers);
bool native_integers;
} nir_shader_compiler_options;
+typedef struct nir_shader_info {
+ const char *name;
+
+ /* Number of textures used by this shader */
+ unsigned num_textures;
+ /* Number of uniform buffers used by this shader */
+ unsigned num_ubos;
+ /* Number of atomic buffers used by this shader */
+ unsigned num_abos;
+ /* Number of shader storage buffers used by this shader */
+ unsigned num_ssbos;
+ /* Number of images used by this shader */
+ unsigned num_images;
+
+ /* Which inputs are actually read */
+ uint64_t inputs_read;
+ /* Which outputs are actually written */
+ uint64_t outputs_written;
+ /* Which system values are actually read */
+ uint64_t system_values_read;
+
+ /* Whether or not this shader ever uses textureGather() */
+ bool uses_texture_gather;
+
+ /* Whether or not this shader uses the gl_ClipDistance output */
+ bool uses_clip_distance_out;
+
+ /* Whether or not separate shader objects were used */
+ bool separate_shader;
+} nir_shader_info;
+
typedef struct nir_shader {
/** list of uniforms (nir_variable) */
struct exec_list uniforms;
*/
const struct nir_shader_compiler_options *options;
+ /** Various bits of compile-time information about a given shader */
+ struct nir_shader_info info;
+
/** list of global variables in the shader (nir_variable) */
struct exec_list globals;
ptn_add_output_stores(c);
+ s->info.name = ralloc_asprintf(s, "ARB%d", prog->Id);
+ s->info.num_textures = _mesa_fls(prog->SamplersUsed);
+ s->info.num_ubos = 0;
+ s->info.num_abos = 0;
+ s->info.num_ssbos = 0;
+ s->info.num_images = 0;
+ s->info.inputs_read = prog->InputsRead;
+ s->info.outputs_written = prog->OutputsWritten;
+ s->info.system_values_read = prog->SystemValuesRead;
+ s->info.uses_texture_gather = false;
+ s->info.uses_clip_distance_out = false;
+ s->info.separate_shader = false;
+
fail:
if (c->error) {
ralloc_free(s);