mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 12:58:33 +02:00
revert the mess i made in the d3d plugin. Add way to use HLSL directly without going through Cg. Not that the results look much better... i do see shadows of spinning cars in Burnout 2 after clicking around in the dark. Then it crashes.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2504 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -85,8 +85,9 @@ void VertexShaderCache::SetShader(u32 components)
|
||||
return;
|
||||
}
|
||||
|
||||
bool HLSL = false;
|
||||
const char *code = GenerateVertexShader(components, false);
|
||||
LPDIRECT3DVERTEXSHADER9 shader = CompileCgShader(code);
|
||||
LPDIRECT3DVERTEXSHADER9 shader = HLSL ? D3D::CompileVertexShader(code, strlen(code), false) : CompileCgShader(code);
|
||||
if (shader)
|
||||
{
|
||||
// Make an entry in the table
|
||||
@ -121,33 +122,9 @@ LPDIRECT3DVERTEXSHADER9 VertexShaderCache::CompileCgShader(const char *pstrprogr
|
||||
}
|
||||
const char *pcompiledprog = cgGetProgramString(tempprog, CG_COMPILED_PROGRAM);
|
||||
|
||||
LPD3DXBUFFER shader_binary;
|
||||
LPD3DXBUFFER error_msg;
|
||||
|
||||
// Step one - Assemble into binary code. This binary code could be cached.
|
||||
if (FAILED(D3DXAssembleShader(pcompiledprog, (UINT)strlen(pcompiledprog), NULL, NULL, 0, &shader_binary, &error_msg)))
|
||||
PanicAlert("Asm fail");
|
||||
// Destroy Cg program as early as possible - we want as little as possible to do with Cg due to
|
||||
// our rather extreme performance requirements.
|
||||
LPDIRECT3DVERTEXSHADER9 vertex_shader = D3D::CompileVertexShader(pcompiledprog, (int)strlen(pcompiledprog), true);
|
||||
cgDestroyProgram(tempprog);
|
||||
tempprog = NULL;
|
||||
|
||||
// Create vertex shader from the binary code.
|
||||
LPDIRECT3DVERTEXSHADER9 vertex_shader = NULL;
|
||||
if (SUCCEEDED(D3D::dev->CreateVertexShader((const DWORD *)shader_binary->GetBufferPointer(), &vertex_shader))) {
|
||||
// PanicAlert("Successvertex!");
|
||||
} else {
|
||||
if (error_msg) {
|
||||
PanicAlert("failure vertex %s", error_msg->GetBufferPointer());
|
||||
MessageBox(0, pcompiledprog, 0, 0);
|
||||
}
|
||||
else
|
||||
PanicAlert("failure vertex with no error message.");
|
||||
}
|
||||
if (shader_binary)
|
||||
shader_binary->Release();
|
||||
if (error_msg)
|
||||
error_msg->Release();
|
||||
return vertex_shader;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user