diff --git a/Source/Core/VideoCommon/Src/BPFunctions.cpp b/Source/Core/VideoCommon/Src/BPFunctions.cpp index 2ffa893ca9..8a6d9e7705 100644 --- a/Source/Core/VideoCommon/Src/BPFunctions.cpp +++ b/Source/Core/VideoCommon/Src/BPFunctions.cpp @@ -156,13 +156,13 @@ void ClearScreen(const BPCmd &bp, const EFBRectangle &rc) u32 srcg8 = (color & 0xFF00) >> 8; u32 srcb8 = color & 0xFF; u32 dstr6 = srcr8 >> 2; - u32 dstg6 = ((srcr8 & 0xFF) << 4) | (srcg8 >> 4); - u32 dstb6 = ((srcg8 & 0xFFFF) << 2) | (srcb8 >> 6); - u32 dsta6 = srcb8 & 0xFFFFFF; - u32 dstr8 = (dstr6 << 2) | (dstr6>>4); - u32 dstg8 = (dstg6 << 2) | (dstg6>>4); - u32 dstb8 = (dstb6 << 2) | (dstb6>>4); - u32 dsta8 = (dsta6 << 2) | (dsta6>>4); + u32 dstg6 = ((srcr8 & 0x3) << 4) | (srcg8 >> 4); + u32 dstb6 = ((srcg8 & 0xF) << 2) | (srcb8 >> 6); + u32 dsta6 = srcb8 & 0x3F; + u32 dstr8 = (dstr6 << 2) | (dstr6 >> 4); + u32 dstg8 = (dstg6 << 2) | (dstg6 >> 4); + u32 dstb8 = (dstb6 << 2) | (dstb6 >> 4); + u32 dsta8 = (dsta6 << 2) | (dsta6 >> 4); color = (dsta8 << 24) | (dstr8 << 16) | (dstg8 << 8) | dstb8; } else // (2): convert RGBA8 color to RGBA6 diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 0e8111cafb..a91b0d5f6c 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -94,8 +94,8 @@ public: static int EFBToScaledY(int y) { return y * GetTargetHeight() / EFB_HEIGHT; } // Floating point versions of the above - only use them if really necessary - static float EFBToScaledXf(float x) { return x * (float)GetTargetWidth() / (float)EFB_WIDTH; } - static float EFBToScaledYf(float y) { return y * (float)GetTargetHeight() / (float)EFB_HEIGHT; } + static float EFBToScaledXf(float x) { return x * ((float)GetTargetWidth() / (float)EFB_WIDTH); } + static float EFBToScaledYf(float y) { return y * ((float)GetTargetHeight() / (float)EFB_HEIGHT); } // Returns the offset at which the EFB will be drawn onto the backbuffer // NOTE: Never calculate this manually (e.g. to "increase accuracy"), since you might end up getting off-by-one errors. diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp index 780476da56..d886a449bb 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp @@ -355,7 +355,6 @@ void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyf s32 expandedHeight = (height + blkH) & (~blkH); float sampleStride = bScaleByHalf ? 2.f : 1.f; - // TODO: sampleStride scaling might be slightly off TextureConversionShader::SetShaderParameters( (float)expandedWidth, (float)Renderer::EFBToScaledY(expandedHeight), // TODO: Why do we scale this? @@ -420,7 +419,6 @@ u64 EncodeToRamFromTexture(u32 address,LPDIRECT3DTEXTURE9 source_texture, u32 So s32 expandedHeight = (height + blkH) & (~blkH); float sampleStride = bScaleByHalf ? 2.f : 1.f; - // TODO: sampleStride scaling might be slightly off TextureConversionShader::SetShaderParameters( (float)expandedWidth, (float)Renderer::EFBToScaledY(expandedHeight), // TODO: Why do we scale this? diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp index 2d34bf33da..cc72f29b86 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp @@ -285,7 +285,6 @@ void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyf s32 expandedHeight = (height + blkH) & (~blkH); float sampleStride = bScaleByHalf ? 2.f : 1.f; - // TODO: sampleStride scaling might be slightly off TextureConversionShader::SetShaderParameters((float)expandedWidth, (float)Renderer::EFBToScaledY(expandedHeight), // TODO: Why do we scale this? (float)Renderer::EFBToScaledX(source.left), @@ -350,7 +349,6 @@ u64 EncodeToRamFromTexture(u32 address,GLuint source_texture, bool bFromZBuffer, s32 expandedHeight = (height + blkH) & (~blkH); float sampleStride = bScaleByHalf ? 2.f : 1.f; - // TODO: sampleStride scaling might be slightly off TextureConversionShader::SetShaderParameters((float)expandedWidth, (float)Renderer::EFBToScaledY(expandedHeight), // TODO: Why do we scale this? (float)Renderer::EFBToScaledX(source.left),