From 221165f02bf1b6b7c164c9e290d3535ac92512ee Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 12 Aug 2018 02:27:36 +0200 Subject: [PATCH] [d3d10] Implement more d3d10.dll functions using D3DCompiler --- src/d3d10/d3d10.def | 14 ++++ src/d3d10/d3d10_1.def | 14 ++++ src/d3d10/d3d10_main.cpp | 137 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+) diff --git a/src/d3d10/d3d10.def b/src/d3d10/d3d10.def index de081a331..381448a16 100644 --- a/src/d3d10/d3d10.def +++ b/src/d3d10/d3d10.def @@ -2,3 +2,17 @@ LIBRARY D3D10.DLL EXPORTS D3D10CreateDevice D3D10CreateDeviceAndSwapChain + D3D10GetVertexShaderProfile + D3D10GetGeometryShaderProfile + D3D10GetPixelShaderProfile + D3D10CreateBlob + D3D10GetInputSignatureBlob + D3D10GetOutputSignatureBlob + D3D10ReflectShader + D3D10CompileShader + D3D10CreateEffectFromMemory + D3D10CreateEffectPoolFromMemory + D3D10CompileEffectFromMemory + D3D10DisassembleEffect + D3D10DisassembleShader + D3D10PreprocessShader \ No newline at end of file diff --git a/src/d3d10/d3d10_1.def b/src/d3d10/d3d10_1.def index fff76a7fd..0575c2e24 100644 --- a/src/d3d10/d3d10_1.def +++ b/src/d3d10/d3d10_1.def @@ -2,3 +2,17 @@ LIBRARY D3D10_1.DLL EXPORTS D3D10CreateDevice1 D3D10CreateDeviceAndSwapChain1 + D3D10GetVertexShaderProfile + D3D10GetGeometryShaderProfile + D3D10GetPixelShaderProfile + D3D10CreateBlob + D3D10GetInputSignatureBlob + D3D10GetOutputSignatureBlob + D3D10ReflectShader + D3D10CompileShader + D3D10CreateEffectFromMemory + D3D10CreateEffectPoolFromMemory + D3D10CompileEffectFromMemory + D3D10DisassembleEffect + D3D10DisassembleShader + D3D10PreprocessShader \ No newline at end of file diff --git a/src/d3d10/d3d10_main.cpp b/src/d3d10/d3d10_main.cpp index d33b23c86..a046796a2 100644 --- a/src/d3d10/d3d10_main.cpp +++ b/src/d3d10/d3d10_main.cpp @@ -1,3 +1,5 @@ +#include + #include "d3d10_include.h" #include "../dxgi/dxgi_adapter.h" @@ -211,6 +213,141 @@ extern "C" { } return S_FALSE; } + + const char* STDMETHODCALLTYPE D3D10GetVertexShaderProfile (ID3D10Device*) { return "vs_4_1"; } + const char* STDMETHODCALLTYPE D3D10GetGeometryShaderProfile (ID3D10Device*) { return "gs_4_1"; } + const char* STDMETHODCALLTYPE D3D10GetPixelShaderProfile (ID3D10Device*) { return "ps_4_1"; } + + + HRESULT STDMETHODCALLTYPE D3D10CreateBlob(SIZE_T size, LPD3D10BLOB* ppBuffer) { + return D3DCreateBlob(size, ppBuffer); + } + + + HRESULT STDMETHODCALLTYPE D3D10GetInputSignatureBlob( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10Blob** ppSignatureBlob) { + return D3DGetInputSignatureBlob( + pShaderBytecode, + BytecodeLength, + ppSignatureBlob); + } + + + HRESULT STDMETHODCALLTYPE D3D10GetOutputSignatureBlob( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10Blob** ppSignatureBlob) { + return D3DGetOutputSignatureBlob( + pShaderBytecode, + BytecodeLength, + ppSignatureBlob); + } + + + HRESULT STDMETHODCALLTYPE D3D10ReflectShader( + const void* pShaderBytecode, + SIZE_T BytecodeLength, + ID3D10ShaderReflection** ppReflector) { + return D3DReflect(pShaderBytecode, BytecodeLength, + IID_ID3D10ShaderReflection, + reinterpret_cast(ppReflector)); + } + + + HRESULT STDMETHODCALLTYPE D3D10CompileShader( + LPCSTR pSrcData, + SIZE_T SrcDataSize, + LPCSTR pFileName, + const D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + UINT Flags, + ID3D10Blob** ppShader, + ID3D10Blob** ppErrorMsgs) { + return D3DCompile(pSrcData, SrcDataSize, pFileName, + pDefines, pInclude, pFunctionName, pProfile, Flags, + 0, ppShader, ppErrorMsgs); + } + + + HRESULT STDMETHODCALLTYPE D3D10CreateEffectFromMemory( + void* pData, + SIZE_T DataSize, + UINT EffectFlags, + ID3D10Device* pDevice, + ID3D10EffectPool* pEffectPool, + ID3D10Effect** ppEffect) { + Logger::warn("D3D10CreateEffectFromMemory: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10CreateEffectPoolFromMemory( + void* pData, + SIZE_T DataSize, + UINT EffectFlags, + ID3D10Device* pDevice, + ID3D10EffectPool** ppEffectPool) { + Logger::warn("D3D10CreateEffectPoolFromMemory: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10CompileEffectFromMemory( + void* pData, + SIZE_T DataLength, + LPCSTR pSrcFileName, + const D3D10_SHADER_MACRO* pDefines, + ID3D10Include* pInclude, + UINT ShaderFlags, + UINT EffectFlags, + ID3D10Blob** ppCompiledEffect, + ID3D10Blob** ppErrors) { + Logger::warn("D3D10CompileEffectFromMemory: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10DisassembleEffect( + ID3D10Effect* pEffect, + BOOL EnableColorCode, + ID3D10Blob** ppDisassembly) { + Logger::warn("D3D10DisassembleEffect: Not implemented"); + return E_NOTIMPL; + } + + + HRESULT STDMETHODCALLTYPE D3D10DisassembleShader( + const void* pShader, + SIZE_T BytecodeLength, + BOOL EnableColorCode, + LPCSTR pComments, + ID3D10Blob** ppDisassembly) { + return D3DDisassemble( + pShader, BytecodeLength, + 0, pComments, ppDisassembly); + } + + + HRESULT STDMETHODCALLTYPE D3D10PreprocessShader( + LPCSTR pSrcData, + SIZE_T SrcDataSize, + LPCSTR pFileName, + const D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, + ID3D10Blob** ppShaderText, + ID3D10Blob** ppErrorMsgs) { + return D3DPreprocess( + pSrcData, SrcDataSize, + pFileName, pDefines, + pInclude, + ppShaderText, + ppErrorMsgs); + } + }