diff options
author | Jason Ekstrand <[email protected]> | 2017-05-08 09:20:21 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-05-09 15:07:47 -0700 |
commit | b86dba8a0eee6be283a96481c0c2b1fb1e882824 (patch) | |
tree | 5a8bfc6bff9ef65ab733327305026f2731f3096e /src/intel/compiler/brw_vec4.cpp | |
parent | d4fa0a0fa63c538b0c67ec3c46a45c1e4dcf91fc (diff) |
nir: Embed the shader_info in the nir_shader again
Commit e1af20f18a86f52a9640faf2d4ff8a71b0a4fa9b changed the shader_info
from being embedded into being just a pointer. The idea was that
sharing the shader_info between NIR and GLSL would be easier if it were
a pointer pointing to the same shader_info struct. This, however, has
caused a few problems:
1) There are many things which generate NIR without GLSL. This means
we have to support both NIR shaders which come from GLSL and ones
that don't and need to have an info elsewhere.
2) The solution to (1) raises all sorts of ownership issues which have
to be resolved with ralloc_parent checks.
3) Ever since 00620782c92100d77c660f9783504c6d80fa1d58, we've been
using nir_gather_info to fill out the final shader_info. Thanks to
cloning and the above ownership issues, the nir_shader::info may not
point back to the gl_shader anymore and so we have to do a copy of
the shader_info from NIR back to GLSL anyway.
All of these issues go away if we just embed the shader_info in the
nir_shader. There's a little downside of having to copy it back after
calling nir_gather_info but, as explained above, we have to do that
anyway.
Acked-by: Timothy Arceri <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/compiler/brw_vec4.cpp')
-rw-r--r-- | src/intel/compiler/brw_vec4.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp index 70487d3c151..9f280840091 100644 --- a/src/intel/compiler/brw_vec4.cpp +++ b/src/intel/compiler/brw_vec4.cpp @@ -2620,7 +2620,7 @@ vec4_visitor::run() if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER) && this_progress) { \ char filename[64]; \ snprintf(filename, 64, "%s-%s-%02d-%02d-" #pass, \ - stage_abbrev, nir->info->name, iteration, pass_num); \ + stage_abbrev, nir->info.name, iteration, pass_num); \ \ backend_shader::dump_instructions(filename); \ } \ @@ -2633,7 +2633,7 @@ vec4_visitor::run() if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) { char filename[64]; snprintf(filename, 64, "%s-%s-00-00-start", - stage_abbrev, nir->info->name); + stage_abbrev, nir->info.name); backend_shader::dump_instructions(filename); } @@ -2779,17 +2779,17 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data, const unsigned *assembly = NULL; prog_data->base.clip_distance_mask = - ((1 << shader->info->clip_distance_array_size) - 1); + ((1 << shader->info.clip_distance_array_size) - 1); prog_data->base.cull_distance_mask = - ((1 << shader->info->cull_distance_array_size) - 1) << - shader->info->clip_distance_array_size; + ((1 << shader->info.cull_distance_array_size) - 1) << + shader->info.clip_distance_array_size; unsigned nr_attribute_slots = _mesa_bitcount_64(prog_data->inputs_read); /* gl_VertexID and gl_InstanceID are system values, but arrive via an * incoming vertex attribute. So, add an extra slot. */ - if (shader->info->system_values_read & + if (shader->info.system_values_read & (BITFIELD64_BIT(SYSTEM_VALUE_BASE_VERTEX) | BITFIELD64_BIT(SYSTEM_VALUE_BASE_INSTANCE) | BITFIELD64_BIT(SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) | @@ -2798,13 +2798,13 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data, } /* gl_DrawID has its very own vec4 */ - if (shader->info->system_values_read & + if (shader->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_DRAW_ID)) { nr_attribute_slots++; } unsigned nr_attributes = nr_attribute_slots - - DIV_ROUND_UP(_mesa_bitcount_64(shader->info->double_inputs_read), 2); + DIV_ROUND_UP(_mesa_bitcount_64(shader->info.double_inputs_read), 2); /* The 3DSTATE_VS documentation lists the lower bound on "Vertex URB Entry * Read Length" as 1 in vec4 mode, and 0 in SIMD8 mode. Empirically, in @@ -2858,9 +2858,9 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data, if (INTEL_DEBUG & DEBUG_VS) { const char *debug_name = ralloc_asprintf(mem_ctx, "%s vertex shader %s", - shader->info->label ? shader->info->label : + shader->info.label ? shader->info.label : "unnamed", - shader->info->name); + shader->info.name); g.enable_debug(debug_name); } |