]> git.cworth.org Git - apitrace/commitdiff
d3d1x: Rename d3d10shader -> d3dcommonshader.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 7 Nov 2012 19:15:39 +0000 (19:15 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Wed, 7 Nov 2012 19:15:39 +0000 (19:15 +0000)
wrappers/CMakeLists.txt
wrappers/d3d10_1trace.py
wrappers/d3d10shader.cpp [deleted file]
wrappers/d3d10shader.hpp [deleted file]
wrappers/d3d10trace.py
wrappers/d3d11trace.py
wrappers/d3dcommonshader.cpp [new file with mode: 0644]
wrappers/d3dcommonshader.hpp [new file with mode: 0644]

index a8579c64a3ffe114c1499de0136bf277f6562d55..4a8e1326d08c2cd3bc039e8c0ad5552d88f8d588 100644 (file)
@@ -146,7 +146,7 @@ if (WIN32)
         add_library (d3d10trace MODULE
             d3d10.def
             d3d10trace.cpp
-            d3d10shader.cpp
+            d3dcommonshader.cpp
         )
         target_link_libraries (d3d10trace
             common_trace
@@ -186,7 +186,7 @@ if (WIN32)
         add_library (d3d10_1trace MODULE
             d3d10_1.def
             d3d10_1trace.cpp
-            d3d10shader.cpp
+            d3dcommonshader.cpp
         )
         target_link_libraries (d3d10_1trace
             common_trace
@@ -231,7 +231,7 @@ if (WIN32)
         add_library (d3d11trace MODULE
             d3d11.def
             d3d11trace.cpp
-            d3d10shader.cpp
+            d3dcommonshader.cpp
         )
         target_link_libraries (d3d11trace
             common_trace
index d2f72a773c046b71ddd86e06262c7c461105b60c..6fa3efc27cf7199b4a99954cccca29e030d11b5d 100644 (file)
@@ -35,7 +35,7 @@ if __name__ == '__main__':
     print '#include "os.hpp"'
     print
     print '#include "d3d10_1imports.hpp"'
-    print '#include "d3d10shader.hpp"'
+    print '#include "d3dcommonshader.hpp"'
     print '#include "d3d10size.hpp"'
     print
     tracer = D3DCommonTracer('d3d10_1.dll')
diff --git a/wrappers/d3d10shader.cpp b/wrappers/d3d10shader.cpp
deleted file mode 100644 (file)
index a6b4377..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2011 Jose Fonseca
- * Copyright 2008-2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include <stdio.h>
-
-#include "d3d10shader.hpp"
-
-
-struct ID3D10Blob : public IUnknown {
-public:
-    virtual LPVOID STDMETHODCALLTYPE GetBufferPointer( void) = 0;
-    virtual SIZE_T STDMETHODCALLTYPE GetBufferSize( void) = 0;
-};
-
-typedef ID3D10Blob ID3DBlob;
-typedef ID3DBlob* LPD3DBLOB;
-
-#define D3D_DISASM_ENABLE_COLOR_CODE            0x00000001
-#define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS  0x00000002
-#define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING 0x00000004
-#define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE     0x00000008
-#define D3D_DISASM_DISABLE_DEBUG_INFO           0x00000010
-#define D3D_DISASM_ENABLE_INSTRUCTION_OFFSET    0x00000020
-#define D3D_DISASM_INSTRUCTION_ONLY             0x00000040
-
-typedef HRESULT
-(WINAPI *PFND3DDISASSEMBLE)(
-    LPCVOID pSrcData,
-    SIZE_T SrcDataSize,
-    UINT Flags,
-    LPCSTR szComments,
-    ID3DBlob **ppDisassembly
-);
-
-static PFND3DDISASSEMBLE pfnD3DDisassemble = NULL;
-
-typedef HRESULT
-(WINAPI *PFND3D10DISASSEMBLESHADER)(
-    const void *pShader,
-    SIZE_T BytecodeLength,
-    BOOL EnableColorCode,
-    LPCSTR pComments,
-    ID3D10Blob **ppDisassembly
-);
-
-static PFND3D10DISASSEMBLESHADER pfnD3D10DisassembleShader = NULL;
-
-void DumpShader(trace::Writer &writer, const void *pShaderBytecode, SIZE_T BytecodeLength)
-{
-    static bool firsttime = true;
-
-    if (firsttime) {
-        char szFilename[MAX_PATH];
-        HMODULE hModule = NULL;
-
-        int version;
-        for (version = 44; version >= 33; --version) {
-            _snprintf(szFilename, sizeof(szFilename), "d3dcompiler_%i.dll", version);
-            hModule = LoadLibraryA(szFilename);
-            if (hModule) {
-                pfnD3DDisassemble = (PFND3DDISASSEMBLE)
-                    GetProcAddress(hModule, "D3DDisassemble");
-                if (pfnD3DDisassemble) {
-                    break;
-                }
-            }
-        }
-
-        if (!pfnD3DDisassemble) {
-            /*
-             * Fallback to D3D10DisassembleShader, which should be always present.
-             */
-            if (GetSystemDirectoryA(szFilename, MAX_PATH)) {
-                strcat(szFilename, "\\d3d10.dll");
-                hModule = LoadLibraryA(szFilename);
-                if (hModule) {
-                    pfnD3D10DisassembleShader = (PFND3D10DISASSEMBLESHADER)
-                        GetProcAddress(hModule, "D3D10DisassembleShader");
-                }
-            }
-        }
-
-        firsttime = false;
-    }
-
-    LPD3DBLOB pDisassembly = NULL;
-    HRESULT hr = E_FAIL;
-
-    if (pfnD3DDisassemble) {
-        hr = pfnD3DDisassemble(pShaderBytecode, BytecodeLength, 0, NULL, &pDisassembly);
-    } else if (pfnD3D10DisassembleShader) {
-        hr = pfnD3D10DisassembleShader(pShaderBytecode, BytecodeLength, 0, NULL, &pDisassembly);
-    }
-
-    if (SUCCEEDED(hr)) {
-        writer.beginRepr();
-        writer.writeString((const char *)pDisassembly->GetBufferPointer(), pDisassembly->GetBufferSize());
-    }
-
-    writer.writeBlob(pShaderBytecode, BytecodeLength);
-
-    if (pDisassembly) {
-        pDisassembly->Release();
-    }
-    
-    if (SUCCEEDED(hr)) {
-        writer.endRepr();
-    }
-}
diff --git a/wrappers/d3d10shader.hpp b/wrappers/d3d10shader.hpp
deleted file mode 100644 (file)
index b447b48..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2011 Jose Fonseca
- * Copyright 2008-2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef _D3D10SHADER_HPP_
-#define _D3D10SHADER_HPP_
-
-
-#include <windows.h>
-
-#include "trace_writer.hpp"
-
-void DumpShader(trace::Writer &writer, const void *pShaderBytecode, SIZE_T BytecodeLength);
-
-
-#endif /* _D3D10SHADER_HPP_ */
index adb5dae207c94a0d6eef6554b67585ae0f6eee29..42f6058a9b3a8e14c5ae67ecb4d19a056aa2e469 100644 (file)
@@ -35,7 +35,7 @@ if __name__ == '__main__':
     print '#include "os.hpp"'
     print
     print '#include "d3d10imports.hpp"'
-    print '#include "d3d10shader.hpp"'
+    print '#include "d3dcommonshader.hpp"'
     print '#include "d3d10size.hpp"'
     print
     tracer = D3DCommonTracer('d3d10.dll')
index 7e7b8298f76055bfdbd49b25def1f3e028088bad..c504f5e35326fab498f8ed0c86c7a1e14305af7d 100644 (file)
@@ -44,7 +44,7 @@ if __name__ == '__main__':
         print '#include <d3d11_1.h>'
         print
 
-    print '#include "d3d10shader.hpp"'
+    print '#include "d3dcommonshader.hpp"'
     print '#include "d3d11size.hpp"'
     print
     tracer = D3DCommonTracer('d3d11.dll')
diff --git a/wrappers/d3dcommonshader.cpp b/wrappers/d3dcommonshader.cpp
new file mode 100644 (file)
index 0000000..2ae804b
--- /dev/null
@@ -0,0 +1,133 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Jose Fonseca
+ * Copyright 2008-2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <stdio.h>
+
+#include "d3dcommonshader.hpp"
+
+
+struct ID3D10Blob : public IUnknown {
+public:
+    virtual LPVOID STDMETHODCALLTYPE GetBufferPointer( void) = 0;
+    virtual SIZE_T STDMETHODCALLTYPE GetBufferSize( void) = 0;
+};
+
+typedef ID3D10Blob ID3DBlob;
+typedef ID3DBlob* LPD3DBLOB;
+
+#define D3D_DISASM_ENABLE_COLOR_CODE            0x00000001
+#define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS  0x00000002
+#define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING 0x00000004
+#define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE     0x00000008
+#define D3D_DISASM_DISABLE_DEBUG_INFO           0x00000010
+#define D3D_DISASM_ENABLE_INSTRUCTION_OFFSET    0x00000020
+#define D3D_DISASM_INSTRUCTION_ONLY             0x00000040
+
+typedef HRESULT
+(WINAPI *PFND3DDISASSEMBLE)(
+    LPCVOID pSrcData,
+    SIZE_T SrcDataSize,
+    UINT Flags,
+    LPCSTR szComments,
+    ID3DBlob **ppDisassembly
+);
+
+static PFND3DDISASSEMBLE pfnD3DDisassemble = NULL;
+
+typedef HRESULT
+(WINAPI *PFND3D10DISASSEMBLESHADER)(
+    const void *pShader,
+    SIZE_T BytecodeLength,
+    BOOL EnableColorCode,
+    LPCSTR pComments,
+    ID3D10Blob **ppDisassembly
+);
+
+static PFND3D10DISASSEMBLESHADER pfnD3D10DisassembleShader = NULL;
+
+void DumpShader(trace::Writer &writer, const void *pShaderBytecode, SIZE_T BytecodeLength)
+{
+    static bool firsttime = true;
+
+    if (firsttime) {
+        char szFilename[MAX_PATH];
+        HMODULE hModule = NULL;
+
+        int version;
+        for (version = 44; version >= 33; --version) {
+            _snprintf(szFilename, sizeof(szFilename), "d3dcompiler_%i.dll", version);
+            hModule = LoadLibraryA(szFilename);
+            if (hModule) {
+                pfnD3DDisassemble = (PFND3DDISASSEMBLE)
+                    GetProcAddress(hModule, "D3DDisassemble");
+                if (pfnD3DDisassemble) {
+                    break;
+                }
+            }
+        }
+
+        if (!pfnD3DDisassemble) {
+            /*
+             * Fallback to D3D10DisassembleShader, which should be always present.
+             */
+            if (GetSystemDirectoryA(szFilename, MAX_PATH)) {
+                strcat(szFilename, "\\d3d10.dll");
+                hModule = LoadLibraryA(szFilename);
+                if (hModule) {
+                    pfnD3D10DisassembleShader = (PFND3D10DISASSEMBLESHADER)
+                        GetProcAddress(hModule, "D3D10DisassembleShader");
+                }
+            }
+        }
+
+        firsttime = false;
+    }
+
+    LPD3DBLOB pDisassembly = NULL;
+    HRESULT hr = E_FAIL;
+
+    if (pfnD3DDisassemble) {
+        hr = pfnD3DDisassemble(pShaderBytecode, BytecodeLength, 0, NULL, &pDisassembly);
+    } else if (pfnD3D10DisassembleShader) {
+        hr = pfnD3D10DisassembleShader(pShaderBytecode, BytecodeLength, 0, NULL, &pDisassembly);
+    }
+
+    if (SUCCEEDED(hr)) {
+        writer.beginRepr();
+        writer.writeString((const char *)pDisassembly->GetBufferPointer(), pDisassembly->GetBufferSize());
+    }
+
+    writer.writeBlob(pShaderBytecode, BytecodeLength);
+
+    if (pDisassembly) {
+        pDisassembly->Release();
+    }
+    
+    if (SUCCEEDED(hr)) {
+        writer.endRepr();
+    }
+}
diff --git a/wrappers/d3dcommonshader.hpp b/wrappers/d3dcommonshader.hpp
new file mode 100644 (file)
index 0000000..6d8500b
--- /dev/null
@@ -0,0 +1,38 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Jose Fonseca
+ * Copyright 2008-2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef _D3DCOMMONSHADER_HPP_
+#define _D3DCOMMONSHADER_HPP_
+
+
+#include <windows.h>
+
+#include "trace_writer.hpp"
+
+void DumpShader(trace::Writer &writer, const void *pShaderBytecode, SIZE_T BytecodeLength);
+
+
+#endif /* _D3DCOMMONSHADER_HPP_ */