Commit bfda69d0 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dcompiler: Fix error messages generation.

parent 1d160bed
...@@ -390,7 +390,7 @@ cleanup: ...@@ -390,7 +390,7 @@ cleanup:
return hr; return hr;
} }
static HRESULT assemble_shader(const char *preproc_shader, const char *preproc_messages, static HRESULT assemble_shader(const char *preproc_shader,
ID3DBlob **shader_blob, ID3DBlob **error_messages) ID3DBlob **shader_blob, ID3DBlob **error_messages)
{ {
struct bwriter_shader *shader; struct bwriter_shader *shader;
...@@ -403,26 +403,19 @@ static HRESULT assemble_shader(const char *preproc_shader, const char *preproc_m ...@@ -403,26 +403,19 @@ static HRESULT assemble_shader(const char *preproc_shader, const char *preproc_m
shader = SlAssembleShader(preproc_shader, &messages); shader = SlAssembleShader(preproc_shader, &messages);
if (messages || preproc_messages) if (messages)
{ {
if (preproc_messages) TRACE("Assembler messages:\n");
{ TRACE("%s", messages);
TRACE("Preprocessor messages:\n");
TRACE("%s", preproc_messages);
}
if (messages)
{
TRACE("Assembler messages:\n");
TRACE("%s", messages);
}
TRACE("Shader source:\n"); TRACE("Shader source:\n");
TRACE("%s\n", debugstr_a(preproc_shader)); TRACE("%s\n", debugstr_a(preproc_shader));
if (error_messages) if (error_messages)
{ {
size = (messages ? strlen(messages) : 0) + const char *preproc_messages = *error_messages ? ID3D10Blob_GetBufferPointer(*error_messages) : NULL;
(preproc_messages ? strlen(preproc_messages) : 0) + 1;
size = strlen(messages) + (preproc_messages ? strlen(preproc_messages) : 0) + 1;
hr = D3DCreateBlob(size, &buffer); hr = D3DCreateBlob(size, &buffer);
if (FAILED(hr)) if (FAILED(hr))
{ {
...@@ -436,9 +429,9 @@ static HRESULT assemble_shader(const char *preproc_shader, const char *preproc_m ...@@ -436,9 +429,9 @@ static HRESULT assemble_shader(const char *preproc_shader, const char *preproc_m
CopyMemory(pos, preproc_messages, strlen(preproc_messages) + 1); CopyMemory(pos, preproc_messages, strlen(preproc_messages) + 1);
pos += strlen(preproc_messages); pos += strlen(preproc_messages);
} }
if (messages) CopyMemory(pos, messages, strlen(messages) + 1);
CopyMemory(pos, messages, strlen(messages) + 1);
if (*error_messages) ID3D10Blob_Release(*error_messages);
*error_messages = buffer; *error_messages = buffer;
} }
HeapFree(GetProcessHeap(), 0, messages); HeapFree(GetProcessHeap(), 0, messages);
...@@ -492,7 +485,7 @@ HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filena ...@@ -492,7 +485,7 @@ HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filena
hr = preprocess_shader(data, datasize, defines, include, error_messages); hr = preprocess_shader(data, datasize, defines, include, error_messages);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = assemble_shader(wpp_output, wpp_messages, shader, error_messages); hr = assemble_shader(wpp_output, shader, error_messages);
HeapFree(GetProcessHeap(), 0, wpp_output); HeapFree(GetProcessHeap(), 0, wpp_output);
LeaveCriticalSection(&wpp_mutex); LeaveCriticalSection(&wpp_mutex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment