d3dcompiler: Move D3DCreateBlob() to blob.c.
This commit is contained in:
parent
81f3d68abd
commit
4d54360765
|
@ -26,6 +26,15 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
|
||||||
|
|
||||||
|
struct d3dcompiler_blob
|
||||||
|
{
|
||||||
|
ID3DBlob ID3DBlob_iface;
|
||||||
|
LONG refcount;
|
||||||
|
|
||||||
|
SIZE_T size;
|
||||||
|
void *data;
|
||||||
|
};
|
||||||
|
|
||||||
static inline struct d3dcompiler_blob *impl_from_ID3DBlob(ID3DBlob *iface)
|
static inline struct d3dcompiler_blob *impl_from_ID3DBlob(ID3DBlob *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, struct d3dcompiler_blob, ID3DBlob_iface);
|
return CONTAINING_RECORD(iface, struct d3dcompiler_blob, ID3DBlob_iface);
|
||||||
|
@ -108,7 +117,7 @@ static const struct ID3D10BlobVtbl d3dcompiler_blob_vtbl =
|
||||||
d3dcompiler_blob_GetBufferSize,
|
d3dcompiler_blob_GetBufferSize,
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
|
static HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
|
||||||
{
|
{
|
||||||
blob->ID3DBlob_iface.lpVtbl = &d3dcompiler_blob_vtbl;
|
blob->ID3DBlob_iface.lpVtbl = &d3dcompiler_blob_vtbl;
|
||||||
blob->refcount = 1;
|
blob->refcount = 1;
|
||||||
|
@ -124,6 +133,41 @@ HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
|
||||||
|
{
|
||||||
|
struct d3dcompiler_blob *object;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
TRACE("data_size %lu, blob %p\n", data_size, blob);
|
||||||
|
|
||||||
|
if (!blob)
|
||||||
|
{
|
||||||
|
WARN("Invalid blob specified.\n");
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||||
|
if (!object)
|
||||||
|
{
|
||||||
|
ERR("Failed to allocate D3D blob object memory\n");
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = d3dcompiler_blob_init(object, data_size);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
WARN("Failed to initialize blob, hr %#x.\n", hr);
|
||||||
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
*blob = (ID3DBlob *)object;
|
||||||
|
|
||||||
|
TRACE("Created ID3DBlob %p\n", object);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL check_blob_part(DWORD tag, D3D_BLOB_PART part)
|
static BOOL check_blob_part(DWORD tag, D3D_BLOB_PART part)
|
||||||
{
|
{
|
||||||
BOOL add = FALSE;
|
BOOL add = FALSE;
|
||||||
|
|
|
@ -46,41 +46,6 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
|
|
||||||
{
|
|
||||||
struct d3dcompiler_blob *object;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
TRACE("data_size %lu, blob %p\n", data_size, blob);
|
|
||||||
|
|
||||||
if (!blob)
|
|
||||||
{
|
|
||||||
WARN("Invalid blob specified.\n");
|
|
||||||
return D3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
|
||||||
if (!object)
|
|
||||||
{
|
|
||||||
ERR("Failed to allocate D3D blob object memory\n");
|
|
||||||
return E_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = d3dcompiler_blob_init(object, data_size);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
WARN("Failed to initialize blob, hr %#x.\n", hr);
|
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
*blob = (ID3DBlob *)object;
|
|
||||||
|
|
||||||
TRACE("Created ID3DBlob %p\n", object);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
|
HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
|
||||||
{
|
{
|
||||||
TRACE("data %p, data_size %lu, part %s, flags %#x, blob %p\n", data,
|
TRACE("data %p, data_size %lu, part %s, flags %#x, blob %p\n", data,
|
||||||
|
|
|
@ -44,18 +44,6 @@ const char *debug_d3dcompiler_d3d_blob_part(D3D_BLOB_PART part) DECLSPEC_HIDDEN;
|
||||||
const char *debug_d3dcompiler_shader_variable_class(D3D_SHADER_VARIABLE_CLASS c) DECLSPEC_HIDDEN;
|
const char *debug_d3dcompiler_shader_variable_class(D3D_SHADER_VARIABLE_CLASS c) DECLSPEC_HIDDEN;
|
||||||
const char *debug_d3dcompiler_shader_variable_type(D3D_SHADER_VARIABLE_TYPE t) DECLSPEC_HIDDEN;
|
const char *debug_d3dcompiler_shader_variable_type(D3D_SHADER_VARIABLE_TYPE t) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* ID3DBlob */
|
|
||||||
struct d3dcompiler_blob
|
|
||||||
{
|
|
||||||
ID3DBlob ID3DBlob_iface;
|
|
||||||
LONG refcount;
|
|
||||||
|
|
||||||
SIZE_T size;
|
|
||||||
void *data;
|
|
||||||
};
|
|
||||||
|
|
||||||
HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
/* blob handling */
|
/* blob handling */
|
||||||
HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob) DECLSPEC_HIDDEN;
|
HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob) DECLSPEC_HIDDEN;
|
||||||
HRESULT d3dcompiler_strip_shader(const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob) DECLSPEC_HIDDEN;
|
HRESULT d3dcompiler_strip_shader(const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue