Commit fc055fc0 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10: Use the global memory allocation helpers.

parent fa4d5b61
...@@ -222,8 +222,7 @@ HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT fl ...@@ -222,8 +222,7 @@ HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT fl
FIXME("data %p, data_size %lu, flags %#x, device %p, effect_pool %p, effect %p stub!\n", FIXME("data %p, data_size %lu, flags %#x, device %p, effect_pool %p, effect %p stub!\n",
data, data_size, flags, device, effect_pool, effect); data, data_size, flags, device, effect_pool, effect);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!(object = heap_alloc_zero(sizeof(*object))))
if (!object)
{ {
ERR("Failed to allocate D3D10 effect object memory\n"); ERR("Failed to allocate D3D10 effect object memory\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -303,8 +302,7 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad ...@@ -303,8 +302,7 @@ HRESULT WINAPI D3D10ReflectShader(const void *data, SIZE_T data_size, ID3D10Shad
FIXME("data %p, data_size %lu, reflector %p stub!\n", data, data_size, reflector); FIXME("data %p, data_size %lu, reflector %p stub!\n", data, data_size, reflector);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!(object = heap_alloc_zero(sizeof(*object))))
if (!object)
{ {
ERR("Failed to allocate D3D10 shader reflection object memory\n"); ERR("Failed to allocate D3D10 shader reflection object memory\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/rbtree.h" #include "wine/rbtree.h"
#include "wine/heap.h"
#define COBJMACROS #define COBJMACROS
#include "winbase.h" #include "winbase.h"
...@@ -278,13 +279,6 @@ HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapte ...@@ -278,13 +279,6 @@ HRESULT WINAPI D3D10CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapte
HRESULT parse_dxbc(const char *data, SIZE_T data_size, HRESULT parse_dxbc(const char *data, SIZE_T data_size,
HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx) DECLSPEC_HIDDEN; HRESULT (*chunk_handler)(const char *data, DWORD data_size, DWORD tag, void *ctx), void *ctx) DECLSPEC_HIDDEN;
static inline void *d3d10_calloc(SIZE_T count, SIZE_T size)
{
if (count > ~(SIZE_T)0 / size)
return NULL;
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * size);
}
static inline void read_dword(const char **ptr, DWORD *d) static inline void read_dword(const char **ptr, DWORD *d)
{ {
memcpy(d, *ptr, sizeof(*d)); memcpy(d, *ptr, sizeof(*d));
......
...@@ -68,9 +68,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderRefle ...@@ -68,9 +68,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_reflection_Release(ID3D10ShaderRefle
TRACE("%p decreasing refcount to %u\n", This, refcount); TRACE("%p decreasing refcount to %u\n", This, refcount);
if (!refcount) if (!refcount)
{ heap_free(This);
HeapFree(GetProcessHeap(), 0, This);
}
return refcount; return refcount;
} }
......
...@@ -275,7 +275,7 @@ static ULONG STDMETHODCALLTYPE d3d10_stateblock_Release(ID3D10StateBlock *iface) ...@@ -275,7 +275,7 @@ static ULONG STDMETHODCALLTYPE d3d10_stateblock_Release(ID3D10StateBlock *iface)
{ {
stateblock_cleanup(stateblock); stateblock_cleanup(stateblock);
ID3D10Device_Release(stateblock->device); ID3D10Device_Release(stateblock->device);
HeapFree(GetProcessHeap(), 0, stateblock); heap_free(stateblock);
} }
return refcount; return refcount;
...@@ -522,8 +522,7 @@ HRESULT WINAPI D3D10CreateStateBlock(ID3D10Device *device, ...@@ -522,8 +522,7 @@ HRESULT WINAPI D3D10CreateStateBlock(ID3D10Device *device,
TRACE("device %p, mask %p, stateblock %p.\n", device, mask, stateblock); TRACE("device %p, mask %p, stateblock %p.\n", device, mask, stateblock);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!(object = heap_alloc_zero(sizeof(*object))))
if (!object)
{ {
ERR("Failed to allocate D3D10 stateblock object memory.\n"); ERR("Failed to allocate D3D10 stateblock object memory.\n");
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
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