Address a bunch of issues detected by clang-tidy

This commit is contained in:
Billy Laws
2021-02-06 12:36:58 +00:00
committed by ◱ Mark
parent 9d5138bef1
commit 48acb6d369
94 changed files with 197 additions and 277 deletions

View File

@ -169,7 +169,7 @@ namespace skyline {
public:
GPFIFO(const DeviceState &state) : Engine(state) {}
void CallMethod(MethodParams params) {
void CallMethod(MethodParams params) override {
state.logger->Debug("Called method in GPFIFO: 0x{:X} args: 0x{:X}", params.method, params.argument);
registers.raw[params.method] = params.argument;

View File

@ -569,7 +569,7 @@ namespace skyline {
*/
void ResetRegs();
void CallMethod(MethodParams params);
void CallMethod(MethodParams params) override;
};
}
}

View File

@ -91,6 +91,8 @@ namespace skyline::gpu {
}
break;
}
default:
throw exception("Unknown MME opcode encountered: 0x{:X}", static_cast<u8>(opcode->operation));
}
if (opcode->exit && (delayedOpcode == nullptr)) {

View File

@ -124,7 +124,7 @@ namespace skyline::gpu::vmm {
u64 MemoryManager::MapFixed(u64 virtAddr, u8 *cpuPtr, u64 size) {
if (!util::IsAligned(virtAddr, constant::GpuPageSize))
return false;
return 0;
size = util::AlignUp(size, constant::GpuPageSize);

View File

@ -29,7 +29,7 @@ namespace skyline {
* @return If the given chunk can be contained wholly within this chunk
*/
inline bool CanContain(const ChunkDescriptor &chunk) {
return (chunk.virtAddr >= this->virtAddr) && ((this->size + this->virtAddr) >= (chunk.size + chunk.virtAddr));
return (chunk.virtAddr >= virtAddr) && ((size + virtAddr) >= (chunk.size + chunk.virtAddr));
}
};

View File

@ -11,7 +11,7 @@ namespace skyline::gpu {
}
std::lock_guard guard(waiterLock);
waiterMap.insert({nextWaiterId, Waiter{threshold, callback}});
waiterMap.emplace(nextWaiterId, Waiter{threshold, callback});
return nextWaiterId++;
}
@ -42,7 +42,7 @@ namespace skyline::gpu {
std::condition_variable cv;
bool flag{};
if (timeout == timeout.max())
if (timeout == std::chrono::steady_clock::duration::max())
timeout = std::chrono::seconds(1);
if (!RegisterWaiter(threshold, [&cv, &mtx, &flag] {
@ -57,5 +57,5 @@ namespace skyline::gpu {
std::unique_lock lock(mtx);
return cv.wait_for(lock, timeout, [&flag] { return flag; });
}
};
}

View File

@ -9,15 +9,15 @@
namespace skyline::gpu {
GuestTexture::GuestTexture(const DeviceState &state, u8 *pointer, texture::Dimensions dimensions, texture::Format format, texture::TileMode tiling, texture::TileConfig layout) : state(state), pointer(pointer), dimensions(dimensions), format(format), tileMode(tiling), tileConfig(layout) {}
std::shared_ptr<Texture> GuestTexture::InitializeTexture(std::optional<texture::Format> format, std::optional<texture::Dimensions> dimensions, texture::Swizzle swizzle) {
std::shared_ptr<Texture> GuestTexture::InitializeTexture(std::optional<texture::Format> pFormat, std::optional<texture::Dimensions> pDimensions, texture::Swizzle swizzle) {
if (!host.expired())
throw exception("Trying to create multiple Texture objects from a single GuestTexture");
auto sharedHost{std::make_shared<Texture>(state, shared_from_this(), dimensions ? *dimensions : this->dimensions, format ? *format : this->format, swizzle)};
auto sharedHost{std::make_shared<Texture>(state, shared_from_this(), pDimensions ? *pDimensions : dimensions, pFormat ? *pFormat : format, swizzle)};
host = sharedHost;
return sharedHost;
}
Texture::Texture(const DeviceState &state, std::shared_ptr<GuestTexture> guest, texture::Dimensions dimensions, texture::Format format, texture::Swizzle swizzle) : state(state), guest(guest), dimensions(dimensions), format(format), swizzle(swizzle) {
Texture::Texture(const DeviceState &state, std::shared_ptr<GuestTexture> guest, texture::Dimensions dimensions, texture::Format format, texture::Swizzle swizzle) : state(state), guest(std::move(guest)), dimensions(dimensions), format(format), swizzle(swizzle) {
SynchronizeHost();
}
@ -25,7 +25,7 @@ namespace skyline::gpu {
auto pointer{guest->pointer};
auto size{format.GetSize(dimensions)};
backing.resize(size);
auto output{reinterpret_cast<u8 *>(backing.data())};
auto output{backing.data()};
if (guest->tileMode == texture::TileMode::Block) {
// Reference on Block-linear tiling: https://gist.github.com/PixelyIon/d9c35050af0ef5690566ca9f0965bc32