Lint fixes
This commit is contained in:
parent
11de923dcb
commit
31cfe8250d
|
@ -36,7 +36,7 @@ struct HookBase
|
|||
|
||||
using EventHook = std::unique_ptr<HookBase>;
|
||||
|
||||
template<StringLiteral EventName, typename... CallbackArgs>
|
||||
template <StringLiteral EventName, typename... CallbackArgs>
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
|
@ -46,12 +46,12 @@ private:
|
|||
struct HookImpl : public HookBase
|
||||
{
|
||||
~HookImpl() override { Event::Remove(this); }
|
||||
HookImpl(CallbackType callback, std::string name) : m_fn(callback), m_name(name){ }
|
||||
HookImpl(CallbackType callback, std::string name) : m_fn(callback), m_name(name) {}
|
||||
CallbackType m_fn;
|
||||
std::string m_name;
|
||||
};
|
||||
public:
|
||||
|
||||
public:
|
||||
// Returns a handle that will unregister the listener when destroyed.
|
||||
static EventHook Register(CallbackType callback, std::string name)
|
||||
{
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
|
||||
// A useful template for passing string literals as arguments to templates
|
||||
// from: https://ctrpeach.io/posts/cpp20-string-literal-template-parameters/
|
||||
template<size_t N>
|
||||
struct StringLiteral {
|
||||
consteval StringLiteral(const char (&str)[N]) {
|
||||
std::copy_n(str, N, value);
|
||||
}
|
||||
template <size_t N>
|
||||
struct StringLiteral
|
||||
{
|
||||
consteval StringLiteral(const char (&str)[N]) { std::copy_n(str, N, value); }
|
||||
|
||||
char value[N];
|
||||
};
|
||||
|
|
|
@ -132,12 +132,14 @@ static thread_local bool tls_is_gpu_thread = false;
|
|||
|
||||
static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi);
|
||||
|
||||
static EventHook s_frame_presented = AfterPresentEvent::Register([](auto& present_info) {
|
||||
const double last_speed_denominator = g_perf_metrics.GetLastSpeedDenominator();
|
||||
// The denominator should always be > 0 but if it's not, just return 1
|
||||
const double last_speed = last_speed_denominator > 0.0 ? (1.0 / last_speed_denominator) : 1.0;
|
||||
Core::Callback_FramePresented(last_speed);
|
||||
}, "Core Frame Presented");
|
||||
static EventHook s_frame_presented = AfterPresentEvent::Register(
|
||||
[](auto& present_info) {
|
||||
const double last_speed_denominator = g_perf_metrics.GetLastSpeedDenominator();
|
||||
// The denominator should always be > 0 but if it's not, just return 1
|
||||
const double last_speed = last_speed_denominator > 0.0 ? (1.0 / last_speed_denominator) : 1.0;
|
||||
Core::Callback_FramePresented(last_speed);
|
||||
},
|
||||
"Core Frame Presented");
|
||||
|
||||
bool GetIsThrottlerTempDisabled()
|
||||
{
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
#include "VideoCommon/CommandProcessor.h"
|
||||
#include "VideoCommon/OpcodeDecoding.h"
|
||||
#include "VideoCommon/TextureDecoder.h"
|
||||
#include "VideoCommon/XFStructs.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
#include "VideoCommon/VideoEvents.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
#include "VideoCommon/XFStructs.h"
|
||||
|
||||
class FifoRecorder::FifoRecordAnalyzer : public OpcodeDecoder::Callback
|
||||
{
|
||||
|
@ -255,24 +255,26 @@ void FifoRecorder::StartRecording(s32 numFrames, CallbackFunc finishedCb)
|
|||
m_RequestedRecordingEnd = false;
|
||||
m_FinishedCb = finishedCb;
|
||||
|
||||
m_end_of_frame_event = AfterFrameEvent::Register([this] {
|
||||
const bool was_recording = OpcodeDecoder::g_record_fifo_data;
|
||||
OpcodeDecoder::g_record_fifo_data = IsRecording();
|
||||
m_end_of_frame_event = AfterFrameEvent::Register(
|
||||
[this] {
|
||||
const bool was_recording = OpcodeDecoder::g_record_fifo_data;
|
||||
OpcodeDecoder::g_record_fifo_data = IsRecording();
|
||||
|
||||
if (!OpcodeDecoder::g_record_fifo_data)
|
||||
return;
|
||||
if (!OpcodeDecoder::g_record_fifo_data)
|
||||
return;
|
||||
|
||||
if (!was_recording)
|
||||
{
|
||||
RecordInitialVideoMemory();
|
||||
}
|
||||
if (!was_recording)
|
||||
{
|
||||
RecordInitialVideoMemory();
|
||||
}
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& command_processor = system.GetCommandProcessor();
|
||||
const auto& fifo = command_processor.GetFifo();
|
||||
EndFrame(fifo.CPBase.load(std::memory_order_relaxed),
|
||||
fifo.CPEnd.load(std::memory_order_relaxed));
|
||||
}, "FifoRecorder::EndFrame");
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& command_processor = system.GetCommandProcessor();
|
||||
const auto& fifo = command_processor.GetFifo();
|
||||
EndFrame(fifo.CPBase.load(std::memory_order_relaxed),
|
||||
fifo.CPEnd.load(std::memory_order_relaxed));
|
||||
},
|
||||
"FifoRecorder::EndFrame");
|
||||
}
|
||||
|
||||
void FifoRecorder::RecordInitialVideoMemory()
|
||||
|
|
|
@ -50,19 +50,19 @@ bool Gfx::IsHeadless() const
|
|||
}
|
||||
|
||||
std::unique_ptr<AbstractTexture> Gfx::CreateTexture(const TextureConfig& config,
|
||||
std::string_view name)
|
||||
std::string_view name)
|
||||
{
|
||||
return DXTexture::Create(config, name);
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractStagingTexture> Gfx::CreateStagingTexture(StagingTextureType type,
|
||||
const TextureConfig& config)
|
||||
const TextureConfig& config)
|
||||
{
|
||||
return DXStagingTexture::Create(type, config);
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractFramebuffer> Gfx::CreateFramebuffer(AbstractTexture* color_attachment,
|
||||
AbstractTexture* depth_attachment)
|
||||
AbstractTexture* depth_attachment)
|
||||
{
|
||||
return DXFramebuffer::Create(static_cast<DXTexture*>(color_attachment),
|
||||
static_cast<DXTexture*>(depth_attachment));
|
||||
|
@ -78,16 +78,15 @@ Gfx::CreateShaderFromSource(ShaderStage stage, std::string_view source, std::str
|
|||
return DXShader::CreateFromBytecode(stage, std::move(*bytecode), name);
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractShader> Gfx::CreateShaderFromBinary(ShaderStage stage,
|
||||
const void* data, size_t length,
|
||||
std::string_view name)
|
||||
std::unique_ptr<AbstractShader> Gfx::CreateShaderFromBinary(ShaderStage stage, const void* data,
|
||||
size_t length, std::string_view name)
|
||||
{
|
||||
return DXShader::CreateFromBytecode(stage, DXShader::CreateByteCode(data, length), name);
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractPipeline> Gfx::CreatePipeline(const AbstractPipelineConfig& config,
|
||||
const void* cache_data,
|
||||
size_t cache_data_length)
|
||||
const void* cache_data,
|
||||
size_t cache_data_length)
|
||||
{
|
||||
return DXPipeline::Create(config);
|
||||
}
|
||||
|
@ -129,7 +128,7 @@ void Gfx::SetScissorRect(const MathUtil::Rectangle<int>& rc)
|
|||
}
|
||||
|
||||
void Gfx::SetViewport(float x, float y, float width, float height, float near_depth,
|
||||
float far_depth)
|
||||
float far_depth)
|
||||
{
|
||||
// TODO: Move to stateman
|
||||
const CD3D11_VIEWPORT vp(x, y, width, height, near_depth, far_depth);
|
||||
|
@ -149,7 +148,7 @@ void Gfx::DrawIndexed(u32 base_index, u32 num_indices, u32 base_vertex)
|
|||
}
|
||||
|
||||
void Gfx::DispatchComputeShader(const AbstractShader* shader, u32 groupsize_x, u32 groupsize_y,
|
||||
u32 groupsize_z, u32 groups_x, u32 groups_y, u32 groups_z)
|
||||
u32 groupsize_z, u32 groups_x, u32 groups_y, u32 groups_z)
|
||||
{
|
||||
D3D::stateman->SetComputeShader(static_cast<const DXShader*>(shader)->GetD3DComputeShader());
|
||||
D3D::stateman->SyncComputeBindings();
|
||||
|
@ -222,8 +221,8 @@ void Gfx::SetAndDiscardFramebuffer(AbstractFramebuffer* framebuffer)
|
|||
SetFramebuffer(framebuffer);
|
||||
}
|
||||
|
||||
void Gfx::SetAndClearFramebuffer(AbstractFramebuffer* framebuffer,
|
||||
const ClearColor& color_value, float depth_value)
|
||||
void Gfx::SetAndClearFramebuffer(AbstractFramebuffer* framebuffer, const ClearColor& color_value,
|
||||
float depth_value)
|
||||
{
|
||||
SetFramebuffer(framebuffer);
|
||||
D3D::stateman->Apply();
|
||||
|
@ -286,12 +285,9 @@ bool Gfx::IsFullscreen() const
|
|||
|
||||
SurfaceInfo Gfx::GetSurfaceInfo() const
|
||||
{
|
||||
return {
|
||||
m_swap_chain ? static_cast<u32>(m_swap_chain->GetWidth()) : 0,
|
||||
m_swap_chain ? static_cast<u32>(m_swap_chain->GetHeight()) : 0,
|
||||
m_backbuffer_scale,
|
||||
m_swap_chain ? m_swap_chain->GetFormat() : AbstractTextureFormat::Undefined
|
||||
};
|
||||
return {m_swap_chain ? static_cast<u32>(m_swap_chain->GetWidth()) : 0,
|
||||
m_swap_chain ? static_cast<u32>(m_swap_chain->GetHeight()) : 0, m_backbuffer_scale,
|
||||
m_swap_chain ? m_swap_chain->GetFormat() : AbstractTextureFormat::Undefined};
|
||||
}
|
||||
|
||||
} // namespace DX11
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
#include "VideoBackends/D3D/D3DBase.h"
|
||||
#include "VideoBackends/D3D/D3DBoundingBox.h"
|
||||
#include "VideoBackends/D3D/D3DPerfQuery.h"
|
||||
#include "VideoBackends/D3D/D3DGfx.h"
|
||||
#include "VideoBackends/D3D/D3DPerfQuery.h"
|
||||
#include "VideoBackends/D3D/D3DSwapChain.h"
|
||||
#include "VideoBackends/D3D/D3DVertexManager.h"
|
||||
#include "VideoBackends/D3DCommon/D3DCommon.h"
|
||||
|
@ -161,7 +161,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
|||
auto bounding_box = std::make_unique<D3DBoundingBox>();
|
||||
|
||||
return InitializeShared(std::move(gfx), std::move(vertex_manager), std::move(perf_query),
|
||||
std::move(bounding_box));
|
||||
std::move(bounding_box));
|
||||
}
|
||||
|
||||
void VideoBackend::Shutdown()
|
||||
|
|
|
@ -114,8 +114,8 @@ void PerfQuery::FlushOne()
|
|||
// NOTE: Reported pixel metrics should be referenced to native resolution
|
||||
// TODO: Dropping the lower 2 bits from this count should be closer to actual
|
||||
// hardware behavior when drawing triangles.
|
||||
const u64 native_res_result = result * EFB_WIDTH / g_framebuffer_manager->GetEFBWidth() * EFB_HEIGHT /
|
||||
g_framebuffer_manager->GetEFBHeight();
|
||||
const u64 native_res_result = result * EFB_WIDTH / g_framebuffer_manager->GetEFBWidth() *
|
||||
EFB_HEIGHT / g_framebuffer_manager->GetEFBHeight();
|
||||
m_results[entry.query_group].fetch_add(static_cast<u32>(native_res_result),
|
||||
std::memory_order_relaxed);
|
||||
|
||||
|
@ -143,8 +143,8 @@ void PerfQuery::WeakFlush()
|
|||
if (hr == S_OK)
|
||||
{
|
||||
// NOTE: Reported pixel metrics should be referenced to native resolution
|
||||
const u64 native_res_result = result * EFB_WIDTH / g_framebuffer_manager->GetEFBWidth() * EFB_HEIGHT /
|
||||
g_framebuffer_manager->GetEFBHeight();
|
||||
const u64 native_res_result = result * EFB_WIDTH / g_framebuffer_manager->GetEFBWidth() *
|
||||
EFB_HEIGHT / g_framebuffer_manager->GetEFBHeight();
|
||||
m_results[entry.query_group].store(static_cast<u32>(native_res_result),
|
||||
std::memory_order_relaxed);
|
||||
|
||||
|
|
|
@ -49,19 +49,19 @@ bool Gfx::IsHeadless() const
|
|||
}
|
||||
|
||||
std::unique_ptr<AbstractTexture> Gfx::CreateTexture(const TextureConfig& config,
|
||||
std::string_view name)
|
||||
std::string_view name)
|
||||
{
|
||||
return DXTexture::Create(config, name);
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractStagingTexture> Gfx::CreateStagingTexture(StagingTextureType type,
|
||||
const TextureConfig& config)
|
||||
const TextureConfig& config)
|
||||
{
|
||||
return DXStagingTexture::Create(type, config);
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractFramebuffer> Gfx::CreateFramebuffer(AbstractTexture* color_attachment,
|
||||
AbstractTexture* depth_attachment)
|
||||
AbstractTexture* depth_attachment)
|
||||
{
|
||||
return DXFramebuffer::Create(static_cast<DXTexture*>(color_attachment),
|
||||
static_cast<DXTexture*>(depth_attachment));
|
||||
|
@ -73,9 +73,8 @@ Gfx::CreateShaderFromSource(ShaderStage stage, std::string_view source, std::str
|
|||
return DXShader::CreateFromSource(stage, source, name);
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractShader> Gfx::CreateShaderFromBinary(ShaderStage stage,
|
||||
const void* data, size_t length,
|
||||
std::string_view name)
|
||||
std::unique_ptr<AbstractShader> Gfx::CreateShaderFromBinary(ShaderStage stage, const void* data,
|
||||
size_t length, std::string_view name)
|
||||
{
|
||||
return DXShader::CreateFromBytecode(stage, DXShader::CreateByteCode(data, length), name);
|
||||
}
|
||||
|
@ -87,8 +86,8 @@ Gfx::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
|||
}
|
||||
|
||||
std::unique_ptr<AbstractPipeline> Gfx::CreatePipeline(const AbstractPipelineConfig& config,
|
||||
const void* cache_data,
|
||||
size_t cache_data_length)
|
||||
const void* cache_data,
|
||||
size_t cache_data_length)
|
||||
{
|
||||
return DXPipeline::Create(config, cache_data, cache_data_length);
|
||||
}
|
||||
|
@ -103,8 +102,8 @@ void Gfx::WaitForGPUIdle()
|
|||
ExecuteCommandList(true);
|
||||
}
|
||||
|
||||
void Gfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc,
|
||||
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z)
|
||||
void Gfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_enable,
|
||||
bool alpha_enable, bool z_enable, u32 color, u32 z)
|
||||
{
|
||||
// Use a fast path without the shader if both color/alpha are enabled.
|
||||
const bool fast_color_clear = color_enable && alpha_enable;
|
||||
|
@ -229,8 +228,8 @@ void Gfx::SetAndDiscardFramebuffer(AbstractFramebuffer* framebuffer)
|
|||
}
|
||||
}
|
||||
|
||||
void Gfx::SetAndClearFramebuffer(AbstractFramebuffer* framebuffer,
|
||||
const ClearColor& color_value, float depth_value)
|
||||
void Gfx::SetAndClearFramebuffer(AbstractFramebuffer* framebuffer, const ClearColor& color_value,
|
||||
float depth_value)
|
||||
{
|
||||
DXFramebuffer* dxfb = static_cast<DXFramebuffer*>(framebuffer);
|
||||
BindFramebuffer(dxfb);
|
||||
|
@ -318,7 +317,7 @@ void Gfx::UnbindTexture(const AbstractTexture* texture)
|
|||
}
|
||||
|
||||
void Gfx::SetViewport(float x, float y, float width, float height, float near_depth,
|
||||
float far_depth)
|
||||
float far_depth)
|
||||
{
|
||||
if (m_state.viewport.TopLeftX == x && m_state.viewport.TopLeftY == y &&
|
||||
m_state.viewport.Width == width && m_state.viewport.Height == height &&
|
||||
|
@ -357,7 +356,7 @@ void Gfx::DrawIndexed(u32 base_index, u32 num_indices, u32 base_vertex)
|
|||
}
|
||||
|
||||
void Gfx::DispatchComputeShader(const AbstractShader* shader, u32 groupsize_x, u32 groupsize_y,
|
||||
u32 groupsize_z, u32 groups_x, u32 groups_y, u32 groups_z)
|
||||
u32 groupsize_z, u32 groups_x, u32 groups_y, u32 groups_z)
|
||||
{
|
||||
SetRootSignatures();
|
||||
SetDescriptorHeaps();
|
||||
|
@ -427,12 +426,9 @@ void Gfx::PresentBackbuffer()
|
|||
|
||||
SurfaceInfo Gfx::GetSurfaceInfo() const
|
||||
{
|
||||
return {
|
||||
m_swap_chain ? static_cast<u32>(m_swap_chain->GetWidth()) : 0,
|
||||
m_swap_chain ? static_cast<u32>(m_swap_chain->GetHeight()) : 0,
|
||||
m_backbuffer_scale,
|
||||
m_swap_chain ? m_swap_chain->GetFormat() : AbstractTextureFormat::Undefined
|
||||
};
|
||||
return {m_swap_chain ? static_cast<u32>(m_swap_chain->GetWidth()) : 0,
|
||||
m_swap_chain ? static_cast<u32>(m_swap_chain->GetHeight()) : 0, m_backbuffer_scale,
|
||||
m_swap_chain ? m_swap_chain->GetFormat() : AbstractTextureFormat::Undefined};
|
||||
}
|
||||
|
||||
void Gfx::OnConfigChanged(u32 bits)
|
||||
|
@ -494,7 +490,7 @@ void Gfx::SetPixelShaderUAV(D3D12_CPU_DESCRIPTOR_HANDLE handle)
|
|||
}
|
||||
|
||||
void Gfx::SetVertexBuffer(D3D12_GPU_VIRTUAL_ADDRESS address, D3D12_CPU_DESCRIPTOR_HANDLE srv,
|
||||
u32 stride, u32 size)
|
||||
u32 stride, u32 size)
|
||||
{
|
||||
if (m_state.vertex_buffer.BufferLocation != address ||
|
||||
m_state.vertex_buffer.StrideInBytes != stride || m_state.vertex_buffer.SizeInBytes != size)
|
||||
|
|
|
@ -47,8 +47,8 @@ public:
|
|||
void Flush() override;
|
||||
void WaitForGPUIdle() override;
|
||||
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
|
||||
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) override;
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_enable, bool alpha_enable,
|
||||
bool z_enable, u32 color, u32 z) override;
|
||||
|
||||
void SetPipeline(const AbstractPipeline* pipeline) override;
|
||||
void SetFramebuffer(AbstractFramebuffer* framebuffer) override;
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include "VideoBackends/D3D12/Common.h"
|
||||
#include "VideoBackends/D3D12/D3D12Gfx.h"
|
||||
#include "VideoBackends/D3D12/DX12Context.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
||||
namespace DX12
|
||||
{
|
||||
|
|
|
@ -130,10 +130,10 @@ void VertexManager::CommitBuffer(u32 num_vertices, u32 vertex_stride, u32 num_in
|
|||
ADDSTAT(g_stats.this_frame.bytes_index_streamed, static_cast<int>(index_data_size));
|
||||
|
||||
Gfx::GetInstance()->SetVertexBuffer(m_vertex_stream_buffer.GetGPUPointer(),
|
||||
m_vertex_srv.cpu_handle, vertex_stride,
|
||||
m_vertex_stream_buffer.GetSize());
|
||||
m_vertex_srv.cpu_handle, vertex_stride,
|
||||
m_vertex_stream_buffer.GetSize());
|
||||
Gfx::GetInstance()->SetIndexBuffer(m_index_stream_buffer.GetGPUPointer(),
|
||||
m_index_stream_buffer.GetSize(), DXGI_FORMAT_R16_UINT);
|
||||
m_index_stream_buffer.GetSize(), DXGI_FORMAT_R16_UINT);
|
||||
}
|
||||
|
||||
void VertexManager::UploadUniforms()
|
||||
|
@ -235,11 +235,11 @@ void VertexManager::UploadAllConstants()
|
|||
|
||||
// Update bindings
|
||||
Gfx::GetInstance()->SetConstantBuffer(0, m_uniform_stream_buffer.GetCurrentGPUPointer() +
|
||||
pixel_constants_offset);
|
||||
pixel_constants_offset);
|
||||
Gfx::GetInstance()->SetConstantBuffer(1, m_uniform_stream_buffer.GetCurrentGPUPointer() +
|
||||
vertex_constants_offset);
|
||||
vertex_constants_offset);
|
||||
Gfx::GetInstance()->SetConstantBuffer(2, m_uniform_stream_buffer.GetCurrentGPUPointer() +
|
||||
geometry_constants_offset);
|
||||
geometry_constants_offset);
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
#include "VideoBackends/D3D12/Common.h"
|
||||
#include "VideoBackends/D3D12/D3D12BoundingBox.h"
|
||||
#include "VideoBackends/D3D12/D3D12PerfQuery.h"
|
||||
#include "VideoBackends/D3D12/D3D12Gfx.h"
|
||||
#include "VideoBackends/D3D12/D3D12PerfQuery.h"
|
||||
#include "VideoBackends/D3D12/D3D12SwapChain.h"
|
||||
#include "VideoBackends/D3D12/D3D12VertexManager.h"
|
||||
#include "VideoBackends/D3D12/DX12Context.h"
|
||||
|
|
|
@ -47,8 +47,8 @@ public:
|
|||
void WaitForGPUIdle() override;
|
||||
void OnConfigChanged(u32 bits) override;
|
||||
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
|
||||
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) override;
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_enable, bool alpha_enable,
|
||||
bool z_enable, u32 color, u32 z) override;
|
||||
|
||||
void SetPipeline(const AbstractPipeline* pipeline) override;
|
||||
void SetFramebuffer(AbstractFramebuffer* framebuffer) override;
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
|
||||
#include <fstream>
|
||||
|
||||
Metal::Gfx::Gfx(MRCOwned<CAMetalLayer*> layer)
|
||||
: m_layer(std::move(layer))
|
||||
Metal::Gfx::Gfx(MRCOwned<CAMetalLayer*> layer) : m_layer(std::move(layer))
|
||||
{
|
||||
UpdateActiveConfig();
|
||||
[m_layer setDisplaySyncEnabled:g_ActiveConfig.bVSyncActive];
|
||||
|
@ -38,7 +37,7 @@ bool Metal::Gfx::IsHeadless() const
|
|||
// MARK: Texture Creation
|
||||
|
||||
std::unique_ptr<AbstractTexture> Metal::Gfx::CreateTexture(const TextureConfig& config,
|
||||
std::string_view name)
|
||||
std::string_view name)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
|
@ -94,8 +93,7 @@ Metal::Gfx::CreateStagingTexture(StagingTextureType type, const TextureConfig& c
|
|||
}
|
||||
|
||||
std::unique_ptr<AbstractFramebuffer>
|
||||
Metal::Gfx::CreateFramebuffer(AbstractTexture* color_attachment,
|
||||
AbstractTexture* depth_attachment)
|
||||
Metal::Gfx::CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment)
|
||||
{
|
||||
AbstractTexture* const either_attachment = color_attachment ? color_attachment : depth_attachment;
|
||||
return std::make_unique<Framebuffer>(
|
||||
|
@ -107,8 +105,8 @@ Metal::Gfx::CreateFramebuffer(AbstractTexture* color_attachment,
|
|||
// MARK: Pipeline Creation
|
||||
|
||||
std::unique_ptr<AbstractShader> Metal::Gfx::CreateShaderFromSource(ShaderStage stage,
|
||||
std::string_view source,
|
||||
std::string_view name)
|
||||
std::string_view source,
|
||||
std::string_view name)
|
||||
{
|
||||
std::optional<std::string> msl = Util::TranslateShaderToMSL(stage, source);
|
||||
if (!msl.has_value())
|
||||
|
@ -121,9 +119,8 @@ std::unique_ptr<AbstractShader> Metal::Gfx::CreateShaderFromSource(ShaderStage s
|
|||
}
|
||||
|
||||
std::unique_ptr<AbstractShader> Metal::Gfx::CreateShaderFromBinary(ShaderStage stage,
|
||||
const void* data,
|
||||
size_t length,
|
||||
std::string_view name)
|
||||
const void* data, size_t length,
|
||||
std::string_view name)
|
||||
{
|
||||
return CreateShaderFromMSL(stage, std::string(static_cast<const char*>(data), length), {}, name);
|
||||
}
|
||||
|
@ -154,10 +151,9 @@ static NSString* GenericShaderName(ShaderStage stage)
|
|||
|
||||
// clang-format on
|
||||
|
||||
std::unique_ptr<AbstractShader> Metal::Gfx::CreateShaderFromMSL(ShaderStage stage,
|
||||
std::string msl,
|
||||
std::string_view glsl,
|
||||
std::string_view name)
|
||||
std::unique_ptr<AbstractShader> Metal::Gfx::CreateShaderFromMSL(ShaderStage stage, std::string msl,
|
||||
std::string_view glsl,
|
||||
std::string_view name)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
|
@ -247,9 +243,9 @@ Metal::Gfx::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<AbstractPipeline>
|
||||
Metal::Gfx::CreatePipeline(const AbstractPipelineConfig& config, const void* cache_data,
|
||||
size_t cache_data_length)
|
||||
std::unique_ptr<AbstractPipeline> Metal::Gfx::CreatePipeline(const AbstractPipelineConfig& config,
|
||||
const void* cache_data,
|
||||
size_t cache_data_length)
|
||||
{
|
||||
return g_object_cache->CreatePipeline(config);
|
||||
}
|
||||
|
@ -285,8 +281,8 @@ void Metal::Gfx::OnConfigChanged(u32 bits)
|
|||
}
|
||||
}
|
||||
|
||||
void Metal::Gfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc,
|
||||
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z)
|
||||
void Metal::Gfx::ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_enable,
|
||||
bool alpha_enable, bool z_enable, u32 color, u32 z)
|
||||
{
|
||||
u32 framebuffer_width = m_current_framebuffer->GetWidth();
|
||||
u32 framebuffer_height = m_current_framebuffer->GetHeight();
|
||||
|
@ -362,7 +358,7 @@ void Metal::Gfx::SetAndDiscardFramebuffer(AbstractFramebuffer* framebuffer)
|
|||
}
|
||||
|
||||
void Metal::Gfx::SetAndClearFramebuffer(AbstractFramebuffer* framebuffer,
|
||||
const ClearColor& color_value, float depth_value)
|
||||
const ClearColor& color_value, float depth_value)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
|
@ -400,7 +396,7 @@ void Metal::Gfx::UnbindTexture(const AbstractTexture* texture)
|
|||
}
|
||||
|
||||
void Metal::Gfx::SetViewport(float x, float y, float width, float height, float near_depth,
|
||||
float far_depth)
|
||||
float far_depth)
|
||||
{
|
||||
g_state_tracker->SetViewport(x, y, width, height, near_depth, far_depth);
|
||||
}
|
||||
|
@ -422,8 +418,8 @@ void Metal::Gfx::DrawIndexed(u32 base_index, u32 num_indices, u32 base_vertex)
|
|||
}
|
||||
|
||||
void Metal::Gfx::DispatchComputeShader(const AbstractShader* shader, //
|
||||
u32 groupsize_x, u32 groupsize_y, u32 groupsize_z,
|
||||
u32 groups_x, u32 groups_y, u32 groups_z)
|
||||
u32 groupsize_x, u32 groupsize_y, u32 groupsize_z,
|
||||
u32 groups_x, u32 groups_y, u32 groups_z)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
|
@ -491,7 +487,8 @@ void Metal::Gfx::SetupSurface()
|
|||
|
||||
[m_layer setDrawableSize:{static_cast<double>(info.width), static_cast<double>(info.height)}];
|
||||
|
||||
TextureConfig cfg(info.width, info.height, 1, 1, 1, info.format, AbstractTextureFlag_RenderTarget);
|
||||
TextureConfig cfg(info.width, info.height, 1, 1, 1, info.format,
|
||||
AbstractTextureFlag_RenderTarget);
|
||||
m_bb_texture = std::make_unique<Texture>(nullptr, cfg);
|
||||
m_backbuffer = std::make_unique<Framebuffer>(m_bb_texture.get(), nullptr, //
|
||||
info.width, info.height, 1, 1);
|
||||
|
@ -502,16 +499,12 @@ void Metal::Gfx::SetupSurface()
|
|||
|
||||
SurfaceInfo Metal::Gfx::GetSurfaceInfo() const
|
||||
{
|
||||
if (!m_layer) // Headless
|
||||
if (!m_layer) // Headless
|
||||
return {};
|
||||
|
||||
CGSize size = [m_layer bounds].size;
|
||||
const float scale = [m_layer contentsScale];
|
||||
|
||||
return {
|
||||
static_cast<u32>(size.width * scale),
|
||||
static_cast<u32>(size.height * scale),
|
||||
scale,
|
||||
Util::ToAbstract([m_layer pixelFormat])
|
||||
};
|
||||
return {static_cast<u32>(size.width * scale), static_cast<u32>(size.height * scale), scale,
|
||||
Util::ToAbstract([m_layer pixelFormat])};
|
||||
}
|
||||
|
|
|
@ -77,8 +77,9 @@ void Metal::PerfQuery::ReturnResults(const u64* data, const PerfQueryGroup* grou
|
|||
{
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
u64 native_res_result = data[i] * (EFB_WIDTH * EFB_HEIGHT) /
|
||||
(g_framebuffer_manager->GetEFBWidth() * g_framebuffer_manager->GetEFBHeight());
|
||||
u64 native_res_result =
|
||||
data[i] * (EFB_WIDTH * EFB_HEIGHT) /
|
||||
(g_framebuffer_manager->GetEFBWidth() * g_framebuffer_manager->GetEFBHeight());
|
||||
|
||||
native_res_result /= g_ActiveConfig.iMultisamples;
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ public:
|
|||
void SetAndDiscardFramebuffer(AbstractFramebuffer* framebuffer) override;
|
||||
void SetAndClearFramebuffer(AbstractFramebuffer* framebuffer, const ClearColor& color_value = {},
|
||||
float depth_value = 0.0f) override;
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
|
||||
bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override;
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool colorEnable, bool alphaEnable,
|
||||
bool zEnable, u32 color, u32 z) override;
|
||||
void SetScissorRect(const MathUtil::Rectangle<int>& rc) override;
|
||||
void SetTexture(u32 index, const AbstractTexture* texture) override;
|
||||
void SetSamplerState(u32 index, const SamplerState& state) override;
|
||||
|
|
|
@ -264,8 +264,9 @@ void PerfQueryGLESNV::FlushOne()
|
|||
// NOTE: Reported pixel metrics should be referenced to native resolution
|
||||
// TODO: Dropping the lower 2 bits from this count should be closer to actual
|
||||
// hardware behavior when drawing triangles.
|
||||
const u64 native_res_result = static_cast<u64>(result) * EFB_WIDTH * EFB_HEIGHT /
|
||||
(g_framebuffer_manager->GetEFBWidth() * g_framebuffer_manager->GetEFBHeight());
|
||||
const u64 native_res_result =
|
||||
static_cast<u64>(result) * EFB_WIDTH * EFB_HEIGHT /
|
||||
(g_framebuffer_manager->GetEFBWidth() * g_framebuffer_manager->GetEFBHeight());
|
||||
m_results[entry.query_group].fetch_add(static_cast<u32>(native_res_result),
|
||||
std::memory_order_relaxed);
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ public:
|
|||
|
||||
void SetScissorRect(const MathUtil::Rectangle<int>& rc) override;
|
||||
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
|
||||
bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) override;
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool colorEnable, bool alphaEnable,
|
||||
bool zEnable, u32 color, u32 z) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<SWOGLWindow> m_window;
|
||||
|
|
|
@ -53,8 +53,8 @@ public:
|
|||
void WaitForGPUIdle() override;
|
||||
void OnConfigChanged(u32 bits) override;
|
||||
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc,
|
||||
bool color_enable, bool alpha_enable, bool z_enable, u32 color, u32 z) override;
|
||||
void ClearRegion(const MathUtil::Rectangle<int>& target_rc, bool color_enable, bool alpha_enable,
|
||||
bool z_enable, u32 color, u32 z) override;
|
||||
|
||||
void SetPipeline(const AbstractPipeline* pipeline) override;
|
||||
void SetFramebuffer(AbstractFramebuffer* framebuffer) override;
|
||||
|
|
|
@ -240,7 +240,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
|||
auto bounding_box = std::make_unique<VKBoundingBox>();
|
||||
|
||||
return InitializeShared(std::move(gfx), std::move(vertex_manager), std::move(perf_query),
|
||||
std::move(bounding_box));
|
||||
std::move(bounding_box));
|
||||
}
|
||||
|
||||
void VideoBackend::Shutdown()
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
#include "VideoCommon/VertexManagerBase.h"
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
#include "VideoCommon/VideoState.h"
|
||||
#include "VideoCommon/VideoEvents.h"
|
||||
#include "VideoCommon/VideoState.h"
|
||||
|
||||
AsyncRequests AsyncRequests::s_singleton;
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
#include "VideoCommon/GeometryShaderManager.h"
|
||||
#include "VideoCommon/OpcodeDecoding.h"
|
||||
#include "VideoCommon/PerfQueryBase.h"
|
||||
#include "VideoCommon/Present.h"
|
||||
#include "VideoCommon/PixelEngine.h"
|
||||
#include "VideoCommon/PixelShaderManager.h"
|
||||
#include "VideoCommon/Present.h"
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/Statistics.h"
|
||||
#include "VideoCommon/TMEM.h"
|
||||
|
@ -346,7 +346,6 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager,
|
|||
// It works 99% of the time.
|
||||
AfterFrameEvent::Trigger();
|
||||
|
||||
|
||||
if (g_ActiveConfig.bImmediateXFB)
|
||||
{
|
||||
// below div two to convert from bytes to pixels - it expects width, not stride
|
||||
|
|
|
@ -149,16 +149,14 @@ static u32 CalculateEFBLayers()
|
|||
|
||||
TextureConfig FramebufferManager::GetEFBColorTextureConfig(u32 width, u32 height)
|
||||
{
|
||||
return TextureConfig(width, height, 1,
|
||||
CalculateEFBLayers(), g_ActiveConfig.iMultisamples, GetEFBColorFormat(),
|
||||
AbstractTextureFlag_RenderTarget);
|
||||
return TextureConfig(width, height, 1, CalculateEFBLayers(), g_ActiveConfig.iMultisamples,
|
||||
GetEFBColorFormat(), AbstractTextureFlag_RenderTarget);
|
||||
}
|
||||
|
||||
TextureConfig FramebufferManager::GetEFBDepthTextureConfig(u32 width, u32 height)
|
||||
{
|
||||
return TextureConfig(width, height, 1,
|
||||
CalculateEFBLayers(), g_ActiveConfig.iMultisamples, GetEFBDepthFormat(),
|
||||
AbstractTextureFlag_RenderTarget);
|
||||
return TextureConfig(width, height, 1, CalculateEFBLayers(), g_ActiveConfig.iMultisamples,
|
||||
GetEFBDepthFormat(), AbstractTextureFlag_RenderTarget);
|
||||
}
|
||||
|
||||
FramebufferState FramebufferManager::GetEFBFramebufferState() const
|
||||
|
@ -905,8 +903,7 @@ bool FramebufferManager::CompileClearPipelines()
|
|||
config.depth_state.testenable = depth_enable != 0;
|
||||
config.depth_state.updateenable = depth_enable != 0;
|
||||
|
||||
m_clear_pipelines[color_enable][alpha_enable][depth_enable] =
|
||||
g_gfx->CreatePipeline(config);
|
||||
m_clear_pipelines[color_enable][alpha_enable][depth_enable] = g_gfx->CreatePipeline(config);
|
||||
if (!m_clear_pipelines[color_enable][alpha_enable][depth_enable])
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -226,8 +226,7 @@ protected:
|
|||
|
||||
// EFB clear pipelines
|
||||
// Indexed by [color_write_enabled][alpha_write_enabled][depth_write_enabled]
|
||||
std::array<std::array<std::array<std::unique_ptr<AbstractPipeline>, 2>, 2>, 2>
|
||||
m_clear_pipelines;
|
||||
std::array<std::array<std::array<std::unique_ptr<AbstractPipeline>, 2>, 2>, 2> m_clear_pipelines;
|
||||
|
||||
// EFB poke drawing setup
|
||||
std::unique_ptr<NativeVertexFormat> m_poke_vertex_format;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "VideoCommon/GraphicsModSystem/Runtime/FBInfo.h"
|
||||
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h"
|
||||
#include "VideoCommon/TextureInfo.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
#include "VideoCommon/VideoEvents.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
|
||||
class GraphicsModGroupConfig;
|
||||
class GraphicsModManager
|
||||
|
|
|
@ -16,7 +16,6 @@ class AbstractPipeline;
|
|||
|
||||
namespace VideoCommon
|
||||
{
|
||||
|
||||
// OnScreenUI handles all the ImGui rendering.
|
||||
class OnScreenUI
|
||||
{
|
||||
|
|
|
@ -74,7 +74,8 @@ void PixelShaderManager::Dirty()
|
|||
// Any constants that can changed based on settings should be re-calculated
|
||||
m_fog_range_adjusted_changed = true;
|
||||
|
||||
SetEfbScaleChanged(g_framebuffer_manager->EFBToScaledXf(1), g_framebuffer_manager->EFBToScaledYf(1));
|
||||
SetEfbScaleChanged(g_framebuffer_manager->EFBToScaledXf(1),
|
||||
g_framebuffer_manager->EFBToScaledYf(1));
|
||||
SetFogParamChanged();
|
||||
|
||||
dirty = true;
|
||||
|
@ -102,8 +103,8 @@ void PixelShaderManager::SetConstants()
|
|||
// so to simplify I use the hi coefficient as K in the shader taking 256 as the scale
|
||||
// TODO: Shouldn't this be EFBToScaledXf?
|
||||
constants.fogf[2] = ScreenSpaceCenter;
|
||||
constants.fogf[3] =
|
||||
static_cast<float>(g_framebuffer_manager->EFBToScaledX(static_cast<int>(2.0f * xfmem.viewport.wd)));
|
||||
constants.fogf[3] = static_cast<float>(
|
||||
g_framebuffer_manager->EFBToScaledX(static_cast<int>(2.0f * xfmem.viewport.wd)));
|
||||
|
||||
for (size_t i = 0, vec_index = 0; i < std::size(bpmem.fogRange.K); i++)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
|
||||
#include "Present.h"
|
||||
#include "VideoCommon/AbstractGfx.h"
|
||||
#include "VideoCommon/FrameDumper.h"
|
||||
#include "VideoCommon/OnScreenUI.h"
|
||||
|
@ -18,7 +19,6 @@
|
|||
#include "VideoCommon/VertexManagerBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/VideoEvents.h"
|
||||
#include "Present.h"
|
||||
|
||||
std::unique_ptr<VideoCommon::Presenter> g_presenter;
|
||||
|
||||
|
@ -67,7 +67,8 @@ bool Presenter::FetchXFB(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_heigh
|
|||
{
|
||||
ReleaseXFBContentLock();
|
||||
|
||||
m_xfb_entry = g_texture_cache->GetXFBTexture(xfb_addr, fb_width, fb_height, fb_stride, &m_xfb_rect);
|
||||
m_xfb_entry =
|
||||
g_texture_cache->GetXFBTexture(xfb_addr, fb_width, fb_height, fb_stride, &m_xfb_rect);
|
||||
bool is_duplicate = m_xfb_entry->id == m_last_xfb_id;
|
||||
|
||||
m_xfb_entry->AcquireContentLock();
|
||||
|
@ -95,7 +96,7 @@ void Presenter::ViSwap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height,
|
|||
}
|
||||
else
|
||||
{
|
||||
present_info.frame_count = m_frame_count - 1; // Previous frame
|
||||
present_info.frame_count = m_frame_count - 1; // Previous frame
|
||||
present_info.reason = PresentInfo::PresentReason::VideoInterfaceDuplicate;
|
||||
}
|
||||
present_info.present_count = m_present_count;
|
||||
|
@ -308,7 +309,7 @@ void Presenter::ResizeSurface()
|
|||
|
||||
void* Presenter::GetNewSurfaceHandle()
|
||||
{
|
||||
void *handle = m_new_surface_handle;
|
||||
void* handle = m_new_surface_handle;
|
||||
m_new_surface_handle = nullptr;
|
||||
return handle;
|
||||
}
|
||||
|
@ -605,11 +606,9 @@ void Presenter::DoState(PointerWrap& p)
|
|||
AfterFrameEvent::Trigger();
|
||||
|
||||
// re-display the most recent XFB
|
||||
ImmediateSwap(m_last_xfb_addr, m_last_xfb_width, m_last_xfb_stride,
|
||||
m_last_xfb_height, m_last_xfb_ticks);
|
||||
ImmediateSwap(m_last_xfb_addr, m_last_xfb_width, m_last_xfb_stride, m_last_xfb_height,
|
||||
m_last_xfb_ticks);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace VideoCommon
|
||||
|
|
|
@ -31,31 +31,32 @@
|
|||
#include "Core/System.h"
|
||||
|
||||
#include "VideoCommon/AbstractGfx.h"
|
||||
#include "VideoCommon/BPFunctions.h"
|
||||
#include "VideoCommon/BPMemory.h"
|
||||
#include "VideoCommon/BoundingBox.h"
|
||||
#include "VideoCommon/BPFunctions.h"
|
||||
#include "VideoCommon/FrameDumper.h"
|
||||
#include "VideoCommon/FramebufferManager.h"
|
||||
#include "VideoCommon/FramebufferManager.h"
|
||||
#include "VideoCommon/PixelEngine.h"
|
||||
#include "VideoCommon/Present.h"
|
||||
#include "VideoCommon/VertexManagerBase.h"
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/XFMemory.h"
|
||||
|
||||
std::unique_ptr<Renderer> g_renderer;
|
||||
|
||||
Renderer::Renderer()
|
||||
: m_prev_efb_format{PixelFormat::INVALID_FMT}
|
||||
Renderer::Renderer() : m_prev_efb_format{PixelFormat::INVALID_FMT}
|
||||
{
|
||||
UpdateWidescreen();
|
||||
|
||||
m_config_changed_handle = ConfigChangedEvent::Register([this](u32 bits) { OnConfigChanged(bits); }, "Renderer");
|
||||
m_config_changed_handle =
|
||||
ConfigChangedEvent::Register([this](u32 bits) { OnConfigChanged(bits); }, "Renderer");
|
||||
|
||||
// VertexManager doesn't maintain statistics in Wii mode.
|
||||
if (!SConfig::GetInstance().bWii)
|
||||
m_update_widescreen_handle = AfterFrameEvent::Register([this] { UpdateWidescreenHeuristic(); }, "WideScreen Heuristic");
|
||||
m_update_widescreen_handle =
|
||||
AfterFrameEvent::Register([this] { UpdateWidescreenHeuristic(); }, "WideScreen Heuristic");
|
||||
}
|
||||
|
||||
Renderer::~Renderer() = default;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// Copyright 2010 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
|
|
@ -46,7 +46,8 @@ bool ShaderCache::Initialize()
|
|||
return false;
|
||||
|
||||
m_async_shader_compiler = g_gfx->CreateAsyncShaderCompiler();
|
||||
m_frame_end_handler = AfterFrameEvent::Register([this] { RetrieveAsyncShaders(); }, "RetreiveAsyncShaders");
|
||||
m_frame_end_handler =
|
||||
AfterFrameEvent::Register([this] { RetrieveAsyncShaders(); }, "RetreiveAsyncShaders");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,17 +18,18 @@
|
|||
|
||||
Statistics g_stats;
|
||||
|
||||
static EventHook s_before_frame_event = BeforeFrameEvent::Register([] {
|
||||
g_stats.ResetFrame();
|
||||
}, "Statistics::ResetFrame");
|
||||
static EventHook s_before_frame_event =
|
||||
BeforeFrameEvent::Register([] { g_stats.ResetFrame(); }, "Statistics::ResetFrame");
|
||||
|
||||
static EventHook s_after_frame_event = AfterFrameEvent::Register([] {
|
||||
DolphinAnalytics::PerformanceSample perf_sample;
|
||||
perf_sample.speed_ratio = SystemTimers::GetEstimatedEmulationPerformance();
|
||||
perf_sample.num_prims = g_stats.this_frame.num_prims + g_stats.this_frame.num_dl_prims;
|
||||
perf_sample.num_draw_calls = g_stats.this_frame.num_draw_calls;
|
||||
DolphinAnalytics::Instance().ReportPerformanceInfo(std::move(perf_sample));
|
||||
}, "Statistics::PerformanceSample");
|
||||
static EventHook s_after_frame_event = AfterFrameEvent::Register(
|
||||
[] {
|
||||
DolphinAnalytics::PerformanceSample perf_sample;
|
||||
perf_sample.speed_ratio = SystemTimers::GetEstimatedEmulationPerformance();
|
||||
perf_sample.num_prims = g_stats.this_frame.num_prims + g_stats.this_frame.num_dl_prims;
|
||||
perf_sample.num_draw_calls = g_stats.this_frame.num_draw_calls;
|
||||
DolphinAnalytics::Instance().ReportPerformanceInfo(std::move(perf_sample));
|
||||
},
|
||||
"Statistics::PerformanceSample");
|
||||
|
||||
static bool clear_scissors;
|
||||
|
||||
|
|
|
@ -773,7 +773,7 @@ void TextureCacheBase::OnFrameEnd()
|
|||
{
|
||||
if (m_force_reload_textures.TestAndClear())
|
||||
{
|
||||
ForceReload();
|
||||
ForceReload();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -920,9 +920,9 @@ RcTcacheEntry TextureCacheBase::DoPartialTextureUpdates(RcTcacheEntry& entry_to_
|
|||
entry_to_update->native_height != entry_to_update->GetHeight() ||
|
||||
entry->native_width != entry->GetWidth() || entry->native_height != entry->GetHeight())
|
||||
{
|
||||
ScaleTextureCacheEntryTo(entry_to_update,
|
||||
g_framebuffer_manager->EFBToScaledX(entry_to_update->native_width),
|
||||
g_framebuffer_manager->EFBToScaledY(entry_to_update->native_height));
|
||||
ScaleTextureCacheEntryTo(
|
||||
entry_to_update, g_framebuffer_manager->EFBToScaledX(entry_to_update->native_width),
|
||||
g_framebuffer_manager->EFBToScaledY(entry_to_update->native_height));
|
||||
ScaleTextureCacheEntryTo(entry, g_framebuffer_manager->EFBToScaledX(entry->native_width),
|
||||
g_framebuffer_manager->EFBToScaledY(entry->native_height));
|
||||
|
||||
|
@ -1957,7 +1957,8 @@ void TextureCacheBase::StitchXFBCopy(RcTcacheEntry& stitched_entry)
|
|||
// copies to be stitched together.
|
||||
if (create_upscaled_copy)
|
||||
{
|
||||
ScaleTextureCacheEntryTo(stitched_entry, g_framebuffer_manager->EFBToScaledX(stitched_entry->native_width),
|
||||
ScaleTextureCacheEntryTo(stitched_entry,
|
||||
g_framebuffer_manager->EFBToScaledX(stitched_entry->native_width),
|
||||
g_framebuffer_manager->EFBToScaledY(stitched_entry->native_height));
|
||||
}
|
||||
|
||||
|
@ -2269,7 +2270,8 @@ void TextureCacheBase::CopyRenderTargetToTexture(
|
|||
// 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.
|
||||
const bool linear_filter =
|
||||
!is_depth_copy && (scaleByHalf || g_framebuffer_manager->GetEFBScale() != 1 || y_scale > 1.0f);
|
||||
!is_depth_copy &&
|
||||
(scaleByHalf || g_framebuffer_manager->GetEFBScale() != 1 || y_scale > 1.0f);
|
||||
|
||||
RcTcacheEntry entry;
|
||||
if (copy_to_vram)
|
||||
|
|
|
@ -104,7 +104,7 @@ VertexManagerBase::~VertexManagerBase() = default;
|
|||
|
||||
bool VertexManagerBase::Initialize()
|
||||
{
|
||||
m_frame_end_event = AfterFrameEvent::Register([this] { OnEndFrame();}, "VertexManagerBase");
|
||||
m_frame_end_event = AfterFrameEvent::Register([this] { OnEndFrame(); }, "VertexManagerBase");
|
||||
m_index_generator.Init();
|
||||
m_cpu_cull.Init();
|
||||
return true;
|
||||
|
@ -562,8 +562,7 @@ void VertexManagerBase::Flush()
|
|||
{
|
||||
bool skip = false;
|
||||
GraphicsModActionData::DrawStarted draw_started{&skip};
|
||||
for (const auto action :
|
||||
g_graphics_mod_manager->GetDrawStartedActions(texture_name))
|
||||
for (const auto action : g_graphics_mod_manager->GetDrawStartedActions(texture_name))
|
||||
{
|
||||
action->OnDrawStarted(&draw_started);
|
||||
}
|
||||
|
|
|
@ -388,16 +388,15 @@ void VertexShaderManager::SetConstants(const std::vector<std::string>& textures)
|
|||
std::vector<GraphicsModAction*> projection_actions;
|
||||
if (g_ActiveConfig.bGraphicMods)
|
||||
{
|
||||
for (const auto action :
|
||||
g_graphics_mod_manager->GetProjectionActions(xfmem.projection.type))
|
||||
for (const auto action : g_graphics_mod_manager->GetProjectionActions(xfmem.projection.type))
|
||||
{
|
||||
projection_actions.push_back(action);
|
||||
}
|
||||
|
||||
for (const auto& texture : textures)
|
||||
{
|
||||
for (const auto action : g_graphics_mod_manager->GetProjectionTextureActions(
|
||||
xfmem.projection.type, texture))
|
||||
for (const auto action :
|
||||
g_graphics_mod_manager->GetProjectionTextureActions(xfmem.projection.type, texture))
|
||||
{
|
||||
projection_actions.push_back(action);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "VideoCommon/GraphicsModSystem/Config/GraphicsMod.h"
|
||||
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.h"
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
#include "VideoCommon/Present.h"
|
||||
#include "VideoCommon/PixelShaderManager.h"
|
||||
#include "VideoCommon/Present.h"
|
||||
#include "VideoCommon/ShaderGenCommon.h"
|
||||
#include "VideoCommon/TextureCacheBase.h"
|
||||
#include "VideoCommon/VertexManagerBase.h"
|
||||
|
@ -355,7 +355,8 @@ void CheckForConfigChanges()
|
|||
// TODO: Move everything else to the ConfigChanged event
|
||||
}
|
||||
|
||||
static EventHook s_check_config_event = AfterFrameEvent::Register([] {
|
||||
CheckForConfigChanges();
|
||||
|
||||
}, "CheckForConfigChanges");
|
||||
static EventHook s_check_config_event = AfterFrameEvent::Register(
|
||||
[] {
|
||||
CheckForConfigChanges();
|
||||
},
|
||||
"CheckForConfigChanges");
|
||||
|
|
|
@ -59,7 +59,6 @@ enum class TriState : int
|
|||
Auto
|
||||
};
|
||||
|
||||
|
||||
// Bitmask containing information about which configuration has changed for the backend.
|
||||
enum ConfigChangeBits : u32
|
||||
{
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "Common/CommonTypes.h"
|
||||
#include "Common/EventHook.h"
|
||||
|
||||
|
||||
// Called when certain video config setting are changed
|
||||
using ConfigChangedEvent = Event<"ConfigChanged", u32>;
|
||||
|
||||
|
@ -21,60 +20,60 @@ using AfterFrameEvent = Event<"AfterFrame">;
|
|||
|
||||
struct PresentInfo
|
||||
{
|
||||
enum class PresentReason
|
||||
{
|
||||
Immediate, // FIFO is Presenting the XFB immediately, straight after the XFB copy
|
||||
VideoInterface, // VideoInterface has triggered a present with a new frame
|
||||
VideoInterfaceDuplicate, // VideoInterface has triggered a present with a duplicate frame
|
||||
};
|
||||
enum class PresentReason
|
||||
{
|
||||
Immediate, // FIFO is Presenting the XFB immediately, straight after the XFB copy
|
||||
VideoInterface, // VideoInterface has triggered a present with a new frame
|
||||
VideoInterfaceDuplicate, // VideoInterface has triggered a present with a duplicate frame
|
||||
};
|
||||
|
||||
// The number of (unique) frames since the emulated console booted
|
||||
u64 frame_count;
|
||||
// The number of (unique) frames since the emulated console booted
|
||||
u64 frame_count;
|
||||
|
||||
// The number of presents since the video backend was initialized.
|
||||
// never goes backwards.
|
||||
u64 present_count;
|
||||
|
||||
// The number of presents since the video backend was initialized.
|
||||
// never goes backwards.
|
||||
u64 present_count;
|
||||
// The frame is identical to the previous frame
|
||||
PresentReason reason;
|
||||
|
||||
// The frame is identical to the previous frame
|
||||
PresentReason reason;
|
||||
// The exact emulated time of the when real hardware would have presented this frame
|
||||
// FIXME: Immediate should predict the timestamp of this present
|
||||
u64 emulated_timestamp;
|
||||
|
||||
// The exact emulated time of the when real hardware would have presented this frame
|
||||
// FIXME: Immediate should predict the timestamp of this present
|
||||
u64 emulated_timestamp;
|
||||
// TODO:
|
||||
// u64 intended_present_time;
|
||||
|
||||
// TODO:
|
||||
// u64 intended_present_time;
|
||||
// AfterPresent only: The actual time the frame was presented
|
||||
u64 actual_present_time = 0;
|
||||
|
||||
// AfterPresent only: The actual time the frame was presented
|
||||
u64 actual_present_time = 0;
|
||||
enum class PresentTimeAccuracy
|
||||
{
|
||||
// The Driver/OS has given us an exact timestamp of when the first line of the frame started
|
||||
// scanning out to the monitor
|
||||
PresentOnScreenExact,
|
||||
|
||||
enum class PresentTimeAccuracy
|
||||
{
|
||||
// The Driver/OS has given us an exact timestamp of when the first line of the frame started
|
||||
// scanning out to the monitor
|
||||
PresentOnScreenExact,
|
||||
// An approximate timestamp of scanout.
|
||||
PresentOnScreen,
|
||||
|
||||
// An approximate timestamp of scanout.
|
||||
PresentOnScreen,
|
||||
// Dolphin doesn't have visibility of the present time. But the present operation has
|
||||
// been queued with the GPU driver and will happen in the near future.
|
||||
PresentInProgress,
|
||||
|
||||
// Dolphin doesn't have visibility of the present time. But the present operation has
|
||||
// been queued with the GPU driver and will happen in the near future.
|
||||
PresentInProgress,
|
||||
// Not implemented
|
||||
Unimplemented,
|
||||
};
|
||||
|
||||
// Not implemented
|
||||
Unimplemented,
|
||||
};
|
||||
|
||||
// Accuracy of actual_present_time
|
||||
PresentTimeAccuracy present_time_accuracy = PresentTimeAccuracy::Unimplemented;
|
||||
// Accuracy of actual_present_time
|
||||
PresentTimeAccuracy present_time_accuracy = PresentTimeAccuracy::Unimplemented;
|
||||
};
|
||||
|
||||
// An event called just as a frame is queued for presentation.
|
||||
// The exact timing of this event depends on the "Immediately Present XFB" option.
|
||||
//
|
||||
// If enabled, this event will trigger immediately after AfterFrame
|
||||
// If disabled, this event won't trigger until the emulated interface starts drawing out a new frame.
|
||||
// If disabled, this event won't trigger until the emulated interface starts drawing out a new
|
||||
// frame.
|
||||
//
|
||||
// frame_count: The number of frames
|
||||
using BeforePresentEvent = Event<"BeforePresent", PresentInfo&>;
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Core/System.h"
|
||||
#include "VideoCommon/BoundingBox.h"
|
||||
#include "VideoCommon/BPMemory.h"
|
||||
#include "VideoCommon/BPStructs.h"
|
||||
#include "VideoCommon/BoundingBox.h"
|
||||
#include "VideoCommon/CPMemory.h"
|
||||
#include "VideoCommon/CommandProcessor.h"
|
||||
#include "VideoCommon/Fifo.h"
|
||||
#include "VideoCommon/FramebufferManager.h"
|
||||
#include "VideoCommon/FrameDumper.h"
|
||||
#include "VideoCommon/FramebufferManager.h"
|
||||
#include "VideoCommon/GeometryShaderManager.h"
|
||||
#include "VideoCommon/PixelEngine.h"
|
||||
#include "VideoCommon/PixelShaderManager.h"
|
||||
|
@ -105,7 +105,6 @@ void VideoCommon_DoState(PointerWrap& p)
|
|||
g_bounding_box->DoState(p);
|
||||
p.DoMarker("Bounding Box");
|
||||
|
||||
|
||||
// Refresh state.
|
||||
if (p.IsReadMode())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue