mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-03 00:42:46 +00:00
d3dcompiler: Store DXBC sections as vkd3d_shader_dxbc_section_desc structures.
This commit is contained in:
parent
92a2ebc680
commit
b8fe76a8b5
8
configure
vendored
8
configure
vendored
|
@ -12891,8 +12891,8 @@ then :
|
|||
else $as_nop
|
||||
:
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for vkd3d_shader_compile in MinGW -lvkd3d-shader" >&5
|
||||
printf %s "checking for vkd3d_shader_compile in MinGW -lvkd3d-shader... " >&6; }
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for vkd3d_shader_serialize_dxbc in MinGW -lvkd3d-shader" >&5
|
||||
printf %s "checking for vkd3d_shader_serialize_dxbc in MinGW -lvkd3d-shader... " >&6; }
|
||||
if test ${ac_cv_mingw_lib_vkd3d_shader+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
|
@ -12909,11 +12909,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char vkd3d_shader_compile ();
|
||||
char vkd3d_shader_serialize_dxbc ();
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return vkd3d_shader_compile ();
|
||||
return vkd3d_shader_serialize_dxbc ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1089,7 +1089,7 @@ then
|
|||
if test "$ac_cv_mingw_header_vkd3d_h" = "yes" -a "$ac_cv_mingw_header_vkd3d_shader_h" = "yes"
|
||||
then
|
||||
WINE_CHECK_MINGW_LIB(vkd3d,vkd3d_set_log_callback,[:],[:],[$VKD3D_PE_LIBS])
|
||||
WINE_CHECK_MINGW_LIB(vkd3d-shader,vkd3d_shader_compile,[:],[:],[$VKD3D_PE_LIBS])
|
||||
WINE_CHECK_MINGW_LIB(vkd3d-shader,vkd3d_shader_serialize_dxbc,[:],[:],[$VKD3D_PE_LIBS])
|
||||
if test "$ac_cv_mingw_lib_vkd3d" = "no" -o "$ac_cv_mingw_lib_vkd3d_shader" = "no"
|
||||
then
|
||||
VKD3D_PE_CFLAGS=""
|
||||
|
|
|
@ -3,6 +3,7 @@ IMPORTLIB = d3d10
|
|||
IMPORTS = uuid d3d10core d3dcompiler dxgi
|
||||
EXTRADEFS = -DD3D_COMPILER_VERSION=0
|
||||
PARENTSRC = ../d3dcompiler_43
|
||||
EXTRAINCL = $(VKD3D_PE_CFLAGS)
|
||||
|
||||
C_SRCS = \
|
||||
d3d10_main.c \
|
||||
|
|
|
@ -250,11 +250,11 @@ static HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D
|
|||
|
||||
for (i = 0; i < src_dxbc.count; ++i)
|
||||
{
|
||||
struct dxbc_section *section = &src_dxbc.sections[i];
|
||||
const struct vkd3d_shader_dxbc_section_desc *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);
|
||||
hr = dxbc_add_section(&dst_dxbc, section->tag, section->data.code, section->data.size);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
dxbc_destroy(&src_dxbc);
|
||||
|
@ -304,10 +304,10 @@ static HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D
|
|||
if (count == 1 && (part == D3D_BLOB_DEBUG_INFO || part == D3D_BLOB_LEGACY_SHADER || part == D3D_BLOB_XNA_PREPASS_SHADER
|
||||
|| part == D3D_BLOB_XNA_SHADER))
|
||||
{
|
||||
hr = D3DCreateBlob(dst_dxbc.sections[0].data_size, blob);
|
||||
hr = D3DCreateBlob(dst_dxbc.sections[0].data.size, blob);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
memcpy(ID3D10Blob_GetBufferPointer(*blob), dst_dxbc.sections[0].data, dst_dxbc.sections[0].data_size);
|
||||
memcpy(ID3D10Blob_GetBufferPointer(*blob), dst_dxbc.sections[0].data.code, dst_dxbc.sections[0].data.size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -391,11 +391,11 @@ static HRESULT d3dcompiler_strip_shader(const void *data, SIZE_T data_size, UINT
|
|||
|
||||
for (i = 0; i < src_dxbc.count; ++i)
|
||||
{
|
||||
struct dxbc_section *section = &src_dxbc.sections[i];
|
||||
const struct vkd3d_shader_dxbc_section_desc *section = &src_dxbc.sections[i];
|
||||
|
||||
if (check_blob_strip(section->tag, flags))
|
||||
{
|
||||
hr = dxbc_add_section(&dst_dxbc, section->tag, section->data, section->data_size);
|
||||
hr = dxbc_add_section(&dst_dxbc, section->tag, section->data.code, section->data.size);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
dxbc_destroy(&src_dxbc);
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
#include "d3dcompiler_private.h"
|
||||
|
||||
#include <vkd3d_shader.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
|
||||
|
||||
static HRESULT hresult_from_vkd3d_result(int vkd3d_result)
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vkd3d_shader.h>
|
||||
|
||||
/*
|
||||
* This doesn't belong here, but for some functions it is possible to return that value,
|
||||
* see http://msdn.microsoft.com/en-us/library/bb205278%28v=VS.85%29.aspx
|
||||
|
@ -551,18 +553,11 @@ void SlDeleteShader(struct bwriter_shader *shader) DECLSPEC_HIDDEN;
|
|||
#define TAG_XNAP MAKE_TAG('X', 'N', 'A', 'P')
|
||||
#define TAG_XNAS MAKE_TAG('X', 'N', 'A', 'S')
|
||||
|
||||
struct dxbc_section
|
||||
{
|
||||
DWORD tag;
|
||||
const char *data;
|
||||
DWORD data_size;
|
||||
};
|
||||
|
||||
struct dxbc
|
||||
{
|
||||
UINT size;
|
||||
UINT count;
|
||||
struct dxbc_section *sections;
|
||||
struct vkd3d_shader_dxbc_section_desc *sections;
|
||||
};
|
||||
|
||||
HRESULT dxbc_write_blob(struct dxbc *dxbc, ID3DBlob **blob) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -1681,12 +1681,13 @@ err_out:
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s, struct dxbc_section *section)
|
||||
static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *s,
|
||||
const struct vkd3d_shader_dxbc_section_desc *section)
|
||||
{
|
||||
enum D3DCOMPILER_SIGNATURE_ELEMENT_SIZE element_size;
|
||||
const char *ptr = section->data.code;
|
||||
D3D11_SIGNATURE_PARAMETER_DESC *d;
|
||||
unsigned int string_data_offset;
|
||||
const char *ptr = section->data;
|
||||
unsigned int string_data_size;
|
||||
unsigned int i, count;
|
||||
char *string_data;
|
||||
|
@ -1723,7 +1724,7 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *
|
|||
|
||||
/* 2 u32s for the header, element_size for each element. */
|
||||
string_data_offset = 2 * sizeof(uint32_t) + count * element_size * sizeof(uint32_t);
|
||||
string_data_size = section->data_size - string_data_offset;
|
||||
string_data_size = section->data.size - string_data_offset;
|
||||
|
||||
string_data = HeapAlloc(GetProcessHeap(), 0, string_data_size);
|
||||
if (!string_data)
|
||||
|
@ -1732,7 +1733,7 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *
|
|||
HeapFree(GetProcessHeap(), 0, d);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
memcpy(string_data, section->data + string_data_offset, string_data_size);
|
||||
memcpy(string_data, (const char *)section->data.code + string_data_offset, string_data_size);
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
|
@ -1876,12 +1877,12 @@ static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_refl
|
|||
|
||||
for (i = 0; i < src_dxbc.count; ++i)
|
||||
{
|
||||
struct dxbc_section *section = &src_dxbc.sections[i];
|
||||
const struct vkd3d_shader_dxbc_section_desc *section = &src_dxbc.sections[i];
|
||||
|
||||
switch (section->tag)
|
||||
{
|
||||
case TAG_RDEF:
|
||||
hr = d3dcompiler_parse_rdef(reflection, section->data, section->data_size);
|
||||
hr = d3dcompiler_parse_rdef(reflection, section->data.code, section->data.size);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to parse RDEF section.\n");
|
||||
|
@ -1943,7 +1944,7 @@ static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_refl
|
|||
|
||||
case TAG_SHEX:
|
||||
case TAG_SHDR:
|
||||
hr = d3dcompiler_parse_shdr(reflection, section->data, section->data_size);
|
||||
hr = d3dcompiler_parse_shdr(reflection, section->data.code, section->data.size);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to parse SHDR section.\n");
|
||||
|
@ -1952,7 +1953,7 @@ static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_refl
|
|||
break;
|
||||
|
||||
case TAG_STAT:
|
||||
hr = d3dcompiler_parse_stat(reflection, section->data, section->data_size);
|
||||
hr = d3dcompiler_parse_stat(reflection, section->data.code, section->data.size);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to parse section STAT.\n");
|
||||
|
|
|
@ -538,7 +538,7 @@ HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, size_t
|
|||
|
||||
if (dxbc->count >= dxbc->size)
|
||||
{
|
||||
struct dxbc_section *new_sections;
|
||||
struct vkd3d_shader_dxbc_section_desc *new_sections;
|
||||
DWORD new_size = dxbc->size << 1;
|
||||
|
||||
new_sections = HeapReAlloc(GetProcessHeap(), 0, dxbc->sections, new_size * sizeof(*dxbc->sections));
|
||||
|
@ -553,8 +553,8 @@ HRESULT dxbc_add_section(struct dxbc *dxbc, DWORD tag, const char *data, size_t
|
|||
}
|
||||
|
||||
dxbc->sections[dxbc->count].tag = tag;
|
||||
dxbc->sections[dxbc->count].data_size = data_size;
|
||||
dxbc->sections[dxbc->count].data = data;
|
||||
dxbc->sections[dxbc->count].data.size = data_size;
|
||||
dxbc->sections[dxbc->count].data.code = data;
|
||||
++dxbc->count;
|
||||
|
||||
return S_OK;
|
||||
|
@ -670,7 +670,7 @@ HRESULT dxbc_write_blob(struct dxbc *dxbc, ID3DBlob **blob)
|
|||
|
||||
for (i = 0; i < dxbc->count; ++i)
|
||||
{
|
||||
size += 12 + dxbc->sections[i].data_size;
|
||||
size += 12 + dxbc->sections[i].data.size;
|
||||
}
|
||||
|
||||
hr = D3DCreateBlob(size, &object);
|
||||
|
@ -703,16 +703,16 @@ HRESULT dxbc_write_blob(struct dxbc *dxbc, ID3DBlob **blob)
|
|||
for (i = 0; i < dxbc->count; ++i)
|
||||
{
|
||||
write_u32(&ptr, offset);
|
||||
offset += 8 + dxbc->sections[i].data_size;
|
||||
offset += 8 + dxbc->sections[i].data.size;
|
||||
}
|
||||
|
||||
/* write the chunks */
|
||||
for (i = 0; i < dxbc->count; ++i)
|
||||
{
|
||||
write_u32(&ptr, dxbc->sections[i].tag);
|
||||
write_u32(&ptr, dxbc->sections[i].data_size);
|
||||
memcpy(ptr, dxbc->sections[i].data, dxbc->sections[i].data_size);
|
||||
ptr += dxbc->sections[i].data_size;
|
||||
write_u32(&ptr, dxbc->sections[i].data.size);
|
||||
memcpy(ptr, dxbc->sections[i].data.code, dxbc->sections[i].data.size);
|
||||
ptr += dxbc->sections[i].data.size;
|
||||
}
|
||||
|
||||
TRACE("Created ID3DBlob %p\n", object);
|
||||
|
|
Loading…
Reference in a new issue