From a6967368cbb3c0406367e18ef23feedd19a0f200 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 22 Nov 2015 16:34:38 +0000 Subject: [PATCH] [D3DCOMPILER_43] Sync with Wine Staging 1.7.55. CORE-10536 svn path=/trunk/; revision=70035 --- .../wine/d3dcompiler_43/CMakeLists.txt | 2 +- .../dll/directx/wine/d3dcompiler_43/blob.c | 14 +++++++ .../wine/d3dcompiler_43/bytecodewriter.c | 30 +++++++-------- .../directx/wine/d3dcompiler_43/compiler.c | 37 +++++++++++++++++-- .../wine/d3dcompiler_43/d3dcompiler_private.h | 4 +- .../{d3dcompiler_43_main.c => main.c} | 0 reactos/media/doc/README.WINE | 2 +- 7 files changed, 66 insertions(+), 23 deletions(-) rename reactos/dll/directx/wine/d3dcompiler_43/{d3dcompiler_43_main.c => main.c} (100%) diff --git a/reactos/dll/directx/wine/d3dcompiler_43/CMakeLists.txt b/reactos/dll/directx/wine/d3dcompiler_43/CMakeLists.txt index 7578f2fd662..aa8f6b1efb0 100644 --- a/reactos/dll/directx/wine/d3dcompiler_43/CMakeLists.txt +++ b/reactos/dll/directx/wine/d3dcompiler_43/CMakeLists.txt @@ -13,9 +13,9 @@ list(APPEND SOURCE blob.c bytecodewriter.c compiler.c - d3dcompiler_43_main.c hlsl.tab.c hlsl.yy.c + main.c reflection.c utils.c d3dcompiler_private.h diff --git a/reactos/dll/directx/wine/d3dcompiler_43/blob.c b/reactos/dll/directx/wine/d3dcompiler_43/blob.c index c04891a20a6..896038a9d09 100644 --- a/reactos/dll/directx/wine/d3dcompiler_43/blob.c +++ b/reactos/dll/directx/wine/d3dcompiler_43/blob.c @@ -460,3 +460,17 @@ HRESULT WINAPI D3DStripShader(const void *data, SIZE_T data_size, UINT flags, ID return d3dcompiler_strip_shader(data, data_size, flags, blob); } + +HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents) +{ + FIXME("filename %s, contents %p\n", debugstr_w(filename), contents); + + return E_NOTIMPL; +} + +HRESULT WINAPI D3DWriteBlobToFile(ID3DBlob* blob, const WCHAR *filename, BOOL overwrite) +{ + FIXME("blob %p, filename %s, overwrite %d\n", blob, debugstr_w(filename), overwrite); + + return E_NOTIMPL; +} diff --git a/reactos/dll/directx/wine/d3dcompiler_43/bytecodewriter.c b/reactos/dll/directx/wine/d3dcompiler_43/bytecodewriter.c index 17ea050624f..2b36319b833 100644 --- a/reactos/dll/directx/wine/d3dcompiler_43/bytecodewriter.c +++ b/reactos/dll/directx/wine/d3dcompiler_43/bytecodewriter.c @@ -598,7 +598,7 @@ static void write_declarations(struct bc_writer *This, put_dword(buffer, instr_dcl); /* Write the usage and index */ - token = (1 << 31); /* Bit 31 of non-instruction opcodes is 1 */ + token = (1u << 31); /* Bit 31 of non-instruction opcodes is 1 */ token |= (decls[i].usage << D3DSP_DCL_USAGE_SHIFT) & D3DSP_DCL_USAGE_MASK; token |= (decls[i].usage_idx << D3DSP_DCL_USAGEINDEX_SHIFT) & D3DSP_DCL_USAGEINDEX_MASK; put_dword(buffer, token); @@ -614,7 +614,7 @@ static void write_declarations(struct bc_writer *This, static void write_const(struct constant **consts, int num, DWORD opcode, DWORD reg_type, struct bytecode_buffer *buffer, BOOL len) { int i; DWORD instr_def = opcode; - const DWORD reg = (1<<31) | d3dsp_register( reg_type, 0 ) | D3DSP_WRITEMASK_ALL; + const DWORD reg = (1u << 31) | d3dsp_register( reg_type, 0 ) | D3DSP_WRITEMASK_ALL; if(len) { if(opcode == D3DSIO_DEFB) @@ -885,7 +885,7 @@ static DWORD map_vs_output(struct bc_writer *This, DWORD regnum, DWORD mask, DWO static void vs_12_dstreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer, DWORD shift, DWORD mod) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ DWORD has_wmask; if(reg->rel_reg) { @@ -959,7 +959,7 @@ static void vs_12_dstreg(struct bc_writer *This, const struct shader_reg *reg, static void vs_1_x_srcreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ DWORD has_swizzle; DWORD component; @@ -1070,7 +1070,7 @@ static DWORD map_ps_input(struct bc_writer *This, static void ps_1_0123_srcreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ if(reg->rel_reg) { WARN("Relative addressing not supported in <= ps_3_0\n"); This->state = E_INVALIDARG; @@ -1116,7 +1116,7 @@ static void ps_1_0123_srcreg(struct bc_writer *This, const struct shader_reg *re static void ps_1_0123_dstreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer, DWORD shift, DWORD mod) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ if(reg->rel_reg) { WARN("Relative addressing not supported for destination registers\n"); @@ -1378,7 +1378,7 @@ static const struct bytecode_backend ps_1_0123_backend = { static void ps_1_4_srcreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ if(reg->rel_reg) { WARN("Relative addressing not supported in <= ps_3_0\n"); This->state = E_INVALIDARG; @@ -1417,7 +1417,7 @@ static void ps_1_4_srcreg(struct bc_writer *This, const struct shader_reg *reg, static void ps_1_4_dstreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer, DWORD shift, DWORD mod) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ if(reg->rel_reg) { WARN("Relative addressing not supported for destination registers\n"); @@ -1564,7 +1564,7 @@ static void vs_2_header(struct bc_writer *This, static void vs_2_srcreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ DWORD has_swizzle; DWORD component; DWORD d3d9reg; @@ -1799,12 +1799,12 @@ static void write_samplers(const struct bwriter_shader *shader, struct bytecode_ DWORD i; DWORD instr_dcl = D3DSIO_DCL | (2 << D3DSI_INSTLENGTH_SHIFT); DWORD token; - const DWORD reg = (1<<31) | d3dsp_register( D3DSPR_SAMPLER, 0 ) | D3DSP_WRITEMASK_ALL; + const DWORD reg = (1u << 31) | d3dsp_register( D3DSPR_SAMPLER, 0 ) | D3DSP_WRITEMASK_ALL; for(i = 0; i < shader->num_samplers; i++) { /* Write the DCL instruction */ put_dword(buffer, instr_dcl); - token = (1<<31); + token = (1u << 31); /* Already shifted */ token |= (d3d9_sampler(shader->samplers[i].type)) & D3DSP_TEXTURETYPE_MASK; put_dword(buffer, token); @@ -1831,7 +1831,7 @@ static void ps_2_header(struct bc_writer *This, const struct bwriter_shader *sha static void ps_2_srcreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ DWORD d3d9reg; if(reg->rel_reg) { WARN("Relative addressing not supported in <= ps_3_0\n"); @@ -1886,7 +1886,7 @@ static void ps_2_0_dstreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer, DWORD shift, DWORD mod) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ DWORD d3d9reg; if(reg->rel_reg) { @@ -2059,7 +2059,7 @@ static void sm_3_header(struct bc_writer *This, const struct bwriter_shader *sha static void sm_3_srcreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ DWORD d3d9reg; d3d9reg = d3d9_register(reg->type); @@ -2098,7 +2098,7 @@ static void sm_3_dstreg(struct bc_writer *This, const struct shader_reg *reg, struct bytecode_buffer *buffer, DWORD shift, DWORD mod) { - DWORD token = (1 << 31); /* Bit 31 of registers is 1 */ + DWORD token = (1u << 31); /* Bit 31 of registers is 1 */ DWORD d3d9reg; if(reg->rel_reg) { diff --git a/reactos/dll/directx/wine/d3dcompiler_43/compiler.c b/reactos/dll/directx/wine/d3dcompiler_43/compiler.c index 29615c5e2db..2f1821edb0d 100644 --- a/reactos/dll/directx/wine/d3dcompiler_43/compiler.c +++ b/reactos/dll/directx/wine/d3dcompiler_43/compiler.c @@ -687,16 +687,23 @@ static HRESULT compile_shader(const char *preproc_shader, const char *target, co return S_OK; } -HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename, +HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, - const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages) + const char *target, UINT sflags, UINT eflags, UINT secondary_flags, + const void *secondary_data, SIZE_T secondary_data_size, ID3DBlob **shader, + ID3DBlob **error_messages) { HRESULT hr; TRACE("data %p, data_size %lu, filename %s, defines %p, include %p, entrypoint %s,\n" - "target %s, sflags %#x, eflags %#x, shader %p, error_messages %p\n", + "target %s, sflags %#x, eflags %#x, secondary_flags %#x, secondary_data %p,\n" + "secondary_data_size %lu, shader %p, error_messages %p\n", data, data_size, debugstr_a(filename), defines, include, debugstr_a(entrypoint), - debugstr_a(target), sflags, eflags, shader, error_messages); + debugstr_a(target), sflags, eflags, secondary_flags, secondary_data, + secondary_data_size, shader, error_messages); + + if (secondary_data) + FIXME("secondary data not implemented yet\n"); if (shader) *shader = NULL; if (error_messages) *error_messages = NULL; @@ -712,6 +719,19 @@ HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filena return hr; } +HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename, + const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, + const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages) +{ + TRACE("data %p, data_size %lu, filename %s, defines %p, include %p, entrypoint %s,\n" + "target %s, sflags %#x, eflags %#x, shader %p, error_messages %p\n", + data, data_size, debugstr_a(filename), defines, include, debugstr_a(entrypoint), + debugstr_a(target), sflags, eflags, shader, error_messages); + + return D3DCompile2(data, data_size, filename, defines, include, entrypoint, target, sflags, + eflags, 0, NULL, 0, shader, error_messages); +} + HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages) @@ -758,3 +778,12 @@ HRESULT WINAPI D3DDisassemble(const void *data, SIZE_T size, UINT flags, const c data, size, flags, comments, disassembly); return E_NOTIMPL; } + +HRESULT WINAPI D3DCompileFromFile(const WCHAR *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *includes, + const char *entrypoint, const char *target, UINT flags1, UINT flags2, ID3DBlob **code, ID3DBlob **errors) +{ + FIXME("filename %s, defines %p, includes %p, entrypoint %s, target %s, flags1 %x, flags2 %x, code %p, errors %p\n", + debugstr_w(filename), defines, includes, debugstr_a(entrypoint), debugstr_a(target), flags1, flags2, code, errors); + + return E_NOTIMPL; +} diff --git a/reactos/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h b/reactos/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h index b0c93895a62..c7ed2e9597c 100644 --- a/reactos/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h +++ b/reactos/dll/directx/wine/d3dcompiler_43/d3dcompiler_private.h @@ -535,8 +535,8 @@ enum bwritershader_param_srcmod_type BWRITERSPSM_NOT, }; -#define BWRITER_SM1_VS 0xfffe -#define BWRITER_SM1_PS 0xffff +#define BWRITER_SM1_VS 0xfffeu +#define BWRITER_SM1_PS 0xffffu #define BWRITERPS_VERSION(major, minor) ((BWRITER_SM1_PS << 16) | ((major) << 8) | (minor)) #define BWRITERVS_VERSION(major, minor) ((BWRITER_SM1_VS << 16) | ((major) << 8) | (minor)) diff --git a/reactos/dll/directx/wine/d3dcompiler_43/d3dcompiler_43_main.c b/reactos/dll/directx/wine/d3dcompiler_43/main.c similarity index 100% rename from reactos/dll/directx/wine/d3dcompiler_43/d3dcompiler_43_main.c rename to reactos/dll/directx/wine/d3dcompiler_43/main.c diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 9429aa8192a..d204ba953e7 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -24,7 +24,7 @@ The following libraries are shared with Wine. reactos/dll/directx/wine/amstream # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/d3d8 # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/d3d9 # Synced to WineStaging-1.7.55 -reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-1.7.47 +reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/d3drm # Synced to WineStaging-1.7.47 reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.7.47