Almost there.
This commit is contained in:
parent
8123b137aa
commit
7cec31dbf3
|
@ -1274,7 +1274,7 @@ static void WriteAlphaTest(char *&p, API_TYPE ApiType,DSTALPHA_MODE dstAlphaMode
|
||||||
WRITE(p, tevAlphaFuncsTable[compindex],alphaRef[1]);//lookup the second component from the alpha function table
|
WRITE(p, tevAlphaFuncsTable[compindex],alphaRef[1]);//lookup the second component from the alpha function table
|
||||||
WRITE(p, ")) {\n");
|
WRITE(p, ")) {\n");
|
||||||
|
|
||||||
WRITE(p, "ocol0 = 0;\n");
|
WRITE(p, "ocol0 = float4(0);\n");
|
||||||
if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
|
if (dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
|
||||||
WRITE(p, "ocol1 = 0;\n");
|
WRITE(p, "ocol1 = 0;\n");
|
||||||
if (DepthTextureEnable)
|
if (DepthTextureEnable)
|
||||||
|
|
|
@ -291,7 +291,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WRITE(p, "int posmtx = fposmtx;\n");
|
WRITE(p, "int posmtx = int(fposmtx);\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE(p, "float4 pos = float4(dot("I_TRANSFORMMATRICES"[posmtx], rawpos), dot("I_TRANSFORMMATRICES"[posmtx+1], rawpos), dot("I_TRANSFORMMATRICES"[posmtx+2], rawpos), 1);\n");
|
WRITE(p, "float4 pos = float4(dot("I_TRANSFORMMATRICES"[posmtx], rawpos), dot("I_TRANSFORMMATRICES"[posmtx+1], rawpos), dot("I_TRANSFORMMATRICES"[posmtx+2], rawpos), 1);\n");
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace OGL
|
||||||
{
|
{
|
||||||
|
|
||||||
static int s_nMaxPixelInstructions;
|
static int s_nMaxPixelInstructions;
|
||||||
static GLuint s_ColorMatrixProgram = 0;
|
static FRAGMENTSHADER s_ColorMatrixProgram;
|
||||||
static GLuint s_DepthMatrixProgram = 0;
|
static FRAGMENTSHADER s_DepthMatrixProgram;
|
||||||
PixelShaderCache::PSCache PixelShaderCache::PixelShaders;
|
PixelShaderCache::PSCache PixelShaderCache::PixelShaders;
|
||||||
PIXELSHADERUID PixelShaderCache::s_curuid;
|
PIXELSHADERUID PixelShaderCache::s_curuid;
|
||||||
bool PixelShaderCache::s_displayCompileAlert;
|
bool PixelShaderCache::s_displayCompileAlert;
|
||||||
|
@ -56,12 +56,12 @@ bool (*pCompilePixelShader)(FRAGMENTSHADER&, const char*);
|
||||||
|
|
||||||
GLuint PixelShaderCache::GetDepthMatrixProgram()
|
GLuint PixelShaderCache::GetDepthMatrixProgram()
|
||||||
{
|
{
|
||||||
return s_DepthMatrixProgram;
|
return s_DepthMatrixProgram.glprogid;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint PixelShaderCache::GetColorMatrixProgram()
|
GLuint PixelShaderCache::GetColorMatrixProgram()
|
||||||
{
|
{
|
||||||
return s_ColorMatrixProgram;
|
return s_ColorMatrixProgram.glprogid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelShaderCache::Init()
|
void PixelShaderCache::Init()
|
||||||
|
@ -105,7 +105,66 @@ void PixelShaderCache::Init()
|
||||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&maxinst);
|
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&maxinst);
|
||||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, (GLint *)&maxattribs);
|
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, (GLint *)&maxattribs);
|
||||||
INFO_LOG(VIDEO, "pixel max_alu=%d, max_inst=%d, max_attrib=%d", s_nMaxPixelInstructions, maxinst, maxattribs);
|
INFO_LOG(VIDEO, "pixel max_alu=%d, max_inst=%d, max_attrib=%d", s_nMaxPixelInstructions, maxinst, maxattribs);
|
||||||
|
if(g_ActiveConfig.bUseGLSL)
|
||||||
|
{
|
||||||
|
char pmatrixprog[2048];
|
||||||
|
sprintf(pmatrixprog, "#extension GL_ARB_texture_rectangle : enable\n"
|
||||||
|
"uniform sampler2DRect samp0;\n"
|
||||||
|
"uniform vec4 "I_COLORS"[7];\n"
|
||||||
|
"void main(){\n"
|
||||||
|
"vec4 Temp0, Temp1;\n"
|
||||||
|
"vec4 K0 = vec4(0.5, 0.5, 0.5, 0.5);\n"
|
||||||
|
"Temp0 = texture2DRect(samp0, gl_TexCoord[0].xy);\n"
|
||||||
|
"Temp0 = Temp0 * "I_COLORS"[%d];\n"
|
||||||
|
"Temp0 = Temp0 + K0;\n"
|
||||||
|
"Temp0 = floor(Temp0);\n"
|
||||||
|
"Temp0 = Temp0 * "I_COLORS"[%d];\n"
|
||||||
|
"Temp1.x = dot(Temp0, "I_COLORS"[%d]);\n"
|
||||||
|
"Temp1.y = dot(Temp0, "I_COLORS"[%d]);\n"
|
||||||
|
"Temp1.z = dot(Temp0, "I_COLORS"[%d]);\n"
|
||||||
|
"Temp1.w = dot(Temp0, "I_COLORS"[%d]);\n"
|
||||||
|
"gl_FragData[0] = Temp1 + "I_COLORS"[%d];\n"
|
||||||
|
"}\n", C_COLORS+5, C_COLORS+6, C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||||
|
if(!pCompilePixelShader(s_ColorMatrixProgram, pmatrixprog))
|
||||||
|
{
|
||||||
|
ERROR_LOG(VIDEO, "Failed to create color matrix fragment program");
|
||||||
|
s_ColorMatrixProgram.Destroy();
|
||||||
|
}
|
||||||
|
sprintf(pmatrixprog, "#extension GL_ARB_texture_rectangle : enable\n"
|
||||||
|
"uniform sampler2DRect samp0;\n"
|
||||||
|
"uniform vec4 "I_COLORS"[5];\n"
|
||||||
|
"void main(){\n"
|
||||||
|
"vec4 R0, R1, R2;\n"
|
||||||
|
"vec4 K0 = vec4(255.99998474121, 0.003921568627451, 256.0, 0.0);\n"
|
||||||
|
"vec4 K1 = vec4(15.0, 0.066666666666, 0.0, 0.0);\n"
|
||||||
|
"R2 = texture2DRect(samp0, gl_TexCoord[0].xy);\n"
|
||||||
|
"R0.x = R2.x * K0.x;\n"
|
||||||
|
"R0.x = floor(R0).x;\n"
|
||||||
|
"R0.yzw = (R0 - R0.x).yzw;\n"
|
||||||
|
"R0.yzw = (R0 * K0.z).yzw;\n"
|
||||||
|
"R0.y = floor(R0).y;\n"
|
||||||
|
"R0.zw = (R0 - R0.y).zw;\n"
|
||||||
|
"R0.zw = (R0 * K0.z).zw;\n"
|
||||||
|
"R0.z = floor(R0).z;\n"
|
||||||
|
"R0.w = R0.x;\n"
|
||||||
|
"R0 = R0 * K0.y;\n"
|
||||||
|
"R0.w = (R0 * K1.x).w;\n"
|
||||||
|
"R0.w = floor(R0).w;\n"
|
||||||
|
"R0.w = (R0 * K1.y).w;\n"
|
||||||
|
"R1.x = dot(R0, "I_COLORS"[%d]);\n"
|
||||||
|
"R1.y = dot(R0, "I_COLORS"[%d]);\n"
|
||||||
|
"R1.z = dot(R0, "I_COLORS"[%d]);\n"
|
||||||
|
"R1.w = dot(R0, "I_COLORS"[%d]);\n"
|
||||||
|
"gl_FragData[0] = R1 * "I_COLORS"[%d];\n"
|
||||||
|
"}\n", C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||||
|
if(!pCompilePixelShader(s_DepthMatrixProgram, pmatrixprog))
|
||||||
|
{
|
||||||
|
ERROR_LOG(VIDEO, "Failed to create depth matrix fragment program");
|
||||||
|
s_DepthMatrixProgram.Destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
char pmatrixprog[2048];
|
char pmatrixprog[2048];
|
||||||
sprintf(pmatrixprog, "!!ARBfp1.0"
|
sprintf(pmatrixprog, "!!ARBfp1.0"
|
||||||
"TEMP R0;\n"
|
"TEMP R0;\n"
|
||||||
|
@ -121,16 +180,15 @@ void PixelShaderCache::Init()
|
||||||
"DP4 R1.z, R0, program.env[%d];\n"
|
"DP4 R1.z, R0, program.env[%d];\n"
|
||||||
"DP4 R1.w, R0, program.env[%d];\n"
|
"DP4 R1.w, R0, program.env[%d];\n"
|
||||||
"ADD result.color, R1, program.env[%d];\n"
|
"ADD result.color, R1, program.env[%d];\n"
|
||||||
"END\n",C_COLORMATRIX+5,C_COLORMATRIX+6, C_COLORMATRIX, C_COLORMATRIX+1, C_COLORMATRIX+2, C_COLORMATRIX+3, C_COLORMATRIX+4);
|
"END\n",C_COLORS+5,C_COLORS+6, C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||||
glGenProgramsARB(1, &s_ColorMatrixProgram);
|
glGenProgramsARB(1, &s_ColorMatrixProgram.glprogid);
|
||||||
SetCurrentShader(s_ColorMatrixProgram);
|
SetCurrentShader(s_ColorMatrixProgram.glprogid);
|
||||||
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pmatrixprog), pmatrixprog);
|
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pmatrixprog), pmatrixprog);
|
||||||
|
|
||||||
GLenum err = GL_REPORT_ERROR();
|
GLenum err = GL_REPORT_ERROR();
|
||||||
if (err != GL_NO_ERROR) {
|
if (err != GL_NO_ERROR) {
|
||||||
ERROR_LOG(VIDEO, "Failed to create color matrix fragment program");
|
ERROR_LOG(VIDEO, "Failed to create color matrix fragment program");
|
||||||
glDeleteProgramsARB(1, &s_ColorMatrixProgram);
|
s_ColorMatrixProgram.Destroy();
|
||||||
s_ColorMatrixProgram = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(pmatrixprog, "!!ARBfp1.0\n"
|
sprintf(pmatrixprog, "!!ARBfp1.0\n"
|
||||||
|
@ -177,26 +235,24 @@ void PixelShaderCache::Init()
|
||||||
"DP4 R1.z, R0, program.env[%d];\n"
|
"DP4 R1.z, R0, program.env[%d];\n"
|
||||||
"DP4 R1.w, R0, program.env[%d];\n"
|
"DP4 R1.w, R0, program.env[%d];\n"
|
||||||
"ADD result.color, R1, program.env[%d];\n"
|
"ADD result.color, R1, program.env[%d];\n"
|
||||||
"END\n", C_COLORMATRIX, C_COLORMATRIX+1, C_COLORMATRIX+2, C_COLORMATRIX+3, C_COLORMATRIX+4);
|
"END\n", C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||||
glGenProgramsARB(1, &s_DepthMatrixProgram);
|
glGenProgramsARB(1, &s_DepthMatrixProgram.glprogid);
|
||||||
SetCurrentShader(s_DepthMatrixProgram);
|
SetCurrentShader(s_DepthMatrixProgram.glprogid);
|
||||||
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pmatrixprog), pmatrixprog);
|
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pmatrixprog), pmatrixprog);
|
||||||
|
|
||||||
err = GL_REPORT_ERROR();
|
err = GL_REPORT_ERROR();
|
||||||
if (err != GL_NO_ERROR) {
|
if (err != GL_NO_ERROR) {
|
||||||
ERROR_LOG(VIDEO, "Failed to create depth matrix fragment program");
|
ERROR_LOG(VIDEO, "Failed to create depth matrix fragment program");
|
||||||
glDeleteProgramsARB(1, &s_DepthMatrixProgram);
|
s_DepthMatrixProgram.Destroy();
|
||||||
s_DepthMatrixProgram = 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelShaderCache::Shutdown()
|
void PixelShaderCache::Shutdown()
|
||||||
{
|
{
|
||||||
glDeleteProgramsARB(1, &s_ColorMatrixProgram);
|
s_ColorMatrixProgram.Destroy();
|
||||||
s_ColorMatrixProgram = 0;
|
s_DepthMatrixProgram.Destroy();
|
||||||
glDeleteProgramsARB(1, &s_DepthMatrixProgram);
|
|
||||||
s_DepthMatrixProgram = 0;
|
|
||||||
PSCache::iterator iter = PixelShaders.begin();
|
PSCache::iterator iter = PixelShaders.begin();
|
||||||
for (; iter != PixelShaders.end(); iter++)
|
for (; iter != PixelShaders.end(); iter++)
|
||||||
iter->second.Destroy();
|
iter->second.Destroy();
|
||||||
|
@ -235,7 +291,6 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp
|
||||||
// Make an entry in the table
|
// Make an entry in the table
|
||||||
PSCacheEntry& newentry = PixelShaders[uid];
|
PSCacheEntry& newentry = PixelShaders[uid];
|
||||||
last_entry = &newentry;
|
last_entry = &newentry;
|
||||||
newentry.shader.bGLSL = g_ActiveConfig.bUseGLSL;
|
|
||||||
const char *code = GeneratePixelShaderCode(dstAlphaMode, g_ActiveConfig.bUseGLSL ? API_GLSL : API_OPENGL, components);
|
const char *code = GeneratePixelShaderCode(dstAlphaMode, g_ActiveConfig.bUseGLSL ? API_GLSL : API_OPENGL, components);
|
||||||
|
|
||||||
if (g_ActiveConfig.bEnableShaderDebugging && code)
|
if (g_ActiveConfig.bEnableShaderDebugging && code)
|
||||||
|
@ -320,7 +375,6 @@ bool CompileGLSLPixelShader(FRAGMENTSHADER& ps, const char* pstrprogram)
|
||||||
FILE *fp = fopen(szTemp, "wb");
|
FILE *fp = fopen(szTemp, "wb");
|
||||||
fwrite(pstrprogram, strlen(pstrprogram), 1, fp);
|
fwrite(pstrprogram, strlen(pstrprogram), 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
if(strstr(infoLog, "warning") != NULL || strstr(infoLog, "error") != NULL)
|
if(strstr(infoLog, "warning") != NULL || strstr(infoLog, "error") != NULL)
|
||||||
exit(0);
|
exit(0);
|
||||||
delete[] infoLog;
|
delete[] infoLog;
|
||||||
|
@ -339,6 +393,7 @@ bool CompileGLSLPixelShader(FRAGMENTSHADER& ps, const char* pstrprogram)
|
||||||
|
|
||||||
(void)GL_REPORT_ERROR();
|
(void)GL_REPORT_ERROR();
|
||||||
ps.glprogid = result;
|
ps.glprogid = result;
|
||||||
|
ps.bGLSL = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void PixelShaderCache::SetPSSampler(const char * name, unsigned int Tex)
|
void PixelShaderCache::SetPSSampler(const char * name, unsigned int Tex)
|
||||||
|
@ -462,6 +517,7 @@ bool CompileCGPixelShader(FRAGMENTSHADER& ps, const char* pstrprogram)
|
||||||
}
|
}
|
||||||
|
|
||||||
glGenProgramsARB(1, &ps.glprogid);
|
glGenProgramsARB(1, &ps.glprogid);
|
||||||
|
ps.bGLSL = false;
|
||||||
PixelShaderCache::SetCurrentShader(ps.glprogid);
|
PixelShaderCache::SetCurrentShader(ps.glprogid);
|
||||||
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pcompiledprog), pcompiledprog);
|
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pcompiledprog), pcompiledprog);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "ImageWrite.h"
|
#include "ImageWrite.h"
|
||||||
#include "MemoryUtil.h"
|
#include "MemoryUtil.h"
|
||||||
#include "PixelShaderCache.h"
|
#include "PixelShaderCache.h"
|
||||||
|
#include "ProgramShaderCache.h"
|
||||||
#include "PixelShaderManager.h"
|
#include "PixelShaderManager.h"
|
||||||
#include "Render.h"
|
#include "Render.h"
|
||||||
#include "Statistics.h"
|
#include "Statistics.h"
|
||||||
|
@ -299,6 +300,12 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
||||||
|
|
||||||
glViewport(0, 0, virtual_width, virtual_height);
|
glViewport(0, 0, virtual_width, virtual_height);
|
||||||
|
|
||||||
|
if(g_ActiveConfig.bUseGLSL)
|
||||||
|
{
|
||||||
|
ProgramShaderCache::SetBothShaders((srcFormat == PIXELFMT_Z24) ? PixelShaderCache::GetDepthMatrixProgram() : PixelShaderCache::GetColorMatrixProgram(), 0);
|
||||||
|
PixelShaderCache::SetPSSampler("samp0", 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
PixelShaderCache::SetCurrentShader((srcFormat == PIXELFMT_Z24) ? PixelShaderCache::GetDepthMatrixProgram() : PixelShaderCache::GetColorMatrixProgram());
|
PixelShaderCache::SetCurrentShader((srcFormat == PIXELFMT_Z24) ? PixelShaderCache::GetDepthMatrixProgram() : PixelShaderCache::GetColorMatrixProgram());
|
||||||
PixelShaderManager::SetColorMatrix(colmat); // set transformation
|
PixelShaderManager::SetColorMatrix(colmat); // set transformation
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
|
@ -129,9 +129,6 @@ void VertexManager::vFlush()
|
||||||
//glBufferData(GL_ARRAY_BUFFER, s_pCurBufferPointer - LocalVBuffer, LocalVBuffer, GL_STREAM_DRAW);
|
//glBufferData(GL_ARRAY_BUFFER, s_pCurBufferPointer - LocalVBuffer, LocalVBuffer, GL_STREAM_DRAW);
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
// setup the pointers
|
|
||||||
if (g_nativeVertexFmt)
|
|
||||||
g_nativeVertexFmt->SetupVertexPointers();
|
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
u32 usedtextures = 0;
|
u32 usedtextures = 0;
|
||||||
|
@ -214,6 +211,21 @@ void VertexManager::vFlush()
|
||||||
VertexShaderManager::SetConstants();
|
VertexShaderManager::SetConstants();
|
||||||
PixelShaderManager::SetConstants();
|
PixelShaderManager::SetConstants();
|
||||||
|
|
||||||
|
// setup the pointers
|
||||||
|
if (g_nativeVertexFmt)
|
||||||
|
g_nativeVertexFmt->SetupVertexPointers();
|
||||||
|
GL_REPORT_ERRORD();
|
||||||
|
if(g_ActiveConfig.bUseGLSL)
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
if (usedtextures & (1 << i))
|
||||||
|
{
|
||||||
|
char tmp[16];
|
||||||
|
sprintf(tmp, "samp%d", i); // Bake this in to something so we don't have to sprintf?
|
||||||
|
PixelShaderCache::SetPSSampler(tmp, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Draw();
|
Draw();
|
||||||
|
|
||||||
// run through vertex groups again to set alpha
|
// run through vertex groups again to set alpha
|
||||||
|
@ -224,6 +236,17 @@ void VertexManager::vFlush()
|
||||||
{
|
{
|
||||||
ProgramShaderCache::SetBothShaders(ps->glprogid, 0);
|
ProgramShaderCache::SetBothShaders(ps->glprogid, 0);
|
||||||
PixelShaderManager::SetConstants(); // Need to set these again
|
PixelShaderManager::SetConstants(); // Need to set these again
|
||||||
|
if (g_nativeVertexFmt)
|
||||||
|
g_nativeVertexFmt->SetupVertexPointers();
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
if (usedtextures & (1 << i))
|
||||||
|
{
|
||||||
|
char tmp[16];
|
||||||
|
sprintf(tmp, "samp%d", i); // Bake this in to something so we don't have to sprintf?
|
||||||
|
PixelShaderCache::SetPSSampler(tmp, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid);
|
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid);
|
||||||
|
|
|
@ -125,7 +125,6 @@ VERTEXSHADER* VertexShaderCache::SetShader(u32 components)
|
||||||
// Make an entry in the table
|
// Make an entry in the table
|
||||||
VSCacheEntry& entry = vshaders[uid];
|
VSCacheEntry& entry = vshaders[uid];
|
||||||
last_entry = &entry;
|
last_entry = &entry;
|
||||||
entry.shader.bGLSL = g_ActiveConfig.bUseGLSL;
|
|
||||||
const char *code = GenerateVertexShaderCode(components, g_ActiveConfig.bUseGLSL ? API_GLSL : API_OPENGL);
|
const char *code = GenerateVertexShaderCode(components, g_ActiveConfig.bUseGLSL ? API_GLSL : API_OPENGL);
|
||||||
GetSafeVertexShaderId(&entry.safe_uid, components);
|
GetSafeVertexShaderId(&entry.safe_uid, components);
|
||||||
|
|
||||||
|
@ -223,6 +222,7 @@ bool CompileGLSLVertexShader(VERTEXSHADER& vs, const char* pstrprogram)
|
||||||
|
|
||||||
(void)GL_REPORT_ERROR();
|
(void)GL_REPORT_ERROR();
|
||||||
vs.glprogid = result;
|
vs.glprogid = result;
|
||||||
|
vs.bGLSL = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void SetVSConstant4fvByName(const char * name, unsigned int offset, const float *f, const unsigned int count = 1)
|
void SetVSConstant4fvByName(const char * name, unsigned int offset, const float *f, const unsigned int count = 1)
|
||||||
|
@ -352,6 +352,7 @@ bool CompileCGVertexShader(VERTEXSHADER& vs, const char* pstrprogram)
|
||||||
plocal = strstr(plocal + 13, "program.local");
|
plocal = strstr(plocal + 13, "program.local");
|
||||||
}
|
}
|
||||||
glGenProgramsARB(1, &vs.glprogid);
|
glGenProgramsARB(1, &vs.glprogid);
|
||||||
|
vs.bGLSL = false;
|
||||||
VertexShaderCache::SetCurrentShader(vs.glprogid);
|
VertexShaderCache::SetCurrentShader(vs.glprogid);
|
||||||
|
|
||||||
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pcompiledprog), pcompiledprog);
|
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pcompiledprog), pcompiledprog);
|
||||||
|
|
Loading…
Reference in New Issue