Pārlūkot izejas kodu

shader: Show SPIR-V disassembly with notify-level-shader spam

rdb 5 gadi atpakaļ
vecāks
revīzija
77c32eb048
1 mainītis faili ar 11 papildinājumiem un 0 dzēšanām
  1. 11 0
      panda/src/shaderpipeline/shaderModuleSpirV.cxx

+ 11 - 0
panda/src/shaderpipeline/shaderModuleSpirV.cxx

@@ -15,6 +15,10 @@
 #include "string_utils.h"
 #include "string_utils.h"
 #include "shaderType.h"
 #include "shaderType.h"
 
 
+#ifndef NDEBUG
+#include <glslang/SPIRV/disassemble.h>
+#endif
+
 TypeHandle ShaderModuleSpirV::_type_handle;
 TypeHandle ShaderModuleSpirV::_type_handle;
 
 
 /**
 /**
@@ -170,6 +174,13 @@ ShaderModuleSpirV(Stage stage, std::vector<uint32_t> words) :
     }
     }
   }
   }
 
 
+#ifndef NDEBUG
+  if (shader_cat.is_spam()) {
+    spv::Disassemble(shader_cat.spam()
+      << "Disassembly for " << *this << ":\n", _instructions);
+  }
+#endif
+
   // We no longer need the debugging information, so it can be safely stripped
   // We no longer need the debugging information, so it can be safely stripped
   // from the module.
   // from the module.
   strip();
   strip();