Commit b3523a44 authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

d3dx9: Implement D3DXCreateEffectCompilerFromFile/Resource.

parent 943eefc8
......@@ -48,10 +48,10 @@
@ stub D3DXCreateCylinder
@ stdcall D3DXCreateEffect(ptr ptr long ptr ptr long ptr ptr ptr)
@ stdcall D3DXCreateEffectCompiler(ptr long ptr ptr long ptr ptr)
@ stub D3DXCreateEffectCompilerFromFileA
@ stub D3DXCreateEffectCompilerFromFileW
@ stub D3DXCreateEffectCompilerFromResourceA
@ stub D3DXCreateEffectCompilerFromResourceW
@ stdcall D3DXCreateEffectCompilerFromFileA(str ptr ptr long ptr ptr)
@ stdcall D3DXCreateEffectCompilerFromFileW(wstr ptr ptr long ptr ptr)
@ stdcall D3DXCreateEffectCompilerFromResourceA(long str ptr ptr long ptr ptr)
@ stdcall D3DXCreateEffectCompilerFromResourceW(long wstr ptr ptr long ptr ptr)
@ stdcall D3DXCreateEffectEx(ptr ptr long ptr ptr ptr long ptr ptr ptr)
@ stub D3DXCreateEffectFromFileA
@ stub D3DXCreateEffectFromFileExA
......
......@@ -998,3 +998,100 @@ HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL* pool)
return S_OK;
}
HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
{
LPVOID buffer;
HRESULT ret;
DWORD size;
TRACE("(%s): relay\n", debugstr_w(srcfile));
if (!srcfile || !defines)
return D3DERR_INVALIDCALL;
ret = map_view_of_file(srcfile, &buffer, &size);
if (FAILED(ret))
return D3DXERR_INVALIDDATA;
ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
UnmapViewOfFile(buffer);
return ret;
}
HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
{
LPWSTR srcfileW;
HRESULT ret;
DWORD len;
TRACE("(void): relay\n");
if (!srcfile || !defines)
return D3DERR_INVALIDCALL;
len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
srcfileW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
HeapFree(GetProcessHeap(), 0, srcfileW);
return ret;
}
HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
{
HRSRC resinfo;
TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
if (resinfo)
{
LPVOID buffer;
HRESULT ret;
DWORD size;
ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
if (FAILED(ret))
return D3DXERR_INVALIDDATA;
return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
}
return D3DXERR_INVALIDDATA;
}
HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
{
HRSRC resinfo;
TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
if (resinfo)
{
LPVOID buffer;
HRESULT ret;
DWORD size;
ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
if (FAILED(ret))
return D3DXERR_INVALIDDATA;
return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
}
return D3DXERR_INVALIDDATA;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment