HybridXFB: Fix lint errors
This commit is contained in:
parent
725d14e4c6
commit
53684701fa
|
@ -43,7 +43,7 @@ const ConfigInfo<bool> GFX_CONVERT_HIRES_TEXTURES{{System::GFX, "Settings", "Con
|
|||
const ConfigInfo<bool> GFX_CACHE_HIRES_TEXTURES{{System::GFX, "Settings", "CacheHiresTextures"},
|
||||
false};
|
||||
const ConfigInfo<bool> GFX_DUMP_EFB_TARGET{{System::GFX, "Settings", "DumpEFBTarget"}, false};
|
||||
const ConfigInfo<bool> GFX_DUMP_XFB_TARGET{ { System::GFX, "Settings", "DumpXFBTarget" }, false };
|
||||
const ConfigInfo<bool> GFX_DUMP_XFB_TARGET{{System::GFX, "Settings", "DumpXFBTarget"}, false};
|
||||
const ConfigInfo<bool> GFX_DUMP_FRAMES_AS_IMAGES{{System::GFX, "Settings", "DumpFramesAsImages"},
|
||||
false};
|
||||
const ConfigInfo<bool> GFX_FREE_LOOK{{System::GFX, "Settings", "FreeLook"}, false};
|
||||
|
|
|
@ -28,17 +28,17 @@ bool IsSettingSaveable(const Config::ConfigLocation& config_location)
|
|||
// Graphics.Settings
|
||||
|
||||
Config::GFX_WIDESCREEN_HACK.location, Config::GFX_ASPECT_RATIO.location,
|
||||
Config::GFX_CROP.location,
|
||||
Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES.location, Config::GFX_SHOW_FPS.location,
|
||||
Config::GFX_SHOW_NETPLAY_PING.location, Config::GFX_SHOW_NETPLAY_MESSAGES.location,
|
||||
Config::GFX_LOG_RENDER_TIME_TO_FILE.location, Config::GFX_OVERLAY_STATS.location,
|
||||
Config::GFX_OVERLAY_PROJ_STATS.location, Config::GFX_DUMP_TEXTURES.location,
|
||||
Config::GFX_HIRES_TEXTURES.location, Config::GFX_CONVERT_HIRES_TEXTURES.location,
|
||||
Config::GFX_CACHE_HIRES_TEXTURES.location, Config::GFX_DUMP_EFB_TARGET.location,
|
||||
Config::GFX_DUMP_FRAMES_AS_IMAGES.location, Config::GFX_FREE_LOOK.location,
|
||||
Config::GFX_USE_FFV1.location, Config::GFX_DUMP_FORMAT.location,
|
||||
Config::GFX_DUMP_CODEC.location, Config::GFX_DUMP_PATH.location,
|
||||
Config::GFX_BITRATE_KBPS.location, Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS.location,
|
||||
Config::GFX_CROP.location, Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES.location,
|
||||
Config::GFX_SHOW_FPS.location, Config::GFX_SHOW_NETPLAY_PING.location,
|
||||
Config::GFX_SHOW_NETPLAY_MESSAGES.location, Config::GFX_LOG_RENDER_TIME_TO_FILE.location,
|
||||
Config::GFX_OVERLAY_STATS.location, Config::GFX_OVERLAY_PROJ_STATS.location,
|
||||
Config::GFX_DUMP_TEXTURES.location, Config::GFX_HIRES_TEXTURES.location,
|
||||
Config::GFX_CONVERT_HIRES_TEXTURES.location, Config::GFX_CACHE_HIRES_TEXTURES.location,
|
||||
Config::GFX_DUMP_EFB_TARGET.location, Config::GFX_DUMP_FRAMES_AS_IMAGES.location,
|
||||
Config::GFX_FREE_LOOK.location, Config::GFX_USE_FFV1.location,
|
||||
Config::GFX_DUMP_FORMAT.location, Config::GFX_DUMP_CODEC.location,
|
||||
Config::GFX_DUMP_PATH.location, Config::GFX_BITRATE_KBPS.location,
|
||||
Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS.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_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_BBOX_PREFER_STENCIL_IMPLEMENTATION.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_IMMEDIATE_XFB.location,
|
||||
Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM.location, Config::GFX_HACK_IMMEDIATE_XFB.location,
|
||||
Config::GFX_HACK_COPY_EFB_ENABLED.location,
|
||||
Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES.location,
|
||||
Config::GFX_HACK_VERTEX_ROUDING.location,
|
||||
|
|
|
@ -39,7 +39,6 @@ static void LoadFromDTM(Config::Layer* config_layer, Movie::DTMHeader* dtm)
|
|||
else
|
||||
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_SKIP_EFB_COPY_TO_RAM, dtm->bSkipEFBCopyToRam);
|
||||
config_layer->Set(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM, dtm->bSkipXFBCopyToRam);
|
||||
|
|
|
@ -69,8 +69,7 @@ void HacksWidget::CreateWidgets()
|
|||
|
||||
m_store_xfb_copies = new GraphicsBool(tr("Store XFB Copies to Texture Only"),
|
||||
Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM);
|
||||
m_immediate_xfb = new GraphicsBool(tr("Immediately Present XFB"),
|
||||
Config::GFX_HACK_IMMEDIATE_XFB);
|
||||
m_immediate_xfb = new GraphicsBool(tr("Immediately Present XFB"), Config::GFX_HACK_IMMEDIATE_XFB);
|
||||
|
||||
xfb_layout->addWidget(m_store_xfb_copies, 1, 0);
|
||||
|
||||
|
@ -171,15 +170,18 @@ void HacksWidget::AddDescriptions()
|
|||
"from RAM.\nLower accuracies cause in-game text to appear garbled in certain "
|
||||
"games.\n\nIf unsure, use the rightmost value.");
|
||||
|
||||
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 "
|
||||
"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.");
|
||||
|
||||
static const char* TR_IMMEDIATE_XFB_DESCRIPTION = QT_TR_NOOP(
|
||||
"Displays the XFB copies as soon as they are created, without waiting for 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.");
|
||||
static const char* TR_IMMEDIATE_XFB_DESCRIPTION =
|
||||
QT_TR_NOOP("Displays the XFB copies as soon as they are created, without waiting for "
|
||||
"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.");
|
||||
|
||||
static const char* TR_GPU_DECODING_DESCRIPTION =
|
||||
QT_TR_NOOP("Enables texture decoding using the GPU instead of the CPU. This may result in "
|
||||
|
|
|
@ -1496,7 +1496,7 @@ void CFrame::ParseHotkeys()
|
|||
OSDChoice = 6;
|
||||
// Toggle immediate present of xfb
|
||||
Config::SetCurrent(Config::GFX_HACK_IMMEDIATE_XFB,
|
||||
!Config::Get(Config::GFX_HACK_IMMEDIATE_XFB));
|
||||
!Config::Get(Config::GFX_HACK_IMMEDIATE_XFB));
|
||||
}
|
||||
if (IsHotkey(HK_TOGGLE_FOG))
|
||||
{
|
||||
|
|
|
@ -202,13 +202,16 @@ static wxString skip_efb_copy_to_ram_desc = wxTRANSLATE(
|
|||
"in a small number of games.\n\nEnabled = EFB Copies to Texture\nDisabled = EFB Copies to RAM "
|
||||
"(and Texture)\n\nIf unsure, leave this checked.");
|
||||
static wxString skip_xfb_copy_to_ram_desc = wxTRANSLATE(
|
||||
"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 "
|
||||
"(and Texture)\n\nIf unsure, leave this checked.");
|
||||
static wxString immediate_xfb_desc = wxTRANSLATE(
|
||||
"Displays the XFB copies as soon as they are created, without waiting for 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.");
|
||||
"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 "
|
||||
"(and Texture)\n\nIf unsure, leave this checked.");
|
||||
static wxString immediate_xfb_desc =
|
||||
wxTRANSLATE("Displays the XFB copies as soon as they are created, without waiting for 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.");
|
||||
static wxString stc_desc =
|
||||
wxTRANSLATE("The \"Safe\" setting eliminates the likelihood of the GPU missing texture updates "
|
||||
"from RAM.\nLower accuracies cause in-game text to appear garbled in certain "
|
||||
|
@ -248,7 +251,7 @@ static wxString cache_hires_textures_desc =
|
|||
static wxString dump_efb_desc = wxTRANSLATE(
|
||||
"Dump the contents of EFB copies to User/Dump/Textures/.\n\nIf unsure, leave this unchecked.");
|
||||
static wxString dump_xfb_desc = wxTRANSLATE(
|
||||
"Dump the contents of XFB copies to User/Dump/Textures/.\n\nIf unsure, leave this unchecked.");
|
||||
"Dump the contents of XFB copies to User/Dump/Textures/.\n\nIf unsure, leave this unchecked.");
|
||||
static wxString internal_resolution_frame_dumping_desc = wxTRANSLATE(
|
||||
"Create frame dumps and screenshots at the internal resolution of the renderer, rather than "
|
||||
"the size of the window it is displayed within. If the aspect ratio is widescreen, the output "
|
||||
|
@ -779,21 +782,21 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
|
|||
szr_hacks->Add(szr_safetex, 0, wxEXPAND | wxLEFT | wxRIGHT, space5);
|
||||
}
|
||||
|
||||
// - XFB
|
||||
// - XFB
|
||||
{
|
||||
wxStaticBoxSizer* const group_xfb =
|
||||
new wxStaticBoxSizer(wxVERTICAL, page_hacks, _("External Frame Buffer (XFB)"));
|
||||
|
||||
group_xfb->Add(CreateCheckBox(page_hacks, _("Store XFB Copies to Texture Only"),
|
||||
wxGetTranslation(skip_xfb_copy_to_ram_desc),
|
||||
Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM),
|
||||
0, wxLEFT | wxRIGHT, space5);
|
||||
wxGetTranslation(skip_xfb_copy_to_ram_desc),
|
||||
Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM),
|
||||
0, wxLEFT | wxRIGHT, space5);
|
||||
group_xfb->AddSpacer(space5);
|
||||
|
||||
group_xfb->Add(CreateCheckBox(page_hacks, _("Immediately Present XFB"),
|
||||
wxGetTranslation(immediate_xfb_desc),
|
||||
Config::GFX_HACK_IMMEDIATE_XFB),
|
||||
0, wxLEFT | wxRIGHT, space5);
|
||||
wxGetTranslation(immediate_xfb_desc),
|
||||
Config::GFX_HACK_IMMEDIATE_XFB),
|
||||
0, wxLEFT | wxRIGHT, space5);
|
||||
group_xfb->AddSpacer(space5);
|
||||
|
||||
szr_hacks->AddSpacer(space5);
|
||||
|
@ -885,8 +888,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
|
|||
szr_utility->Add(CreateCheckBox(page_advanced, _("Dump EFB Target"),
|
||||
wxGetTranslation(dump_efb_desc),
|
||||
Config::GFX_DUMP_EFB_TARGET));
|
||||
szr_utility->Add(CreateCheckBox(page_advanced, _("Dump XFB Target"),
|
||||
wxGetTranslation(dump_xfb_desc), Config::GFX_DUMP_XFB_TARGET));
|
||||
szr_utility->Add(CreateCheckBox(page_advanced, _("Dump XFB Target"),
|
||||
wxGetTranslation(dump_xfb_desc),
|
||||
Config::GFX_DUMP_XFB_TARGET));
|
||||
szr_utility->Add(CreateCheckBox(page_advanced, _("Free Look"),
|
||||
wxGetTranslation(free_look_desc), Config::GFX_FREE_LOOK));
|
||||
#if defined(HAVE_FFMPEG)
|
||||
|
|
|
@ -46,8 +46,8 @@ void PSTextureEncoder::Init()
|
|||
// TODO: This Texture is overly large and parts of it are unused
|
||||
// EFB2RAM copies use max (EFB_WIDTH * 4) by (EFB_HEIGHT / 4)
|
||||
// XFB2RAM copies use max (EFB_WIDTH / 2) by (EFB_HEIGHT)
|
||||
D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_B8G8R8A8_UNORM, EFB_WIDTH * 4,
|
||||
1024, 1, 1, D3D11_BIND_RENDER_TARGET);
|
||||
D3D11_TEXTURE2D_DESC t2dd = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_B8G8R8A8_UNORM, EFB_WIDTH * 4, 1024,
|
||||
1, 1, D3D11_BIND_RENDER_TARGET);
|
||||
hr = D3D::device->CreateTexture2D(&t2dd, nullptr, &m_out);
|
||||
CHECK(SUCCEEDED(hr), "create efb encode output texture");
|
||||
D3D::SetDebugObjectName(m_out, "efb encoder output texture");
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "VideoCommon/RenderState.h"
|
||||
#include "VideoCommon/SamplerCommon.h"
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
|
||||
namespace DX11
|
||||
|
@ -626,8 +626,8 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ti
|
|||
auto* xfb_texture = static_cast<DXTexture*>(texture);
|
||||
TargetRectangle source_rc = xfb_texture->GetConfig().GetRect();
|
||||
|
||||
BlitScreen(source_rc, targetRc, xfb_texture->GetRawTexIdentifier(), xfb_texture->GetConfig().width,
|
||||
xfb_texture->GetConfig().height, Gamma);
|
||||
BlitScreen(source_rc, targetRc, xfb_texture->GetRawTexIdentifier(),
|
||||
xfb_texture->GetConfig().width, xfb_texture->GetConfig().height, Gamma);
|
||||
|
||||
// Reset viewport for drawing text
|
||||
D3D11_VIEWPORT vp =
|
||||
|
|
|
@ -25,7 +25,7 @@ static const char s_vertex_shader[] = "out vec2 uv0;\n"
|
|||
"void main(void) {\n"
|
||||
" vec2 rawpos = vec2(gl_VertexID&1, gl_VertexID&2);\n"
|
||||
" gl_Position = vec4(rawpos*2.0-1.0, 0.0, 1.0);\n"
|
||||
" uv0 = vec2(mix(src_rect.xy, src_rect.zw, rawpos));\n"
|
||||
" uv0 = vec2(mix(src_rect.xy, src_rect.zw, rawpos));\n"
|
||||
"}\n";
|
||||
|
||||
OpenGLPostProcessing::OpenGLPostProcessing() : m_initialized(false)
|
||||
|
|
|
@ -1353,7 +1353,8 @@ void Renderer::SwapImpl(AbstractTexture* texture, const EFBRectangle& rc, u64 ti
|
|||
|
||||
// Copy the framebuffer to screen.
|
||||
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
|
||||
|
||||
|
|
|
@ -111,7 +111,8 @@ private:
|
|||
void UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRectangle& efbPixelRc,
|
||||
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,
|
||||
int src_height);
|
||||
|
|
|
@ -388,10 +388,10 @@ void main()
|
|||
void TextureCache::CreateTextureDecodingResources()
|
||||
{
|
||||
static const GLenum gl_view_types[TextureConversionShader::BUFFER_FORMAT_COUNT] = {
|
||||
GL_R8UI, // BUFFER_FORMAT_R8_UINT
|
||||
GL_R16UI, // BUFFER_FORMAT_R16_UINT
|
||||
GL_RG32UI, // BUFFER_FORMAT_R32G32_UINT
|
||||
GL_RGBA8UI, // BUFFER_FORMAT_RGBA8_UINT
|
||||
GL_R8UI, // BUFFER_FORMAT_R8_UINT
|
||||
GL_R16UI, // BUFFER_FORMAT_R16_UINT
|
||||
GL_RG32UI, // BUFFER_FORMAT_R32G32_UINT
|
||||
GL_RGBA8UI, // BUFFER_FORMAT_RGBA8_UINT
|
||||
};
|
||||
|
||||
glGenTextures(TextureConversionShader::BUFFER_FORMAT_COUNT,
|
||||
|
|
|
@ -22,9 +22,9 @@ void copy_region(const T* const source, const MathUtil::Rectangle<int>& srcrect,
|
|||
int destination_y = i + dstrect.top;
|
||||
int destination_offset = (destination_y * dstrect.GetWidth()) + destination_x;
|
||||
|
||||
double src_x = std::round(destination_x*x_ratio) + srcrect.left;
|
||||
double src_y = std::round(destination_y*y_ratio) + srcrect.top;
|
||||
int src_offset = static_cast<int>((src_y*srcrect.GetWidth()) + src_x);
|
||||
double src_x = std::round(destination_x * x_ratio) + srcrect.left;
|
||||
double src_y = std::round(destination_y * y_ratio) + srcrect.top;
|
||||
int src_offset = static_cast<int>((src_y * srcrect.GetWidth()) + src_x);
|
||||
|
||||
destination[destination_offset] = source[src_offset];
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
namespace EfbCopy
|
||||
{
|
||||
|
||||
void ClearEfb()
|
||||
{
|
||||
u32 clearColor = (bpmem.clearcolorAR & 0xff) << 24 | bpmem.clearcolorGB << 8 |
|
||||
|
@ -34,5 +33,4 @@ void ClearEfb()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -497,7 +497,8 @@ u8* GetPixelPointer(u16 x, u16 y, bool depth)
|
|||
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)
|
||||
{
|
||||
|
@ -543,8 +544,7 @@ void EncodeXFB(yuv422_packed* xfb_in_ram, u32 memory_stride, const EFBRectangle&
|
|||
src_ptr[x].Y = scanline[i].Y + 16;
|
||||
// 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]
|
||||
src_ptr[x].UV =
|
||||
128 + ((scanline[i - 1].U + (scanline[i].U << 1) + scanline[i + 1].U) >> 2);
|
||||
src_ptr[x].UV = 128 + ((scanline[i - 1].U + (scanline[i].U << 1) + scanline[i + 1].U) >> 2);
|
||||
|
||||
// YV pixel
|
||||
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
|
||||
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)
|
||||
|
|
|
@ -57,7 +57,8 @@ u32 GetDepth(u16 x, u16 y);
|
|||
|
||||
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];
|
||||
inline void IncPerfCounterQuadCount(PerfQueryType type)
|
||||
|
|
|
@ -92,7 +92,7 @@ void SWOGLWindow::PrintText(const std::string& text, int x, int y, u32 color)
|
|||
|
||||
void SWOGLWindow::ShowImage(AbstractTexture* image, float aspect)
|
||||
{
|
||||
SW::SWTexture * sw_image = static_cast<SW::SWTexture*>(image);
|
||||
SW::SWTexture* sw_image = static_cast<SW::SWTexture*>(image);
|
||||
GLInterface->Update(); // just updates the render window position and the backbuffer size
|
||||
|
||||
GLsizei glWidth = (GLsizei)GLInterface->GetBackBufferWidth();
|
||||
|
|
|
@ -31,7 +31,6 @@ public:
|
|||
|
||||
private:
|
||||
SWOGLWindow() {}
|
||||
|
||||
struct TextData
|
||||
{
|
||||
std::string text;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
namespace SW
|
||||
{
|
||||
|
||||
SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config)
|
||||
{
|
||||
}
|
||||
|
@ -23,11 +22,12 @@ void SWTexture::CopyRectangleFromTexture(const AbstractTexture* source,
|
|||
const MathUtil::Rectangle<int>& srcrect,
|
||||
const MathUtil::Rectangle<int>& dstrect)
|
||||
{
|
||||
const SWTexture * software_source_texture = static_cast<const SWTexture*>(source);
|
||||
const SWTexture* software_source_texture = static_cast<const SWTexture*>(source);
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -53,8 +53,8 @@ u8* SWTexture::GetData()
|
|||
|
||||
std::optional<AbstractTexture::RawTextureInfo> SWTexture::MapFullImpl()
|
||||
{
|
||||
return AbstractTexture::RawTextureInfo{ GetData(),
|
||||
m_config.width * 4, m_config.width, m_config.height };
|
||||
return AbstractTexture::RawTextureInfo{GetData(), m_config.width * 4, m_config.width,
|
||||
m_config.height};
|
||||
}
|
||||
|
||||
} // namespace SW
|
||||
|
|
|
@ -30,7 +30,6 @@ public:
|
|||
u8* GetData();
|
||||
|
||||
private:
|
||||
|
||||
std::optional<RawTextureInfo> MapFullImpl() override;
|
||||
|
||||
std::vector<u8> m_data;
|
||||
|
|
|
@ -7,23 +7,21 @@
|
|||
|
||||
namespace SW
|
||||
{
|
||||
|
||||
class TextureCache : public TextureCacheBase
|
||||
{
|
||||
public:
|
||||
bool CompileShaders() override { return true; }
|
||||
void DeleteShaders() override {}
|
||||
void ConvertTexture(TCacheEntry* entry, TCacheEntry* unconverted, const void* palette,
|
||||
TLUTFormat format) override
|
||||
TLUTFormat format) override
|
||||
{
|
||||
}
|
||||
void CopyEFB(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
|
||||
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
|
||||
bool scale_by_half) override
|
||||
{
|
||||
TextureEncoder::Encode(dst, params, native_width, bytes_per_row,
|
||||
num_blocks_y, memory_stride, src_rect,
|
||||
scale_by_half);
|
||||
TextureEncoder::Encode(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride,
|
||||
src_rect, scale_by_half);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -39,4 +37,4 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
} // namespace SW
|
||||
} // namespace SW
|
||||
|
|
|
@ -1419,63 +1419,63 @@ static void EncodeZ24halfscale(u8* dst, const u8* src, EFBCopyFormat format)
|
|||
|
||||
namespace
|
||||
{
|
||||
void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
|
||||
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
|
||||
bool scale_by_half)
|
||||
{
|
||||
const u8* src =
|
||||
EfbInterface::GetPixelPointer(src_rect.left, src_rect.top, params.depth);
|
||||
|
||||
if (scale_by_half)
|
||||
{
|
||||
switch (params.efb_format)
|
||||
{
|
||||
case PEControl::RGBA6_Z24:
|
||||
EncodeRGBA6halfscale(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::RGB8_Z24:
|
||||
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::RGB565_Z16:
|
||||
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::Z24:
|
||||
EncodeZ24halfscale(dst, src, params.copy_format);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (params.efb_format)
|
||||
{
|
||||
case PEControl::RGBA6_Z24:
|
||||
EncodeRGBA6(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::RGB8_Z24:
|
||||
EncodeRGB8(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::RGB565_Z16:
|
||||
EncodeRGB8(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::Z24:
|
||||
EncodeZ24(dst, src, params.copy_format);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
bool scale_by_half)
|
||||
void EncodeEfbCopy(u8* dst, const EFBCopyParams& params, u32 native_width, u32 bytes_per_row,
|
||||
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect,
|
||||
bool scale_by_half)
|
||||
{
|
||||
if (params.copy_format == EFBCopyFormat::XFB)
|
||||
const u8* src = EfbInterface::GetPixelPointer(src_rect.left, src_rect.top, params.depth);
|
||||
|
||||
if (scale_by_half)
|
||||
{
|
||||
EfbInterface::EncodeXFB(reinterpret_cast<EfbInterface::yuv422_packed*>(dst), native_width, src_rect, params.y_scale);
|
||||
switch (params.efb_format)
|
||||
{
|
||||
case PEControl::RGBA6_Z24:
|
||||
EncodeRGBA6halfscale(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::RGB8_Z24:
|
||||
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::RGB565_Z16:
|
||||
EncodeRGB8halfscale(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::Z24:
|
||||
EncodeZ24halfscale(dst, src, params.copy_format);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EncodeEfbCopy(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride, src_rect, scale_by_half);
|
||||
switch (params.efb_format)
|
||||
{
|
||||
case PEControl::RGBA6_Z24:
|
||||
EncodeRGBA6(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::RGB8_Z24:
|
||||
EncodeRGB8(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::RGB565_Z16:
|
||||
EncodeRGB8(dst, src, params.copy_format, params.yuv);
|
||||
break;
|
||||
case PEControl::Z24:
|
||||
EncodeZ24(dst, src, params.copy_format);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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, bool scale_by_half)
|
||||
{
|
||||
if (params.copy_format == EFBCopyFormat::XFB)
|
||||
{
|
||||
EfbInterface::EncodeXFB(reinterpret_cast<EfbInterface::yuv422_packed*>(dst), native_width,
|
||||
src_rect, params.y_scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
EncodeEfbCopy(dst, params, native_width, bytes_per_row, num_blocks_y, memory_stride, src_rect,
|
||||
scale_by_half);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,5 @@ struct EFBCopyParams;
|
|||
namespace TextureEncoder
|
||||
{
|
||||
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,
|
||||
bool scale_by_half);
|
||||
u32 num_blocks_y, u32 memory_stride, const EFBRectangle& src_rect, bool scale_by_half);
|
||||
}
|
||||
|
|
|
@ -33,14 +33,14 @@
|
|||
|
||||
namespace Vulkan
|
||||
{
|
||||
namespace
|
||||
{
|
||||
struct EFBEncodeParams
|
||||
{
|
||||
std::array<s32, 4> position_uniform;
|
||||
float y_scale;
|
||||
};
|
||||
}
|
||||
namespace
|
||||
{
|
||||
struct EFBEncodeParams
|
||||
{
|
||||
std::array<s32, 4> position_uniform;
|
||||
float y_scale;
|
||||
};
|
||||
}
|
||||
TextureConverter::TextureConverter()
|
||||
{
|
||||
}
|
||||
|
@ -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
|
||||
// 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.
|
||||
bool linear_filter = (scale_by_half && !params.depth) || g_renderer->GetEFBScale() != 1 ||
|
||||
params.y_scale > 1.0f;
|
||||
bool linear_filter =
|
||||
(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() :
|
||||
g_object_cache->GetPointSampler());
|
||||
|
||||
|
@ -580,7 +580,7 @@ bool TextureConverter::CreateTexelBuffer()
|
|||
m_texel_buffer_view_r16_uint = CreateTexelBufferView(VK_FORMAT_R16_UINT);
|
||||
m_texel_buffer_view_r32g32_uint = CreateTexelBufferView(VK_FORMAT_R32G32_UINT);
|
||||
m_texel_buffer_view_rgba8_unorm = CreateTexelBufferView(VK_FORMAT_R8G8B8A8_UNORM);
|
||||
m_texel_buffer_view_rgba8_uint= CreateTexelBufferView(VK_FORMAT_R8G8B8A8_UINT);
|
||||
m_texel_buffer_view_rgba8_uint = CreateTexelBufferView(VK_FORMAT_R8G8B8A8_UINT);
|
||||
return m_texel_buffer_view_r8_uint != VK_NULL_HANDLE &&
|
||||
m_texel_buffer_view_r16_uint != VK_NULL_HANDLE &&
|
||||
m_texel_buffer_view_r32g32_uint != VK_NULL_HANDLE &&
|
||||
|
|
|
@ -133,8 +133,8 @@ std::optional<AbstractTexture::RawTextureInfo> VKTexture::MapRegionImpl(u32 leve
|
|||
|
||||
// Copy to download buffer.
|
||||
m_staging_texture->CopyFromImage(g_command_buffer_mgr->GetCurrentCommandBuffer(),
|
||||
m_texture->GetImage(), VK_IMAGE_ASPECT_COLOR_BIT, x, y, width,
|
||||
height, level, 0);
|
||||
m_texture->GetImage(), VK_IMAGE_ASPECT_COLOR_BIT, x, y, width,
|
||||
height, level, 0);
|
||||
|
||||
// Restore original state of texture.
|
||||
m_texture->TransitionToLayout(g_command_buffer_mgr->GetCurrentCommandBuffer(),
|
||||
|
|
|
@ -261,8 +261,8 @@ static void BPWritten(const BPCmd& bp)
|
|||
|
||||
bool is_depth_copy = bpmem.zcontrol.pixel_format == PEControl::Z24;
|
||||
g_texture_cache->CopyRenderTargetToTexture(destAddr, EFBCopyFormat::XFB, destStride,
|
||||
is_depth_copy, srcRect, false,
|
||||
false, yScale, s_gammaLUT[PE_copy.gamma]);
|
||||
is_depth_copy, srcRect, false, false, yScale,
|
||||
s_gammaLUT[PE_copy.gamma]);
|
||||
|
||||
// This stays in to signal end of a "frame"
|
||||
g_renderer->RenderToXFB(destAddr, srcRect, destStride, height, s_gammaLUT[PE_copy.gamma]);
|
||||
|
|
|
@ -17,4 +17,3 @@ std::unique_ptr<FramebufferManagerBase> g_framebuffer_manager;
|
|||
unsigned int FramebufferManagerBase::m_EFBLayers = 1;
|
||||
|
||||
FramebufferManagerBase::~FramebufferManagerBase() = default;
|
||||
|
||||
|
|
|
@ -23,9 +23,7 @@ public:
|
|||
virtual ~FramebufferManagerBase();
|
||||
|
||||
static unsigned int GetEFBLayers() { return m_EFBLayers; }
|
||||
|
||||
protected:
|
||||
|
||||
static unsigned int m_EFBLayers;
|
||||
};
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
#include "Core/Host.h"
|
||||
#include "Core/Movie.h"
|
||||
|
||||
#include "VideoCommon/AbstractTexture.h"
|
||||
#include "VideoCommon/AVIDump.h"
|
||||
#include "VideoCommon/AbstractTexture.h"
|
||||
#include "VideoCommon/BPMemory.h"
|
||||
#include "VideoCommon/CPMemory.h"
|
||||
#include "VideoCommon/CommandProcessor.h"
|
||||
|
@ -336,7 +336,8 @@ void Renderer::DrawDebugText()
|
|||
"Speed Limit: Unlimited" :
|
||||
StringFromFormat("Speed Limit: %li%%",
|
||||
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
|
||||
|
@ -691,7 +692,8 @@ bool Renderer::IsFrameDumping()
|
|||
void Renderer::UpdateFrameDumpTexture(float horizontal_scale)
|
||||
{
|
||||
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 ||
|
||||
m_dump_texture->GetConfig().width != static_cast<u32>(target_width) ||
|
||||
m_dump_texture->GetConfig().height != static_cast<u32>(target_height))
|
||||
|
@ -720,7 +722,7 @@ void Renderer::ShutdownFrameDumping()
|
|||
|
||||
void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, const AVIDump::Frame& state)
|
||||
{
|
||||
m_frame_dump_config = FrameDumpConfig{ m_last_xfb_texture, data, w, h, stride, state };
|
||||
m_frame_dump_config = FrameDumpConfig{m_last_xfb_texture, data, w, h, stride, state};
|
||||
|
||||
if (!m_frame_dump_thread_running.IsSet())
|
||||
{
|
||||
|
|
|
@ -208,7 +208,7 @@ private:
|
|||
AVIDump::Frame state;
|
||||
} m_frame_dump_config;
|
||||
|
||||
AbstractTexture * m_last_xfb_texture;
|
||||
AbstractTexture* m_last_xfb_texture;
|
||||
u64 m_last_xfb_id = 0;
|
||||
|
||||
std::unique_ptr<AbstractTexture> m_dump_texture;
|
||||
|
|
|
@ -376,16 +376,17 @@ TextureCacheBase::DoPartialTextureUpdates(TCacheEntry* entry_to_update, u8* pale
|
|||
u32 copy_width =
|
||||
std::min(entry->native_width - src_x, entry_to_update->native_width - dst_x);
|
||||
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 (entry_to_update->native_width != entry_to_update->GetWidth() ||
|
||||
entry_to_update->native_height != entry_to_update->GetHeight() ||
|
||||
entry->native_width != entry->GetWidth() || entry->native_height != entry->GetHeight())
|
||||
{
|
||||
ScaleTextureCacheEntryTo(entry_to_update,
|
||||
g_renderer->EFBToScaledX(entry_to_update->native_width),
|
||||
g_renderer->EFBToScaledY(entry_to_update->native_height * entry_to_update->y_scale));
|
||||
ScaleTextureCacheEntryTo(
|
||||
entry_to_update, g_renderer->EFBToScaledX(entry_to_update->native_width),
|
||||
g_renderer->EFBToScaledY(entry_to_update->native_height * entry_to_update->y_scale));
|
||||
ScaleTextureCacheEntryTo(entry, g_renderer->EFBToScaledX(entry->native_width),
|
||||
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,
|
||||
g_ActiveConfig.iSafeTextureCache_ColorSamples, tlutaddr, tlutfmt,
|
||||
use_mipmaps, tex_levels, from_tmem, tmem_address_even,
|
||||
tmem_address_odd);
|
||||
use_mipmaps, tex_levels, from_tmem, tmem_address_even, tmem_address_odd);
|
||||
|
||||
if (!entry)
|
||||
return nullptr;
|
||||
|
@ -643,7 +643,8 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::Load(const u32 stage)
|
|||
|
||||
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);
|
||||
|
||||
return entry;
|
||||
|
@ -728,8 +729,8 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
|
|||
if (isPaletteTexture)
|
||||
{
|
||||
palette_size = TexDecoder_GetPaletteSize(texformat);
|
||||
full_hash = base_hash ^ GetHash64(&texMem[tlutaddr], palette_size,
|
||||
textureCacheSafetyColorSampleSize);
|
||||
full_hash =
|
||||
base_hash ^ GetHash64(&texMem[tlutaddr], palette_size, textureCacheSafetyColorSampleSize);
|
||||
}
|
||||
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.
|
||||
// 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)
|
||||
{
|
||||
// EFB copies have slightly different rules as EFB copy formats have different
|
||||
|
@ -829,7 +831,7 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
|
|||
else
|
||||
{
|
||||
// For normal textures, all texture parameters need to match
|
||||
if (!entry->IsCopy() && entry->hash == full_hash && entry->format == full_format &&
|
||||
if (!entry->IsCopy() && entry->hash == full_hash && entry->format == full_format &&
|
||||
entry->native_levels >= tex_levels && entry->native_width == nativeW &&
|
||||
entry->native_height == nativeH)
|
||||
{
|
||||
|
@ -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
|
||||
// different ones
|
||||
if (textureCacheSafetyColorSampleSize == 0 ||
|
||||
std::max(texture_size, palette_size) <=
|
||||
(u32)textureCacheSafetyColorSampleSize * 8)
|
||||
std::max(texture_size, palette_size) <= (u32)textureCacheSafetyColorSampleSize * 8)
|
||||
{
|
||||
auto hash_range = textures_by_hash.equal_range(full_hash);
|
||||
TexHashCache::iterator hash_iter = hash_range.first;
|
||||
|
@ -961,9 +962,9 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
|
|||
if (decode_on_gpu)
|
||||
{
|
||||
u32 row_stride = bytes_per_block * (expandedWidth / bsw);
|
||||
g_texture_cache->DecodeTextureOnGPU(
|
||||
entry, 0, src_data, texture_size, texformat, width, height,
|
||||
expandedWidth, expandedHeight, row_stride, tlut, tlutfmt);
|
||||
g_texture_cache->DecodeTextureOnGPU(entry, 0, src_data, texture_size, texformat, width,
|
||||
height, expandedWidth, expandedHeight, row_stride, tlut,
|
||||
tlutfmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -989,13 +990,11 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::GetTexture(u32 address, u32 wid
|
|||
dst_buffer = temp;
|
||||
if (!(texformat == TextureFormat::RGBA8 && from_tmem))
|
||||
{
|
||||
TexDecoder_Decode(dst_buffer, src_data, expandedWidth, expandedHeight, texformat, tlut,
|
||||
tlutfmt);
|
||||
TexDecoder_Decode(dst_buffer, src_data, expandedWidth, expandedHeight, texformat, tlut, tlutfmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
u8* src_data_gb =
|
||||
&texMem[tmem_address_odd];
|
||||
u8* src_data_gb = &texMem[tmem_address_odd];
|
||||
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);
|
||||
if (textureCacheSafetyColorSampleSize == 0 ||
|
||||
std::max(texture_size, palette_size) <=
|
||||
(u32)textureCacheSafetyColorSampleSize * 8)
|
||||
std::max(texture_size, palette_size) <= (u32)textureCacheSafetyColorSampleSize * 8)
|
||||
{
|
||||
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;
|
||||
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 is_xfb_copy = false;
|
||||
|
||||
|
@ -1418,7 +1417,8 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstF
|
|||
ColorMask[3] = 0.0f;
|
||||
fConstAdd[3] = 1.0f;
|
||||
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;
|
||||
break;
|
||||
|
||||
|
@ -1587,7 +1587,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstF
|
|||
0);
|
||||
}
|
||||
|
||||
if (g_ActiveConfig.bDumpXFBTarget && is_xfb_copy)
|
||||
if (g_ActiveConfig.bDumpXFBTarget && is_xfb_copy)
|
||||
{
|
||||
static int xfb_count = 0;
|
||||
entry->texture->Save(StringFromFormat("%sxfb_frame_%i.png",
|
||||
|
|
|
@ -46,7 +46,8 @@ struct EFBCopyParams
|
|||
{
|
||||
EFBCopyParams(PEControl::PixelFormat efb_format_, EFBCopyFormat copy_format_, bool depth_,
|
||||
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();
|
||||
|
||||
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;
|
||||
size_in_bytes = _size;
|
||||
|
@ -150,7 +152,6 @@ public:
|
|||
|
||||
bool IsEfbCopy() const { return is_efb_copy; }
|
||||
bool IsCopy() const { return is_xfb_copy || is_efb_copy; }
|
||||
|
||||
u32 NumBlocksY() const;
|
||||
u32 BytesPerRow() const;
|
||||
|
||||
|
@ -186,7 +187,7 @@ public:
|
|||
static bool IsValidBindPoint(u32 i) { return valid_bind_points.test(i); }
|
||||
TCacheEntry* GetTexture(u32 address, u32 width, u32 height, const TextureFormat texformat,
|
||||
const int textureCacheSafetyColorSampleSize, u32 tlutaddr = 0,
|
||||
TLUTFormat tlutfmt = TLUTFormat::IA8, bool use_mipmaps = false,
|
||||
TLUTFormat tlutfmt = TLUTFormat::IA8, bool use_mipmaps = false,
|
||||
u32 tex_levels = 1, bool from_tmem = false, u32 tmem_address_even = 0,
|
||||
u32 tmem_address_odd = 0);
|
||||
virtual void BindTextures();
|
||||
|
|
|
@ -64,7 +64,8 @@ static void WriteSwizzler(char*& p, EFBCopyFormat format, APIType ApiType)
|
|||
// left, top, of source rectangle within source texture
|
||||
// width of the destination rectangle, scale_factor (1 or 2)
|
||||
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
|
||||
{
|
||||
WRITE(p, "uniform int4 position;\n");
|
||||
|
@ -154,7 +155,7 @@ static void WriteSwizzler(char*& p, EFBCopyFormat format, APIType ApiType)
|
|||
// pixel)
|
||||
WRITE(p, " uv0 += float2(position.xy);\n"); // move to copied rect
|
||||
WRITE(p, " uv0 /= float2(%d, %d);\n", EFB_WIDTH, EFB_HEIGHT); // normalize to [0:1]
|
||||
WRITE(p, " uv0 /= float2(1, y_scale);\n"); // apply the y scaling
|
||||
WRITE(p, " uv0 /= float2(1, y_scale);\n"); // apply the y scaling
|
||||
if (ApiType == APIType::OpenGL) // ogl has to flip up and down
|
||||
{
|
||||
WRITE(p, " uv0.y = 1.0-uv0.y;\n");
|
||||
|
@ -1264,11 +1265,11 @@ static const std::map<TextureFormat, DecodingShaderInfo> s_decoding_shader_info{
|
|||
}
|
||||
)"}},
|
||||
|
||||
// We do the inverse BT.601 conversion for YCbCr to RGB
|
||||
// http://www.equasys.de/colorconversion.html#YCbCr-RGBColorFormatConversion
|
||||
{ TextureFormat::XFB,
|
||||
{ BUFFER_FORMAT_RGBA8_UINT, 0, 8, 8, false,
|
||||
R"(
|
||||
// We do the inverse BT.601 conversion for YCbCr to RGB
|
||||
// http://www.equasys.de/colorconversion.html#YCbCr-RGBColorFormatConversion
|
||||
{TextureFormat::XFB,
|
||||
{BUFFER_FORMAT_RGBA8_UINT, 0, 8, 8, false,
|
||||
R"(
|
||||
layout(local_size_x = 8, local_size_y = 8) in;
|
||||
|
||||
void main()
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/MathUtil.h"
|
||||
|
|
|
@ -55,7 +55,7 @@ struct TargetRectangle : public MathUtil::Rectangle<int>
|
|||
return (RECT*)this;
|
||||
}
|
||||
#endif
|
||||
TargetRectangle(const MathUtil::Rectangle<int> &other) : MathUtil::Rectangle<int>(other) {}
|
||||
TargetRectangle(const MathUtil::Rectangle<int>& other) : MathUtil::Rectangle<int>(other) {}
|
||||
TargetRectangle() = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ struct VideoConfig final
|
|||
bool bSupportsGPUTextureDecoding;
|
||||
bool bSupportsST3CTextures;
|
||||
bool bSupportsCopyToVram;
|
||||
bool bForceCopyToRam; // Needed by Software Renderer
|
||||
bool bForceCopyToRam; // Needed by Software Renderer
|
||||
bool bSupportsBitfield; // Needed by UberShaders, so must stay in VideoCommon
|
||||
bool bSupportsDynamicSamplerIndexing; // Needed by UberShaders, so must stay in VideoCommon
|
||||
bool bSupportsBPTCTextures;
|
||||
|
|
Loading…
Reference in New Issue