mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-22 21:09:52 +00:00
d3d9: Show error when default shaders fail.
This commit is contained in:
parent
265094f614
commit
b97af10a6d
@ -139,22 +139,25 @@ bool CompileVertexShader(const char *code, LPDIRECT3DVERTEXSHADER9 *pShader, LPD
|
||||
return true;
|
||||
}
|
||||
|
||||
void CompileShaders() {
|
||||
std::string errorMsg;
|
||||
|
||||
bool CompileShaders(std::string &errorMsg) {
|
||||
if (!CompileVertexShader(vscode, &pFramebufferVertexShader, NULL, errorMsg)) {
|
||||
OutputDebugStringA(errorMsg.c_str());
|
||||
DebugBreak();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CompilePixelShader(pscode, &pFramebufferPixelShader, NULL, errorMsg)) {
|
||||
OutputDebugStringA(errorMsg.c_str());
|
||||
DebugBreak();
|
||||
if (pFramebufferVertexShader) {
|
||||
pFramebufferVertexShader->Release();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
pD3Ddevice->CreateVertexDeclaration(VertexElements, &pFramebufferVertexDecl);
|
||||
pD3Ddevice->SetVertexDeclaration(pFramebufferVertexDecl);
|
||||
pD3Ddevice->CreateVertexDeclaration(SoftTransVertexElements, &pSoftVertexDecl);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DestroyShaders() {
|
||||
@ -207,7 +210,8 @@ void DirectxInit(HWND window) {
|
||||
pD3Ddevice->SetRingBufferParameters( &d3dr );
|
||||
#endif
|
||||
|
||||
CompileShaders();
|
||||
std::string errorMessage;
|
||||
CompileShaders(errorMessage);
|
||||
|
||||
fbo_init(pD3D);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ extern LPDIRECT3DPIXELSHADER9 pFramebufferPixelShader; // Pixel Shader
|
||||
extern IDirect3DVertexDeclaration9* pFramebufferVertexDecl;
|
||||
extern IDirect3DVertexDeclaration9* pSoftVertexDecl;
|
||||
|
||||
void CompileShaders();
|
||||
bool CompileShaders(std::string &errorMessage);
|
||||
bool CompilePixelShader(const char *code, LPDIRECT3DPIXELSHADER9 *pShader, ID3DXConstantTable **pShaderTable, std::string &errorMessage);
|
||||
bool CompileVertexShader(const char *code, LPDIRECT3DVERTEXSHADER9 *pShader, ID3DXConstantTable **pShaderTable, std::string &errorMessage);
|
||||
void DestroyShaders();
|
||||
|
@ -153,11 +153,7 @@ bool D3D9_Init(HWND hWnd, bool windowed, std::string *error_message) {
|
||||
|
||||
if (FAILED(hr)) {
|
||||
*error_message = "Failed to create D3D device";
|
||||
if (has9Ex) {
|
||||
d3dEx->Release();
|
||||
} else {
|
||||
d3d->Release();
|
||||
}
|
||||
d3d->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -167,7 +163,18 @@ bool D3D9_Init(HWND hWnd, bool windowed, std::string *error_message) {
|
||||
|
||||
LoadD3DX9Dynamic();
|
||||
|
||||
DX9::CompileShaders();
|
||||
if (!DX9::CompileShaders(*error_message)) {
|
||||
*error_message = "Unable to compile shaders: " + *error_message;
|
||||
device->EndScene();
|
||||
device->Release();
|
||||
d3d->Release();
|
||||
DX9::pD3Ddevice = nullptr;
|
||||
DX9::pD3DdeviceEx = nullptr;
|
||||
device = nullptr;
|
||||
UnloadD3DXDynamic();
|
||||
return false;
|
||||
}
|
||||
|
||||
DX9::fbo_init(d3d);
|
||||
|
||||
if (deviceEx && IsWin7OrLater()) {
|
||||
@ -182,12 +189,13 @@ void D3D9_Resize(HWND window) {
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void D3D9_Shutdown() {
|
||||
void D3D9_Shutdown() {
|
||||
DX9::DestroyShaders();
|
||||
DX9::fbo_shutdown();
|
||||
device->EndScene();
|
||||
device->Release();
|
||||
d3d->Release();
|
||||
UnloadD3DXDynamic();
|
||||
DX9::pD3Ddevice = nullptr;
|
||||
DX9::pD3DdeviceEx = nullptr;
|
||||
device = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user