summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_pipeline.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-07-12 12:34:00 -0700
committerJason Ekstrand <[email protected]>2017-10-25 16:14:09 -0700
commite758b6519d691cc2becd0d940d1c131634549bf2 (patch)
treeb7a5fdc699bb418b3b4837e0261abcf36b604c89 /src/intel/vulkan/anv_pipeline.c
parent562b8d458c2de262019da2c056f75cb9feb5ee54 (diff)
anv/pipeline: Dump shader immedately after spirv_to_nir
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_pipeline.c')
-rw-r--r--src/intel/vulkan/anv_pipeline.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 51788928af8..20609248d67 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -83,6 +83,15 @@ void anv_DestroyShaderModule(
#define SPIR_V_MAGIC_NUMBER 0x07230203
+static const uint64_t stage_to_debug[] = {
+ [MESA_SHADER_VERTEX] = DEBUG_VS,
+ [MESA_SHADER_TESS_CTRL] = DEBUG_TCS,
+ [MESA_SHADER_TESS_EVAL] = DEBUG_TES,
+ [MESA_SHADER_GEOMETRY] = DEBUG_GS,
+ [MESA_SHADER_FRAGMENT] = DEBUG_WM,
+ [MESA_SHADER_COMPUTE] = DEBUG_CS,
+};
+
/* Eventually, this will become part of anv_CreateShader. Unfortunately,
* we can't do that yet because we don't have the ability to copy nir.
*/
@@ -144,6 +153,12 @@ anv_shader_compile_to_nir(struct anv_pipeline *pipeline,
free(spec_entries);
+ if (unlikely(INTEL_DEBUG & stage_to_debug[stage])) {
+ fprintf(stderr, "NIR (from SPIR-V) for %s shader:\n",
+ gl_shader_stage_name(stage));
+ nir_print_shader(nir, stderr);
+ }
+
/* We have to lower away local constant initializers right before we
* inline functions. That way they get properly initialized at the top
* of the function and not at the top of its caller.