mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
(d3dcompiler_common) Cleanups
This commit is contained in:
parent
af89df2b82
commit
30685c6e60
@ -52,20 +52,15 @@ HRESULT WINAPI D3DCompile(
|
||||
static pD3DCompile fp;
|
||||
const char** dll_name = d3dcompiler_dll_list;
|
||||
while (!d3dcompiler_dll && *dll_name)
|
||||
d3dcompiler_dll = dylib_load(*dll_name++);
|
||||
|
||||
if (!d3dcompiler_dll)
|
||||
return TYPE_E_CANTLOADLIBRARY;
|
||||
|
||||
if (!(d3dcompiler_dll = dylib_load(*dll_name++)))
|
||||
return TYPE_E_CANTLOADLIBRARY;
|
||||
if (!fp)
|
||||
fp = (pD3DCompile)dylib_proc(d3dcompiler_dll, "D3DCompile");
|
||||
|
||||
if (!fp)
|
||||
return TYPE_E_DLLFUNCTIONNOTFOUND;
|
||||
|
||||
if (!(fp = (pD3DCompile)dylib_proc(d3dcompiler_dll, "D3DCompile")))
|
||||
return TYPE_E_DLLFUNCTIONNOTFOUND;
|
||||
return fp(
|
||||
pSrcData, SrcDataSize, pSourceName, pDefines, pInclude, pEntrypoint, pTarget, Flags1,
|
||||
Flags2, ppCode, ppErrorMsgs);
|
||||
pSrcData, SrcDataSize, pSourceName,
|
||||
pDefines, pInclude, pEntrypoint, pTarget,
|
||||
Flags1, Flags2, ppCode, ppErrorMsgs);
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DCompileFromFile(
|
||||
@ -91,11 +86,9 @@ HRESULT WINAPI D3DCompileFromFile(
|
||||
return TYPE_E_CANTLOADLIBRARY;
|
||||
|
||||
if (!fp)
|
||||
fp = (pD3DCompileFromFile)dylib_proc(d3dcompiler_dll, "D3DCompileFromFile");
|
||||
|
||||
if (!fp)
|
||||
return TYPE_E_DLLFUNCTIONNOTFOUND;
|
||||
|
||||
if (!(fp = (pD3DCompileFromFile)dylib_proc(d3dcompiler_dll,
|
||||
"D3DCompileFromFile")))
|
||||
return TYPE_E_DLLFUNCTIONNOTFOUND;
|
||||
return fp(
|
||||
pFileName, pDefines, pInclude, pEntrypoint, pTarget, Flags1, Flags2, ppCode, ppErrorMsgs);
|
||||
}
|
||||
@ -114,34 +107,36 @@ HRESULT WINAPI
|
||||
return TYPE_E_CANTLOADLIBRARY;
|
||||
|
||||
if (!fp)
|
||||
fp = (pD3DCompileFromFile)dylib_proc(d3dcompiler_dll, "D3DReflect");
|
||||
|
||||
if (!fp)
|
||||
return TYPE_E_DLLFUNCTIONNOTFOUND;
|
||||
|
||||
if (!(fp = (pD3DCompileFromFile)dylib_proc(d3dcompiler_dll,
|
||||
"D3DReflect")))
|
||||
return TYPE_E_DLLFUNCTIONNOTFOUND;
|
||||
return fp(pSrcData, SrcDataSize, pInterface, ppReflector);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool d3d_compile(const char* src, size_t size, LPCSTR src_name, LPCSTR entrypoint, LPCSTR target, D3DBlob* out)
|
||||
bool d3d_compile(const char* src, size_t size,
|
||||
LPCSTR src_name, LPCSTR entrypoint, LPCSTR target, D3DBlob* out)
|
||||
{
|
||||
D3DBlob error_msg;
|
||||
UINT compileflags = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
compileflags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
UINT compileflags = D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
#else
|
||||
UINT compileflags = 0;
|
||||
#endif
|
||||
|
||||
if (!size)
|
||||
size = strlen(src);
|
||||
|
||||
if (FAILED(D3DCompile(
|
||||
src, size, src_name, NULL, NULL, entrypoint, target, compileflags, 0, out, &error_msg)))
|
||||
src, size, src_name, NULL, NULL,
|
||||
entrypoint, target, compileflags, 0, out, &error_msg)))
|
||||
{
|
||||
if (error_msg)
|
||||
{
|
||||
const char* msg = (const char*)D3DGetBufferPointer(error_msg);
|
||||
RARCH_ERR("D3DCompile failed :\n%s\n", msg); /* Place a breakpoint here, if you want, to see shader compilation issues */
|
||||
RARCH_ERR("D3DCompile failed :\n%s\n", msg);
|
||||
/* Place a breakpoint here, if you want,
|
||||
to see shader compilation issues */
|
||||
Release(error_msg);
|
||||
}
|
||||
return false;
|
||||
@ -150,21 +145,24 @@ bool d3d_compile(const char* src, size_t size, LPCSTR src_name, LPCSTR entrypoin
|
||||
return true;
|
||||
}
|
||||
|
||||
bool d3d_compile_from_file(LPCWSTR filename, LPCSTR entrypoint, LPCSTR target, D3DBlob* out)
|
||||
bool d3d_compile_from_file(LPCWSTR filename,
|
||||
LPCSTR entrypoint, LPCSTR target, D3DBlob* out)
|
||||
{
|
||||
D3DBlob error_msg;
|
||||
UINT compileflags = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
compileflags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
UINT compileflags = D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
#else
|
||||
UINT compileflags = 0;
|
||||
#endif
|
||||
|
||||
if (FAILED(D3DCompileFromFile(
|
||||
filename, NULL, NULL, entrypoint, target, compileflags, 0, out, &error_msg)))
|
||||
filename, NULL, NULL, entrypoint,
|
||||
target, compileflags, 0, out, &error_msg)))
|
||||
{
|
||||
if (error_msg)
|
||||
{
|
||||
RARCH_ERR("D3DCompile failed :\n%s\n", (const char*)D3DGetBufferPointer(error_msg));
|
||||
RARCH_ERR("D3DCompile failed :\n%s\n",
|
||||
(const char*)D3DGetBufferPointer(error_msg));
|
||||
Release(error_msg);
|
||||
}
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user