d3dx10/tests: Basic tests for async loaders.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
be74d3a5d5
commit
53d01474f2
|
@ -67,3 +67,38 @@ HRESULT WINAPI D3DX10CreateEffectPoolFromFileW(const WCHAR *filename, const D3D1
|
|||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(const void *data, SIZE_T data_size, ID3DX10DataLoader **loader)
|
||||
{
|
||||
FIXME("data %p, data_size %lu, loader %p stub!\n", data, data_size, loader);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(const char *filename, ID3DX10DataLoader **loader)
|
||||
{
|
||||
FIXME("filename %s, loader %p stub!\n", debugstr_a(filename), loader);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(const WCHAR *filename, ID3DX10DataLoader **loader)
|
||||
{
|
||||
FIXME("filename %s, loader %p stub!\n", debugstr_w(filename), loader);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE module, const char *resource, ID3DX10DataLoader **loader)
|
||||
{
|
||||
FIXME("module %p, resource %s, loader %p stub!\n", module, debugstr_a(resource), loader);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *resource, ID3DX10DataLoader **loader)
|
||||
{
|
||||
FIXME("module %p, resource %s, loader %p stub!\n", module, debugstr_w(resource), loader);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
@ stub D3DX10CreateAsyncCompilerProcessor(str ptr ptr str str long long ptr ptr ptr)
|
||||
@ stub D3DX10CreateAsyncEffectCreateProcessor(str ptr ptr str long long ptr ptr ptr ptr)
|
||||
@ stub D3DX10CreateAsyncEffectPoolCreateProcessor(str ptr ptr str long long ptr ptr ptr)
|
||||
@ stub D3DX10CreateAsyncFileLoaderA(str ptr)
|
||||
@ stub D3DX10CreateAsyncFileLoaderW(wstr ptr)
|
||||
@ stub D3DX10CreateAsyncMemoryLoader(ptr long ptr)
|
||||
@ stub D3DX10CreateAsyncResourceLoaderA(long str ptr)
|
||||
@ stub D3DX10CreateAsyncResourceLoaderW(long wstr ptr)
|
||||
@ stdcall D3DX10CreateAsyncFileLoaderA(str ptr)
|
||||
@ stdcall D3DX10CreateAsyncFileLoaderW(wstr ptr)
|
||||
@ stdcall D3DX10CreateAsyncMemoryLoader(ptr long ptr)
|
||||
@ stdcall D3DX10CreateAsyncResourceLoaderA(long str ptr)
|
||||
@ stdcall D3DX10CreateAsyncResourceLoaderW(long wstr ptr)
|
||||
@ stub D3DX10CreateAsyncShaderPreprocessProcessor(str ptr ptr ptr ptr ptr)
|
||||
@ stub D3DX10CreateAsyncShaderResourceViewProcessor(ptr ptr ptr)
|
||||
@ stub D3DX10CreateAsyncTextureInfoProcessor(ptr ptr)
|
||||
|
|
|
@ -605,7 +605,107 @@ float4 main(float4 color : COLOR) : SV_TARGET
|
|||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
}
|
||||
|
||||
static void test_D3DX10CreateAsyncMemoryLoader(void)
|
||||
{
|
||||
ID3DX10DataLoader *loader;
|
||||
SIZE_T size;
|
||||
DWORD data;
|
||||
HRESULT hr;
|
||||
void *ptr;
|
||||
|
||||
hr = D3DX10CreateAsyncMemoryLoader(NULL, 0, NULL);
|
||||
todo_wine ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = D3DX10CreateAsyncMemoryLoader(NULL, 0, &loader);
|
||||
todo_wine ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = D3DX10CreateAsyncMemoryLoader(&data, 0, &loader);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
if (FAILED(hr))
|
||||
return;
|
||||
|
||||
size = 100;
|
||||
hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ok(ptr == &data, "Got data pointer %p, original %p.\n", ptr, &data);
|
||||
ok(!size, "Got unexpected data size.\n");
|
||||
|
||||
/* Load() is no-op. */
|
||||
hr = ID3DX10DataLoader_Load(loader);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3DX10DataLoader_Destroy(loader);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
data = 0;
|
||||
hr = D3DX10CreateAsyncMemoryLoader(&data, sizeof(data), &loader);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
/* Load() is no-op. */
|
||||
hr = ID3DX10DataLoader_Load(loader);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ok(ptr == &data, "Got data pointer %p, original %p.\n", ptr, &data);
|
||||
ok(size == sizeof(data), "Got unexpected data size.\n");
|
||||
|
||||
hr = ID3DX10DataLoader_Destroy(loader);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
static void test_D3DX10CreateAsyncFileLoader(void)
|
||||
{
|
||||
ID3DX10DataLoader *loader;
|
||||
SIZE_T size;
|
||||
HRESULT hr;
|
||||
void *ptr;
|
||||
|
||||
hr = D3DX10CreateAsyncFileLoaderA(NULL, NULL);
|
||||
todo_wine ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = D3DX10CreateAsyncFileLoaderA(NULL, &loader);
|
||||
todo_wine ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = D3DX10CreateAsyncFileLoaderA("nonexistentfilename", &loader);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
if (FAILED(hr))
|
||||
return;
|
||||
|
||||
hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size);
|
||||
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3DX10DataLoader_Load(loader);
|
||||
ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size);
|
||||
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = ID3DX10DataLoader_Destroy(loader);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
static void test_D3DX10CreateAsyncResourceLoader(void)
|
||||
{
|
||||
ID3DX10DataLoader *loader;
|
||||
HRESULT hr;
|
||||
|
||||
hr = D3DX10CreateAsyncResourceLoaderA(NULL, NULL, NULL);
|
||||
todo_wine ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = D3DX10CreateAsyncResourceLoaderA(NULL, NULL, &loader);
|
||||
todo_wine ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = D3DX10CreateAsyncResourceLoaderA(NULL, "nonexistentresourcename", &loader);
|
||||
todo_wine ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
START_TEST(d3dx10)
|
||||
{
|
||||
test_D3DX10UnsetAllDeviceObjects();
|
||||
test_D3DX10CreateAsyncMemoryLoader();
|
||||
test_D3DX10CreateAsyncFileLoader();
|
||||
test_D3DX10CreateAsyncResourceLoader();
|
||||
}
|
||||
|
|
|
@ -32,4 +32,20 @@
|
|||
#include "d3dx10async.h"
|
||||
#include "d3dx10tex.h"
|
||||
|
||||
#define _FACDD 0x876
|
||||
#define MAKE_DDHRESULT(code) MAKE_HRESULT(1, _FACDD, code)
|
||||
|
||||
enum _D3DX10_ERR
|
||||
{
|
||||
D3DX10_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT(2900),
|
||||
D3DX10_ERR_INVALID_MESH = MAKE_DDHRESULT(2901),
|
||||
D3DX10_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT(2902),
|
||||
D3DX10_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT(2903),
|
||||
D3DX10_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT(2904),
|
||||
D3DX10_ERR_INVALID_DATA = MAKE_DDHRESULT(2905),
|
||||
D3DX10_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT(2906),
|
||||
D3DX10_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT(2907),
|
||||
D3DX10_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT(2908)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,4 +54,10 @@ HRESULT WINAPI D3DX10CreateEffectPoolFromMemory(const void *data, SIZE_T datasiz
|
|||
UINT fxflags, ID3D10Device *device, ID3DX10ThreadPump *pump, ID3D10EffectPool **effectpool,
|
||||
ID3D10Blob **errors, HRESULT *hresult);
|
||||
|
||||
HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(const WCHAR *filename, ID3DX10DataLoader **loader);
|
||||
HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(const char *filename, ID3DX10DataLoader **loader);
|
||||
HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(const void *data, SIZE_T datasize, ID3DX10DataLoader **loader);
|
||||
HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE module, const char *resource, ID3DX10DataLoader **loader);
|
||||
HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *resource, ID3DX10DataLoader **loader);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue