Fix a few nits

This commit is contained in:
Charles Giessen 2021-08-09 01:05:11 -06:00 committed by Charles Giessen
parent 0408041547
commit 8922a41bd4
2 changed files with 16 additions and 16 deletions

View File

@ -205,7 +205,7 @@ auto get_vector(std::vector<T>& out, F&& f, Ts&&... ts) -> VkResult {
VkResult err;
do {
err = f(ts..., &count, nullptr);
if (err) {
if (err != VK_SUCCESS) {
return err;
};
out.resize(count);
@ -229,13 +229,13 @@ auto get_vector_noerror(F&& f, Ts&&... ts) -> std::vector<T> {
const char* to_string_message_severity(VkDebugUtilsMessageSeverityFlagBitsEXT s) {
switch (s) {
case VkDebugUtilsMessageSeverityFlagBitsEXT::VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
return "VERBOSE";
case VkDebugUtilsMessageSeverityFlagBitsEXT::VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT:
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT:
return "ERROR";
case VkDebugUtilsMessageSeverityFlagBitsEXT::VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
return "WARNING";
case VkDebugUtilsMessageSeverityFlagBitsEXT::VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
return "INFO";
default:
return "UNKNOWN";
@ -1111,7 +1111,7 @@ PhysicalDeviceSelector::Suitable PhysicalDeviceSelector::is_device_suitable(Phys
bool has_required_memory = false;
bool has_preferred_memory = false;
for (uint32_t i = 0; i < pd.mem_properties.memoryHeapCount; i++) {
if (pd.mem_properties.memoryHeaps[i].flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) {
if (pd.mem_properties.memoryHeaps[i].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) {
if (pd.mem_properties.memoryHeaps[i].size > criteria.required_mem_size) {
has_required_memory = true;
}
@ -1141,7 +1141,8 @@ detail::Result<PhysicalDevice> PhysicalDeviceSelector::select() const {
#if !defined(NDEBUG)
// Validation
for (const auto& node : criteria.extended_features_chain) {
assert(node.sType != 0 && "Features struct sType must be filled with the struct's "
assert(node.sType != static_cast<VkStructureType>(0) &&
"Features struct sType must be filled with the struct's "
"corresponding VkStructureType enum");
assert(
node.sType != VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 &&

View File

@ -121,8 +121,7 @@ struct GenericFeaturesPNextNode {
GenericFeaturesPNextNode();
template <typename T>
GenericFeaturesPNextNode(T const& features) noexcept {
template <typename T> GenericFeaturesPNextNode(T const& features) noexcept {
*reinterpret_cast<T*>(this) = features;
}
@ -349,7 +348,7 @@ class InstanceBuilder {
// VkInstanceCreateInfo
std::vector<const char*> layers;
std::vector<const char*> extensions;
VkInstanceCreateFlags flags = 0;
VkInstanceCreateFlags flags = static_cast<VkInstanceCreateFlags>(0);
std::vector<VkBaseOutStructure*> pNext_elements;
// debug callback - use the default so it is not nullptr
@ -640,7 +639,7 @@ class DeviceBuilder {
private:
PhysicalDevice physical_device;
struct DeviceInfo {
VkDeviceCreateFlags flags = 0;
VkDeviceCreateFlags flags = static_cast<VkDeviceCreateFlags>(0);
std::vector<VkBaseOutStructure*> pNext_chain;
std::vector<CustomQueueDescription> queue_descriptions;
VkAllocationCallbacks* allocation_callbacks = VK_NULL_HANDLE;