d3dx10: Add a stub sprite object.
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
7db3593a73
commit
c2be6fa691
|
@ -1,6 +1,6 @@
|
|||
MODULE = d3dx10_43.dll
|
||||
IMPORTLIB = d3dx10
|
||||
IMPORTS = d3d10_1 d3dcompiler dxguid
|
||||
IMPORTS = d3d10_1 d3dcompiler dxguid uuid
|
||||
DELAYIMPORTS = windowscodecs
|
||||
|
||||
EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native
|
||||
|
@ -9,6 +9,7 @@ C_SRCS = \
|
|||
async.c \
|
||||
compiler.c \
|
||||
d3dx10_43_main.c \
|
||||
sprite.c \
|
||||
texture.c
|
||||
|
||||
RC_SRCS = version.rc
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
@ stub D3DX10CreateShaderResourceViewFromResourceA(ptr long str ptr ptr ptr ptr)
|
||||
@ stub D3DX10CreateShaderResourceViewFromResourceW(ptr long wstr ptr ptr ptr ptr)
|
||||
@ stub D3DX10CreateSkinInfo(ptr)
|
||||
@ stub D3DX10CreateSprite(ptr long ptr)
|
||||
@ stdcall D3DX10CreateSprite(ptr long ptr)
|
||||
@ stub D3DX10CreateTextureFromFileA(ptr str ptr ptr ptr ptr)
|
||||
@ stub D3DX10CreateTextureFromFileW(ptr wstr ptr ptr ptr ptr)
|
||||
@ stdcall D3DX10CreateTextureFromMemory(ptr ptr long ptr ptr ptr ptr)
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
/*
|
||||
* Copyright 2021 Nikolay Sivov for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
#include "d3dx10.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
|
||||
|
||||
#define D3DERR_INVALIDCALL 0x8876086c
|
||||
|
||||
struct d3dx10_sprite
|
||||
{
|
||||
ID3DX10Sprite ID3DX10Sprite_iface;
|
||||
LONG refcount;
|
||||
|
||||
ID3D10Device *device;
|
||||
};
|
||||
|
||||
static inline struct d3dx10_sprite *impl_from_ID3DX10Sprite(ID3DX10Sprite *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct d3dx10_sprite, ID3DX10Sprite_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_QueryInterface(ID3DX10Sprite *iface, REFIID riid, void **out)
|
||||
{
|
||||
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_ID3DX10Sprite)
|
||||
|| IsEqualGUID(riid, &IID_IUnknown))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*out = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
|
||||
|
||||
*out = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI d3dx10_sprite_AddRef(ID3DX10Sprite *iface)
|
||||
{
|
||||
struct d3dx10_sprite *sprite = impl_from_ID3DX10Sprite(iface);
|
||||
ULONG refcount = InterlockedIncrement(&sprite->refcount);
|
||||
|
||||
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG WINAPI d3dx10_sprite_Release(ID3DX10Sprite *iface)
|
||||
{
|
||||
struct d3dx10_sprite *sprite = impl_from_ID3DX10Sprite(iface);
|
||||
ULONG refcount = InterlockedDecrement(&sprite->refcount);
|
||||
|
||||
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
ID3D10Device_Release(sprite->device);
|
||||
heap_free(sprite);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_Begin(ID3DX10Sprite *iface, UINT flags)
|
||||
{
|
||||
FIXME("iface %p, flags %#x stub!\n", iface, flags);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_DrawSpritesBuffered(ID3DX10Sprite *iface,
|
||||
D3DX10_SPRITE *sprites, UINT count)
|
||||
{
|
||||
FIXME("iface %p, sprites %p, count %u stub!\n", iface, sprites, count);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_Flush(ID3DX10Sprite *iface)
|
||||
{
|
||||
FIXME("iface %p stub!\n", iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_DrawSpritesImmediate(ID3DX10Sprite *iface,
|
||||
D3DX10_SPRITE *sprites, UINT count, UINT size, UINT flags)
|
||||
{
|
||||
FIXME("iface %p, sprites %p, count %u, size %u, flags %#x stub!\n",
|
||||
iface, sprites, count, size, flags);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_End(ID3DX10Sprite *iface)
|
||||
{
|
||||
FIXME("iface %p stub!\n", iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_GetViewTransform(ID3DX10Sprite *iface, D3DXMATRIX *transform)
|
||||
{
|
||||
FIXME("iface %p, transform %p stub!\n", iface, transform);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_SetViewTransform(ID3DX10Sprite *iface, D3DXMATRIX *transform)
|
||||
{
|
||||
FIXME("iface %p, transform %p stub!\n", iface, transform);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_GetProjectionTransform(ID3DX10Sprite *iface,
|
||||
D3DXMATRIX *transform)
|
||||
{
|
||||
FIXME("iface %p, transform %p stub!\n", iface, transform);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_SetProjectionTransform(ID3DX10Sprite *iface, D3DXMATRIX *transform)
|
||||
{
|
||||
FIXME("iface %p, transform %p stub!\n", iface, transform);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3dx10_sprite_GetDevice(ID3DX10Sprite *iface, ID3D10Device **device)
|
||||
{
|
||||
struct d3dx10_sprite *sprite = impl_from_ID3DX10Sprite(iface);
|
||||
|
||||
TRACE("iface %p, device %p.\n", iface, device);
|
||||
|
||||
*device = sprite->device;
|
||||
ID3D10Device_AddRef(*device);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const ID3DX10SpriteVtbl d3dx10_sprite_vtbl =
|
||||
{
|
||||
d3dx10_sprite_QueryInterface,
|
||||
d3dx10_sprite_AddRef,
|
||||
d3dx10_sprite_Release,
|
||||
d3dx10_sprite_Begin,
|
||||
d3dx10_sprite_DrawSpritesBuffered,
|
||||
d3dx10_sprite_Flush,
|
||||
d3dx10_sprite_DrawSpritesImmediate,
|
||||
d3dx10_sprite_End,
|
||||
d3dx10_sprite_GetViewTransform,
|
||||
d3dx10_sprite_SetViewTransform,
|
||||
d3dx10_sprite_GetProjectionTransform,
|
||||
d3dx10_sprite_SetProjectionTransform,
|
||||
d3dx10_sprite_GetDevice,
|
||||
};
|
||||
|
||||
HRESULT WINAPI D3DX10CreateSprite(ID3D10Device *device, UINT size, ID3DX10Sprite **sprite)
|
||||
{
|
||||
struct d3dx10_sprite *object;
|
||||
|
||||
TRACE("device %p, size %u, sprite %p.\n", device, size, sprite);
|
||||
|
||||
if (!device || !sprite)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
*sprite = NULL;
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
object->ID3DX10Sprite_iface.lpVtbl = &d3dx10_sprite_vtbl;
|
||||
object->refcount = 1;
|
||||
object->device = device;
|
||||
ID3D10Device_AddRef(device);
|
||||
|
||||
*sprite = &object->ID3DX10Sprite_iface;
|
||||
|
||||
return S_OK;
|
||||
}
|
|
@ -289,3 +289,4 @@ HRESULT WINAPI D3DX10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVE
|
|||
ID3D10Device **device);
|
||||
typedef interface ID3D10Device1 ID3D10Device1;
|
||||
HRESULT WINAPI D3DX10GetFeatureLevel1(ID3D10Device *device, ID3D10Device1 **device1);
|
||||
HRESULT WINAPI D3DX10CreateSprite(ID3D10Device *device, UINT size, ID3DX10Sprite **sprite);
|
||||
|
|
Loading…
Reference in New Issue