vkd3d: Move ID3D12Heap impl_froms to header
Basic casts should not be function calls. Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
parent
26d8011b06
commit
27e66b5c4a
|
@ -9769,7 +9769,7 @@ static void STDMETHODCALLTYPE d3d12_command_queue_UpdateTileMappings(ID3D12Comma
|
|||
struct d3d12_command_queue *command_queue = impl_from_ID3D12CommandQueue(iface);
|
||||
unsigned int region_tile = 0, region_idx = 0, range_tile = 0, range_idx = 0;
|
||||
struct d3d12_resource *res = unsafe_impl_from_ID3D12Resource(resource);
|
||||
struct d3d12_heap *memory_heap = unsafe_impl_from_ID3D12Heap(heap);
|
||||
struct d3d12_heap *memory_heap = impl_from_ID3D12Heap(heap);
|
||||
struct vkd3d_sparse_memory_bind *bind, **bound_tiles;
|
||||
struct d3d12_sparse_info *sparse = &res->sparse;
|
||||
D3D12_TILED_RESOURCE_COORDINATE region_coord;
|
||||
|
|
|
@ -3791,7 +3791,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource(d3d12_device_
|
|||
const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state,
|
||||
const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource)
|
||||
{
|
||||
struct d3d12_heap *heap_object = unsafe_impl_from_ID3D12Heap(heap);
|
||||
struct d3d12_heap *heap_object = impl_from_ID3D12Heap(heap);
|
||||
struct d3d12_device *device = impl_from_ID3D12Device(iface);
|
||||
struct d3d12_resource *object;
|
||||
HRESULT hr;
|
||||
|
|
|
@ -23,11 +23,6 @@
|
|||
#include "vkd3d_private.h"
|
||||
|
||||
/* ID3D12Heap */
|
||||
static inline struct d3d12_heap *impl_from_ID3D12Heap(d3d12_heap_iface *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct d3d12_heap, ID3D12Heap_iface);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d3d12_heap_QueryInterface(d3d12_heap_iface *iface,
|
||||
REFIID iid, void **object)
|
||||
{
|
||||
|
@ -53,7 +48,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_heap_QueryInterface(d3d12_heap_iface *ifa
|
|||
|
||||
static ULONG STDMETHODCALLTYPE d3d12_heap_AddRef(d3d12_heap_iface *iface)
|
||||
{
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap(iface);
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap1(iface);
|
||||
ULONG refcount = InterlockedIncrement(&heap->refcount);
|
||||
|
||||
TRACE("%p increasing refcount to %u.\n", heap, refcount);
|
||||
|
@ -79,7 +74,7 @@ static void d3d12_heap_set_name(struct d3d12_heap *heap, const char *name)
|
|||
|
||||
static ULONG STDMETHODCALLTYPE d3d12_heap_Release(d3d12_heap_iface *iface)
|
||||
{
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap(iface);
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap1(iface);
|
||||
ULONG refcount = InterlockedDecrement(&heap->refcount);
|
||||
|
||||
TRACE("%p decreasing refcount to %u.\n", heap, refcount);
|
||||
|
@ -93,7 +88,7 @@ static ULONG STDMETHODCALLTYPE d3d12_heap_Release(d3d12_heap_iface *iface)
|
|||
static HRESULT STDMETHODCALLTYPE d3d12_heap_GetPrivateData(d3d12_heap_iface *iface,
|
||||
REFGUID guid, UINT *data_size, void *data)
|
||||
{
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap(iface);
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap1(iface);
|
||||
|
||||
TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
|
||||
|
||||
|
@ -103,7 +98,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_heap_GetPrivateData(d3d12_heap_iface *ifa
|
|||
static HRESULT STDMETHODCALLTYPE d3d12_heap_SetPrivateData(d3d12_heap_iface *iface,
|
||||
REFGUID guid, UINT data_size, const void *data)
|
||||
{
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap(iface);
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap1(iface);
|
||||
|
||||
TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
|
||||
|
||||
|
@ -114,7 +109,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_heap_SetPrivateData(d3d12_heap_iface *ifa
|
|||
static HRESULT STDMETHODCALLTYPE d3d12_heap_SetPrivateDataInterface(d3d12_heap_iface *iface,
|
||||
REFGUID guid, const IUnknown *data)
|
||||
{
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap(iface);
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap1(iface);
|
||||
|
||||
TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
|
||||
|
||||
|
@ -124,7 +119,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_heap_SetPrivateDataInterface(d3d12_heap_i
|
|||
|
||||
static HRESULT STDMETHODCALLTYPE d3d12_heap_GetDevice(d3d12_heap_iface *iface, REFIID iid, void **device)
|
||||
{
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap(iface);
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap1(iface);
|
||||
|
||||
TRACE("iface %p, iid %s, device %p.\n", iface, debugstr_guid(iid), device);
|
||||
|
||||
|
@ -134,7 +129,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_heap_GetDevice(d3d12_heap_iface *iface, R
|
|||
static D3D12_HEAP_DESC * STDMETHODCALLTYPE d3d12_heap_GetDesc(d3d12_heap_iface *iface,
|
||||
D3D12_HEAP_DESC *desc)
|
||||
{
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap(iface);
|
||||
struct d3d12_heap *heap = impl_from_ID3D12Heap1(iface);
|
||||
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
||||
|
@ -150,7 +145,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_heap_GetProtectedResourceSession(d3d12_he
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static CONST_VTBL struct ID3D12Heap1Vtbl d3d12_heap_vtbl =
|
||||
CONST_VTBL struct ID3D12Heap1Vtbl d3d12_heap_vtbl =
|
||||
{
|
||||
/* IUnknown methods */
|
||||
d3d12_heap_QueryInterface,
|
||||
|
@ -169,19 +164,6 @@ static CONST_VTBL struct ID3D12Heap1Vtbl d3d12_heap_vtbl =
|
|||
d3d12_heap_GetProtectedResourceSession,
|
||||
};
|
||||
|
||||
static struct d3d12_heap *unsafe_impl_from_ID3D12Heap1(ID3D12Heap1 *iface)
|
||||
{
|
||||
if (!iface)
|
||||
return NULL;
|
||||
assert(iface->lpVtbl == &d3d12_heap_vtbl);
|
||||
return impl_from_ID3D12Heap(iface);
|
||||
}
|
||||
|
||||
struct d3d12_heap *unsafe_impl_from_ID3D12Heap(ID3D12Heap *iface)
|
||||
{
|
||||
return unsafe_impl_from_ID3D12Heap1((ID3D12Heap1 *)iface);
|
||||
}
|
||||
|
||||
static HRESULT validate_heap_desc(const D3D12_HEAP_DESC *desc)
|
||||
{
|
||||
if (!desc->SizeInBytes)
|
||||
|
|
|
@ -760,7 +760,20 @@ struct d3d12_heap
|
|||
|
||||
HRESULT d3d12_heap_create(struct d3d12_device *device, const D3D12_HEAP_DESC *desc,
|
||||
void *host_address, struct d3d12_heap **heap);
|
||||
struct d3d12_heap *unsafe_impl_from_ID3D12Heap(ID3D12Heap *iface);
|
||||
|
||||
static inline struct d3d12_heap *impl_from_ID3D12Heap1(ID3D12Heap1 *iface)
|
||||
{
|
||||
extern CONST_VTBL struct ID3D12Heap1Vtbl d3d12_heap_vtbl;
|
||||
if (!iface)
|
||||
return NULL;
|
||||
assert(iface->lpVtbl == &d3d12_heap_vtbl);
|
||||
return CONTAINING_RECORD(iface, struct d3d12_heap, ID3D12Heap_iface);
|
||||
}
|
||||
|
||||
static inline struct d3d12_heap *impl_from_ID3D12Heap(ID3D12Heap *iface)
|
||||
{
|
||||
return impl_from_ID3D12Heap1((ID3D12Heap1 *)iface);
|
||||
}
|
||||
|
||||
enum vkd3d_resource_flag
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue