summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2014-01-05 09:52:26 +0100
committerdegasus <wickmarkus@web.de>2014-01-05 09:52:26 +0100
commit4fff5ac90dc674f775dcf7d57b5b513f62f87fc5 (patch)
tree60483cb793eaffeaaeb64f14969caebdc82635f7 /Source/Core
parent01351795f01d113a587fe51c904cdba84536f230 (diff)
OpenGL: drop UBO-workaround usage for efb2ram shaders
It's just brainfuck to use this workaroung there. Just fetch the uniform location like all other util shaders.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp13
-rw-r--r--Source/Core/VideoBackends/OGL/TextureConverter.cpp5
-rw-r--r--Source/Core/VideoCommon/TextureConversionShader.cpp9
3 files changed, 14 insertions, 13 deletions
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
index d1782196fb..f4e7dcb6a7 100644
--- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
+++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
@@ -108,15 +108,14 @@ void SHADER::SetProgramVariables()
}
// UBO workaround
- for (int a = 0; a < NUM_UNIFORMS; ++a)
- {
- UniformLocations[a] = glGetUniformLocation(glprogid, UniformNames[a]);
- UniformSize[a] = 0;
- if(g_ActiveConfig.backend_info.bSupportsGLSLUBO)
- break;
- }
if(!g_ActiveConfig.backend_info.bSupportsGLSLUBO)
{
+ for (int a = 0; a < NUM_UNIFORMS; ++a)
+ {
+ UniformLocations[a] = glGetUniformLocation(glprogid, UniformNames[a]);
+ UniformSize[a] = 0;
+ }
+
int max_uniforms = 0;
char name[50];
int size;
diff --git a/Source/Core/VideoBackends/OGL/TextureConverter.cpp b/Source/Core/VideoBackends/OGL/TextureConverter.cpp
index 56a620b84a..bf36523929 100644
--- a/Source/Core/VideoBackends/OGL/TextureConverter.cpp
+++ b/Source/Core/VideoBackends/OGL/TextureConverter.cpp
@@ -40,6 +40,7 @@ static SHADER s_yuyvToRgbProgram;
// Not all slots are taken - but who cares.
const u32 NUM_ENCODING_PROGRAMS = 64;
static SHADER s_encodingPrograms[NUM_ENCODING_PROGRAMS];
+static int s_encodingUniforms[NUM_ENCODING_PROGRAMS];
static GLuint s_PBO = 0; // for readback with different strides
@@ -156,6 +157,8 @@ SHADER &GetOrCreateEncodingShader(u32 format)
"}\n";
ProgramShaderCache::CompileShader(s_encodingPrograms[format], VProgram, shader);
+
+ s_encodingUniforms[format] = glGetUniformLocation(s_encodingPrograms[format].glprogid, "position");
}
return s_encodingPrograms[format];
}
@@ -312,7 +315,7 @@ int EncodeToRamFromTexture(u32 address,GLuint source_texture, bool bFromZBuffer,
s32 expandedHeight = (height + blkH) & (~blkH);
texconv_shader.Bind();
- glUniform4i(texconv_shader.UniformLocations[0],
+ glUniform4i(s_encodingUniforms[format],
source.left, source.top,
expandedWidth, bScaleByHalf ? 2 : 1);
diff --git a/Source/Core/VideoCommon/TextureConversionShader.cpp b/Source/Core/VideoCommon/TextureConversionShader.cpp
index f271111851..46516782c2 100644
--- a/Source/Core/VideoCommon/TextureConversionShader.cpp
+++ b/Source/Core/VideoCommon/TextureConversionShader.cpp
@@ -12,7 +12,6 @@
#include "TextureConversionShader.h"
#include "TextureDecoder.h"
-#include "PixelShaderGen.h"
#include "BPMemory.h"
#include "RenderBase.h"
#include "VideoConfig.h"
@@ -62,7 +61,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
{
// left, top, of source rectangle within source texture
// width of the destination rectangle, scale_factor (1 or 2)
- WRITE(p, "uniform int4 " I_COLORS";\n");
+ WRITE(p, "uniform int4 position;\n");
int blkW = TexDecoder_GetBlockWidthInTexels(format);
int blkH = TexDecoder_GetBlockHeightInTexels(format);
@@ -97,7 +96,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
WRITE(p, " int yl = uv1.y / %d;\n", blkH);
WRITE(p, " int yb = yl * %d;\n", blkH);
WRITE(p, " int yoff = uv1.y - yb;\n");
- WRITE(p, " int xp = uv1.x + yoff * " I_COLORS".z;\n");
+ WRITE(p, " int xp = uv1.x + yoff * position.z;\n");
WRITE(p, " int xel = xp / %d;\n", samples == 1 ? factor : blkW);
WRITE(p, " int xb = xel / %d;\n", blkH);
WRITE(p, " int xoff = xel - xb * %d;\n", blkH);
@@ -113,9 +112,9 @@ void WriteSampleColor(char*& p, const char* colorComp, const char* dest, int xof
{
WRITE(p, // sampleUv is the sample position in (int)gx_coords
"uv0 = float2(sampleUv + int2(%d, 0)" // pixel offset (if more than one pixel is samped)
- " + " I_COLORS".xy);\n" // move to copyed rect
+ " + position.xy);\n" // move to copyed rect
"uv0 += float2(0.5, 0.5);\n" // move to center of pixel
- "uv0 *= float(" I_COLORS".w);\n" // scale by two if needed (this will move to pixels border to filter linear)
+ "uv0 *= float(position.w);\n" // scale by two if needed (this will move to pixels border to filter linear)
"uv0 /= float2(%d, %d);\n" // normlize to [0:1]
"uv0.y = 1.0-uv0.y;\n" // ogl foo (disable this line for d3d)
"%s = texture(samp0, uv0).%s;\n",