mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2026-04-27 04:41:45 +00:00
chore: Adjust to new compiler warnings
Some checks failed
(CI) lsfg-vk / build (push) Has been cancelled
(CI/Flatpak) lsfg-vk / flatpak-extensions (23.08) (push) Has been cancelled
(CI/Flatpak) lsfg-vk / flatpak-extensions (24.08) (push) Has been cancelled
(CI/Flatpak) lsfg-vk / flatpak-extensions (25.08) (push) Has been cancelled
(CI/Flatpak) lsfg-vk / flatpak-ui (push) Has been cancelled
Some checks failed
(CI) lsfg-vk / build (push) Has been cancelled
(CI/Flatpak) lsfg-vk / flatpak-extensions (23.08) (push) Has been cancelled
(CI/Flatpak) lsfg-vk / flatpak-extensions (24.08) (push) Has been cancelled
(CI/Flatpak) lsfg-vk / flatpak-extensions (25.08) (push) Has been cancelled
(CI/Flatpak) lsfg-vk / flatpak-ui (push) Has been cancelled
This commit is contained in:
parent
f17e9ce746
commit
218820e8dc
25 changed files with 98 additions and 79 deletions
|
|
@ -1,3 +1,4 @@
|
|||
UseColor: true
|
||||
Checks:
|
||||
# COMMON: Usually, we keep all checks enabled
|
||||
- "bugprone-*"
|
||||
|
|
@ -21,6 +22,9 @@ Checks:
|
|||
- -cppcoreguidelines-avoid-magic-numbers
|
||||
- -cppcoreguidelines-macro-usage
|
||||
- -bugprone-easily-swappable-parameters
|
||||
- -portability-avoid-pragma-once
|
||||
# Vulkan requires the use of reinterpret/const casts in many places
|
||||
- -cppcoreguidelines-pro-type-reinterpret-cast
|
||||
- -cppcoreguidelines-pro-type-const-cast
|
||||
# We use namespace forward declarations
|
||||
- -bugprone-forward-declaration-namespace
|
||||
|
|
|
|||
|
|
@ -20,59 +20,61 @@
|
|||
using namespace lsfgvk;
|
||||
using namespace lsfgvk::backend;
|
||||
|
||||
/// DOS file header
|
||||
struct DOSHeader {
|
||||
uint16_t magic; // 0x5A4D
|
||||
std::array<uint16_t, 29> pad;
|
||||
int32_t pe_offset; // file offset
|
||||
};
|
||||
namespace {
|
||||
/// DOS file header
|
||||
struct DOSHeader {
|
||||
uint16_t magic; // 0x5A4D
|
||||
std::array<uint16_t, 29> pad;
|
||||
int32_t pe_offset; // file offset
|
||||
};
|
||||
|
||||
/// PE header
|
||||
struct PEHeader {
|
||||
uint32_t signature; // "PE\0\0"
|
||||
std::array<uint16_t, 1> pad1;
|
||||
uint16_t sect_count;
|
||||
std::array<uint16_t, 6> pad2;
|
||||
uint16_t opt_hdr_size;
|
||||
std::array<uint16_t, 1> pad3;
|
||||
};
|
||||
/// PE header
|
||||
struct PEHeader {
|
||||
uint32_t signature; // "PE\0\0"
|
||||
std::array<uint16_t, 1> pad1;
|
||||
uint16_t sect_count;
|
||||
std::array<uint16_t, 6> pad2;
|
||||
uint16_t opt_hdr_size;
|
||||
std::array<uint16_t, 1> pad3;
|
||||
};
|
||||
|
||||
/// (partial!) PE optional header
|
||||
struct PEOptionalHeader {
|
||||
uint16_t magic; // 0x20B
|
||||
std::array<uint16_t, 63> pad4;
|
||||
std::pair<uint32_t, uint32_t> resource_table; // file offset/size
|
||||
};
|
||||
/// (partial!) PE optional header
|
||||
struct PEOptionalHeader {
|
||||
uint16_t magic; // 0x20B
|
||||
std::array<uint16_t, 63> pad4;
|
||||
std::pair<uint32_t, uint32_t> resource_table; // file offset/size
|
||||
};
|
||||
|
||||
/// Section header
|
||||
struct SectionHeader {
|
||||
std::array<uint16_t, 4> pad1;
|
||||
uint32_t vsize; // virtual
|
||||
uint32_t vaddress;
|
||||
uint32_t fsize; // raw
|
||||
uint32_t foffset;
|
||||
std::array<uint16_t, 8> pad2;
|
||||
};
|
||||
/// Section header
|
||||
struct SectionHeader {
|
||||
std::array<uint16_t, 4> pad1;
|
||||
uint32_t vsize; // virtual
|
||||
uint32_t vaddress;
|
||||
uint32_t fsize; // raw
|
||||
uint32_t foffset;
|
||||
std::array<uint16_t, 8> pad2;
|
||||
};
|
||||
|
||||
/// Resource directory
|
||||
struct ResourceDirectory {
|
||||
std::array<uint16_t, 6> pad;
|
||||
uint16_t name_count;
|
||||
uint16_t id_count;
|
||||
};
|
||||
/// Resource directory
|
||||
struct ResourceDirectory {
|
||||
std::array<uint16_t, 6> pad;
|
||||
uint16_t name_count;
|
||||
uint16_t id_count;
|
||||
};
|
||||
|
||||
/// Resource directory entry
|
||||
struct ResourceDirectoryEntry {
|
||||
uint32_t id;
|
||||
uint32_t offset; // high bit = directory
|
||||
};
|
||||
/// Resource directory entry
|
||||
struct ResourceDirectoryEntry {
|
||||
uint32_t id;
|
||||
uint32_t offset; // high bit = directory
|
||||
};
|
||||
|
||||
/// Resource data entry
|
||||
struct ResourceDataEntry {
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
std::array<uint32_t, 2> pad;
|
||||
};
|
||||
/// Resource data entry
|
||||
struct ResourceDataEntry {
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
std::array<uint32_t, 2> pad;
|
||||
};
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
|
|
|
|||
|
|
@ -51,22 +51,23 @@ namespace {
|
|||
const uint32_t SpvImageFormatRgba8 = 4;
|
||||
|
||||
for (size_t i = 5; i < words.size();) {
|
||||
const uint32_t& word = words[i];
|
||||
const uint32_t& word = words[i]; // NOLINT ([]-usage)
|
||||
const uint16_t wc = (word >> 16);
|
||||
const uint16_t op = word & 0xFFFF;
|
||||
|
||||
// remove write without format capability
|
||||
if (op == SpvOpCapability && wc >= 2) {
|
||||
uint32_t& cap = words[i + 1];
|
||||
uint32_t& cap = words[i + 1]; // NOLINT ([]-usage)
|
||||
if (cap == SpvCapabilityStorageImageWriteWithoutFormat)
|
||||
cap = SpvCapabilityShader;
|
||||
}
|
||||
|
||||
// patch format in image instructions
|
||||
if (op == SpvOpTypeImage && wc >= 9) {
|
||||
const uint32_t sampled = words[i + 7];
|
||||
const uint32_t sampled = words[i + 7]; // NOLINT ([]-usage)
|
||||
if (sampled == 2)
|
||||
words[i + 8] = hdr ? SpvImageFormatRgba16f : SpvImageFormatRgba8;
|
||||
words[i + 8] = // NOLINT ([]-usage)
|
||||
hdr ? SpvImageFormatRgba16f : SpvImageFormatRgba8;
|
||||
}
|
||||
|
||||
i += wc ? wc : 1;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ ManagedShaderBuilder& ManagedShaderBuilder::sampleds(
|
|||
count = images.size() - offset;
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
this->sampledImages.push_back(std::ref(images[offset + i]));
|
||||
this->sampledImages.push_back(std::ref(images.at(offset + i)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ ManagedShaderBuilder& ManagedShaderBuilder::storages(
|
|||
count = images.size() - offset;
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
this->storageImages.push_back(std::ref(images[offset + i]));
|
||||
this->storageImages.push_back(std::ref(images.at(offset + i)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ Instance::Instance(
|
|||
funcs.GetPhysicalDeviceProperties2(device, &props);
|
||||
|
||||
std::array<char, 256> devname = std::to_array(props.properties.deviceName);
|
||||
devname[255] = '\0'; // ensure null-termination
|
||||
devname.at(255) = '\0'; // ensure null-termination
|
||||
|
||||
if (devicePicker(
|
||||
std::string(devname.data()),
|
||||
|
|
@ -549,7 +549,7 @@ ContextImpl::ContextImpl(const InstanceImpl& instance,
|
|||
cmdbuf.submit(ctx.vk); // wait for completion
|
||||
}
|
||||
|
||||
void Instance::scheduleFrames(Context& context) {
|
||||
void Instance::scheduleFrames(Context& context) { // NOLINT (static)
|
||||
#ifdef LSFGVK_TESTING_RENDERDOC
|
||||
const auto& impl = this->m_impl;
|
||||
if (impl->getRenderDocAPI()) {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void Alpha0::prepare(std::vector<VkImage>& images) const {
|
|||
}
|
||||
|
||||
void Alpha0::render(const vk::Vulkan& vk, const vk::CommandBuffer& cmd) const {
|
||||
this->sets[0].dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets[1].dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets[2].dispatch(vk, cmd, this->dispatchExtent1);
|
||||
this->sets.at(0).dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets.at(1).dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets.at(2).dispatch(vk, cmd, this->dispatchExtent1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,5 +50,5 @@ void Alpha1::prepare(std::vector<VkImage>& images) const {
|
|||
}
|
||||
|
||||
void Alpha1::render(const vk::Vulkan& vk, const vk::CommandBuffer& cmd, size_t idx) const {
|
||||
this->sets[idx % this->sets.size()].dispatch(vk, cmd, dispatchExtent);
|
||||
this->sets.at(idx % this->sets.size()).dispatch(vk, cmd, dispatchExtent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,5 +46,5 @@ void Beta0::prepare(std::vector<VkImage>& images) const {
|
|||
}
|
||||
|
||||
void Beta0::render(const vk::Vulkan& vk, const vk::CommandBuffer& cmd, size_t idx) const {
|
||||
this->sets[idx % this->sets.size()].dispatch(vk, cmd, dispatchExtent);
|
||||
this->sets.at(idx % this->sets.size()).dispatch(vk, cmd, dispatchExtent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ void Beta1::prepare(std::vector<VkImage>& images) const {
|
|||
}
|
||||
|
||||
void Beta1::render(const vk::Vulkan& vk, const vk::CommandBuffer& cmd) const {
|
||||
this->sets[0].dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets[1].dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets[2].dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets[3].dispatch(vk, cmd, this->dispatchExtent1);
|
||||
this->sets.at(0).dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets.at(1).dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets.at(2).dispatch(vk, cmd, this->dispatchExtent0);
|
||||
this->sets.at(3).dispatch(vk, cmd, this->dispatchExtent1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,6 @@ void Delta0::prepare(std::vector<VkImage>& images) const {
|
|||
}
|
||||
|
||||
void Delta0::render(const vk::Vulkan& vk, const vk::CommandBuffer& cmd, size_t idx) const {
|
||||
this->sets0[idx % this->sets0.size()].dispatch(vk, cmd, dispatchExtent);
|
||||
this->sets1[idx % this->sets1.size()].dispatch(vk, cmd, dispatchExtent);
|
||||
this->sets0.at(idx % this->sets0.size()).dispatch(vk, cmd, dispatchExtent);
|
||||
this->sets1.at(idx % this->sets1.size()).dispatch(vk, cmd, dispatchExtent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,5 +49,5 @@ void Gamma0::prepare(std::vector<VkImage>& images) const {
|
|||
}
|
||||
|
||||
void Gamma0::render(const vk::Vulkan& vk, const vk::CommandBuffer& cmd, size_t idx) const {
|
||||
this->sets[idx % this->sets.size()].dispatch(vk, cmd, dispatchExtent);
|
||||
this->sets.at(idx % this->sets.size()).dispatch(vk, cmd, dispatchExtent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,5 +53,5 @@ Generate::Generate(const Ctx& ctx, size_t idx,
|
|||
}
|
||||
|
||||
void Generate::render(const vk::Vulkan& vk, const vk::CommandBuffer& cmd, size_t idx) const {
|
||||
this->sets[idx % 2].dispatch(vk, cmd, this->dispatchExtent);
|
||||
this->sets.at(idx % 2).dispatch(vk, cmd, this->dispatchExtent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,5 +49,5 @@ void Mipmaps::prepare(std::vector<VkImage>& images) const {
|
|||
}
|
||||
|
||||
void Mipmaps::render(const vk::Vulkan& vk, const vk::CommandBuffer& cmd, size_t idx) const {
|
||||
this->sets[idx % 2].dispatch(vk, cmd, this->dispatchExtent);
|
||||
this->sets.at(idx % 2).dispatch(vk, cmd, this->dispatchExtent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
UseColor: true
|
||||
Checks:
|
||||
# COMMON: Usually, we keep all checks enabled
|
||||
- "bugprone-*"
|
||||
|
|
@ -21,5 +22,6 @@ Checks:
|
|||
- -cppcoreguidelines-avoid-magic-numbers
|
||||
- -cppcoreguidelines-macro-usage
|
||||
- -bugprone-easily-swappable-parameters
|
||||
- -portability-avoid-pragma-once
|
||||
# Pointer arithmetic is used plenty for parsing cli arguments
|
||||
- -cppcoreguidelines-pro-bounds-pointer-arithmetic
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ int benchmark::run(const Options& opts) {
|
|||
|
||||
auto& properties = props.properties;
|
||||
std::array<char, 256> devname = std::to_array(properties.deviceName);
|
||||
devname[255] = '\0'; // ensure null-termination
|
||||
devname.at(255) = '\0'; // ensure null-termination
|
||||
|
||||
if (std::string(devname.data()) == *opts.gpu)
|
||||
return device;
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ int debug::run(const Options& opts) {
|
|||
|
||||
auto& properties = props.properties;
|
||||
std::array<char, 256> devname = std::to_array(properties.deviceName);
|
||||
devname[255] = '\0'; // ensure null-termination
|
||||
devname.at(255) = '\0'; // ensure null-termination
|
||||
|
||||
if (std::string(devname.data()) == *opts.gpu)
|
||||
return device;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
UseColor: true
|
||||
Checks:
|
||||
# COMMON: Usually, we keep all checks enabled
|
||||
- "bugprone-*"
|
||||
|
|
@ -21,6 +22,9 @@ Checks:
|
|||
- -cppcoreguidelines-avoid-magic-numbers
|
||||
- -cppcoreguidelines-macro-usage
|
||||
- -bugprone-easily-swappable-parameters
|
||||
- -portability-avoid-pragma-once
|
||||
# Vulkan requires the use of reinterpret/const casts in many places
|
||||
- -cppcoreguidelines-pro-type-reinterpret-cast
|
||||
- -cppcoreguidelines-pro-type-const-cast
|
||||
CheckOptions:
|
||||
cppcoreguidelines-pro-bounds-avoid-unchecked-container-access.ExcludeClasses: '::std::map;::std::unordered_map;::std::flat_map;::toml::table'
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
|
@ -15,11 +16,11 @@ namespace ls {
|
|||
/// optional dll override
|
||||
std::optional<std::string> dll;
|
||||
/// should fp16 be allowed
|
||||
bool allow_fp16;
|
||||
bool allow_fp16{};
|
||||
};
|
||||
|
||||
/// pacing methods
|
||||
enum class Pacing {
|
||||
enum class Pacing : uint8_t {
|
||||
/// do not perform any pacing (vsync+novrr)
|
||||
None
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "config.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
|
@ -23,7 +24,7 @@ namespace ls {
|
|||
};
|
||||
|
||||
/// enum describing which identification method was used
|
||||
enum class IdentType {
|
||||
enum class IdentType : uint8_t {
|
||||
OVERRIDE, // identified by override
|
||||
EXECUTABLE, // identified by executable path
|
||||
WINE_EXECUTABLE, // identified by wine executable path
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ namespace ls {
|
|||
: ptr(ptr), deleter(std::move(deleter)) {}
|
||||
|
||||
/// get reference to owned object
|
||||
T& get() const {
|
||||
[[nodiscard]] T& get() const {
|
||||
assert(ptr != nullptr && "owned_ptr: no object owned");
|
||||
return *ptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ namespace {
|
|||
fi.GetPhysicalDeviceQueueFamilyProperties(physdev, &queueCount, queues.data());
|
||||
|
||||
for (uint32_t i = 0; i < queueCount; ++i) {
|
||||
if ((queues[i].queueFlags & flags) == flags)
|
||||
if ((queues.at(i).queueFlags & flags) == flags)
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
UseColor: true
|
||||
Checks:
|
||||
# COMMON: Usually, we keep all checks enabled
|
||||
- "bugprone-*"
|
||||
|
|
@ -21,6 +22,7 @@ Checks:
|
|||
- -cppcoreguidelines-avoid-magic-numbers
|
||||
- -cppcoreguidelines-macro-usage
|
||||
- -bugprone-easily-swappable-parameters
|
||||
- -portability-avoid-pragma-once
|
||||
# Vulkan requires the use of reinterpret/const casts in many places
|
||||
- -cppcoreguidelines-pro-type-reinterpret-cast
|
||||
- -cppcoreguidelines-pro-type-const-cast
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ void Root::modifySwapchainCreateInfo(const vk::Vulkan& vk, VkSwapchainCreateInfo
|
|||
if (!this->active_profile.has_value())
|
||||
return;
|
||||
|
||||
VkSurfaceCapabilitiesKHR caps{};
|
||||
VkSurfaceCapabilitiesKHR caps{}; // NOLINT (enum value 0)
|
||||
auto res = vk.fi().GetPhysicalDeviceSurfaceCapabilitiesKHR(
|
||||
vk.physdev(), createInfo.surface, &caps);
|
||||
if (res != VK_SUCCESS)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
UseColor: true
|
||||
Checks:
|
||||
# COMMON: Usually, we keep all checks enabled
|
||||
- "bugprone-*"
|
||||
|
|
@ -21,5 +22,6 @@ Checks:
|
|||
- -cppcoreguidelines-avoid-magic-numbers
|
||||
- -cppcoreguidelines-macro-usage
|
||||
- -bugprone-easily-swappable-parameters
|
||||
- -portability-avoid-pragma-once
|
||||
# Qt requires use of raw pointers in many places
|
||||
- -cppcoreguidelines-owning-memory
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace lsfgvk::ui {
|
|||
|
||||
#define VALIDATE_AND_GET_PROFILE(default) \
|
||||
if (!isValidProfileIndex()) return default; \
|
||||
auto& conf = this->m_profiles[static_cast<size_t>(this->m_profile_index)];
|
||||
auto& conf = this->m_profiles.at(static_cast<size_t>(this->m_profile_index));
|
||||
|
||||
[[nodiscard]] bool isValidProfileIndex() const {
|
||||
return this->m_profile_index >= 0 && std::cmp_less(this->m_profile_index, this->m_profiles.size());
|
||||
|
|
@ -131,7 +131,7 @@ namespace lsfgvk::ui {
|
|||
|
||||
#define VALIDATE_AND_GET_PROFILE() \
|
||||
if (!isValidProfileIndex()) return; \
|
||||
auto& conf = this->m_profiles[static_cast<size_t>(this->m_profile_index)];
|
||||
auto& conf = this->m_profiles.at(static_cast<size_t>(this->m_profile_index));
|
||||
|
||||
void multiplierUpdated(size_t multiplier) {
|
||||
VALIDATE_AND_GET_PROFILE()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue