Lint fixes

This commit is contained in:
Scott Mansell
2023-01-31 17:29:16 +13:00
parent 11de923dcb
commit 31cfe8250d
39 changed files with 219 additions and 235 deletions

View File

@ -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;

View File

@ -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])};
}

View File

@ -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;