mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
TextureCache: Extract BP enum check to VideoCommon.
We have TOO many video backends.
This commit is contained in:
@ -204,14 +204,14 @@ void TextureCache::TCacheEntry::Load(const u8* buffer, u32 width, u32 height, u3
|
||||
TextureCache::SetStage();
|
||||
}
|
||||
|
||||
void TextureCache::TCacheEntry::FromRenderTarget(u8* dstPointer, PEControl::PixelFormat srcFormat,
|
||||
void TextureCache::TCacheEntry::FromRenderTarget(u8* dstPointer, bool is_depth_copy,
|
||||
const EFBRectangle& srcRect, bool scaleByHalf,
|
||||
unsigned int cbufid, const float* colmat)
|
||||
{
|
||||
g_renderer->ResetAPIState(); // reset any game specific settings
|
||||
|
||||
// Make sure to resolve anything we need to read from.
|
||||
const GLuint read_texture = (srcFormat == PEControl::Z24) ?
|
||||
const GLuint read_texture = is_depth_copy ?
|
||||
FramebufferManager::ResolveAndGetDepthTarget(srcRect) :
|
||||
FramebufferManager::ResolveAndGetRenderTarget(srcRect);
|
||||
|
||||
@ -229,7 +229,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dstPointer, PEControl::Pixe
|
||||
glViewport(0, 0, config.width, config.height);
|
||||
|
||||
GLuint uniform_location;
|
||||
if (srcFormat == PEControl::Z24)
|
||||
if (is_depth_copy)
|
||||
{
|
||||
s_DepthMatrixProgram.Bind();
|
||||
if (s_DepthCbufid != cbufid)
|
||||
@ -257,11 +257,11 @@ void TextureCache::TCacheEntry::FromRenderTarget(u8* dstPointer, PEControl::Pixe
|
||||
}
|
||||
|
||||
void TextureCache::CopyEFB(u8* dst, u32 format, u32 native_width, u32 bytes_per_row,
|
||||
u32 num_blocks_y, u32 memory_stride, PEControl::PixelFormat srcFormat,
|
||||
u32 num_blocks_y, u32 memory_stride, bool is_depth_copy,
|
||||
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf)
|
||||
{
|
||||
TextureConverter::EncodeToRamFromTexture(dst, format, native_width, bytes_per_row, num_blocks_y,
|
||||
memory_stride, srcFormat, isIntensity, scaleByHalf,
|
||||
memory_stride, is_depth_copy, isIntensity, scaleByHalf,
|
||||
srcRect);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
|
||||
void Load(const u8* buffer, u32 width, u32 height, u32 expanded_width, u32 level) override;
|
||||
|
||||
void FromRenderTarget(u8* dst, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||
void FromRenderTarget(u8* dst, bool is_depth_copy, const EFBRectangle& srcRect,
|
||||
bool scaleByHalf, unsigned int cbufid, const float* colmat) override;
|
||||
|
||||
void Bind(unsigned int stage) override;
|
||||
@ -53,8 +53,8 @@ private:
|
||||
TlutFormat format) override;
|
||||
|
||||
void CopyEFB(u8* dst, u32 format, u32 native_width, u32 bytes_per_row, u32 num_blocks_y,
|
||||
u32 memory_stride, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||
bool isIntensity, bool scaleByHalf) override;
|
||||
u32 memory_stride, bool is_depth_copy, const EFBRectangle& srcRect, bool isIntensity,
|
||||
bool scaleByHalf) override;
|
||||
|
||||
bool CompileShaders() override;
|
||||
void DeleteShaders() override;
|
||||
|
@ -270,7 +270,7 @@ static void EncodeToRamUsingShader(GLuint srcTexture, u8* destAddr, u32 dst_line
|
||||
}
|
||||
|
||||
void EncodeToRamFromTexture(u8* dest_ptr, u32 format, u32 native_width, u32 bytes_per_row,
|
||||
u32 num_blocks_y, u32 memory_stride, PEControl::PixelFormat srcFormat,
|
||||
u32 num_blocks_y, u32 memory_stride, bool is_depth_copy,
|
||||
bool bIsIntensityFmt, int bScaleByHalf, const EFBRectangle& source)
|
||||
{
|
||||
g_renderer->ResetAPIState();
|
||||
@ -281,12 +281,11 @@ void EncodeToRamFromTexture(u8* dest_ptr, u32 format, u32 native_width, u32 byte
|
||||
glUniform4i(s_encodingUniforms[format], source.left, source.top, native_width,
|
||||
bScaleByHalf ? 2 : 1);
|
||||
|
||||
const GLuint read_texture = (srcFormat == PEControl::Z24) ?
|
||||
FramebufferManager::ResolveAndGetDepthTarget(source) :
|
||||
FramebufferManager::ResolveAndGetRenderTarget(source);
|
||||
const GLuint read_texture = is_depth_copy ? FramebufferManager::ResolveAndGetDepthTarget(source) :
|
||||
FramebufferManager::ResolveAndGetRenderTarget(source);
|
||||
|
||||
EncodeToRamUsingShader(read_texture, dest_ptr, bytes_per_row, num_blocks_y, memory_stride,
|
||||
bScaleByHalf > 0 && srcFormat != PEControl::Z24);
|
||||
bScaleByHalf > 0 && !is_depth_copy);
|
||||
|
||||
FramebufferManager::SetFramebuffer(0);
|
||||
g_renderer->RestoreAPIState();
|
||||
|
@ -25,7 +25,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
|
||||
|
||||
// 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, PEControl::PixelFormat srcFormat,
|
||||
u32 num_blocks_y, u32 memory_stride, bool is_depth_copy,
|
||||
bool bIsIntensityFmt, int bScaleByHalf, const EFBRectangle& source);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user