From cdc6a4628af52a564582988c78b23a1b1198c51f Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Thu, 4 Aug 2022 19:58:28 +0100 Subject: [PATCH] Enable VK uint8 indices feature when supported --- app/src/main/cpp/skyline/gpu.cpp | 3 ++- app/src/main/cpp/skyline/gpu/trait_manager.cpp | 9 +++++++-- app/src/main/cpp/skyline/gpu/trait_manager.h | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu.cpp b/app/src/main/cpp/skyline/gpu.cpp index 922767f4..4009f38e 100644 --- a/app/src/main/cpp/skyline/gpu.cpp +++ b/app/src/main/cpp/skyline/gpu.cpp @@ -234,7 +234,8 @@ namespace skyline::gpu { vk::PhysicalDeviceProvokingVertexFeaturesEXT, vk::PhysicalDevicePrimitiveTopologyListRestartFeaturesEXT, vk::PhysicalDeviceImagelessFramebufferFeatures, - vk::PhysicalDeviceTransformFeedbackFeaturesEXT>()}; + vk::PhysicalDeviceTransformFeedbackFeaturesEXT, + vk::PhysicalDeviceIndexTypeUint8FeaturesEXT>()}; decltype(deviceFeatures2) enabledFeatures2{}; // We only want to enable features we required due to potential overhead from unused features #define FEAT_REQ(structName, feature) \ diff --git a/app/src/main/cpp/skyline/gpu/trait_manager.cpp b/app/src/main/cpp/skyline/gpu/trait_manager.cpp index 60a8b75d..9c47ff67 100644 --- a/app/src/main/cpp/skyline/gpu/trait_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/trait_manager.cpp @@ -6,7 +6,7 @@ namespace skyline::gpu { TraitManager::TraitManager(const DeviceFeatures2 &deviceFeatures2, DeviceFeatures2 &enabledFeatures2, const std::vector &deviceExtensions, std::vector> &enabledExtensions, const DeviceProperties2 &deviceProperties2, const vk::raii::PhysicalDevice &physicalDevice) : quirks(deviceProperties2.get().properties, deviceProperties2.get()) { - bool hasCustomBorderColorExt{}, hasShaderAtomicInt64Ext{}, hasShaderFloat16Int8Ext{}, hasShaderDemoteToHelperExt{}, hasVertexAttributeDivisorExt{}, hasProvokingVertexExt{}, hasPrimitiveTopologyListRestartExt{}, hasImagelessFramebuffersExt{}, hasTransformFeedbackExt{}; + bool hasCustomBorderColorExt{}, hasShaderAtomicInt64Ext{}, hasShaderFloat16Int8Ext{}, hasShaderDemoteToHelperExt{}, hasVertexAttributeDivisorExt{}, hasProvokingVertexExt{}, hasPrimitiveTopologyListRestartExt{}, hasImagelessFramebuffersExt{}, hasTransformFeedbackExt{}, hasUint8IndicesExt{}; bool supportsUniformBufferStandardLayout{}; // We require VK_KHR_uniform_buffer_standard_layout but assume it is implicitly supported even when not present for (auto &extension : deviceExtensions) { @@ -39,7 +39,7 @@ namespace skyline::gpu { std::string_view extensionName{extension.extensionName}; auto extensionVersion{extension.specVersion}; switch (util::Hash(extensionName)) { - EXT_SET("VK_EXT_index_type_uint8", supportsUint8Indices); + EXT_SET("VK_EXT_index_type_uint8", hasUint8IndicesExt); EXT_SET("VK_EXT_sampler_mirror_clamp_to_edge", supportsSamplerMirrorClampToEdge); EXT_SET("VK_EXT_sampler_filter_minmax", supportsSamplerReductionMode); EXT_SET("VK_EXT_custom_border_color", hasCustomBorderColorExt); @@ -78,6 +78,11 @@ namespace skyline::gpu { FEAT_SET(vk::PhysicalDeviceFeatures2, features.shaderInt64, supportsInt64) FEAT_SET(vk::PhysicalDeviceFeatures2, features.shaderStorageImageReadWithoutFormat, supportsImageReadWithoutFormat) + if (hasUint8IndicesExt) + FEAT_SET(vk::PhysicalDeviceIndexTypeUint8FeaturesEXT, indexTypeUint8, supportsUint8Indices) + else + enabledFeatures2.unlink(); + if (hasCustomBorderColorExt) { bool hasCustomBorderColorFeature{}; FEAT_SET(vk::PhysicalDeviceCustomBorderColorFeaturesEXT, customBorderColors, hasCustomBorderColorFeature) diff --git a/app/src/main/cpp/skyline/gpu/trait_manager.h b/app/src/main/cpp/skyline/gpu/trait_manager.h index 7f3fd682..6d4501db 100644 --- a/app/src/main/cpp/skyline/gpu/trait_manager.h +++ b/app/src/main/cpp/skyline/gpu/trait_manager.h @@ -91,7 +91,8 @@ namespace skyline::gpu { vk::PhysicalDeviceProvokingVertexFeaturesEXT, vk::PhysicalDevicePrimitiveTopologyListRestartFeaturesEXT, vk::PhysicalDeviceImagelessFramebufferFeatures, - vk::PhysicalDeviceTransformFeedbackFeaturesEXT>; + vk::PhysicalDeviceTransformFeedbackFeaturesEXT, + vk::PhysicalDeviceIndexTypeUint8FeaturesEXT>; TraitManager(const DeviceFeatures2 &deviceFeatures2, DeviceFeatures2 &enabledFeatures2, const std::vector &deviceExtensions, std::vector> &enabledExtensions, const DeviceProperties2 &deviceProperties2, const vk::raii::PhysicalDevice& physicalDevice);