d3d1x: add shader dumping
authorLuca Barbieri <luca@luca-barbieri.com>
Thu, 23 Sep 2010 16:03:06 +0000 (18:03 +0200)
committerLuca Barbieri <luca@luca-barbieri.com>
Fri, 24 Sep 2010 07:15:49 +0000 (09:15 +0200)
src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp
src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h

index 962bea5ce95c2855d3e089f493d5935360cd7eb2..42678fab4d091033e82b74dac891c125cb8aacb6 100644 (file)
@@ -30,6 +30,7 @@ extern "C"
 {
 #include "util/u_gen_mipmap.h"
 #include "tgsi/tgsi_ureg.h"
+#include "tgsi/tgsi_dump.h"
 #include "cso_cache/cso_context.h"
 }
 
index 61b1ba2bd3e4bf0074e29cd7bfb88b5776d3185d..c41117080a2b2c474045ec975c7c86b96be189a7 100644 (file)
@@ -24,6 +24,8 @@
  *
  **************************************************************************/
 
+DEBUG_GET_ONCE_BOOL_OPTION(dump_shaders, "D3D1X_DUMP_SHADERS", FALSE);
+
 /* These cap sets are much more correct than the ones in u_caps.c */
 /* TODO: it seems cube levels should be the same as 2D levels */
 
@@ -1166,6 +1168,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
 #endif
                        )
        {
+               bool dump = debug_get_option_dump_shaders();
+
                dxbc_chunk_header* sm4_chunk = dxbc_find_shader_bytecode(shader_bytecode, bytecode_length);
                if(!sm4_chunk)
                        return 0;
@@ -1174,12 +1178,18 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
                if(!sm4.get())
                        return 0;
 
+               if(dump)
+                       sm4->dump();
+
                struct pipe_shader_state tgsi_shader;
                memset(&tgsi_shader, 0, sizeof(tgsi_shader));
                tgsi_shader.tokens = (const tgsi_token*)sm4_to_tgsi(*sm4);
                if(!tgsi_shader.tokens)
                        return 0;
 
+               if(dump)
+                       tgsi_dump(tgsi_shader.tokens, 0);
+
                void* shader_cso;
                GalliumD3D11Shader<>* shader;