Move constant table retrieval out of compileToBinary.

TRAC #22205 Signed-off-by: Daniel Koch Signed-off-by: Geoff Lang Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1545 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent d4cf251e
...@@ -2697,11 +2697,18 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha ...@@ -2697,11 +2697,18 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha
return NULL; return NULL;
} }
gl::D3DConstantTable *constantTable = NULL; ID3DBlob *binary = compileToBinary(infoLog, shaderHLSL, profile);
ID3DBlob *binary = compileToBinary(infoLog, shaderHLSL, profile, &constantTable);
if (!binary) if (!binary)
return NULL; return NULL;
gl::D3DConstantTable *constantTable = new gl::D3DConstantTable(binary->GetBufferPointer(), binary->GetBufferSize());
if (constantTable->error())
{
delete constantTable;
binary->Release();
return NULL;
}
ShaderExecutable *executable = loadExecutable(binary->GetBufferPointer(), binary->GetBufferSize(), type, constantTable); ShaderExecutable *executable = loadExecutable(binary->GetBufferPointer(), binary->GetBufferSize(), type, constantTable);
binary->Release(); binary->Release();
...@@ -2709,7 +2716,7 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha ...@@ -2709,7 +2716,7 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha
} }
// Compiles the HLSL code of the attached shaders into executable binaries // Compiles the HLSL code of the attached shaders into executable binaries
ID3DBlob *Renderer9::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, gl::D3DConstantTable **constantTable) ID3DBlob *Renderer9::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile)
{ {
if (!hlsl) if (!hlsl)
{ {
...@@ -2774,15 +2781,6 @@ ID3DBlob *Renderer9::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, con ...@@ -2774,15 +2781,6 @@ ID3DBlob *Renderer9::compileToBinary(gl::InfoLog &infoLog, const char *hlsl, con
if (SUCCEEDED(result)) if (SUCCEEDED(result))
{ {
gl::D3DConstantTable *table = new gl::D3DConstantTable(binary->GetBufferPointer(), binary->GetBufferSize());
if (table->error())
{
delete table;
binary->Release();
return NULL;
}
*constantTable = table;
return binary; return binary;
} }
else else
......
...@@ -184,7 +184,7 @@ class Renderer9 : public Renderer ...@@ -184,7 +184,7 @@ class Renderer9 : public Renderer
void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray); void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged); bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
ID3DBlob *compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile, gl::D3DConstantTable **constantTable); ID3DBlob *compileToBinary(gl::InfoLog &infoLog, const char *hlsl, const char *profile);
D3DPOOL getBufferPool(DWORD usage) const; D3DPOOL getBufferPool(DWORD usage) const;
......
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