HybridXFB: Fix lint errors

This commit is contained in:
iwubcode 2017-09-02 21:30:34 -05:00
parent 725d14e4c6
commit 53684701fa
39 changed files with 207 additions and 204 deletions

View File

@ -28,17 +28,17 @@ bool IsSettingSaveable(const Config::ConfigLocation& config_location)
// Graphics.Settings // Graphics.Settings
Config::GFX_WIDESCREEN_HACK.location, Config::GFX_ASPECT_RATIO.location, Config::GFX_WIDESCREEN_HACK.location, Config::GFX_ASPECT_RATIO.location,
Config::GFX_CROP.location, Config::GFX_CROP.location, Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES.location,
Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES.location, Config::GFX_SHOW_FPS.location, Config::GFX_SHOW_FPS.location, Config::GFX_SHOW_NETPLAY_PING.location,
Config::GFX_SHOW_NETPLAY_PING.location, Config::GFX_SHOW_NETPLAY_MESSAGES.location, Config::GFX_SHOW_NETPLAY_MESSAGES.location, Config::GFX_LOG_RENDER_TIME_TO_FILE.location,
Config::GFX_LOG_RENDER_TIME_TO_FILE.location, Config::GFX_OVERLAY_STATS.location, Config::GFX_OVERLAY_STATS.location, Config::GFX_OVERLAY_PROJ_STATS.location,
Config::GFX_OVERLAY_PROJ_STATS.location, Config::GFX_DUMP_TEXTURES.location, Config::GFX_DUMP_TEXTURES.location, Config::GFX_HIRES_TEXTURES.location,
Config::GFX_HIRES_TEXTURES.location, Config::GFX_CONVERT_HIRES_TEXTURES.location, Config::GFX_CONVERT_HIRES_TEXTURES.location, Config::GFX_CACHE_HIRES_TEXTURES.location,
Config::GFX_CACHE_HIRES_TEXTURES.location, Config::GFX_DUMP_EFB_TARGET.location, Config::GFX_DUMP_EFB_TARGET.location, Config::GFX_DUMP_FRAMES_AS_IMAGES.location,
Config::GFX_DUMP_FRAMES_AS_IMAGES.location, Config::GFX_FREE_LOOK.location, Config::GFX_FREE_LOOK.location, Config::GFX_USE_FFV1.location,
Config::GFX_USE_FFV1.location, Config::GFX_DUMP_FORMAT.location, Config::GFX_DUMP_FORMAT.location, Config::GFX_DUMP_CODEC.location,
Config::GFX_DUMP_CODEC.location, Config::GFX_DUMP_PATH.location, Config::GFX_DUMP_PATH.location, Config::GFX_BITRATE_KBPS.location,
Config::GFX_BITRATE_KBPS.location, Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS.location, Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS.location,
Config::GFX_ENABLE_GPU_TEXTURE_DECODING.location, Config::GFX_ENABLE_PIXEL_LIGHTING.location, Config::GFX_ENABLE_GPU_TEXTURE_DECODING.location, Config::GFX_ENABLE_PIXEL_LIGHTING.location,
Config::GFX_FAST_DEPTH_CALC.location, Config::GFX_MSAA.location, Config::GFX_SSAA.location, Config::GFX_FAST_DEPTH_CALC.location, Config::GFX_MSAA.location, Config::GFX_SSAA.location,
Config::GFX_EFB_SCALE.location, Config::GFX_TEXFMT_OVERLAY_ENABLE.location, Config::GFX_EFB_SCALE.location, Config::GFX_TEXFMT_OVERLAY_ENABLE.location,
@ -73,8 +73,7 @@ bool IsSettingSaveable(const Config::ConfigLocation& config_location)
Config::GFX_HACK_EFB_ACCESS_ENABLE.location, Config::GFX_HACK_BBOX_ENABLE.location, Config::GFX_HACK_EFB_ACCESS_ENABLE.location, Config::GFX_HACK_BBOX_ENABLE.location,
Config::GFX_HACK_BBOX_PREFER_STENCIL_IMPLEMENTATION.location, Config::GFX_HACK_BBOX_PREFER_STENCIL_IMPLEMENTATION.location,
Config::GFX_HACK_FORCE_PROGRESSIVE.location, Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM.location, Config::GFX_HACK_FORCE_PROGRESSIVE.location, Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM.location,
Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM.location, Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM.location, Config::GFX_HACK_IMMEDIATE_XFB.location,
Config::GFX_HACK_IMMEDIATE_XFB.location,
Config::GFX_HACK_COPY_EFB_ENABLED.location, Config::GFX_HACK_COPY_EFB_ENABLED.location,
Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES.location, Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES.location,
Config::GFX_HACK_VERTEX_ROUDING.location, Config::GFX_HACK_VERTEX_ROUDING.location,

View File

@ -39,7 +39,6 @@ static void LoadFromDTM(Config::Layer* config_layer, Movie::DTMHeader* dtm)
else else
config_layer->Set(Config::MAIN_GC_LANGUAGE, static_cast<int>(dtm->language)); config_layer->Set(Config::MAIN_GC_LANGUAGE, static_cast<int>(dtm->language));
config_layer->Set(Config::GFX_HACK_EFB_ACCESS_ENABLE, dtm->bEFBAccessEnable); config_layer->Set(Config::GFX_HACK_EFB_ACCESS_ENABLE, dtm->bEFBAccessEnable);
config_layer->Set(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM, dtm->bSkipEFBCopyToRam); config_layer->Set(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM, dtm->bSkipEFBCopyToRam);
config_layer->Set(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM, dtm->bSkipXFBCopyToRam); config_layer->Set(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM, dtm->bSkipXFBCopyToRam);

View File

@ -69,8 +69,7 @@ void HacksWidget::CreateWidgets()
m_store_xfb_copies = new GraphicsBool(tr("Store XFB Copies to Texture Only"), m_store_xfb_copies = new GraphicsBool(tr("Store XFB Copies to Texture Only"),
Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM); Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM);
m_immediate_xfb = new GraphicsBool(tr("Immediately Present XFB"), m_immediate_xfb = new GraphicsBool(tr("Immediately Present XFB"), Config::GFX_HACK_IMMEDIATE_XFB);
Config::GFX_HACK_IMMEDIATE_XFB);
xfb_layout->addWidget(m_store_xfb_copies, 1, 0); xfb_layout->addWidget(m_store_xfb_copies, 1, 0);
@ -173,12 +172,15 @@ void HacksWidget::AddDescriptions()
static const char* TR_STORE_XFB_TO_TEXTURE_DESCRIPTION = QT_TR_NOOP( static const char* TR_STORE_XFB_TO_TEXTURE_DESCRIPTION = QT_TR_NOOP(
"Stores XFB Copies exclusively on the GPU, bypassing system memory. Causes graphical defects " "Stores XFB Copies exclusively on the GPU, bypassing system memory. Causes graphical defects "
"in a small number of games that need to readback from memory.\n\nEnabled = XFB Copies to Texture\nDisabled = XFB Copies to RAM " "in a small number of games that need to readback from memory.\n\nEnabled = XFB Copies to "
"Texture\nDisabled = XFB Copies to RAM "
"(and Texture)\n\nIf unsure, leave this checked."); "(and Texture)\n\nIf unsure, leave this checked.");
static const char* TR_IMMEDIATE_XFB_DESCRIPTION = QT_TR_NOOP( static const char* TR_IMMEDIATE_XFB_DESCRIPTION =
"Displays the XFB copies as soon as they are created, without waiting for scanout. Can cause graphical defects " QT_TR_NOOP("Displays the XFB copies as soon as they are created, without waiting for "
"in some games if the game doesn't expect all XFB copies to be displayed. However, turning this setting on reduces latency." "scanout. Can cause graphical defects "
"in some games if the game doesn't expect all XFB copies to be displayed. "
"However, turning this setting on reduces latency."
"\n\nIf unsure, leave this unchecked."); "\n\nIf unsure, leave this unchecked.");
static const char* TR_GPU_DECODING_DESCRIPTION = static const char* TR_GPU_DECODING_DESCRIPTION =

View File

@ -203,11 +203,14 @@ static wxString skip_efb_copy_to_ram_desc = wxTRANSLATE(
"(and Texture)\n\nIf unsure, leave this checked."); "(and Texture)\n\nIf unsure, leave this checked.");
static wxString skip_xfb_copy_to_ram_desc = wxTRANSLATE( static wxString skip_xfb_copy_to_ram_desc = wxTRANSLATE(
"Stores XFB Copies exclusively on the GPU, bypassing system memory. Causes graphical defects " "Stores XFB Copies exclusively on the GPU, bypassing system memory. Causes graphical defects "
"in a small number of games that need to readback from memory.\n\nEnabled = XFB Copies to Texture\nDisabled = XFB Copies to RAM " "in a small number of games that need to readback from memory.\n\nEnabled = XFB Copies to "
"Texture\nDisabled = XFB Copies to RAM "
"(and Texture)\n\nIf unsure, leave this checked."); "(and Texture)\n\nIf unsure, leave this checked.");
static wxString immediate_xfb_desc = wxTRANSLATE( static wxString immediate_xfb_desc =
"Displays the XFB copies as soon as they are created, without waiting for scanout. Can cause graphical defects " wxTRANSLATE("Displays the XFB copies as soon as they are created, without waiting for scanout. "
"in some games if the game doesn't expect all XFB copies to be displayed. However, turning this setting on reduces latency." "Can cause graphical defects "
"in some games if the game doesn't expect all XFB copies to be displayed. However, "
"turning this setting on reduces latency."
"\n\nIf unsure, leave this unchecked."); "\n\nIf unsure, leave this unchecked.");
static wxString stc_desc = static wxString stc_desc =
wxTRANSLATE("The \"Safe\" setting eliminates the likelihood of the GPU missing texture updates " wxTRANSLATE("The \"Safe\" setting eliminates the likelihood of the GPU missing texture updates "
@ -886,7 +889,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
wxGetTranslation(dump_efb_desc), wxGetTranslation(dump_efb_desc),
Config::GFX_DUMP_EFB_TARGET)); Config::GFX_DUMP_EFB_TARGET));
szr_utility->Add(CreateCheckBox(page_advanced, _("Dump XFB Target"), szr_utility->Add(CreateCheckBox(page_advanced, _("Dump XFB Target"),
wxGetTranslation(dump_xfb_desc), Config::GFX_DUMP_XFB_TARGET)); wxGetTranslation(dump_xfb_desc),
Config::GFX_DUMP_XFB_TARGET));
szr_utility->Add(CreateCheckBox(page_advanced, _("Free Look"), szr_utility->Add(CreateCheckBox(page_advanced, _("Free Look"),
wxGetTranslation(free_look_desc), Config::GFX_FREE_LOOK)); wxGetTranslation(free_look_desc), Config::GFX_FREE_LOOK));
#if defined(HAVE_FFMPEG) #if defined(HAVE_FFMPEG)

View File

@ -46,8 +46,8 @@ void PSTextureEncoder::Init()
// TODO: This Texture is overly large and parts of it are unused // TODO: This Texture is overly large and parts of it are unused
// EFB2RAM copies use max (EFB_WIDTH * 4) by (EFB_HEIGHT / 4) // EFB2RAM copies use max (EFB_WIDTH * 4) by (EFB_HEIGHT / 4)
// XFB2RAM copies use max (EFB_WIDTH / 2) by (EFB_HEIGHT) // XFB2RAM copies use max (EFB_WIDTH / 2) by (EFB_HEIGHT)
D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_B8G8R8A8_UNORM, EFB_WIDTH * 4, D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_B8G8R8A8_UNORM, EFB_WIDTH * 4, 1024,
1024, 1, 1, D3D11_BIND_RENDER_TARGET); 1, 1, D3D11_BIND_RENDER_TARGET);
hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_out); hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_out);
CHECK(SUCCEEDED(hr), "create efb encode output texture"); CHECK(SUCCEEDED(hr), "create efb encode output texture");
D3D::SetDebugObjectName(m_out, "efb encoder output texture"); D3D::SetDebugObjectName(m_out, "efb encoder output texture");

View File

@ -39,8 +39,8 @@
#include "VideoCommon/RenderState.h" #include "VideoCommon/RenderState.h"
#include "VideoCommon/SamplerCommon.h" #include "VideoCommon/SamplerCommon.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/XFMemory.h" #include "VideoCommon/XFMemory.h"
namespace DX11 namespace DX11
@ -626,8 +626,8 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ti
auto* xfb_texture = static_cast<DXTexture*>(texture); auto* xfb_texture = static_cast<DXTexture*>(texture);
TargetRectangle source_rc = xfb_texture->GetConfig().GetRect(); TargetRectangle source_rc = xfb_texture->GetConfig().GetRect();
BlitScreen(source_rc, targetRc, xfb_texture->GetRawTexIdentifier(), xfb_texture->GetConfig().width, BlitScreen(source_rc, targetRc, xfb_texture->GetRawTexIdentifier(),
xfb_texture->GetConfig().height, Gamma); xfb_texture->GetConfig().width, xfb_texture->GetConfig().height, Gamma);
// Reset viewport for drawing text // Reset viewport for drawing text
D3D11_VIEWPORT vp = D3D11_VIEWPORT vp =

View File

@ -1353,7 +1353,8 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ti
// Copy the framebuffer to screen. // Copy the framebuffer to screen.
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
BlitScreen(sourceRc, flipped_trc, xfb_texture->GetRawTexIdentifier(), xfb_texture->GetConfig().width, xfb_texture->GetConfig().height); BlitScreen(sourceRc, flipped_trc, xfb_texture->GetRawTexIdentifier(),
xfb_texture->GetConfig().width, xfb_texture->GetConfig().height);
// Finish up the current frame, print some stats // Finish up the current frame, print some stats

View File

@ -111,7 +111,8 @@ private:
void UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRectangle& efbPixelRc, void UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRectangle& efbPixelRc,
const TargetRectangle& targetPixelRc, const void* data); const TargetRectangle& targetPixelRc, const void* data);
void DrawEFB(GLuint framebuffer, const TargetRectangle& target_rc, const TargetRectangle& source_rc); void DrawEFB(GLuint framebuffer, const TargetRectangle& target_rc,
const TargetRectangle& source_rc);
void BlitScreen(TargetRectangle src, TargetRectangle dst, GLuint src_texture, int src_width, void BlitScreen(TargetRectangle src, TargetRectangle dst, GLuint src_texture, int src_width,
int src_height); int src_height);

View File

@ -14,7 +14,6 @@
namespace EfbCopy namespace EfbCopy
{ {
void ClearEfb() void ClearEfb()
{ {
u32 clearColor = (bpmem.clearcolorAR & 0xff) << 24 | bpmem.clearcolorGB << 8 | u32 clearColor = (bpmem.clearcolorAR & 0xff) << 24 | bpmem.clearcolorGB << 8 |
@ -34,5 +33,4 @@ void ClearEfb()
} }
} }
} }
} }

View File

@ -497,7 +497,8 @@ u8* GetPixelPointer(u16 x, u16 y, bool depth)
return &efb[GetColorOffset(x, y)]; return &efb[GetColorOffset(x, y)];
} }
void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale) void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect,
float y_scale)
{ {
if (!xfb_in_ram) if (!xfb_in_ram)
{ {
@ -543,8 +544,7 @@ void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle&
src_ptr[x].Y = scanline[i].Y + 16; src_ptr[x].Y = scanline[i].Y + 16;
// we mix our color differences in 10 bit space so it will round more accurately // we mix our color differences in 10 bit space so it will round more accurately
// U[i] = 1/4 * U[i-1] + 1/2 * U[i] + 1/4 * U[i+1] // U[i] = 1/4 * U[i-1] + 1/2 * U[i] + 1/4 * U[i+1]
src_ptr[x].UV = src_ptr[x].UV = 128 + ((scanline[i - 1].U + (scanline[i].U << 1) + scanline[i + 1].U) >> 2);
128 + ((scanline[i - 1].U + (scanline[i].U << 1) + scanline[i + 1].U) >> 2);
// YV pixel // YV pixel
src_ptr[x + 1].Y = scanline[i + 1].Y + 16; src_ptr[x + 1].Y = scanline[i + 1].Y + 16;
@ -556,7 +556,9 @@ void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle&
} }
// Apply y scaling and copy to the xfb memory location // Apply y scaling and copy to the xfb memory location
SW::copy_region(source.data(), source_rect, xfb_in_ram, EFBRectangle{ source_rect.left, source_rect.top, source_rect.right, static_cast<int>(static_cast<float>(source_rect.bottom) * y_scale) }); SW::copy_region(source.data(), source_rect, xfb_in_ram,
EFBRectangle{source_rect.left, source_rect.top, source_rect.right,
static_cast<int>(static_cast<float>(source_rect.bottom) * y_scale)});
} }
bool ZCompare(u16 x, u16 y, u32 z) bool ZCompare(u16 x, u16 y, u32 z)

View File

@ -57,7 +57,8 @@ u32 GetDepth(u16 x, u16 y);
u8* GetPixelPointer(u16 x, u16 y, bool depth); u8* GetPixelPointer(u16 x, u16 y, bool depth);
void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect, float y_scale); void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle& source_rect,
float y_scale);
extern u32 perf_values[PQ_NUM_MEMBERS]; extern u32 perf_values[PQ_NUM_MEMBERS];
inline void IncPerfCounterQuadCount(PerfQueryType type) inline void IncPerfCounterQuadCount(PerfQueryType type)

View File

@ -31,7 +31,6 @@ public:
private: private:
SWOGLWindow() {} SWOGLWindow() {}
struct TextData struct TextData
{ {
std::string text; std::string text;

View File

@ -10,7 +10,6 @@
namespace SW namespace SW
{ {
SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config) SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config)
{ {
} }
@ -27,7 +26,8 @@ void SWTexture::CopyRectangleFromTexture(const AbstractTexture* source,
if (srcrect.GetWidth() == dstrect.GetWidth() && srcrect.GetHeight() == dstrect.GetHeight()) if (srcrect.GetWidth() == dstrect.GetWidth() && srcrect.GetHeight() == dstrect.GetHeight())
{ {
m_data.assign(software_source_texture->GetData(), software_source_texture->GetData() + m_data.size()); m_data.assign(software_source_texture->GetData(),
software_source_texture->GetData() + m_data.size());
} }
else else
{ {
@ -53,8 +53,8 @@ u8* SWTexture::GetData()
std::optional<AbstractTexture::RawTextureInfo> SWTexture::MapFullImpl() std::optional<AbstractTexture::RawTextureInfo> SWTexture::MapFullImpl()
{ {
return AbstractTexture::RawTextureInfo{ GetData(), return AbstractTexture::RawTextureInfo{GetData(), m_config.width * 4, m_config.width,
m_config.width * 4, m_config.width, m_config.height }; m_config.height};
} }
} // namespace SW } // namespace SW

View File

@ -30,7 +30,6 @@ public:
u8* GetData(); u8* GetData();
private: private:
std::optional<RawTextureInfo> MapFullImpl() override; std::optional<RawTextureInfo> MapFullImpl() override;
std::vector<u8> m_data; std::vector<u8> m_data;

View File

@ -7,7 +7,6 @@
namespace SW namespace SW
{ {
class TextureCache : public TextureCacheBase class TextureCache : public TextureCacheBase
{ {
public: public:
@ -21,9 +20,8 @@ public:
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
bool scale_by_half) override bool scale_by_half) override
{ {
TextureEncoder::Encode(dst, params, native_width, bytes_per_row, TextureEncoder::Encode(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride,
num_blocks_y, memory_stride, src_rect, src_rect, scale_by_half);
scale_by_half);
} }
private: private:

View File

@ -1423,8 +1423,7 @@ namespace
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
bool scale_by_half) bool scale_by_half)
{ {
const u8* src = const u8* src = EfbInterface::GetPixelPointer(src_rect.left, src_rect.top, params.depth);
EfbInterface::GetPixelPointer(src_rect.left, src_rect.top, params.depth);
if (scale_by_half) if (scale_by_half)
{ {
@ -1466,16 +1465,17 @@ namespace
} }
void Encode(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row, void Encode(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, bool scale_by_half)
bool scale_by_half)
{ {
if (params.copy_format == EFBCopyFormat::XFB) if (params.copy_format == EFBCopyFormat::XFB)
{ {
EfbInterface::EncodeXFB(reinterpret_cast<EfbInterface::yuv422_packed*>(dst), native_width, src_rect, params.y_scale); EfbInterface::EncodeXFB(reinterpret_cast<EfbInterface::yuv422_packed*>(dst), native_width,
src_rect, params.y_scale);
} }
else else
{ {
EncodeEfbCopy(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride, src_rect, scale_by_half); EncodeEfbCopy(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride, src_rect,
scale_by_half);
} }
} }
} }

View File

@ -12,6 +12,5 @@ struct EFBCopyParams;
namespace TextureEncoder namespace TextureEncoder
{ {
void Encode(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row, void Encode(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, bool scale_by_half);
bool scale_by_half);
} }

View File

@ -265,8 +265,8 @@ void TextureConverter::EncodeTextureToMemory(VkImageView src_texture, u8* dest_p
// We also linear filtering for both box filtering and downsampling higher resolutions to 1x // We also linear filtering for both box filtering and downsampling higher resolutions to 1x
// TODO: This only produces perfect downsampling for 2x IR, other resolutions will need more // TODO: This only produces perfect downsampling for 2x IR, other resolutions will need more
// complex down filtering to average all pixels and produce the correct result. // complex down filtering to average all pixels and produce the correct result.
bool linear_filter = (scale_by_half && !params.depth) || g_renderer->GetEFBScale() != 1 || bool linear_filter =
params.y_scale > 1.0f; (scale_by_half && !params.depth) || g_renderer->GetEFBScale() != 1 || params.y_scale > 1.0f;
draw.SetPSSampler(0, src_texture, linear_filter ? g_object_cache->GetLinearSampler() : draw.SetPSSampler(0, src_texture, linear_filter ? g_object_cache->GetLinearSampler() :
g_object_cache->GetPointSampler()); g_object_cache->GetPointSampler());

View File

@ -261,8 +261,8 @@ static void BPWritten(const BPCmd& bp)
bool is_depth_copy = bpmem.zcontrol.pixel_format == PEControl::Z24; bool is_depth_copy = bpmem.zcontrol.pixel_format == PEControl::Z24;
g_texture_cache->CopyRenderTargetToTexture(destAddr, EFBCopyFormat::XFB, destStride, g_texture_cache->CopyRenderTargetToTexture(destAddr, EFBCopyFormat::XFB, destStride,
is_depth_copy, srcRect, false, is_depth_copy, srcRect, false, false, yScale,
false, yScale, s_gammaLUT[PE_copy.gamma]); s_gammaLUT[PE_copy.gamma]);
// This stays in to signal end of a "frame" // This stays in to signal end of a "frame"
g_renderer->RenderToXFB(destAddr, srcRect, destStride, height, s_gammaLUT[PE_copy.gamma]); g_renderer->RenderToXFB(destAddr, srcRect, destStride, height, s_gammaLUT[PE_copy.gamma]);

View File

@ -17,4 +17,3 @@ std::unique_ptr<FramebufferManagerBase> g_framebuffer_manager;
unsigned int FramebufferManagerBase::m_EFBLayers = 1; unsigned int FramebufferManagerBase::m_EFBLayers = 1;
FramebufferManagerBase::~FramebufferManagerBase() = default; FramebufferManagerBase::~FramebufferManagerBase() = default;

View File

@ -23,9 +23,7 @@ public:
virtual ~FramebufferManagerBase(); virtual ~FramebufferManagerBase();
static unsigned int GetEFBLayers() { return m_EFBLayers; } static unsigned int GetEFBLayers() { return m_EFBLayers; }
protected: protected:
static unsigned int m_EFBLayers; static unsigned int m_EFBLayers;
}; };

View File

@ -42,8 +42,8 @@
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/Movie.h" #include "Core/Movie.h"
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/AVIDump.h" #include "VideoCommon/AVIDump.h"
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/BPMemory.h" #include "VideoCommon/BPMemory.h"
#include "VideoCommon/CPMemory.h" #include "VideoCommon/CPMemory.h"
#include "VideoCommon/CommandProcessor.h" #include "VideoCommon/CommandProcessor.h"
@ -336,7 +336,8 @@ void Renderer::DrawDebugText()
"Speed Limit: Unlimited" : "Speed Limit: Unlimited" :
StringFromFormat("Speed Limit: %li%%", StringFromFormat("Speed Limit: %li%%",
std::lround(SConfig::GetInstance().m_EmulationSpeed * 100.f)), std::lround(SConfig::GetInstance().m_EmulationSpeed * 100.f)),
std::string("Copy XFB: ") + xfbcopy_text + (g_ActiveConfig.bImmediateXFB ? " (Immediate)" : ""), std::string("Copy XFB: ") + xfbcopy_text +
(g_ActiveConfig.bImmediateXFB ? " (Immediate)" : ""),
}; };
enum enum
@ -691,7 +692,8 @@ bool Renderer::IsFrameDumping()
void Renderer::UpdateFrameDumpTexture(float horizontal_scale) void Renderer::UpdateFrameDumpTexture(float horizontal_scale)
{ {
int target_width, target_height; int target_width, target_height;
std::tie(target_width, target_height) = CalculateOutputDimensions(m_last_xfb_texture->GetConfig().width, m_last_xfb_texture->GetConfig().height); std::tie(target_width, target_height) = CalculateOutputDimensions(
m_last_xfb_texture->GetConfig().width, m_last_xfb_texture->GetConfig().height);
if (m_dump_texture == nullptr || if (m_dump_texture == nullptr ||
m_dump_texture->GetConfig().width != static_cast<u32>(target_width) || m_dump_texture->GetConfig().width != static_cast<u32>(target_width) ||
m_dump_texture->GetConfig().height != static_cast<u32>(target_height)) m_dump_texture->GetConfig().height != static_cast<u32>(target_height))

View File

@ -376,15 +376,16 @@ TextureCacheBase::DoPartialTextureUpdates(TCacheEntry* entry_to_update, u8* pale
u32 copy_width = u32 copy_width =
std::min(entry->native_width - src_x, entry_to_update->native_width - dst_x); std::min(entry->native_width - src_x, entry_to_update->native_width - dst_x);
u32 copy_height = u32 copy_height =
std::min((entry->native_height * entry->y_scale) - src_y, (entry_to_update->native_height * entry_to_update->y_scale) - dst_y); std::min((entry->native_height * entry->y_scale) - src_y,
(entry_to_update->native_height * entry_to_update->y_scale) - dst_y);
// If one of the textures is scaled, scale both with the current efb scaling factor // If one of the textures is scaled, scale both with the current efb scaling factor
if (entry_to_update->native_width != entry_to_update->GetWidth() || if (entry_to_update->native_width != entry_to_update->GetWidth() ||
entry_to_update->native_height != entry_to_update->GetHeight() || entry_to_update->native_height != entry_to_update->GetHeight() ||
entry->native_width != entry->GetWidth() || entry->native_height != entry->GetHeight()) entry->native_width != entry->GetWidth() || entry->native_height != entry->GetHeight())
{ {
ScaleTextureCacheEntryTo(entry_to_update, ScaleTextureCacheEntryTo(
g_renderer->EFBToScaledX(entry_to_update->native_width), entry_to_update, g_renderer->EFBToScaledX(entry_to_update->native_width),
g_renderer->EFBToScaledY(entry_to_update->native_height * entry_to_update->y_scale)); g_renderer->EFBToScaledY(entry_to_update->native_height * entry_to_update->y_scale));
ScaleTextureCacheEntryTo(entry, g_renderer->EFBToScaledX(entry->native_width), ScaleTextureCacheEntryTo(entry, g_renderer->EFBToScaledX(entry->native_width),
g_renderer->EFBToScaledY(entry->native_height * entry->y_scale)); g_renderer->EFBToScaledY(entry->native_height * entry->y_scale));
@ -632,8 +633,7 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::Load(const u32 stage)
auto entry = GetTexture(address, width, height, texformat, auto entry = GetTexture(address, width, height, texformat,
g_ActiveConfig.iSafeTextureCache_ColorSamples, tlutaddr, tlutfmt, g_ActiveConfig.iSafeTextureCache_ColorSamples, tlutaddr, tlutfmt,
use_mipmaps, tex_levels, from_tmem, tmem_address_even, use_mipmaps, tex_levels, from_tmem, tmem_address_even, tmem_address_odd);
tmem_address_odd);
if (!entry) if (!entry)
return nullptr; return nullptr;
@ -643,7 +643,8 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::Load(const u32 stage)
GFX_DEBUGGER_PAUSE_AT(NEXT_TEXTURE_CHANGE, true); GFX_DEBUGGER_PAUSE_AT(NEXT_TEXTURE_CHANGE, true);
// We need to keep track of invalided textures until they have actually been replaced or re-loaded // We need to keep track of invalided textures until they have actually been replaced or
// re-loaded
valid_bind_points.set(stage); valid_bind_points.set(stage);
return entry; return entry;
@ -728,8 +729,8 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
if (isPaletteTexture) if (isPaletteTexture)
{ {
palette_size = TexDecoder_GetPaletteSize(texformat); palette_size = TexDecoder_GetPaletteSize(texformat);
full_hash = base_hash ^ GetHash64(&texMem[tlutaddr], palette_size, full_hash =
textureCacheSafetyColorSampleSize); base_hash ^ GetHash64(&texMem[tlutaddr], palette_size, textureCacheSafetyColorSampleSize);
} }
else else
{ {
@ -794,7 +795,8 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
// Do not load strided EFB copies, they are not meant to be used directly. // Do not load strided EFB copies, they are not meant to be used directly.
// Also do not directly load EFB copies, which were partly overwritten. // Also do not directly load EFB copies, which were partly overwritten.
if (entry->IsCopy() && entry->native_width == nativeW && static_cast<unsigned int>(entry->native_height * entry->y_scale) == nativeH && if (entry->IsCopy() && entry->native_width == nativeW &&
static_cast<unsigned int>(entry->native_height * entry->y_scale) == nativeH &&
entry->memory_stride == entry->BytesPerRow() && !entry->may_have_overlapping_textures) entry->memory_stride == entry->BytesPerRow() && !entry->may_have_overlapping_textures)
{ {
// EFB copies have slightly different rules as EFB copy formats have different // EFB copies have slightly different rules as EFB copy formats have different
@ -871,8 +873,7 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
// Example: Tales of Symphonia (GC) uses over 500 small textures in menus, but only around 70 // Example: Tales of Symphonia (GC) uses over 500 small textures in menus, but only around 70
// different ones // different ones
if (textureCacheSafetyColorSampleSize == 0 || if (textureCacheSafetyColorSampleSize == 0 ||
std::max(texture_size, palette_size) <= std::max(texture_size, palette_size) <= (u32)textureCacheSafetyColorSampleSize * 8)
(u32)textureCacheSafetyColorSampleSize * 8)
{ {
auto hash_range = textures_by_hash.equal_range(full_hash); auto hash_range = textures_by_hash.equal_range(full_hash);
TexHashCache::iterator hash_iter = hash_range.first; TexHashCache::iterator hash_iter = hash_range.first;
@ -961,9 +962,9 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
if (decode_on_gpu) if (decode_on_gpu)
{ {
u32 row_stride = bytes_per_block * (expandedWidth / bsw); u32 row_stride = bytes_per_block * (expandedWidth / bsw);
g_texture_cache->DecodeTextureOnGPU( g_texture_cache->DecodeTextureOnGPU(entry, 0, src_data, texture_size, texformat, width,
entry, 0, src_data, texture_size, texformat, width, height, height, expandedWidth, expandedHeight, row_stride, tlut,
expandedWidth, expandedHeight, row_stride, tlut, tlutfmt); tlutfmt);
} }
else else
{ {
@ -989,13 +990,11 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
dst_buffer = temp; dst_buffer = temp;
if (!(texformat == TextureFormat::RGBA8 && from_tmem)) if (!(texformat == TextureFormat::RGBA8 && from_tmem))
{ {
TexDecoder_Decode(dst_buffer, src_data, expandedWidth, expandedHeight, texformat, tlut, TexDecoder_Decode(dst_buffer, src_data, expandedWidth, expandedHeight, texformat, tlut, tlutfmt);
tlutfmt);
} }
else else
{ {
u8* src_data_gb = u8* src_data_gb = &texMem[tmem_address_odd];
&texMem[tmem_address_odd];
TexDecoder_DecodeRGBA8FromTmem(dst_buffer, src_data, src_data_gb, expandedWidth, expandedHeight); TexDecoder_DecodeRGBA8FromTmem(dst_buffer, src_data, src_data_gb, expandedWidth, expandedHeight);
} }
@ -1009,8 +1008,7 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
iter = textures_by_address.emplace(address, entry); iter = textures_by_address.emplace(address, entry);
if (textureCacheSafetyColorSampleSize == 0 || if (textureCacheSafetyColorSampleSize == 0 ||
std::max(texture_size, palette_size) <= std::max(texture_size, palette_size) <= (u32)textureCacheSafetyColorSampleSize * 8)
(u32)textureCacheSafetyColorSampleSize * 8)
{ {
entry->textures_by_hash_iter = textures_by_hash.emplace(full_hash, entry); entry->textures_by_hash_iter = textures_by_hash.emplace(full_hash, entry);
} }
@ -1181,7 +1179,8 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstF
PEControl::PixelFormat srcFormat = bpmem.zcontrol.pixel_format; PEControl::PixelFormat srcFormat = bpmem.zcontrol.pixel_format;
bool efbHasAlpha = srcFormat == PEControl::RGBA6_Z24; bool efbHasAlpha = srcFormat == PEControl::RGBA6_Z24;
bool copy_to_ram = !g_ActiveConfig.bSkipEFBCopyToRam || g_ActiveConfig.backend_info.bForceCopyToRam; bool copy_to_ram =
!g_ActiveConfig.bSkipEFBCopyToRam || g_ActiveConfig.backend_info.bForceCopyToRam;
bool copy_to_vram = g_ActiveConfig.backend_info.bSupportsCopyToVram; bool copy_to_vram = g_ActiveConfig.backend_info.bSupportsCopyToVram;
bool is_xfb_copy = false; bool is_xfb_copy = false;
@ -1418,7 +1417,8 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstF
ColorMask[3] = 0.0f; ColorMask[3] = 0.0f;
fConstAdd[3] = 1.0f; fConstAdd[3] = 1.0f;
cbufid = 30; // just re-use the RGBX8 cbufid from above cbufid = 30; // just re-use the RGBX8 cbufid from above
copy_to_ram = !g_ActiveConfig.bSkipXFBCopyToRam || g_ActiveConfig.backend_info.bForceCopyToRam; copy_to_ram =
!g_ActiveConfig.bSkipXFBCopyToRam || g_ActiveConfig.backend_info.bForceCopyToRam;
is_xfb_copy = true; is_xfb_copy = true;
break; break;

View File

@ -46,7 +46,8 @@ struct EFBCopyParams
{ {
EFBCopyParams(PEControl::PixelFormat efb_format_, EFBCopyFormat copy_format_, bool depth_, EFBCopyParams(PEControl::PixelFormat efb_format_, EFBCopyFormat copy_format_, bool depth_,
bool yuv_, float y_scale_) bool yuv_, float y_scale_)
: efb_format(efb_format_), copy_format(copy_format_), depth(depth_), yuv(yuv_), y_scale(y_scale_) : efb_format(efb_format_), copy_format(copy_format_), depth(depth_), yuv(yuv_),
y_scale(y_scale_)
{ {
} }
@ -111,7 +112,8 @@ public:
~TCacheEntry(); ~TCacheEntry();
void SetGeneralParameters(u32 _addr, u32 _size, TextureAndTLUTFormat _format, bool force_safe_hashing) void SetGeneralParameters(u32 _addr, u32 _size, TextureAndTLUTFormat _format,
bool force_safe_hashing)
{ {
addr = _addr; addr = _addr;
size_in_bytes = _size; size_in_bytes = _size;
@ -150,7 +152,6 @@ public:
bool IsEfbCopy() const { return is_efb_copy; } bool IsEfbCopy() const { return is_efb_copy; }
bool IsCopy() const { return is_xfb_copy || is_efb_copy; } bool IsCopy() const { return is_xfb_copy || is_efb_copy; }
u32 NumBlocksY() const; u32 NumBlocksY() const;
u32 BytesPerRow() const; u32 BytesPerRow() const;

View File

@ -64,7 +64,8 @@ static void WriteSwizzler(char*& p, EFBCopyFormat format, APIType ApiType)
// left, top, of source rectangle within source texture // left, top, of source rectangle within source texture
// width of the destination rectangle, scale_factor (1 or 2) // width of the destination rectangle, scale_factor (1 or 2)
if (ApiType == APIType::Vulkan) if (ApiType == APIType::Vulkan)
WRITE(p, "layout(std140, push_constant) uniform PCBlock { int4 position; float y_scale; } PC;\n"); WRITE(p,
"layout(std140, push_constant) uniform PCBlock { int4 position; float y_scale; } PC;\n");
else else
{ {
WRITE(p, "uniform int4 position;\n"); WRITE(p, "uniform int4 position;\n");

View File

@ -3,8 +3,8 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm> #include <algorithm>
#include <cstddef>
#include <cmath> #include <cmath>
#include <cstddef>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/MathUtil.h" #include "Common/MathUtil.h"