d3dcompiler: Improve some parameter names and fix code style.

This commit is contained in:
Matteo Bruni 2011-01-12 23:06:44 +01:00 committed by Alexandre Julliard
parent 86b682154b
commit 1d160beda0
1 changed files with 22 additions and 23 deletions

View File

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