Missed a spot. Most games work now, Still have a problem with viewtiful joe. Destination Alpha pass doesn't work yet, going to use Dual source blending on that.

This commit is contained in:
Ryan Houdek 2011-12-07 23:20:55 -06:00 committed by Sonicadvance1
parent 8058f2f32f
commit 3c9c5de722
1 changed files with 15 additions and 5 deletions

View File

@ -24,6 +24,7 @@
#include "TextureConversionShader.h"
#include "TextureCache.h"
#include "PixelShaderCache.h"
#include "ProgramShaderCache.h"
#include "VertexShaderManager.h"
#include "FramebufferManager.h"
#include "Globals.h"
@ -228,7 +229,7 @@ void Shutdown()
s_texConvFrameBuffer = 0;
}
void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const TargetRectangle& sourceRc,
void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc,
u8* destAddr, int dstWidth, int dstHeight, int readStride,
bool toTexture, bool linearFilter)
{
@ -265,8 +266,6 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar
glViewport(0, 0, (GLsizei)dstWidth, (GLsizei)dstHeight);
PixelShaderCache::SetCurrentShader(shader.glprogid);
// Draw...
glBegin(GL_QUADS);
glTexCoord2f((float)sourceRc.left, (float)sourceRc.top); glVertex2f(-1,-1);
@ -340,6 +339,11 @@ int EncodeToRamFromTexture(u32 address,GLuint source_texture, bool bFromZBuffer,
s32 expandedWidth = (width + blkW) & (~blkW);
s32 expandedHeight = (height + blkH) & (~blkH);
if(g_ActiveConfig.bUseGLSL)
ProgramShaderCache::SetBothShaders(texconv_shader.glprogid, 0);
else
PixelShaderCache::SetCurrentShader(texconv_shader.glprogid);
float sampleStride = bScaleByHalf ? 2.f : 1.f;
TextureConversionShader::SetShaderParameters((float)expandedWidth,
(float)Renderer::EFBToScaledY(expandedHeight), // TODO: Why do we scale this?
@ -359,7 +363,7 @@ int EncodeToRamFromTexture(u32 address,GLuint source_texture, bool bFromZBuffer,
int readStride = (expandedWidth * cacheBytes) /
TexDecoder_GetBlockWidthInTexels(format);
EncodeToRamUsingShader(texconv_shader, source_texture, scaledSource,
EncodeToRamUsingShader(source_texture, scaledSource,
dest_ptr, expandedWidth / samples, expandedHeight, readStride,
true, bScaleByHalf > 0 && !bFromZBuffer);
return size_in_bytes; // TODO: D3D11 is calculating this value differently!
@ -369,7 +373,13 @@ int EncodeToRamFromTexture(u32 address,GLuint source_texture, bool bFromZBuffer,
void EncodeToRamYUYV(GLuint srcTexture, const TargetRectangle& sourceRc, u8* destAddr, int dstWidth, int dstHeight)
{
g_renderer->ResetAPIState();
EncodeToRamUsingShader(s_rgbToYuyvProgram, srcTexture, sourceRc, destAddr, dstWidth / 2, dstHeight, 0, false, false);
if(g_ActiveConfig.bUseGLSL)
ProgramShaderCache::SetBothShaders(s_rgbToYuyvProgram.glprogid, 0);
else
PixelShaderCache::SetCurrentShader(s_rgbToYuyvProgram.glprogid);
EncodeToRamUsingShader(srcTexture, sourceRc, destAddr, dstWidth / 2, dstHeight, 0, false, false);
FramebufferManager::SetFramebuffer(0);
VertexShaderManager::SetViewportChanged();
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);