OGL-TextureConverter: Keep care about the global state ifself

This commit is contained in:
degasus
2015-10-29 08:45:17 +01:00
parent 495902787c
commit 71b22702a1
3 changed files with 17 additions and 10 deletions

View File

@ -270,17 +270,26 @@ static void EncodeToRamUsingShader(GLuint srcTexture,
}
void EncodeToRamFromTexture(u8 *dest_ptr, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
GLuint source_texture, bool bFromZBuffer, bool bIsIntensityFmt, int bScaleByHalf, const EFBRectangle& source)
PEControl::PixelFormat srcFormat, bool bIsIntensityFmt, int bScaleByHalf, const EFBRectangle& source)
{
g_renderer->ResetAPIState();
SHADER& texconv_shader = GetOrCreateEncodingShader(format);
texconv_shader.Bind();
glUniform4i(s_encodingUniforms[format],
source.left, source.top, native_width, bScaleByHalf ? 2 : 1);
EncodeToRamUsingShader(source_texture,
const GLuint read_texture = (srcFormat == PEControl::Z24) ?
FramebufferManager::ResolveAndGetDepthTarget(source) :
FramebufferManager::ResolveAndGetRenderTarget(source);
EncodeToRamUsingShader(read_texture,
dest_ptr, bytes_per_row, num_blocks_y,
memory_stride, bScaleByHalf > 0 && !bFromZBuffer);
memory_stride, bScaleByHalf > 0 && srcFormat != PEControl::Z24);
FramebufferManager::SetFramebuffer(0);
g_renderer->RestoreAPIState();
}
void EncodeToRamYUYV(GLuint srcTexture, const TargetRectangle& sourceRc, u8* destAddr, u32 dstWidth, u32 dstStride, u32 dstHeight)