mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
d3dcompiler: Implement D3DGetInputSignatureBlob().
This commit is contained in:
parent
ec698dea66
commit
5946201d19
@ -119,10 +119,31 @@ HRESULT d3dcompiler_blob_init(struct d3dcompiler_blob *blob, SIZE_T data_size)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static BOOL check_blob_part(DWORD tag, D3D_BLOB_PART part)
|
||||
{
|
||||
BOOL add = FALSE;
|
||||
|
||||
switch(part)
|
||||
{
|
||||
case D3D_BLOB_INPUT_SIGNATURE_BLOB:
|
||||
if (tag == TAG_ISGN) add = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled D3D_BLOB_PART %s.\n", debug_d3dcompiler_d3d_blob_part(part));
|
||||
break;
|
||||
}
|
||||
|
||||
TRACE("%s tag %s\n", add ? "Add" : "Skip", debugstr_an((const char *)&tag, 4));
|
||||
|
||||
return add;
|
||||
}
|
||||
|
||||
HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
|
||||
{
|
||||
struct dxbc src_dxbc, dst_dxbc;
|
||||
HRESULT hr;
|
||||
unsigned int i, count;
|
||||
|
||||
if (!data || !data_size || flags || !blob)
|
||||
{
|
||||
@ -144,6 +165,52 @@ HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D_BLOB_P
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = dxbc_init(&dst_dxbc, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
dxbc_destroy(&src_dxbc);
|
||||
WARN("Failed to init dxbc\n");
|
||||
return hr;
|
||||
}
|
||||
|
||||
for (i = 0; i < src_dxbc.count; ++i)
|
||||
{
|
||||
struct dxbc_section *section = &src_dxbc.sections[i];
|
||||
|
||||
if (check_blob_part(section->tag, part))
|
||||
{
|
||||
hr = dxbc_add_section(&dst_dxbc, section->tag, section->data, section->data_size);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
dxbc_destroy(&src_dxbc);
|
||||
dxbc_destroy(&dst_dxbc);
|
||||
WARN("Failed to add section to dxbc\n");
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
count = dst_dxbc.count;
|
||||
|
||||
switch(part)
|
||||
{
|
||||
case D3D_BLOB_INPUT_SIGNATURE_BLOB:
|
||||
if (count != 1) count = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled D3D_BLOB_PART %s.\n", debug_d3dcompiler_d3d_blob_part(part));
|
||||
break;
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
dxbc_destroy(&src_dxbc);
|
||||
dxbc_destroy(&dst_dxbc);
|
||||
WARN("Nothing to write into the blob (count = 0)\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
hr = dxbc_write_blob(&dst_dxbc, blob);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
@ stdcall D3DGetBlobPart(ptr long long long ptr)
|
||||
@ stub D3DGetDebugInfo
|
||||
@ stub D3DGetInputAndOutputSignatureBlob
|
||||
@ stub D3DGetInputSignatureBlob
|
||||
@ stdcall D3DGetInputSignatureBlob(ptr long ptr)
|
||||
@ stub D3DGetOutputSignatureBlob
|
||||
@ stdcall D3DPreprocess(ptr long str ptr ptr ptr ptr)
|
||||
@ stub D3DReflect
|
||||
|
@ -88,3 +88,10 @@ HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART
|
||||
|
||||
return d3dcompiler_get_blob_part(data, data_size, part, flags, blob);
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DGetInputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob)
|
||||
{
|
||||
TRACE("data %p, data_size %lu, blob %p\n", data, data_size, blob);
|
||||
|
||||
return d3dcompiler_get_blob_part(data, data_size, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, blob);
|
||||
}
|
||||
|
@ -581,6 +581,7 @@ void SlDeleteShader(struct bwriter_shader *shader);
|
||||
((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
|
||||
((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
|
||||
#define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C')
|
||||
#define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
|
||||
|
||||
struct dxbc_section
|
||||
{
|
||||
|
@ -62,6 +62,7 @@ typedef enum D3D_BLOB_PART
|
||||
} D3D_BLOB_PART;
|
||||
|
||||
HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob);
|
||||
HRESULT WINAPI D3DGetInputSignatureBlob(const void *data, SIZE_T data_size, ID3DBlob **blob);
|
||||
|
||||
HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user