diff --git a/dlls/d3dcompiler_43/bytecodewriter.c b/dlls/d3dcompiler_43/bytecodewriter.c index 54321ed84d6..5a3e7f2333e 100644 --- a/dlls/d3dcompiler_43/bytecodewriter.c +++ b/dlls/d3dcompiler_43/bytecodewriter.c @@ -2543,22 +2543,8 @@ static HRESULT call_instr_handler(struct bc_writer *writer, return E_INVALIDARG; } -/* SlWriteBytecode (wineshader.@) - * - * Writes shader version specific bytecode from the shader passed in. - * The returned bytecode can be passed to the Direct3D runtime like - * IDirect3DDevice9::Create*Shader. - * - * Parameters: - * shader: Shader to translate into bytecode - * version: Shader version to generate(d3d version token) - * dxversion: DirectX version the code targets - * result: the resulting shader bytecode - * - * Return values: - * S_OK on success - */ -DWORD SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result) { +HRESULT SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result, DWORD *size) +{ struct bc_writer *writer; struct bytecode_buffer *buffer = NULL; HRESULT hr; @@ -2610,12 +2596,8 @@ DWORD SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD goto error; } - /* Cut off unneeded memory from the result buffer */ - *result = d3dcompiler_realloc(buffer->data, - sizeof(DWORD) * buffer->size); - if(!*result) { - *result = buffer->data; - } + *size = buffer->size * sizeof(DWORD); + *result = buffer->data; buffer->data = NULL; hr = S_OK; diff --git a/dlls/d3dcompiler_43/compiler.c b/dlls/d3dcompiler_43/compiler.c index 7f4ebdba42a..e273d6b265f 100644 --- a/dlls/d3dcompiler_43/compiler.c +++ b/dlls/d3dcompiler_43/compiler.c @@ -396,9 +396,8 @@ static HRESULT assemble_shader(const char *preproc_shader, struct bwriter_shader *shader; char *messages = NULL; HRESULT hr; - DWORD *res; - LPD3DBLOB buffer; - int size; + DWORD *res, size; + ID3DBlob *buffer; char *pos; shader = SlAssembleShader(preproc_shader, &messages); @@ -443,7 +442,7 @@ static HRESULT assemble_shader(const char *preproc_shader, return D3DXERR_INVALIDDATA; } - hr = SlWriteBytecode(shader, 9, &res); + hr = SlWriteBytecode(shader, 9, &res, &size); SlDeleteShader(shader); if (FAILED(hr)) { @@ -453,7 +452,6 @@ static HRESULT assemble_shader(const char *preproc_shader, if (shader_blob) { - size = HeapSize(GetProcessHeap(), 0, res); hr = D3DCreateBlob(size, &buffer); if (FAILED(hr)) { diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index d7190216f43..e64f4cfb59b 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -570,7 +570,7 @@ typedef enum _BWRITERDECLUSAGE { #define T3_REG 5 struct bwriter_shader *SlAssembleShader(const char *text, char **messages) DECLSPEC_HIDDEN; -DWORD SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result) DECLSPEC_HIDDEN; +HRESULT SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result, DWORD *size) DECLSPEC_HIDDEN; void SlDeleteShader(struct bwriter_shader *shader) DECLSPEC_HIDDEN; #define MAKE_TAG(ch0, ch1, ch2, ch3) \