mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 15:59:23 +01:00
An alert is displayed once per run if pixel shaders or vertex shaders fail to compile. Resources are cleaned up if shader compilation fails. Tev coords are zeroed in the pixel shader if there are no tex gens.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2493 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
5b033732b8
commit
e004800e68
@ -712,25 +712,24 @@ static void WriteStage(char *&p, int n, u32 texture_mask)
|
|||||||
if(!bHasIndStage) {
|
if(!bHasIndStage) {
|
||||||
// calc tevcord
|
// calc tevcord
|
||||||
//tevcoord.xy = texdim[1].xy * uv1.xy / uv1.z;
|
//tevcoord.xy = texdim[1].xy * uv1.xy / uv1.z;
|
||||||
int OurTexCoord = 0;
|
if(bpmem.genMode.numtexgens) {
|
||||||
if(bpmem.genMode.numtexgens)
|
if (texture_mask & (1<<texmap)) {
|
||||||
OurTexCoord = texcoord;
|
// nonpow2
|
||||||
else
|
if (texfun == XF_TEXPROJ_STQ )
|
||||||
OurTexCoord = 0;
|
WRITE(p, "tevcoord.xy = uv%d.xy / uv%d.z;\n", texcoord, texcoord);
|
||||||
if (texture_mask & (1<<texmap)) {
|
else
|
||||||
// nonpow2
|
WRITE(p, "tevcoord.xy = uv%d.xy;\n", texcoord);
|
||||||
if (texfun == XF_TEXPROJ_STQ )
|
WrapNonPow2Tex(p, "tevcoord", texmap, texture_mask);
|
||||||
WRITE(p, "tevcoord.xy = uv%d.xy / uv%d.z;\n", texcoord, OurTexCoord);
|
}
|
||||||
else
|
else {
|
||||||
WRITE(p, "tevcoord.xy = uv%d.xy;\n", OurTexCoord);
|
if (texfun == XF_TEXPROJ_STQ )
|
||||||
WrapNonPow2Tex(p, "tevcoord", texmap, texture_mask);
|
WRITE(p, "tevcoord.xy = "I_TEXDIMS"[%d].xy * uv%d.xy / uv%d.z;\n", texmap, texcoord , texcoord );
|
||||||
}
|
else
|
||||||
else {
|
WRITE(p, "tevcoord.xy = "I_TEXDIMS"[%d].xy * uv%d.xy;\n", texmap, texcoord);
|
||||||
if (texfun == XF_TEXPROJ_STQ )
|
}
|
||||||
WRITE(p, "tevcoord.xy = "I_TEXDIMS"[%d].xy * uv%d.xy / uv%d.z;\n", texmap, OurTexCoord , OurTexCoord );
|
} else {
|
||||||
else
|
// donkopunchstania - check that this is correct when there are no tex gens
|
||||||
WRITE(p, "tevcoord.xy = "I_TEXDIMS"[%d].xy * uv%d.xy;\n", texmap, OurTexCoord);
|
WRITE(p, "tevcoord.xy = float2(0.0f,0.0f);\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (texture_mask & (1<<texmap)) {
|
else if (texture_mask & (1<<texmap)) {
|
||||||
|
@ -38,6 +38,7 @@ static int s_nMaxPixelInstructions;
|
|||||||
static GLuint s_ColorMatrixProgram = 0;
|
static GLuint s_ColorMatrixProgram = 0;
|
||||||
PixelShaderCache::PSCache PixelShaderCache::pshaders;
|
PixelShaderCache::PSCache PixelShaderCache::pshaders;
|
||||||
PIXELSHADERUID PixelShaderCache::s_curuid;
|
PIXELSHADERUID PixelShaderCache::s_curuid;
|
||||||
|
bool PixelShaderCache::s_displayCompileAlert;
|
||||||
|
|
||||||
static FRAGMENTSHADER* pShaderLast = NULL;
|
static FRAGMENTSHADER* pShaderLast = NULL;
|
||||||
|
|
||||||
@ -55,6 +56,8 @@ void PixelShaderCache::Init()
|
|||||||
{
|
{
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
|
s_displayCompileAlert = true;
|
||||||
|
|
||||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, (GLint *)&s_nMaxPixelInstructions);
|
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, (GLint *)&s_nMaxPixelInstructions);
|
||||||
|
|
||||||
int maxinst, maxattribs;
|
int maxinst, maxattribs;
|
||||||
@ -178,6 +181,11 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
|
|||||||
const char *opts[] = {"-profileopts", stropt, "-O2", "-q", NULL};
|
const char *opts[] = {"-profileopts", stropt, "-O2", "-q", NULL};
|
||||||
CGprogram tempprog = cgCreateProgram(g_cgcontext, CG_SOURCE, pstrprogram, g_cgfProf, "main", opts);
|
CGprogram tempprog = cgCreateProgram(g_cgcontext, CG_SOURCE, pstrprogram, g_cgfProf, "main", opts);
|
||||||
if (!cgIsProgram(tempprog) || cgGetError() != CG_NO_ERROR) {
|
if (!cgIsProgram(tempprog) || cgGetError() != CG_NO_ERROR) {
|
||||||
|
if (s_displayCompileAlert) {
|
||||||
|
PanicAlert("Failed to create pixel shader");
|
||||||
|
s_displayCompileAlert = false;
|
||||||
|
}
|
||||||
|
cgDestroyProgram(tempprog);
|
||||||
ERROR_LOG(VIDEO, "Failed to create ps %s:\n", cgGetLastListing(g_cgcontext));
|
ERROR_LOG(VIDEO, "Failed to create ps %s:\n", cgGetLastListing(g_cgcontext));
|
||||||
ERROR_LOG(VIDEO, pstrprogram);
|
ERROR_LOG(VIDEO, pstrprogram);
|
||||||
return false;
|
return false;
|
||||||
|
@ -51,6 +51,8 @@ class PixelShaderCache
|
|||||||
|
|
||||||
static PIXELSHADERUID s_curuid; // the current pixel shader uid (progressively changed as memory is written)
|
static PIXELSHADERUID s_curuid; // the current pixel shader uid (progressively changed as memory is written)
|
||||||
|
|
||||||
|
static bool s_displayCompileAlert;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void Init();
|
||||||
static void ProgressiveCleanup();
|
static void ProgressiveCleanup();
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "ImageWrite.h"
|
#include "ImageWrite.h"
|
||||||
|
|
||||||
VertexShaderCache::VSCache VertexShaderCache::vshaders;
|
VertexShaderCache::VSCache VertexShaderCache::vshaders;
|
||||||
|
bool VertexShaderCache::s_displayCompileAlert;
|
||||||
|
|
||||||
static VERTEXSHADER *pShaderLast = NULL;
|
static VERTEXSHADER *pShaderLast = NULL;
|
||||||
static int s_nMaxVertexInstructions;
|
static int s_nMaxVertexInstructions;
|
||||||
@ -54,7 +55,9 @@ void SetVSConstant4fv(int const_number, const float *f)
|
|||||||
|
|
||||||
void VertexShaderCache::Init()
|
void VertexShaderCache::Init()
|
||||||
{
|
{
|
||||||
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&s_nMaxVertexInstructions);
|
s_displayCompileAlert = true;
|
||||||
|
|
||||||
|
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&s_nMaxVertexInstructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexShaderCache::Shutdown()
|
void VertexShaderCache::Shutdown()
|
||||||
@ -137,6 +140,11 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
|
|||||||
const char *opts[] = {"-profileopts", stropt, "-O2", "-q", NULL};
|
const char *opts[] = {"-profileopts", stropt, "-O2", "-q", NULL};
|
||||||
CGprogram tempprog = cgCreateProgram(g_cgcontext, CG_SOURCE, pstrprogram, g_cgvProf, "main", opts);
|
CGprogram tempprog = cgCreateProgram(g_cgcontext, CG_SOURCE, pstrprogram, g_cgvProf, "main", opts);
|
||||||
if (!cgIsProgram(tempprog) || cgGetError() != CG_NO_ERROR) {
|
if (!cgIsProgram(tempprog) || cgGetError() != CG_NO_ERROR) {
|
||||||
|
if (s_displayCompileAlert) {
|
||||||
|
PanicAlert("Failed to create vertex shader");
|
||||||
|
s_displayCompileAlert = false;
|
||||||
|
}
|
||||||
|
cgDestroyProgram(tempprog);
|
||||||
ERROR_LOG(VIDEO, "Failed to load vs %s:\n", cgGetLastListing(g_cgcontext));
|
ERROR_LOG(VIDEO, "Failed to load vs %s:\n", cgGetLastListing(g_cgcontext));
|
||||||
ERROR_LOG(VIDEO, pstrprogram);
|
ERROR_LOG(VIDEO, pstrprogram);
|
||||||
return false;
|
return false;
|
||||||
|
@ -49,6 +49,8 @@ class VertexShaderCache
|
|||||||
|
|
||||||
static VSCache vshaders;
|
static VSCache vshaders;
|
||||||
|
|
||||||
|
static bool s_displayCompileAlert;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void Init();
|
||||||
static void ProgressiveCleanup();
|
static void ProgressiveCleanup();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user