Commit 1d160bed authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dcompiler: Improve some parameter names and fix code style.

parent 86b68215
...@@ -390,8 +390,8 @@ cleanup: ...@@ -390,8 +390,8 @@ cleanup:
return hr; return hr;
} }
static HRESULT assemble_shader(const char *preprocShader, const char *preprocMessages, static HRESULT assemble_shader(const char *preproc_shader, const char *preproc_messages,
LPD3DBLOB* ppShader, LPD3DBLOB* ppErrorMsgs) ID3DBlob **shader_blob, ID3DBlob **error_messages)
{ {
struct bwriter_shader *shader; struct bwriter_shader *shader;
char *messages = NULL; char *messages = NULL;
...@@ -401,51 +401,50 @@ static HRESULT assemble_shader(const char *preprocShader, const char *preprocMes ...@@ -401,51 +401,50 @@ static HRESULT assemble_shader(const char *preprocShader, const char *preprocMes
int size; int size;
char *pos; char *pos;
shader = SlAssembleShader(preprocShader, &messages); shader = SlAssembleShader(preproc_shader, &messages);
if(messages || preprocMessages) if (messages || preproc_messages)
{ {
if(preprocMessages) if (preproc_messages)
{ {
TRACE("Preprocessor messages:\n"); TRACE("Preprocessor messages:\n");
TRACE("%s", preprocMessages); TRACE("%s", preproc_messages);
} }
if(messages) if (messages)
{ {
TRACE("Assembler messages:\n"); TRACE("Assembler messages:\n");
TRACE("%s", messages); TRACE("%s", messages);
} }
TRACE("Shader source:\n"); TRACE("Shader source:\n");
TRACE("%s\n", debugstr_a(preprocShader)); TRACE("%s\n", debugstr_a(preproc_shader));
if(ppErrorMsgs) if (error_messages)
{ {
size = (messages ? strlen(messages) : 0) + size = (messages ? strlen(messages) : 0) +
(preprocMessages ? strlen(preprocMessages) : 0) + 1; (preproc_messages ? strlen(preproc_messages) : 0) + 1;
hr = D3DCreateBlob(size, &buffer); hr = D3DCreateBlob(size, &buffer);
if(FAILED(hr)) if (FAILED(hr))
{ {
HeapFree(GetProcessHeap(), 0, messages); HeapFree(GetProcessHeap(), 0, messages);
if(shader) SlDeleteShader(shader); if (shader) SlDeleteShader(shader);
return hr; return hr;
} }
pos = ID3D10Blob_GetBufferPointer(buffer); pos = ID3D10Blob_GetBufferPointer(buffer);
if(preprocMessages) if (preproc_messages)
{ {
CopyMemory(pos, preprocMessages, strlen(preprocMessages) + 1); CopyMemory(pos, preproc_messages, strlen(preproc_messages) + 1);
pos += strlen(preprocMessages); pos += strlen(preproc_messages);
} }
if(messages) if (messages)
CopyMemory(pos, messages, strlen(messages) + 1); CopyMemory(pos, messages, strlen(messages) + 1);
*ppErrorMsgs = buffer; *error_messages = buffer;
} }
HeapFree(GetProcessHeap(), 0, messages); HeapFree(GetProcessHeap(), 0, messages);
} }
if(shader == NULL) if (shader == NULL)
{ {
ERR("Asm reading failed\n"); ERR("Asm reading failed\n");
return D3DXERR_INVALIDDATA; return D3DXERR_INVALIDDATA;
...@@ -453,23 +452,23 @@ static HRESULT assemble_shader(const char *preprocShader, const char *preprocMes ...@@ -453,23 +452,23 @@ static HRESULT assemble_shader(const char *preprocShader, const char *preprocMes
hr = SlWriteBytecode(shader, 9, &res); hr = SlWriteBytecode(shader, 9, &res);
SlDeleteShader(shader); SlDeleteShader(shader);
if(FAILED(hr)) if (FAILED(hr))
{ {
ERR("SlWriteBytecode failed with 0x%08x\n", hr); ERR("SlWriteBytecode failed with 0x%08x\n", hr);
return D3DXERR_INVALIDDATA; return D3DXERR_INVALIDDATA;
} }
if(ppShader) if (shader_blob)
{ {
size = HeapSize(GetProcessHeap(), 0, res); size = HeapSize(GetProcessHeap(), 0, res);
hr = D3DCreateBlob(size, &buffer); hr = D3DCreateBlob(size, &buffer);
if(FAILED(hr)) if (FAILED(hr))
{ {
HeapFree(GetProcessHeap(), 0, res); HeapFree(GetProcessHeap(), 0, res);
return hr; return hr;
} }
CopyMemory(ID3D10Blob_GetBufferPointer(buffer), res, size); CopyMemory(ID3D10Blob_GetBufferPointer(buffer), res, size);
*ppShader = buffer; *shader_blob = buffer;
} }
HeapFree(GetProcessHeap(), 0, res); HeapFree(GetProcessHeap(), 0, res);
......
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