summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2011-12-09 19:14:02 -0600
committerSonicadvance1 <sonicadvance1@RH-Live.(none)>2012-10-09 23:41:05 -0500
commit2fbca145cb9c559fed0be8e57c954e91e803ff8a (patch)
tree0234be5016a8606a7a255b11b381c51f440ea3a6 /Source
parent4a84c6f742efb7a450d85791cd39d31ee0968812 (diff)
Remove bSupportsGLSLLocation since it won't work how I expect it.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp34
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderGen.cpp25
-rw-r--r--Source/Core/VideoCommon/Src/VideoConfig.h1
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp20
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp2
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp20
6 files changed, 26 insertions, 76 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index fe26df6b03..d5680a8cf2 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -525,14 +525,6 @@ const char* WriteBinding(API_TYPE ApiType, const u32 num)
sprintf(result, "layout(binding = %d) ", num);
return result;
}
-const char* WriteLocation(API_TYPE ApiType, const u32 num)
-{
- if(ApiType != API_GLSL || !g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- return "";
- static char result[64];
- sprintf(result, "layout(location = %d) ", num);
- return result;
-}
const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components)
{
@@ -562,13 +554,13 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
if(ApiType == API_GLSL)
{
// A few required defines and ones that will make our lives a lot easier
- if (g_ActiveConfig.backend_info.bSupportsGLSLBinding || g_ActiveConfig.backend_info.bSupportsGLSLLocation)
+ if (g_ActiveConfig.backend_info.bSupportsGLSLBinding || g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
WRITE(p, "#version 330 compatibility\n");
if (g_ActiveConfig.backend_info.bSupportsGLSLBinding)
WRITE(p, "#extension GL_ARB_shading_language_420pack : enable\n");
- if (g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- WRITE(p, "#extension GL_ARB_separate_shader_objects : enable\n");
+ if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
+ WRITE(p, "#extension GL_ARB_uniform_buffer_object : enable\n");
}
else
WRITE(p, "#version 120\n");
@@ -622,18 +614,18 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
WRITE(p, "layout(std140, binding = 0) uniform PSBlock {\n");
- WRITE(p, "%suniform float4 "I_COLORS"[4] %s;\n", WriteLocation(ApiType, C_COLORS), WriteRegister(ApiType, "c", C_COLORS));
- WRITE(p, "%suniform float4 "I_KCOLORS"[4] %s;\n", WriteLocation(ApiType, C_KCOLORS), WriteRegister(ApiType, "c", C_KCOLORS));
- WRITE(p, "%suniform float4 "I_ALPHA"[1] %s;\n", WriteLocation(ApiType, C_ALPHA), WriteRegister(ApiType, "c", C_ALPHA));
- WRITE(p, "%suniform float4 "I_TEXDIMS"[8] %s;\n", WriteLocation(ApiType, C_TEXDIMS), WriteRegister(ApiType, "c", C_TEXDIMS));
- WRITE(p, "%suniform float4 "I_ZBIAS"[2] %s;\n", WriteLocation(ApiType, C_ZBIAS), WriteRegister(ApiType, "c", C_ZBIAS));
- WRITE(p, "%suniform float4 "I_INDTEXSCALE"[2] %s;\n", WriteLocation(ApiType, C_INDTEXSCALE), WriteRegister(ApiType, "c", C_INDTEXSCALE));
- WRITE(p, "%suniform float4 "I_INDTEXMTX"[6] %s;\n", WriteLocation(ApiType, C_INDTEXMTX), WriteRegister(ApiType, "c", C_INDTEXMTX));
- WRITE(p, "%suniform float4 "I_FOG"[3] %s;\n", WriteLocation(ApiType, C_FOG), WriteRegister(ApiType, "c", C_FOG));
+ WRITE(p, "uniform float4 "I_COLORS"[4] %s;\n", WriteRegister(ApiType, "c", C_COLORS));
+ WRITE(p, "uniform float4 "I_KCOLORS"[4] %s;\n", WriteRegister(ApiType, "c", C_KCOLORS));
+ WRITE(p, "uniform float4 "I_ALPHA"[1] %s;\n", WriteRegister(ApiType, "c", C_ALPHA));
+ WRITE(p, "uniform float4 "I_TEXDIMS"[8] %s;\n", WriteRegister(ApiType, "c", C_TEXDIMS));
+ WRITE(p, "uniform float4 "I_ZBIAS"[2] %s;\n", WriteRegister(ApiType, "c", C_ZBIAS));
+ WRITE(p, "uniform float4 "I_INDTEXSCALE"[2] %s;\n", WriteRegister(ApiType, "c", C_INDTEXSCALE));
+ WRITE(p, "uniform float4 "I_INDTEXMTX"[6] %s;\n", WriteRegister(ApiType, "c", C_INDTEXMTX));
+ WRITE(p, "uniform float4 "I_FOG"[3] %s;\n", WriteRegister(ApiType, "c", C_FOG));
// Compiler will optimize these out by itself.
- WRITE(p, "%suniform float4 "I_PLIGHTS"[40] %s;\n", WriteLocation(ApiType, C_PLIGHTS), WriteRegister(ApiType, "c", C_PLIGHTS));
- WRITE(p, "%suniform float4 "I_PMATERIALS"[4] %s;\n", WriteLocation(ApiType, C_PMATERIALS), WriteRegister(ApiType, "c", C_PMATERIALS));
+ WRITE(p, "uniform float4 "I_PLIGHTS"[40] %s;\n", WriteRegister(ApiType, "c", C_PLIGHTS));
+ WRITE(p, "uniform float4 "I_PMATERIALS"[4] %s;\n", WriteRegister(ApiType, "c", C_PMATERIALS));
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
WRITE(p, "};\n");
diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp
index 13d526ba07..6d3eb239a1 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp
@@ -165,7 +165,6 @@ char* GenerateVSOutputStruct(char* p, u32 components, API_TYPE ApiType)
extern const char* WriteRegister(API_TYPE ApiType, const char *prefix, const u32 num);
extern const char* WriteBinding(API_TYPE ApiType, const u32 num);
-extern const char* WriteLocation(API_TYPE ApiType, const u32 num);
const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
{
@@ -188,13 +187,13 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
if(ApiType == API_GLSL)
{
// A few required defines and ones that will make our lives a lot easier
- if (g_ActiveConfig.backend_info.bSupportsGLSLBinding || g_ActiveConfig.backend_info.bSupportsGLSLLocation)
+ if (g_ActiveConfig.backend_info.bSupportsGLSLBinding || g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
WRITE(p, "#version 330 compatibility\n");
if (g_ActiveConfig.backend_info.bSupportsGLSLBinding)
WRITE(p, "#extension GL_ARB_shading_language_420pack : enable\n");
- if (g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- WRITE(p, "#extension GL_ARB_separate_shader_objects : enable\n");
+ if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
+ WRITE(p, "#extension GL_ARB_uniform_buffer_object : enable\n");
WRITE(p, "#define ATTRIN in\n");
WRITE(p, "#define ATTROUT out\n");
}
@@ -219,15 +218,15 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
WRITE(p, "layout(std140, binding = 1) uniform VSBlock {\n");
- WRITE(p, "%suniform float4 "I_POSNORMALMATRIX"[6] %s;\n", WriteLocation(ApiType, C_POSNORMALMATRIX), WriteRegister(ApiType, "c", C_POSNORMALMATRIX));
- WRITE(p, "%suniform float4 "I_PROJECTION"[4] %s;\n", WriteLocation(ApiType, C_PROJECTION), WriteRegister(ApiType, "c", C_PROJECTION));
- WRITE(p, "%suniform float4 "I_MATERIALS"[4] %s;\n", WriteLocation(ApiType, C_MATERIALS), WriteRegister(ApiType, "c", C_MATERIALS));
- WRITE(p, "%suniform float4 "I_LIGHTS"[40] %s;\n", WriteLocation(ApiType, C_LIGHTS), WriteRegister(ApiType, "c", C_LIGHTS));
- WRITE(p, "%suniform float4 "I_TEXMATRICES"[24] %s;\n", WriteLocation(ApiType, C_TEXMATRICES), WriteRegister(ApiType, "c", C_TEXMATRICES)); // also using tex matrices
- WRITE(p, "%suniform float4 "I_TRANSFORMMATRICES"[64] %s;\n", WriteLocation(ApiType, C_TRANSFORMMATRICES), WriteRegister(ApiType, "c", C_TRANSFORMMATRICES));
- WRITE(p, "%suniform float4 "I_NORMALMATRICES"[32] %s;\n", WriteLocation(ApiType, C_NORMALMATRICES), WriteRegister(ApiType, "c", C_NORMALMATRICES));
- WRITE(p, "%suniform float4 "I_POSTTRANSFORMMATRICES"[64] %s;\n", WriteLocation(ApiType, C_POSTTRANSFORMMATRICES), WriteRegister(ApiType, "c", C_POSTTRANSFORMMATRICES));
- WRITE(p, "%suniform float4 "I_DEPTHPARAMS" %s;\n", WriteLocation(ApiType, C_DEPTHPARAMS), WriteRegister(ApiType, "c", C_DEPTHPARAMS));
+ WRITE(p, "uniform float4 "I_POSNORMALMATRIX"[6] %s;\n", WriteRegister(ApiType, "c", C_POSNORMALMATRIX));
+ WRITE(p, "uniform float4 "I_PROJECTION"[4] %s;\n", WriteRegister(ApiType, "c", C_PROJECTION));
+ WRITE(p, "uniform float4 "I_MATERIALS"[4] %s;\n", WriteRegister(ApiType, "c", C_MATERIALS));
+ WRITE(p, "uniform float4 "I_LIGHTS"[40] %s;\n", WriteRegister(ApiType, "c", C_LIGHTS));
+ WRITE(p, "uniform float4 "I_TEXMATRICES"[24] %s;\n", WriteRegister(ApiType, "c", C_TEXMATRICES)); // also using tex matrices
+ WRITE(p, "uniform float4 "I_TRANSFORMMATRICES"[64] %s;\n", WriteRegister(ApiType, "c", C_TRANSFORMMATRICES));
+ WRITE(p, "uniform float4 "I_NORMALMATRICES"[32] %s;\n", WriteRegister(ApiType, "c", C_NORMALMATRICES));
+ WRITE(p, "uniform float4 "I_POSTTRANSFORMMATRICES"[64] %s;\n", WriteRegister(ApiType, "c", C_POSTTRANSFORMMATRICES));
+ WRITE(p, "uniform float4 "I_DEPTHPARAMS" %s;\n", WriteRegister(ApiType, "c", C_DEPTHPARAMS));
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
WRITE(p, "};\n");
diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h
index 2bdbfe89b2..fa6740c3cb 100644
--- a/Source/Core/VideoCommon/Src/VideoConfig.h
+++ b/Source/Core/VideoCommon/Src/VideoConfig.h
@@ -166,7 +166,6 @@ struct VideoConfig
bool bSupportsGLSL;
bool bSupportsGLSLBinding;
- bool bSupportsGLSLLocation;
bool bSupportsGLSLUBO;
} backend_info;
};
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp
index 2f6a3408a3..6f98dd50c4 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp
@@ -81,11 +81,6 @@ void PixelShaderCache::Init()
// Should this be set here?
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_shading_language_420pack") != NULL)
g_Config.backend_info.bSupportsGLSLBinding = true;
- // This bit doesn't quite work yet, always set to false
- // TODO: Probably just drop this entirely in favour of UBOS
- //if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_separate_shader_objects") != NULL)
- g_Config.backend_info.bSupportsGLSLLocation = false;
-
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_uniform_buffer_object") != NULL)
g_Config.backend_info.bSupportsGLSLUBO = true;
@@ -505,11 +500,6 @@ void SetGLSLPSConstant4f(unsigned int const_number, float f1, float f2, float f3
{
float f[4] = { f1, f2, f3, f4 };
- if (g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- {
- glUniform4fv(const_number, 1, f);
- return;
- }
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
ProgramShaderCache::SetUniformObjects(0, const_number, f);
@@ -528,11 +518,6 @@ void SetGLSLPSConstant4f(unsigned int const_number, float f1, float f2, float f3
void SetGLSLPSConstant4fv(unsigned int const_number, const float *f)
{
- if (g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- {
- glUniform4fv(const_number, 1, f);
- return;
- }
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
ProgramShaderCache::SetUniformObjects(0, const_number, f);
@@ -551,11 +536,6 @@ void SetGLSLPSConstant4fv(unsigned int const_number, const float *f)
void SetMultiGLSLPSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
{
- if (g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- {
- glUniform4fv(const_number, count, f);
- return;
- }
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
ProgramShaderCache::SetUniformObjects(0, const_number, f, count);
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
index 776280103e..c7c8624069 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
@@ -92,7 +92,7 @@ namespace OGL
glAttachShader(entry.program.glprogid, entry.program.psid);
glLinkProgram(entry.program.glprogid);
-
+
glUseProgram(entry.program.glprogid);
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp
index dfa3293a46..d0fb9ec189 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp
@@ -247,11 +247,6 @@ void SetGLSLVSConstant4f(unsigned int const_number, float f1, float f2, float f3
buf[1] = f2;
buf[2] = f3;
buf[3] = f4;
- if(g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- {
- glUniform4fv(const_number, 1, buf);
- return;
- }
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
ProgramShaderCache::SetUniformObjects(1, const_number, buf);
@@ -270,11 +265,6 @@ void SetGLSLVSConstant4f(unsigned int const_number, float f1, float f2, float f3
void SetGLSLVSConstant4fv(unsigned int const_number, const float *f)
{
- if(g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- {
- glUniform4fv(const_number, 1, f);
- return;
- }
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
ProgramShaderCache::SetUniformObjects(1, const_number, f);
@@ -293,11 +283,6 @@ void SetGLSLVSConstant4fv(unsigned int const_number, const float *f)
void SetMultiGLSLVSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
{
- if(g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- {
- glUniform4fv(const_number, count, f);
- return;
- }
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
ProgramShaderCache::SetUniformObjects(1, const_number, f, count);
@@ -324,11 +309,6 @@ void SetMultiGLSLVSConstant3fv(unsigned int const_number, unsigned int count, co
buf[4*i+2] = *f++;
buf[4*i+3] = 0.f;
}
- if(g_ActiveConfig.backend_info.bSupportsGLSLLocation)
- {
- glUniform4fv(const_number, count, buf);
- return;
- }
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
ProgramShaderCache::SetUniformObjects(1, const_number, buf, count);