Made "Show shader compilation errors" work in D3D. Some games actually work behind the curtain of shader compilation errors!
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2612 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c674e6330f
commit
eab121ea31
|
@ -43,6 +43,7 @@ LPDIRECT3DVERTEXSHADER9 CompileVertexShader(const char *code, int len, bool asse
|
||||||
std::string hello = (char*)errorBuffer->GetBufferPointer();
|
std::string hello = (char*)errorBuffer->GetBufferPointer();
|
||||||
hello += "\n\n";
|
hello += "\n\n";
|
||||||
hello += code;
|
hello += code;
|
||||||
|
if(g_Config.bShowShaderErrors)
|
||||||
MessageBox(0, hello.c_str(), "Error assembling vertex shader", MB_ICONERROR);
|
MessageBox(0, hello.c_str(), "Error assembling vertex shader", MB_ICONERROR);
|
||||||
vShader = 0;
|
vShader = 0;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +53,7 @@ LPDIRECT3DVERTEXSHADER9 CompileVertexShader(const char *code, int len, bool asse
|
||||||
HRESULT hr = E_FAIL;
|
HRESULT hr = E_FAIL;
|
||||||
if (shaderBuffer)
|
if (shaderBuffer)
|
||||||
hr = D3D::dev->CreateVertexShader((DWORD *)shaderBuffer->GetBufferPointer(), &vShader);
|
hr = D3D::dev->CreateVertexShader((DWORD *)shaderBuffer->GetBufferPointer(), &vShader);
|
||||||
if (FAILED(hr) || vShader == 0)
|
if ((FAILED(hr) || vShader == 0) && g_Config.bShowShaderErrors)
|
||||||
{
|
{
|
||||||
MessageBox(0, code, (char*)errorBuffer->GetBufferPointer(),MB_ICONERROR);
|
MessageBox(0, code, (char*)errorBuffer->GetBufferPointer(),MB_ICONERROR);
|
||||||
}
|
}
|
||||||
|
@ -86,6 +87,7 @@ LPDIRECT3DPIXELSHADER9 CompilePixelShader(const char *code, int len, bool assemb
|
||||||
std::string hello = (char*)errorBuffer->GetBufferPointer();
|
std::string hello = (char*)errorBuffer->GetBufferPointer();
|
||||||
hello += "\n\n";
|
hello += "\n\n";
|
||||||
hello += code;
|
hello += code;
|
||||||
|
if(g_Config.bShowShaderErrors)
|
||||||
MessageBox(0, hello.c_str(), "Error assembling pixel shader", MB_ICONERROR);
|
MessageBox(0, hello.c_str(), "Error assembling pixel shader", MB_ICONERROR);
|
||||||
pShader = 0;
|
pShader = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "Statistics.h"
|
#include "Statistics.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
|
#include "Config.h"
|
||||||
#include "PixelShaderGen.h"
|
#include "PixelShaderGen.h"
|
||||||
#include "PixelShaderManager.h"
|
#include "PixelShaderManager.h"
|
||||||
#include "PixelShaderCache.h"
|
#include "PixelShaderCache.h"
|
||||||
|
@ -99,7 +100,7 @@ void PixelShaderCache::SetShader()
|
||||||
|
|
||||||
INCSTAT(stats.numPixelShadersCreated);
|
INCSTAT(stats.numPixelShadersCreated);
|
||||||
SETSTAT(stats.numPixelShadersAlive, (int)PixelShaders.size());
|
SETSTAT(stats.numPixelShadersAlive, (int)PixelShaders.size());
|
||||||
} else
|
} else if(g_Config.bShowShaderErrors)
|
||||||
PanicAlert("Failed to compile Pixel Shader:\n\n%s", code);
|
PanicAlert("Failed to compile Pixel Shader:\n\n%s", code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ static std::list<Message> s_listMsgs;
|
||||||
|
|
||||||
void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
|
void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
|
||||||
{
|
{
|
||||||
|
if(!g_Config.bShowShaderErrors)
|
||||||
|
return;
|
||||||
|
|
||||||
PanicAlert("Cg error: %s\n", cgGetErrorString(err));
|
PanicAlert("Cg error: %s\n", cgGetErrorString(err));
|
||||||
const char* listing = cgGetLastListing(g_cgcontext);
|
const char* listing = cgGetLastListing(g_cgcontext);
|
||||||
if (listing != NULL) {
|
if (listing != NULL) {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "Statistics.h"
|
#include "Statistics.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
|
#include "Config.h"
|
||||||
#include "VertexShaderCache.h"
|
#include "VertexShaderCache.h"
|
||||||
#include "VertexLoader.h"
|
#include "VertexLoader.h"
|
||||||
#include "BPMemory.h"
|
#include "BPMemory.h"
|
||||||
|
@ -100,9 +101,8 @@ void VertexShaderCache::SetShader(u32 components)
|
||||||
|
|
||||||
INCSTAT(stats.numVertexShadersCreated);
|
INCSTAT(stats.numVertexShadersCreated);
|
||||||
SETSTAT(stats.numVertexShadersAlive, (int)vshaders.size());
|
SETSTAT(stats.numVertexShadersAlive, (int)vshaders.size());
|
||||||
} else {
|
} else if(g_Config.bShowShaderErrors)
|
||||||
PanicAlert("Failed to compile Vertex Shader:\n\n%s", code);
|
PanicAlert("Failed to compile Vertex Shader:\n\n%s", code);
|
||||||
}
|
|
||||||
|
|
||||||
D3D::dev->SetFVF(NULL);
|
D3D::dev->SetFVF(NULL);
|
||||||
D3D::dev->SetVertexShader(shader);
|
D3D::dev->SetVertexShader(shader);
|
||||||
|
|
Loading…
Reference in New Issue