Commit 4537fbca authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

d3dx10: Add D3DX10CreateAsyncTextureInfoProcessor implementation.

parent a2521a90
......@@ -19,6 +19,7 @@
#include "d3d10_1.h"
#include "d3dx10.h"
#include "d3dcompiler.h"
#include "dxhelpers.h"
#include "wine/debug.h"
......@@ -272,6 +273,48 @@ static const ID3DX10DataLoaderVtbl resourcedataloadervtbl =
resourcedataloader_Destroy
};
struct texture_info_processor
{
ID3DX10DataProcessor ID3DX10DataProcessor_iface;
D3DX10_IMAGE_INFO *info;
};
static inline struct texture_info_processor *impl_from_ID3DX10DataProcessor(ID3DX10DataProcessor *iface)
{
return CONTAINING_RECORD(iface, struct texture_info_processor, ID3DX10DataProcessor_iface);
}
static HRESULT WINAPI texture_info_processor_Process(ID3DX10DataProcessor *iface, void *data, SIZE_T size)
{
struct texture_info_processor *processor = impl_from_ID3DX10DataProcessor(iface);
TRACE("iface %p, data %p, size %Iu.\n", iface, data, size);
return get_image_info(data, size, processor->info);
}
static HRESULT WINAPI texture_info_processor_CreateDeviceObject(ID3DX10DataProcessor *iface, void **object)
{
TRACE("iface %p, object %p.\n", iface, object);
return S_OK;
}
static HRESULT WINAPI texture_info_processor_Destroy(ID3DX10DataProcessor *iface)
{
struct texture_info_processor *processor = impl_from_ID3DX10DataProcessor(iface);
TRACE("iface %p.\n", iface);
free(processor);
return S_OK;
}
static ID3DX10DataProcessorVtbl texture_info_processor_vtbl =
{
texture_info_processor_Process,
texture_info_processor_CreateDeviceObject,
texture_info_processor_Destroy
};
HRESULT WINAPI D3DX10CompileFromMemory(const char *data, SIZE_T data_size, const char *filename,
const D3D10_SHADER_MACRO *defines, ID3D10Include *include, const char *entry_point,
const char *target, UINT sflags, UINT eflags, ID3DX10ThreadPump *pump, ID3D10Blob **shader,
......@@ -453,8 +496,22 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *res
HRESULT WINAPI D3DX10CreateAsyncTextureInfoProcessor(D3DX10_IMAGE_INFO *info, ID3DX10DataProcessor **processor)
{
FIXME("info %p, processor %p stub!\n", info, processor);
return E_NOTIMPL;
struct texture_info_processor *object;
TRACE("info %p, processor %p.\n", info, processor);
if (!processor)
return E_INVALIDARG;
object = malloc(sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
object->ID3DX10DataProcessor_iface.lpVtbl = &texture_info_processor_vtbl;
object->info = info;
*processor = &object->ID3DX10DataProcessor_iface;
return S_OK;
}
HRESULT WINAPI D3DX10PreprocessShaderFromMemory(const char *data, SIZE_T data_size, const char *filename,
......
......@@ -21,3 +21,5 @@ extern HRESULT load_resourceA(HMODULE module, const char *resource,
void **data, DWORD *size) DECLSPEC_HIDDEN;
extern HRESULT load_resourceW(HMODULE module, const WCHAR *resource,
void **data, DWORD *size) DECLSPEC_HIDDEN;
extern HRESULT get_image_info(const void *data, SIZE_T size, D3DX10_IMAGE_INFO *img_info) DECLSPEC_HIDDEN;
......@@ -382,8 +382,7 @@ HRESULT WINAPI D3DX10GetImageInfoFromResourceW(HMODULE module, const WCHAR *reso
return D3DX10GetImageInfoFromMemory(buffer, size, pump, info, result);
}
HRESULT WINAPI D3DX10GetImageInfoFromMemory(const void *src_data, SIZE_T src_data_size, ID3DX10ThreadPump *pump,
D3DX10_IMAGE_INFO *img_info, HRESULT *hresult)
HRESULT get_image_info(const void *data, SIZE_T size, D3DX10_IMAGE_INFO *img_info)
{
IWICBitmapFrameDecode *frame = NULL;
IWICImagingFactory *factory = NULL;
......@@ -395,17 +394,9 @@ HRESULT WINAPI D3DX10GetImageInfoFromMemory(const void *src_data, SIZE_T src_dat
GUID container_format;
HRESULT hr;
TRACE("src_data %p, src_data_size %Iu, pump %p, img_info %p, hresult %p.\n",
src_data, src_data_size, pump, img_info, hresult);
if (!src_data || !src_data_size || !img_info)
return E_FAIL;
if (pump)
FIXME("Thread pump is not supported yet.\n");
WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory);
IWICImagingFactory_CreateStream(factory, &stream);
hr = IWICStream_InitializeFromMemory(stream, (BYTE *)src_data, src_data_size);
hr = IWICStream_InitializeFromMemory(stream, (BYTE *)data, size);
if (FAILED(hr))
{
WARN("Failed to initialize stream.\n");
......@@ -486,6 +477,20 @@ end:
return S_OK;
}
HRESULT WINAPI D3DX10GetImageInfoFromMemory(const void *src_data, SIZE_T src_data_size, ID3DX10ThreadPump *pump,
D3DX10_IMAGE_INFO *img_info, HRESULT *result)
{
TRACE("src_data %p, src_data_size %Iu, pump %p, img_info %p, hresult %p.\n",
src_data, src_data_size, pump, img_info, result);
if (!src_data)
return E_FAIL;
if (pump)
FIXME("Thread pump is not supported yet.\n");
return get_image_info(src_data, src_data_size, img_info);
}
HRESULT WINAPI D3DX10CreateTextureFromFileA(ID3D10Device *device, const char *src_file,
D3DX10_IMAGE_LOAD_INFO *load_info, ID3DX10ThreadPump *pump, ID3D10Resource **texture, HRESULT *hresult)
{
......
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