From f71f8c7d18a1a92681c337cb6dbf507ab06b62b1 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 23 Sep 2010 18:03:06 +0200 Subject: [PATCH] d3d1x: add shader dumping --- src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp | 1 + src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp index 962bea5ce95..42678fab4d0 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11.cpp @@ -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" } diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 61b1ba2bd3e..c41117080a2 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -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; -- 2.30.2