mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 22:49:00 +01:00
OGL-TextureConverter: Keep care about the global state ifself
This commit is contained in:
parent
495902787c
commit
71b22702a1
@ -264,6 +264,9 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dstPointer, unsigned int ds
|
|||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
|
FramebufferManager::SetFramebuffer(0);
|
||||||
|
g_renderer->RestoreAPIState();
|
||||||
|
|
||||||
if (g_ActiveConfig.bSkipEFBCopyToRam)
|
if (g_ActiveConfig.bSkipEFBCopyToRam)
|
||||||
{
|
{
|
||||||
this->Zero(dstPointer);
|
this->Zero(dstPointer);
|
||||||
@ -277,16 +280,11 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dstPointer, unsigned int ds
|
|||||||
BytesPerRow(),
|
BytesPerRow(),
|
||||||
NumBlocksY(),
|
NumBlocksY(),
|
||||||
memory_stride,
|
memory_stride,
|
||||||
read_texture,
|
srcFormat,
|
||||||
srcFormat == PEControl::Z24,
|
|
||||||
isIntensity,
|
isIntensity,
|
||||||
scaleByHalf,
|
scaleByHalf,
|
||||||
srcRect);
|
srcRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
FramebufferManager::SetFramebuffer(0);
|
|
||||||
|
|
||||||
g_renderer->RestoreAPIState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureCache::TextureCache()
|
TextureCache::TextureCache()
|
||||||
|
@ -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,
|
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);
|
SHADER& texconv_shader = GetOrCreateEncodingShader(format);
|
||||||
|
|
||||||
texconv_shader.Bind();
|
texconv_shader.Bind();
|
||||||
glUniform4i(s_encodingUniforms[format],
|
glUniform4i(s_encodingUniforms[format],
|
||||||
source.left, source.top, native_width, bScaleByHalf ? 2 : 1);
|
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,
|
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)
|
void EncodeToRamYUYV(GLuint srcTexture, const TargetRectangle& sourceRc, u8* destAddr, u32 dstWidth, u32 dstStride, u32 dstHeight)
|
||||||
|
@ -27,7 +27,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
|
|||||||
|
|
||||||
// returns size of the encoded data (in bytes)
|
// returns size of the encoded data (in bytes)
|
||||||
void EncodeToRamFromTexture(u8 *dest_ptr, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y, u32 memory_stride,
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user