[Mesa-dev] [RFC 02/11] i965/shader: Add an explicit shader_info field
Jason Ekstrand
jason at jlekstrand.net
Fri Oct 28 20:46:31 UTC 2016
We also go through all the pain of plumbing it through all the
constructors here so we don't have to later.
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++++-----
src/mesa/drivers/dri/i965/brw_fs.h | 2 ++
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 6 ++++--
src/mesa/drivers/dri/i965/brw_shader.cpp | 8 +++++---
src/mesa/drivers/dri/i965/brw_shader.h | 2 ++
src/mesa/drivers/dri/i965/brw_vec4.cpp | 4 ++--
src/mesa/drivers/dri/i965/brw_vec4.h | 1 +
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 11 ++++++-----
src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h | 1 +
src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp | 7 ++++---
src/mesa/drivers/dri/i965/brw_vec4_tcs.h | 1 +
src/mesa/drivers/dri/i965/brw_vec4_tes.cpp | 3 ++-
src/mesa/drivers/dri/i965/brw_vec4_tes.h | 1 +
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 3 ++-
src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp | 3 ++-
src/mesa/drivers/dri/i965/brw_vs.h | 1 +
src/mesa/drivers/dri/i965/gen6_gs_visitor.h | 5 +++--
17 files changed, 44 insertions(+), 25 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index f839d36..caff201 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -6458,7 +6458,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
unsigned simd8_grf_used = 0, simd16_grf_used = 0;
fs_visitor v8(compiler, log_data, mem_ctx, key,
- &prog_data->base, prog, shader, 8,
+ &prog_data->base, prog, shader, shader->info, 8,
shader_time_index8);
if (!v8.run_fs(allow_spilling, false /* do_rep_send */)) {
if (error_str)
@@ -6475,7 +6475,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
likely(!(INTEL_DEBUG & DEBUG_NO16) || use_rep_send)) {
/* Try a SIMD16 compile */
fs_visitor v16(compiler, log_data, mem_ctx, key,
- &prog_data->base, prog, shader, 16,
+ &prog_data->base, prog, shader, shader->info, 16,
shader_time_index16);
v16.import_uniforms(&v8);
if (!v16.run_fs(allow_spilling, use_rep_send)) {
@@ -6683,7 +6683,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,
*/
fs_visitor v8(compiler, log_data, mem_ctx, key, &prog_data->base,
NULL, /* Never used in core profile */
- shader, 8, shader_time_index);
+ shader, shader->info, 8, shader_time_index);
if (simd_required <= 8) {
if (!v8.run_cs()) {
fail_msg = v8.fail_msg;
@@ -6697,7 +6697,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,
fs_visitor v16(compiler, log_data, mem_ctx, key, &prog_data->base,
NULL, /* Never used in core profile */
- shader, 16, shader_time_index);
+ shader, shader->info, 16, shader_time_index);
if (likely(!(INTEL_DEBUG & DEBUG_NO16)) &&
!fail_msg && v8.max_dispatch_width >= 16 &&
simd_required <= 16) {
@@ -6723,7 +6723,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,
fs_visitor v32(compiler, log_data, mem_ctx, key, &prog_data->base,
NULL, /* Never used in core profile */
- shader, 32, shader_time_index);
+ shader, shader->info, 32, shader_time_index);
if (!fail_msg && v8.max_dispatch_width >= 32 &&
(simd_required > 16 || (INTEL_DEBUG & DEBUG_DO32))) {
/* Try a SIMD32 compile */
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index da01174..cf493ce 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -63,6 +63,7 @@ public:
struct brw_stage_prog_data *prog_data,
struct gl_program *prog,
const nir_shader *shader,
+ const shader_info *info,
unsigned dispatch_width,
int shader_time_index,
const struct brw_vue_map *input_vue_map = NULL);
@@ -71,6 +72,7 @@ public:
struct brw_gs_compile *gs_compile,
struct brw_gs_prog_data *prog_data,
const nir_shader *shader,
+ const shader_info *info,
int shader_time_index);
void init();
~fs_visitor();
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 14415bd..72b34fe 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -842,10 +842,11 @@ fs_visitor::fs_visitor(const struct brw_compiler *compiler, void *log_data,
struct brw_stage_prog_data *prog_data,
struct gl_program *prog,
const nir_shader *shader,
+ const shader_info *info,
unsigned dispatch_width,
int shader_time_index,
const struct brw_vue_map *input_vue_map)
- : backend_shader(compiler, log_data, mem_ctx, shader, prog_data),
+ : backend_shader(compiler, log_data, mem_ctx, shader, info, prog_data),
key(key), gs_compile(NULL), prog_data(prog_data), prog(prog),
input_vue_map(input_vue_map),
dispatch_width(dispatch_width),
@@ -860,8 +861,9 @@ fs_visitor::fs_visitor(const struct brw_compiler *compiler, void *log_data,
struct brw_gs_compile *c,
struct brw_gs_prog_data *prog_data,
const nir_shader *shader,
+ const shader_info *info,
int shader_time_index)
- : backend_shader(compiler, log_data, mem_ctx, shader,
+ : backend_shader(compiler, log_data, mem_ctx, shader, info,
&prog_data->base.base),
key(&c->key), gs_compile(c),
prog_data(&prog_data->base.base), prog(NULL),
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 9f5db45..cf49c63 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -684,11 +684,13 @@ backend_shader::backend_shader(const struct brw_compiler *compiler,
void *log_data,
void *mem_ctx,
const nir_shader *shader,
+ const shader_info *info,
struct brw_stage_prog_data *stage_prog_data)
: compiler(compiler),
log_data(log_data),
devinfo(compiler->devinfo),
nir(shader),
+ info(info),
stage_prog_data(stage_prog_data),
mem_ctx(mem_ctx),
cfg(NULL),
@@ -698,7 +700,7 @@ backend_shader::backend_shader(const struct brw_compiler *compiler,
stage_name = _mesa_shader_stage_to_string(stage);
stage_abbrev = _mesa_shader_stage_to_abbrev(stage);
is_passthrough_shader =
- nir->info->name && strcmp(nir->info->name, "passthrough") == 0;
+ info->name && strcmp(info->name, "passthrough") == 0;
}
bool
@@ -1400,7 +1402,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
if (is_scalar) {
fs_visitor v(compiler, log_data, mem_ctx, (void *) key,
- &prog_data->base.base, shader->Program, nir, 8,
+ &prog_data->base.base, shader->Program, nir, nir->info, 8,
shader_time_index, &input_vue_map);
if (!v.run_tes()) {
if (error_str)
@@ -1427,7 +1429,7 @@ brw_compile_tes(const struct brw_compiler *compiler,
return g.get_assembly(final_assembly_size);
} else {
brw::vec4_tes_visitor v(compiler, log_data, key, prog_data,
- nir, mem_ctx, shader_time_index);
+ nir, nir->info, mem_ctx, shader_time_index);
if (!v.run()) {
if (error_str)
*error_str = ralloc_strdup(mem_ctx, v.fail_msg);
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 12113b9..3d50f14 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -175,6 +175,7 @@ protected:
void *log_data,
void *mem_ctx,
const nir_shader *shader,
+ const shader_info *info,
struct brw_stage_prog_data *stage_prog_data);
public:
@@ -184,6 +185,7 @@ public:
const struct gen_device_info * const devinfo;
const nir_shader *nir;
+ const shader_info *info;
struct brw_stage_prog_data * const stage_prog_data;
/** ralloc context for temporary data used during compile */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 6d487da..5cf3236 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -2175,7 +2175,7 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
fs_visitor v(compiler, log_data, mem_ctx, key, &prog_data->base.base,
NULL, /* prog; Only used for TEXTURE_RECTANGLE on gen < 8 */
- shader, 8, shader_time_index);
+ shader, shader->info, 8, shader_time_index);
if (!v.run_vs(clip_planes)) {
if (error_str)
*error_str = ralloc_strdup(mem_ctx, v.fail_msg);
@@ -2205,7 +2205,7 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
prog_data->base.dispatch_mode = DISPATCH_MODE_4X2_DUAL_OBJECT;
vec4_vs_visitor v(compiler, log_data, key, prog_data,
- shader, clip_planes, mem_ctx,
+ shader, shader->info, clip_planes, mem_ctx,
shader_time_index, use_legacy_snorm_formula);
if (!v.run()) {
if (error_str)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 62c6007..c3b20e3 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -69,6 +69,7 @@ public:
const struct brw_sampler_prog_key_data *key,
struct brw_vue_prog_data *prog_data,
const nir_shader *shader,
+ const shader_info *info,
void *mem_ctx,
bool no_spills,
int shader_time_index);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index 10be41b..ee41ac3 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -39,11 +39,12 @@ vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler *compiler,
struct brw_gs_compile *c,
struct brw_gs_prog_data *prog_data,
const nir_shader *shader,
+ const shader_info *info,
void *mem_ctx,
bool no_spills,
int shader_time_index)
: vec4_visitor(compiler, log_data, &c->key.tex,
- &prog_data->base, shader, mem_ctx,
+ &prog_data->base, shader, info, mem_ctx,
no_spills, shader_time_index),
c(c),
gs_prog_data(prog_data)
@@ -817,7 +818,7 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
if (is_scalar) {
fs_visitor v(compiler, log_data, mem_ctx, &c, prog_data, shader,
- shader_time_index);
+ shader->info, shader_time_index);
if (v.run_gs()) {
prog_data->base.dispatch_mode = DISPATCH_MODE_SIMD8;
prog_data->base.base.dispatch_grf_start_reg = v.payload.num_regs;
@@ -846,7 +847,7 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
likely(!(INTEL_DEBUG & DEBUG_NO_DUAL_OBJECT_GS))) {
prog_data->base.dispatch_mode = DISPATCH_MODE_4X2_DUAL_OBJECT;
- vec4_gs_visitor v(compiler, log_data, &c, prog_data, shader,
+ vec4_gs_visitor v(compiler, log_data, &c, prog_data, shader, shader->info,
mem_ctx, true /* no_spills */, shader_time_index);
if (v.run()) {
return brw_vec4_generate_assembly(compiler, log_data, mem_ctx,
@@ -889,11 +890,11 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
if (compiler->devinfo->gen >= 7)
gs = new vec4_gs_visitor(compiler, log_data, &c, prog_data,
- shader, mem_ctx, false /* no_spills */,
+ shader, shader->info, mem_ctx, false /* no_spills */,
shader_time_index);
else
gs = new gen6_gs_visitor(compiler, log_data, &c, prog_data, shader_prog,
- shader, mem_ctx, false /* no_spills */,
+ shader, shader->info, mem_ctx, false /* no_spills */,
shader_time_index);
if (!gs->run()) {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
index 380d6f7..4da5fcd 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
@@ -43,6 +43,7 @@ public:
struct brw_gs_compile *c,
struct brw_gs_prog_data *prog_data,
const nir_shader *shader,
+ const shader_info *info,
void *mem_ctx,
bool no_spills,
int shader_time_index);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp b/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
index c6a6b5e..fb14142 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
@@ -38,11 +38,12 @@ vec4_tcs_visitor::vec4_tcs_visitor(const struct brw_compiler *compiler,
const struct brw_tcs_prog_key *key,
struct brw_tcs_prog_data *prog_data,
const nir_shader *nir,
+ const shader_info *info,
void *mem_ctx,
int shader_time_index,
const struct brw_vue_map *input_vue_map)
: vec4_visitor(compiler, log_data, &key->tex, &prog_data->base,
- nir, mem_ctx, false, shader_time_index),
+ nir, info, mem_ctx, false, shader_time_index),
input_vue_map(input_vue_map), key(key)
{
}
@@ -523,7 +524,7 @@ brw_compile_tcs(const struct brw_compiler *compiler,
if (is_scalar) {
fs_visitor v(compiler, log_data, mem_ctx, (void *) key,
- &prog_data->base.base, NULL, nir, 8,
+ &prog_data->base.base, NULL, nir, nir->info, 8,
shader_time_index, &input_vue_map);
if (!v.run_tcs_single_patch()) {
if (error_str)
@@ -550,7 +551,7 @@ brw_compile_tcs(const struct brw_compiler *compiler,
return g.get_assembly(final_assembly_size);
} else {
vec4_tcs_visitor v(compiler, log_data, key, prog_data,
- nir, mem_ctx, shader_time_index, &input_vue_map);
+ nir, nir->info, mem_ctx, shader_time_index, &input_vue_map);
if (!v.run()) {
if (error_str)
*error_str = ralloc_strdup(mem_ctx, v.fail_msg);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_tcs.h b/src/mesa/drivers/dri/i965/brw_vec4_tcs.h
index 030eb5e..f8ca869 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_tcs.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_tcs.h
@@ -44,6 +44,7 @@ public:
const struct brw_tcs_prog_key *key,
struct brw_tcs_prog_data *prog_data,
const nir_shader *nir,
+ const shader_info *info,
void *mem_ctx,
int shader_time_index,
const struct brw_vue_map *input_vue_map);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_tes.cpp b/src/mesa/drivers/dri/i965/brw_vec4_tes.cpp
index 226dcb4..7602abb 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_tes.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_tes.cpp
@@ -37,10 +37,11 @@ vec4_tes_visitor::vec4_tes_visitor(const struct brw_compiler *compiler,
const struct brw_tes_prog_key *key,
struct brw_tes_prog_data *prog_data,
const nir_shader *shader,
+ const shader_info *info,
void *mem_ctx,
int shader_time_index)
: vec4_visitor(compiler, log_data, &key->tex, &prog_data->base,
- shader, mem_ctx, false, shader_time_index)
+ shader, info, mem_ctx, false, shader_time_index)
{
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_tes.h b/src/mesa/drivers/dri/i965/brw_vec4_tes.h
index 31a28f3..77b333b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_tes.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_tes.h
@@ -43,6 +43,7 @@ public:
const struct brw_tes_prog_key *key,
struct brw_tes_prog_data *prog_data,
const nir_shader *nir,
+ const shader_info *info,
void *mem_ctx,
int shader_time_index);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 954f147..e51ddb5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1776,10 +1776,11 @@ vec4_visitor::vec4_visitor(const struct brw_compiler *compiler,
const struct brw_sampler_prog_key_data *key_tex,
struct brw_vue_prog_data *prog_data,
const nir_shader *shader,
+ const shader_info *info,
void *mem_ctx,
bool no_spills,
int shader_time_index)
- : backend_shader(compiler, log_data, mem_ctx, shader, &prog_data->base),
+ : backend_shader(compiler, log_data, mem_ctx, shader, info, &prog_data->base),
key_tex(key_tex),
prog_data(prog_data),
fail_msg(NULL),
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
index 058ee3a..856d52f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp
@@ -200,12 +200,13 @@ vec4_vs_visitor::vec4_vs_visitor(const struct brw_compiler *compiler,
const struct brw_vs_prog_key *key,
struct brw_vs_prog_data *vs_prog_data,
const nir_shader *shader,
+ const shader_info *info,
gl_clip_plane *clip_planes,
void *mem_ctx,
int shader_time_index,
bool use_legacy_snorm_formula)
: vec4_visitor(compiler, log_data, &key->tex, &vs_prog_data->base, shader,
- mem_ctx, false /* no_spills */, shader_time_index),
+ info, mem_ctx, false /* no_spills */, shader_time_index),
key(key),
vs_prog_data(vs_prog_data),
clip_planes(clip_planes),
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index 016f2bd..a80c9be 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -86,6 +86,7 @@ public:
const struct brw_vs_prog_key *key,
struct brw_vs_prog_data *vs_prog_data,
const nir_shader *shader,
+ const shader_info *info,
gl_clip_plane *clip_planes,
void *mem_ctx,
int shader_time_index,
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_visitor.h b/src/mesa/drivers/dri/i965/gen6_gs_visitor.h
index 311cf06..e6ff249 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/gen6_gs_visitor.h
@@ -41,11 +41,12 @@ public:
struct brw_gs_prog_data *prog_data,
struct gl_shader_program *prog,
const nir_shader *shader,
+ const shader_info *info,
void *mem_ctx,
bool no_spills,
int shader_time_index) :
- vec4_gs_visitor(comp, log_data, c, prog_data, shader, mem_ctx, no_spills,
- shader_time_index),
+ vec4_gs_visitor(comp, log_data, c, prog_data, shader, info, mem_ctx,
+ no_spills, shader_time_index),
shader_prog(prog)
{
}
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list