summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2013-11-25 15:01:18 +0100
committerdegasus <wickmarkus@web.de>2013-11-25 15:01:18 +0100
commitbcb31b09d38463f8a7a515858a2143477bfc8935 (patch)
tree47cc2afeac780a7e8a222646e8059e03de095a11 /Source/Core/VideoBackends
parenta289e0604f3fd3663a7d32e8aafbe9d8286b35ad (diff)
TextureConverter: Use gl_FragCoord instead of uv0
Diffstat (limited to 'Source/Core/VideoBackends')
-rw-r--r--Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp b/Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp
index 161468d2b0..08932f562e 100644
--- a/Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp
+++ b/Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp
@@ -41,17 +41,6 @@ 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_encodingUniform_loc[NUM_ENCODING_PROGRAMS];
-
-static const char *VProgram =
- "VARYOUT vec2 uv0;\n"
- "uniform vec4 copy_position;\n" // left, top, right, bottom
- "void main()\n"
- "{\n"
- " vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);\n"
- " gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);\n"
- " uv0 = mix(copy_position.xy, copy_position.zw, rawpos);\n"
- "}\n";
void CreatePrograms()
{
@@ -158,8 +147,14 @@ SHADER &GetOrCreateEncodingShader(u32 format)
}
#endif
+ const char *VProgram =
+ "void main()\n"
+ "{\n"
+ " vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);\n"
+ " gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);\n"
+ "}\n";
+
ProgramShaderCache::CompileShader(s_encodingPrograms[format], VProgram, shader);
- s_encodingUniform_loc[format] = glGetUniformLocation(s_encodingPrograms[format].glprogid, "copy_position");
}
return s_encodingPrograms[format];
}
@@ -200,7 +195,7 @@ void Shutdown()
void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc,
u8* destAddr, int dstWidth, int dstHeight, int readStride,
- bool toTexture, bool linearFilter, int uniform_loc)
+ bool toTexture, bool linearFilter)
{
@@ -230,8 +225,6 @@ void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc,
glViewport(0, 0, (GLsizei)dstWidth, (GLsizei)dstHeight);
- glUniform4f(uniform_loc, sourceRc.left, sourceRc.top, sourceRc.right, sourceRc.bottom);
-
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
GL_REPORT_ERRORD();
@@ -323,7 +316,7 @@ int EncodeToRamFromTexture(u32 address,GLuint source_texture, bool bFromZBuffer,
TexDecoder_GetBlockWidthInTexels(format);
EncodeToRamUsingShader(source_texture, scaledSource,
dest_ptr, expandedWidth / samples, expandedHeight, readStride,
- true, bScaleByHalf > 0 && !bFromZBuffer, s_encodingUniform_loc[format]);
+ true, bScaleByHalf > 0 && !bFromZBuffer);
return size_in_bytes; // TODO: D3D11 is calculating this value differently!
}
@@ -334,10 +327,12 @@ void EncodeToRamYUYV(GLuint srcTexture, const TargetRectangle& sourceRc, u8* des
s_rgbToYuyvProgram.Bind();
+ glUniform4f(s_rgbToYuyvUniform_loc, sourceRc.left, sourceRc.top, sourceRc.right, sourceRc.bottom);
+
// We enable linear filtering, because the gamecube does filtering in the vertical direction when
// yscale is enabled.
// Otherwise we get jaggies when a game uses yscaling (most PAL games)
- EncodeToRamUsingShader(srcTexture, sourceRc, destAddr, dstWidth / 2, dstHeight, 0, false, true, s_rgbToYuyvUniform_loc);
+ EncodeToRamUsingShader(srcTexture, sourceRc, destAddr, dstWidth / 2, dstHeight, 0, false, true);
FramebufferManager::SetFramebuffer(0);
TextureCache::DisableStage(0);
g_renderer->RestoreAPIState();