|
|
@ -38,6 +38,9 @@ constexpr std::array Depth16UnormS8_UINT{
|
|
|
|
|
|
|
|
|
|
|
|
constexpr std::array REQUIRED_EXTENSIONS{
|
|
|
|
constexpr std::array REQUIRED_EXTENSIONS{
|
|
|
|
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
|
|
|
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
|
|
|
|
|
|
|
VK_KHR_MAINTENANCE1_EXTENSION_NAME,
|
|
|
|
|
|
|
|
VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME,
|
|
|
|
|
|
|
|
VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME,
|
|
|
|
VK_KHR_16BIT_STORAGE_EXTENSION_NAME,
|
|
|
|
VK_KHR_16BIT_STORAGE_EXTENSION_NAME,
|
|
|
|
VK_KHR_8BIT_STORAGE_EXTENSION_NAME,
|
|
|
|
VK_KHR_8BIT_STORAGE_EXTENSION_NAME,
|
|
|
|
VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME,
|
|
|
|
VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME,
|
|
|
@ -187,10 +190,10 @@ std::unordered_map<VkFormat, VkFormatProperties> GetFormatProperties(
|
|
|
|
|
|
|
|
|
|
|
|
} // Anonymous namespace
|
|
|
|
} // Anonymous namespace
|
|
|
|
|
|
|
|
|
|
|
|
VKDevice::VKDevice(VkInstance instance, vk::PhysicalDevice physical, VkSurfaceKHR surface,
|
|
|
|
VKDevice::VKDevice(VkInstance instance_, u32 instance_version_, vk::PhysicalDevice physical_,
|
|
|
|
const vk::InstanceDispatch& dld)
|
|
|
|
VkSurfaceKHR surface, const vk::InstanceDispatch& dld_)
|
|
|
|
: dld{dld}, physical{physical}, properties{physical.GetProperties()},
|
|
|
|
: dld{dld_}, physical{physical_}, properties{physical.GetProperties()},
|
|
|
|
format_properties{GetFormatProperties(physical, dld)} {
|
|
|
|
instance_version{instance_version_}, format_properties{GetFormatProperties(physical, dld)} {
|
|
|
|
SetupFamilies(surface);
|
|
|
|
SetupFamilies(surface);
|
|
|
|
SetupFeatures();
|
|
|
|
SetupFeatures();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -597,8 +600,16 @@ bool VKDevice::IsSuitable(vk::PhysicalDevice physical, VkSurfaceKHR surface) {
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<const char*> VKDevice::LoadExtensions() {
|
|
|
|
std::vector<const char*> VKDevice::LoadExtensions() {
|
|
|
|
std::vector<const char*> extensions;
|
|
|
|
std::vector<const char*> extensions;
|
|
|
|
const auto Test = [&](const VkExtensionProperties& extension,
|
|
|
|
extensions.reserve(7 + REQUIRED_EXTENSIONS.size());
|
|
|
|
std::optional<std::reference_wrapper<bool>> status, const char* name,
|
|
|
|
extensions.insert(extensions.begin(), REQUIRED_EXTENSIONS.begin(), REQUIRED_EXTENSIONS.end());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool has_khr_shader_float16_int8{};
|
|
|
|
|
|
|
|
bool has_ext_subgroup_size_control{};
|
|
|
|
|
|
|
|
bool has_ext_transform_feedback{};
|
|
|
|
|
|
|
|
bool has_ext_custom_border_color{};
|
|
|
|
|
|
|
|
bool has_ext_extended_dynamic_state{};
|
|
|
|
|
|
|
|
for (const VkExtensionProperties& extension : physical.EnumerateDeviceExtensionProperties()) {
|
|
|
|
|
|
|
|
const auto test = [&](std::optional<std::reference_wrapper<bool>> status, const char* name,
|
|
|
|
bool push) {
|
|
|
|
bool push) {
|
|
|
|
if (extension.extensionName != std::string_view(name)) {
|
|
|
|
if (extension.extensionName != std::string_view(name)) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -610,37 +621,23 @@ std::vector<const char*> VKDevice::LoadExtensions() {
|
|
|
|
status->get() = true;
|
|
|
|
status->get() = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
test(nv_viewport_swizzle, VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME, true);
|
|
|
|
extensions.reserve(7 + REQUIRED_EXTENSIONS.size());
|
|
|
|
test(khr_uniform_buffer_standard_layout,
|
|
|
|
extensions.insert(extensions.begin(), REQUIRED_EXTENSIONS.begin(), REQUIRED_EXTENSIONS.end());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool has_khr_shader_float16_int8{};
|
|
|
|
|
|
|
|
bool has_ext_subgroup_size_control{};
|
|
|
|
|
|
|
|
bool has_ext_transform_feedback{};
|
|
|
|
|
|
|
|
bool has_ext_custom_border_color{};
|
|
|
|
|
|
|
|
bool has_ext_extended_dynamic_state{};
|
|
|
|
|
|
|
|
for (const auto& extension : physical.EnumerateDeviceExtensionProperties()) {
|
|
|
|
|
|
|
|
Test(extension, nv_viewport_swizzle, VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME, true);
|
|
|
|
|
|
|
|
Test(extension, khr_uniform_buffer_standard_layout,
|
|
|
|
|
|
|
|
VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME, true);
|
|
|
|
VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME, true);
|
|
|
|
Test(extension, has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME,
|
|
|
|
test(has_khr_shader_float16_int8, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME, false);
|
|
|
|
false);
|
|
|
|
test(ext_depth_range_unrestricted, VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME, true);
|
|
|
|
Test(extension, ext_depth_range_unrestricted,
|
|
|
|
test(ext_index_type_uint8, VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME, true);
|
|
|
|
VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME, true);
|
|
|
|
test(ext_shader_viewport_index_layer, VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME,
|
|
|
|
Test(extension, ext_index_type_uint8, VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME, true);
|
|
|
|
true);
|
|
|
|
Test(extension, ext_shader_viewport_index_layer,
|
|
|
|
test(has_ext_transform_feedback, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, false);
|
|
|
|
VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME, true);
|
|
|
|
test(has_ext_custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME, false);
|
|
|
|
Test(extension, has_ext_subgroup_size_control, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME,
|
|
|
|
test(has_ext_extended_dynamic_state, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, false);
|
|
|
|
false);
|
|
|
|
if (instance_version >= VK_API_VERSION_1_1) {
|
|
|
|
Test(extension, has_ext_transform_feedback, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME,
|
|
|
|
test(has_ext_subgroup_size_control, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME, false);
|
|
|
|
false);
|
|
|
|
}
|
|
|
|
Test(extension, has_ext_custom_border_color, VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME,
|
|
|
|
|
|
|
|
false);
|
|
|
|
|
|
|
|
Test(extension, has_ext_extended_dynamic_state,
|
|
|
|
|
|
|
|
VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME, false);
|
|
|
|
|
|
|
|
if (Settings::values.renderer_debug) {
|
|
|
|
if (Settings::values.renderer_debug) {
|
|
|
|
Test(extension, nv_device_diagnostics_config,
|
|
|
|
test(nv_device_diagnostics_config, VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME,
|
|
|
|
VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME, true);
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|