mah
This commit is contained in:
parent
411357b54a
commit
7a4c080c70
|
@ -20,6 +20,7 @@
|
|||
#include "GLUtil.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <assert.h>
|
||||
|
||||
#include "Statistics.h"
|
||||
#include "VideoConfig.h"
|
||||
|
@ -234,7 +235,8 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp
|
|||
// Make an entry in the table
|
||||
PSCacheEntry& newentry = PixelShaders[uid];
|
||||
last_entry = &newentry;
|
||||
const char *code = GeneratePixelShaderCode(dstAlphaMode, API_OPENGL, components);
|
||||
newentry.shader.bGLSL = g_ActiveConfig.bUseGLSL;
|
||||
const char *code = GeneratePixelShaderCode(dstAlphaMode, g_ActiveConfig.bUseGLSL ? API_GLSL : API_OPENGL, components);
|
||||
|
||||
if (g_ActiveConfig.bEnableShaderDebugging && code)
|
||||
{
|
||||
|
@ -271,6 +273,8 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
|
|||
//Disable Fragment programs and reset the selected Program
|
||||
void PixelShaderCache::DisableShader()
|
||||
{
|
||||
if(g_ActiveConfig.bUseGLSL)
|
||||
assert(true);
|
||||
if(ShaderEnabled)
|
||||
{
|
||||
glDisable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
|
@ -281,6 +285,8 @@ void PixelShaderCache::DisableShader()
|
|||
//bind a program if is diferent from the binded oone
|
||||
void PixelShaderCache::SetCurrentShader(GLuint Shader)
|
||||
{
|
||||
if(g_ActiveConfig.bUseGLSL)
|
||||
assert(true);
|
||||
if(!ShaderEnabled)
|
||||
{
|
||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
|
|
|
@ -29,16 +29,21 @@ namespace OGL
|
|||
|
||||
struct FRAGMENTSHADER
|
||||
{
|
||||
FRAGMENTSHADER() : glprogid(0) { }
|
||||
FRAGMENTSHADER() : glprogid(0), bGLSL(0) { }
|
||||
void Destroy()
|
||||
{
|
||||
if (glprogid)
|
||||
{
|
||||
glDeleteProgramsARB(1, &glprogid);
|
||||
if(bGLSL)
|
||||
glDeleteShader(glprogid);
|
||||
else
|
||||
glDeleteProgramsARB(1, &glprogid);
|
||||
glprogid = 0;
|
||||
}
|
||||
}
|
||||
GLuint glprogid; // opengl program id
|
||||
|
||||
bool bGLSL;
|
||||
std::string strprog;
|
||||
};
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "VideoConfig.h"
|
||||
|
@ -73,7 +74,7 @@ void VertexShaderCache::Init()
|
|||
pSetVSConstant4fv = SetCGVSConstant4fv;
|
||||
pSetMultiVSConstant4fv = SetMultiCGVSConstant4fv;
|
||||
pSetMultiVSConstant3fv = SetMultiCGVSConstant3fv;
|
||||
pCompileVertexShader = CompileGLSLVertexShader;
|
||||
pCompileVertexShader = CompileCGVertexShader;
|
||||
}
|
||||
|
||||
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&s_nMaxVertexInstructions);
|
||||
|
@ -124,7 +125,8 @@ VERTEXSHADER* VertexShaderCache::SetShader(u32 components)
|
|||
// Make an entry in the table
|
||||
VSCacheEntry& entry = vshaders[uid];
|
||||
last_entry = &entry;
|
||||
const char *code = GenerateVertexShaderCode(components, API_OPENGL);
|
||||
entry.shader.bGLSL = g_ActiveConfig.bUseGLSL;
|
||||
const char *code = GenerateVertexShaderCode(components, g_ActiveConfig.bUseGLSL ? API_GLSL : API_OPENGL);
|
||||
GetSafeVertexShaderId(&entry.safe_uid, components);
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
|
@ -155,6 +157,8 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
|
|||
|
||||
void VertexShaderCache::DisableShader()
|
||||
{
|
||||
if(g_ActiveConfig.bUseGLSL)
|
||||
assert(true);
|
||||
if (ShaderEnabled)
|
||||
{
|
||||
glDisable(GL_VERTEX_PROGRAM_ARB);
|
||||
|
@ -165,6 +169,8 @@ void VertexShaderCache::DisableShader()
|
|||
|
||||
void VertexShaderCache::SetCurrentShader(GLuint Shader)
|
||||
{
|
||||
if(g_ActiveConfig.bUseGLSL)
|
||||
assert(true);
|
||||
if (!ShaderEnabled)
|
||||
{
|
||||
glEnable(GL_VERTEX_PROGRAM_ARB);
|
||||
|
|
|
@ -29,9 +29,18 @@ namespace OGL
|
|||
|
||||
struct VERTEXSHADER
|
||||
{
|
||||
VERTEXSHADER() : glprogid(0) {}
|
||||
VERTEXSHADER() : glprogid(0), bGLSL(0) {}
|
||||
void Destroy()
|
||||
{
|
||||
if(bGLSL)
|
||||
glDeleteShader(glprogid);
|
||||
else
|
||||
glDeleteProgramsARB(1, &glprogid);
|
||||
glprogid = 0;
|
||||
}
|
||||
GLuint glprogid; // opengl program id
|
||||
|
||||
bool bGLSL;
|
||||
std::string strprog;
|
||||
};
|
||||
|
||||
|
@ -43,9 +52,7 @@ class VertexShaderCache
|
|||
VERTEXSHADERUIDSAFE safe_uid;
|
||||
VSCacheEntry() {}
|
||||
void Destroy() {
|
||||
// printf("Destroying vs %i\n", shader.glprogid);
|
||||
glDeleteProgramsARB(1, &shader.glprogid);
|
||||
shader.glprogid = 0;
|
||||
shader.Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue