summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-06-22 23:14:07 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2017-07-13 13:27:44 +0200
commit423c231ef96cb908bd72fdb7f15c3819ea96c18d (patch)
tree710cce8fba35280d3ff4c37d37836f40828aca2a /src/compiler
parentddf33754742954b42cb5d964f10b17abecd88d04 (diff)
DBG lots of debug printing
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/link_varyings.cpp30
-rw-r--r--src/compiler/glsl/linker.cpp39
-rw-r--r--src/compiler/glsl/nir_linker.cpp1
3 files changed, 70 insertions, 0 deletions
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 767672b200..6cd75aa350 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -2511,6 +2511,16 @@ link_varyings(struct gl_shader_program *prog, unsigned first, unsigned last,
return false;
}
+ if (ctx->_Shader->Flags & GLSL_DUMP) {
+ printf("Before bottom of link_varyings\n");
+ for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
+ if (prog->_LinkedShaders[i] != NULL) {
+ printf("Stage: %s\n", _mesa_shader_stage_to_string(i));
+ _mesa_print_ir(stdout, prog->_LinkedShaders[i]->ir, NULL);
+ }
+ }
+ }
+
if (last <= MESA_SHADER_FRAGMENT) {
/* Remove unused varyings from the first/last stage unless SSO */
remove_unused_shader_inputs_and_outputs(prog->SeparateShader,
@@ -2520,6 +2530,16 @@ link_varyings(struct gl_shader_program *prog, unsigned first, unsigned last,
prog->_LinkedShaders[last],
ir_var_shader_out);
+ if (ctx->_Shader->Flags & GLSL_DUMP) {
+ printf("After remove_unused_shader_inputs_and_outputs\n");
+ for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
+ if (prog->_LinkedShaders[i] != NULL) {
+ printf("Stage: %s\n", _mesa_shader_stage_to_string(i));
+ _mesa_print_ir(stdout, prog->_LinkedShaders[i]->ir, NULL);
+ }
+ }
+ }
+
/* If the program is made up of only a single stage */
if (first == last) {
gl_linked_shader *const sh = prog->_LinkedShaders[last];
@@ -2572,6 +2592,16 @@ link_varyings(struct gl_shader_program *prog, unsigned first, unsigned last,
reserved_out_slots | reserved_in_slots))
return false;
+ if (ctx->_Shader->Flags & GLSL_DUMP) {
+ printf("After assign_varying_locations, stage %s\n", _mesa_shader_stage_to_string(i));
+ for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
+ if (prog->_LinkedShaders[i] != NULL) {
+ printf("Stage: %s\n", _mesa_shader_stage_to_string(i));
+ _mesa_print_ir(stdout, prog->_LinkedShaders[i]->ir, NULL);
+ }
+ }
+ }
+
/* This must be done after all dead varyings are eliminated. */
if (sh_i != NULL) {
unsigned slots_used = _mesa_bitcount_64(reserved_out_slots);
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 30996571c9..e9130287f7 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4583,14 +4583,44 @@ link_varyings_and_uniforms(unsigned first, unsigned last,
break;
}
+ if (ctx->_Shader->Flags & GLSL_DUMP) {
+ printf("Before link_varyings\n");
+ for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
+ if (prog->_LinkedShaders[i] != NULL) {
+ printf("Stage: %s\n", _mesa_shader_stage_to_string(i));
+ _mesa_print_ir(stdout, prog->_LinkedShaders[i]->ir, NULL);
+ }
+ }
+ }
+
if (!link_varyings(prog, first, last, ctx, mem_ctx))
return false;
+ if (ctx->_Shader->Flags & GLSL_DUMP) {
+ printf("Before link_and_validate_uniforms\n");
+ for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
+ if (prog->_LinkedShaders[i] != NULL) {
+ printf("Stage: %s\n", _mesa_shader_stage_to_string(i));
+ _mesa_print_ir(stdout, prog->_LinkedShaders[i]->ir, NULL);
+ }
+ }
+ }
+
link_and_validate_uniforms(ctx, prog);
if (!prog->data->LinkStatus)
return false;
+ if (ctx->_Shader->Flags & GLSL_DUMP) {
+ printf("After link_varyings\n");
+ for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
+ if (prog->_LinkedShaders[i] != NULL) {
+ printf("Stage: %s\n", _mesa_shader_stage_to_string(i));
+ _mesa_print_ir(stdout, prog->_LinkedShaders[i]->ir, NULL);
+ }
+ }
+ }
+
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
if (prog->_LinkedShaders[i] == NULL)
continue;
@@ -5086,6 +5116,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
}
done:
+ if (ctx->_Shader->Flags & GLSL_DUMP)
+ printf("Linking done\n");
+
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
free(shader_list[i]);
if (prog->_LinkedShaders[i] == NULL)
@@ -5102,6 +5135,9 @@ done:
/* Retain any live IR, but trash the rest. */
reparent_ir(prog->_LinkedShaders[i]->ir, prog->_LinkedShaders[i]->ir);
+ if (ctx->_Shader->Flags & GLSL_DUMP)
+ _mesa_print_ir(stdout, prog->_LinkedShaders[i]->ir, NULL);
+
/* The symbol table in the linked shaders may contain references to
* variables that were removed (e.g., unused uniforms). Since it may
* contain junk, there is no possible valid use. Delete it and set the
@@ -5111,5 +5147,8 @@ done:
prog->_LinkedShaders[i]->symbols = NULL;
}
+ if (ctx->_Shader->Flags & GLSL_DUMP)
+ fflush(stdout);
+
ralloc_free(mem_ctx);
}
diff --git a/src/compiler/glsl/nir_linker.cpp b/src/compiler/glsl/nir_linker.cpp
index c64198a375..22204c1d54 100644
--- a/src/compiler/glsl/nir_linker.cpp
+++ b/src/compiler/glsl/nir_linker.cpp
@@ -229,4 +229,5 @@ void
finalize_linked_nir_shader(struct gl_shader_program *prog,
struct gl_linked_shader *sh)
{
+ nir_print_shader(sh->nir, stdout);
}