mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 19:44:16 +01:00
Use decltype
over typeof
globally
We inconsistently utilized `typeof` and `decltype` all over the codebase, this has now been fixed by uniformly using `decltype` as `typeof` is a GCC extension and not in the C++ standard alongside having the hidden side effect of removing references from the determined type.
This commit is contained in:
parent
841ee9fc15
commit
32de7e5150
@ -25,7 +25,7 @@ namespace skyline {
|
||||
|
||||
#undef PREF_ELEM
|
||||
|
||||
std::bitset<std::tuple_size_v<typeof(preferences)>> preferencesSet{}; // A bitfield to keep track of all the preferences we've set
|
||||
std::bitset<std::tuple_size_v<decltype(preferences)>> preferencesSet{}; // A bitfield to keep track of all the preferences we've set
|
||||
for (auto element{document.last_child().first_child()}; element; element = element.next_sibling()) {
|
||||
std::string_view name{element.attribute("name").value()};
|
||||
std::apply([&](auto... preferences) {
|
||||
|
@ -119,11 +119,11 @@ namespace skyline::gpu {
|
||||
return std::move(vk::raii::PhysicalDevices(instance).front()); // We just select the first device as we aren't expecting multiple GPUs
|
||||
}
|
||||
|
||||
vk::raii::Device GPU::CreateDevice(const vk::raii::PhysicalDevice &physicalDevice, typeof(vk::DeviceQueueCreateInfo::queueCount) &vkQueueFamilyIndex, QuirkManager &quirks) {
|
||||
vk::raii::Device GPU::CreateDevice(const vk::raii::PhysicalDevice &physicalDevice, decltype(vk::DeviceQueueCreateInfo::queueCount) &vkQueueFamilyIndex, QuirkManager &quirks) {
|
||||
auto properties{physicalDevice.getProperties()};
|
||||
|
||||
auto deviceFeatures2{physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVertexAttributeDivisorFeaturesEXT>()};
|
||||
typeof(deviceFeatures2) enabledFeatures2{}; // We only want to enable features we required due to potential overhead from unused features
|
||||
decltype(deviceFeatures2) enabledFeatures2{}; // We only want to enable features we required due to potential overhead from unused features
|
||||
|
||||
#define FEAT_REQ(structName, feature) \
|
||||
if (deviceFeatures2.get<structName>().feature) \
|
||||
@ -160,7 +160,7 @@ namespace skyline::gpu {
|
||||
auto queueFamilies{physicalDevice.getQueueFamilyProperties()};
|
||||
float queuePriority{1.0f}; //!< The priority of the only queue we use, it's set to the maximum of 1.0
|
||||
vk::DeviceQueueCreateInfo queue{[&] {
|
||||
typeof(vk::DeviceQueueCreateInfo::queueFamilyIndex) index{};
|
||||
decltype(vk::DeviceQueueCreateInfo::queueFamilyIndex) index{};
|
||||
for (const auto &queueFamily : queueFamilies) {
|
||||
if (queueFamily.queueFlags & vk::QueueFlagBits::eGraphics && queueFamily.queueFlags & vk::QueueFlagBits::eCompute) {
|
||||
vkQueueFamilyIndex = index;
|
||||
|
@ -23,7 +23,7 @@ namespace skyline::gpu {
|
||||
|
||||
static vk::raii::PhysicalDevice CreatePhysicalDevice(const vk::raii::Instance &instance);
|
||||
|
||||
static vk::raii::Device CreateDevice(const vk::raii::PhysicalDevice &physicalDevice, typeof(vk::DeviceQueueCreateInfo::queueCount)& queueConfiguration, QuirkManager& quirks);
|
||||
static vk::raii::Device CreateDevice(const vk::raii::PhysicalDevice &physicalDevice, decltype(vk::DeviceQueueCreateInfo::queueCount)& queueConfiguration, QuirkManager& quirks);
|
||||
|
||||
public:
|
||||
static constexpr u32 VkApiVersion{VK_API_VERSION_1_1}; //!< The version of core Vulkan that we require
|
||||
|
@ -33,7 +33,7 @@ namespace skyline::service::nvdrv::core {
|
||||
|
||||
i32 pins{};
|
||||
u32 pinVirtAddress{};
|
||||
std::optional<typeof(std::list<std::shared_ptr<Handle>>::iterator)> unmapQueueEntry{};
|
||||
std::optional<std::list<std::shared_ptr<Handle>>::iterator> unmapQueueEntry{};
|
||||
|
||||
struct Flags {
|
||||
bool mapUncached : 1; //!< If the handle should be mapped as uncached
|
||||
@ -140,4 +140,4 @@ namespace skyline::service::nvdrv::core {
|
||||
*/
|
||||
std::optional<FreeInfo> FreeHandle(Handle::Id handle, bool internalSession);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ namespace skyline::soc::gm20b::engine {
|
||||
registers.raw[method] = argument;
|
||||
|
||||
#define GPFIFO_OFFSET(field) U32_OFFSET(Registers, field)
|
||||
#define GPFIFO_STRUCT_OFFSET(field, member) GPFIFO_OFFSET(field) + U32_OFFSET(typeof(Registers::field), member)
|
||||
#define GPFIFO_STRUCT_OFFSET(field, member) GPFIFO_OFFSET(field) + U32_OFFSET(decltype(Registers::field), member)
|
||||
|
||||
#define GPFIFO_CASE_BASE(fieldName, fieldAccessor, offset, content) case offset: { \
|
||||
auto fieldName{util::BitCast<typeof(registers.fieldAccessor)>(argument)}; \
|
||||
auto fieldName{util::BitCast<decltype(registers.fieldAccessor)>(argument)}; \
|
||||
content \
|
||||
return; \
|
||||
}
|
||||
|
@ -45,21 +45,21 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
|
||||
}
|
||||
|
||||
void Maxwell3D::HandleMethod(u32 method, u32 argument) {
|
||||
#define MAXWELL3D_OFFSET(field) (sizeof(typeof(Registers::field)) - sizeof(typeof(*Registers::field))) / sizeof(u32)
|
||||
#define MAXWELL3D_STRUCT_OFFSET(field, member) MAXWELL3D_OFFSET(field) + U32_OFFSET(typeof(*Registers::field), member)
|
||||
#define MAXWELL3D_ARRAY_OFFSET(field, index) MAXWELL3D_OFFSET(field) + ((sizeof(typeof(Registers::field[0])) / sizeof(u32)) * index)
|
||||
#define MAXWELL3D_ARRAY_STRUCT_OFFSET(field, index, member) MAXWELL3D_ARRAY_OFFSET(field, index) + U32_OFFSET(typeof(Registers::field[0]), member)
|
||||
#define MAXWELL3D_ARRAY_STRUCT_STRUCT_OFFSET(field, index, member, submember) MAXWELL3D_ARRAY_STRUCT_OFFSET(field, index, member) + U32_OFFSET(typeof(Registers::field[0].member), submember)
|
||||
#define MAXWELL3D_OFFSET(field) (sizeof(typeof(Registers::field)) - sizeof(std::remove_reference_t<decltype(*Registers::field)>)) / sizeof(u32)
|
||||
#define MAXWELL3D_STRUCT_OFFSET(field, member) MAXWELL3D_OFFSET(field) + U32_OFFSET(std::remove_reference_t<decltype(*Registers::field)>, member)
|
||||
#define MAXWELL3D_ARRAY_OFFSET(field, index) MAXWELL3D_OFFSET(field) + ((sizeof(std::remove_reference_t<decltype(Registers::field[0])>) / sizeof(u32)) * index)
|
||||
#define MAXWELL3D_ARRAY_STRUCT_OFFSET(field, index, member) MAXWELL3D_ARRAY_OFFSET(field, index) + U32_OFFSET(std::remove_reference_t<decltype(Registers::field[0])>, member)
|
||||
#define MAXWELL3D_ARRAY_STRUCT_STRUCT_OFFSET(field, index, member, submember) MAXWELL3D_ARRAY_STRUCT_OFFSET(field, index, member) + U32_OFFSET(decltype(Registers::field[0].member), submember)
|
||||
|
||||
#define MAXWELL3D_CASE(field, content) case MAXWELL3D_OFFSET(field): { \
|
||||
auto field{util::BitCast<typeof(*registers.field)>(argument)}; \
|
||||
content \
|
||||
return; \
|
||||
#define MAXWELL3D_CASE(field, content) case MAXWELL3D_OFFSET(field): { \
|
||||
auto field{util::BitCast<std::remove_reference_t<decltype(*registers.field)>>(argument)}; \
|
||||
content \
|
||||
return; \
|
||||
}
|
||||
#define MAXWELL3D_CASE_BASE(fieldName, fieldAccessor, offset, content) case offset: { \
|
||||
auto fieldName{util::BitCast<typeof(registers.fieldAccessor)>(argument)}; \
|
||||
content \
|
||||
return; \
|
||||
#define MAXWELL3D_CASE_BASE(fieldName, fieldAccessor, offset, content) case offset: { \
|
||||
auto fieldName{util::BitCast<std::remove_reference_t<decltype(registers.fieldAccessor)>>(argument)}; \
|
||||
content \
|
||||
return; \
|
||||
}
|
||||
#define MAXWELL3D_STRUCT_CASE(field, member, content) MAXWELL3D_CASE_BASE(member, field->member, MAXWELL3D_STRUCT_OFFSET(field, member), content)
|
||||
#define MAXWELL3D_ARRAY_CASE(field, index, content) MAXWELL3D_CASE_BASE(field, field[index], MAXWELL3D_ARRAY_OFFSET(field, index), content)
|
||||
|
Loading…
Reference in New Issue
Block a user