mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-25 22:05:42 +01:00
vulkan_common: clean up extension usage
This commit is contained in:
parent
ea56d8f388
commit
18831e0933
2
externals/Vulkan-Headers
vendored
2
externals/Vulkan-Headers
vendored
@ -1 +1 @@
|
||||
Subproject commit 33d4dd987fc8fc6475ff9ca2b4f0c3cc6e793337
|
||||
Subproject commit 2826791bed6a793f164bf534cd859968f13df8a9
|
@ -58,7 +58,7 @@ VkSamplerAddressMode WrapMode(const Device& device, Tegra::Texture::WrapMode wra
|
||||
case Tegra::Texture::WrapMode::Border:
|
||||
return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER;
|
||||
case Tegra::Texture::WrapMode::Clamp:
|
||||
if (device.GetDriverID() == VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR) {
|
||||
if (device.GetDriverID() == VK_DRIVER_ID_NVIDIA_PROPRIETARY) {
|
||||
// Nvidia's Vulkan driver defaults to GL_CLAMP on invalid enumerations, we can hack this
|
||||
// by sending an invalid enumeration.
|
||||
return static_cast<VkSamplerAddressMode>(0xcafe);
|
||||
|
@ -129,7 +129,7 @@ private:
|
||||
const Device* device{};
|
||||
bool is_compute{};
|
||||
boost::container::small_vector<VkDescriptorSetLayoutBinding, 32> bindings;
|
||||
boost::container::small_vector<VkDescriptorUpdateTemplateEntryKHR, 32> entries;
|
||||
boost::container::small_vector<VkDescriptorUpdateTemplateEntry, 32> entries;
|
||||
u32 binding{};
|
||||
u32 num_descriptors{};
|
||||
size_t offset{};
|
||||
|
@ -45,14 +45,14 @@ std::string GetDriverVersion(const Device& device) {
|
||||
// https://github.com/SaschaWillems/vulkan.gpuinfo.org/blob/5dddea46ea1120b0df14eef8f15ff8e318e35462/functions.php#L308-L314
|
||||
const u32 version = device.GetDriverVersion();
|
||||
|
||||
if (device.GetDriverID() == VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR) {
|
||||
if (device.GetDriverID() == VK_DRIVER_ID_NVIDIA_PROPRIETARY) {
|
||||
const u32 major = (version >> 22) & 0x3ff;
|
||||
const u32 minor = (version >> 14) & 0x0ff;
|
||||
const u32 secondary = (version >> 6) & 0x0ff;
|
||||
const u32 tertiary = version & 0x003f;
|
||||
return fmt::format("{}.{}.{}.{}", major, minor, secondary, tertiary);
|
||||
}
|
||||
if (device.GetDriverID() == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR) {
|
||||
if (device.GetDriverID() == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS) {
|
||||
const u32 major = version >> 14;
|
||||
const u32 minor = version & 0x3fff;
|
||||
return fmt::format("{}.{}", major, minor);
|
||||
|
@ -53,7 +53,7 @@ ComputePipeline::ComputePipeline(const Device& device_, DescriptorPool& descript
|
||||
.requiredSubgroupSize = GuestWarpSize,
|
||||
};
|
||||
VkPipelineCreateFlags flags{};
|
||||
if (device.IsKhrPipelineEexecutablePropertiesEnabled()) {
|
||||
if (device.IsKhrPipelineExecutablePropertiesEnabled()) {
|
||||
flags |= VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR;
|
||||
}
|
||||
pipeline = device.GetLogical().CreateComputePipeline({
|
||||
|
@ -830,7 +830,7 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) {
|
||||
*/
|
||||
}
|
||||
VkPipelineCreateFlags flags{};
|
||||
if (device.IsKhrPipelineEexecutablePropertiesEnabled()) {
|
||||
if (device.IsKhrPipelineExecutablePropertiesEnabled()) {
|
||||
flags |= VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR;
|
||||
}
|
||||
pipeline = device.GetLogical().CreateGraphicsPipeline({
|
||||
|
@ -11,10 +11,10 @@
|
||||
namespace Vulkan {
|
||||
|
||||
MasterSemaphore::MasterSemaphore(const Device& device) {
|
||||
static constexpr VkSemaphoreTypeCreateInfoKHR semaphore_type_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO_KHR,
|
||||
static constexpr VkSemaphoreTypeCreateInfo semaphore_type_ci{
|
||||
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE_KHR,
|
||||
.semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE,
|
||||
.initialValue = 0,
|
||||
};
|
||||
static constexpr VkSemaphoreCreateInfo semaphore_ci{
|
||||
@ -28,7 +28,7 @@ MasterSemaphore::MasterSemaphore(const Device& device) {
|
||||
return;
|
||||
}
|
||||
// Validation layers have a bug where they fail to track resource usage when using timeline
|
||||
// semaphores and synchronizing with GetSemaphoreCounterValueKHR. To workaround this issue, have
|
||||
// semaphores and synchronizing with GetSemaphoreCounterValue. To workaround this issue, have
|
||||
// a separate thread waiting for each timeline semaphore value.
|
||||
debug_thread = std::jthread([this](std::stop_token stop_token) {
|
||||
u64 counter = 0;
|
||||
|
@ -287,7 +287,7 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device
|
||||
workers(std::max(std::thread::hardware_concurrency(), 2U) - 1, "VkPipelineBuilder"),
|
||||
serialization_thread(1, "VkPipelineSerialization") {
|
||||
const auto& float_control{device.FloatControlProperties()};
|
||||
const VkDriverIdKHR driver_id{device.GetDriverID()};
|
||||
const VkDriverId driver_id{device.GetDriverID()};
|
||||
profile = Shader::Profile{
|
||||
.supported_spirv = device.SupportedSpirvVersion(),
|
||||
.unified_descriptor_binding = true,
|
||||
@ -297,10 +297,10 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device
|
||||
.support_int64 = device.IsShaderInt64Supported(),
|
||||
.support_vertex_instance_id = false,
|
||||
.support_float_controls = true,
|
||||
.support_separate_denorm_behavior = float_control.denormBehaviorIndependence ==
|
||||
VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR,
|
||||
.support_separate_denorm_behavior =
|
||||
float_control.denormBehaviorIndependence == VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL,
|
||||
.support_separate_rounding_mode =
|
||||
float_control.roundingModeIndependence == VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR,
|
||||
float_control.roundingModeIndependence == VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL,
|
||||
.support_fp16_denorm_preserve = float_control.shaderDenormPreserveFloat16 != VK_FALSE,
|
||||
.support_fp32_denorm_preserve = float_control.shaderDenormPreserveFloat32 != VK_FALSE,
|
||||
.support_fp16_denorm_flush = float_control.shaderDenormFlushToZeroFloat16 != VK_FALSE,
|
||||
@ -327,17 +327,17 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device
|
||||
.lower_left_origin_mode = false,
|
||||
.need_declared_frag_colors = false,
|
||||
|
||||
.has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR,
|
||||
.has_broken_spirv_clamp = driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS,
|
||||
.has_broken_unsigned_image_offsets = false,
|
||||
.has_broken_signed_operations = false,
|
||||
.has_broken_fp16_float_controls = driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR,
|
||||
.has_broken_fp16_float_controls = driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY,
|
||||
.ignore_nan_fp_comparisons = false,
|
||||
};
|
||||
host_info = Shader::HostTranslateInfo{
|
||||
.support_float16 = device.IsFloat16Supported(),
|
||||
.support_int64 = device.IsShaderInt64Supported(),
|
||||
.needs_demote_reorder = driver_id == VK_DRIVER_ID_AMD_PROPRIETARY_KHR ||
|
||||
driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR,
|
||||
.needs_demote_reorder =
|
||||
driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE,
|
||||
.support_snorm_render_buffer = true,
|
||||
.support_viewport_index_layer = device.IsExtShaderViewportIndexLayerSupported(),
|
||||
};
|
||||
@ -408,7 +408,7 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading
|
||||
std::unique_ptr<PipelineStatistics> statistics;
|
||||
} state;
|
||||
|
||||
if (device.IsKhrPipelineEexecutablePropertiesEnabled()) {
|
||||
if (device.IsKhrPipelineExecutablePropertiesEnabled()) {
|
||||
state.statistics = std::make_unique<PipelineStatistics>(device);
|
||||
}
|
||||
const auto load_compute{[&](std::ifstream& file, FileEnvironment env) {
|
||||
|
@ -194,8 +194,8 @@ void Scheduler::SubmitExecution(VkSemaphore signal_semaphore, VkSemaphore wait_s
|
||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
};
|
||||
|
||||
const VkTimelineSemaphoreSubmitInfoKHR timeline_si{
|
||||
.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR,
|
||||
const VkTimelineSemaphoreSubmitInfo timeline_si{
|
||||
.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO,
|
||||
.pNext = nullptr,
|
||||
.waitSemaphoreValueCount = num_wait_semaphores,
|
||||
.pWaitSemaphoreValues = wait_values.data(),
|
||||
|
@ -305,10 +305,10 @@ NvidiaArchitecture GetNvidiaArchitecture(vk::PhysicalDevice physical,
|
||||
VkPhysicalDeviceFragmentShadingRatePropertiesKHR shading_rate_props{};
|
||||
shading_rate_props.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR;
|
||||
VkPhysicalDeviceProperties2KHR physical_properties{};
|
||||
physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
|
||||
VkPhysicalDeviceProperties2 physical_properties{};
|
||||
physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||
physical_properties.pNext = &shading_rate_props;
|
||||
physical.GetProperties2KHR(physical_properties);
|
||||
physical.GetProperties2(physical_properties);
|
||||
if (shading_rate_props.primitiveFragmentShadingRateWithMultipleViewports) {
|
||||
// Only Ampere and newer support this feature
|
||||
return NvidiaArchitecture::AmpereOrNewer;
|
||||
@ -416,8 +416,8 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
};
|
||||
SetNext(next, bit16_storage);
|
||||
|
||||
VkPhysicalDevice8BitStorageFeaturesKHR bit8_storage{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR,
|
||||
VkPhysicalDevice8BitStorageFeatures bit8_storage{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES,
|
||||
.pNext = nullptr,
|
||||
.storageBuffer8BitAccess = false,
|
||||
.uniformAndStorageBuffer8BitAccess = true,
|
||||
@ -441,8 +441,8 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
};
|
||||
SetNext(next, host_query_reset);
|
||||
|
||||
VkPhysicalDeviceVariablePointerFeaturesKHR variable_pointers{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR,
|
||||
VkPhysicalDeviceVariablePointerFeatures variable_pointers{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES,
|
||||
.pNext = nullptr,
|
||||
.variablePointersStorageBuffer = VK_TRUE,
|
||||
.variablePointers = VK_TRUE,
|
||||
@ -456,10 +456,10 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
};
|
||||
SetNext(next, demote);
|
||||
|
||||
VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8;
|
||||
VkPhysicalDeviceShaderFloat16Int8Features float16_int8;
|
||||
if (is_int8_supported || is_float16_supported) {
|
||||
float16_int8 = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR,
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES,
|
||||
.pNext = nullptr,
|
||||
.shaderFloat16 = is_float16_supported,
|
||||
.shaderInt8 = is_int8_supported,
|
||||
@ -485,10 +485,10 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
LOG_INFO(Render_Vulkan, "Device doesn't support passthrough geometry shaders");
|
||||
}
|
||||
|
||||
VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR std430_layout;
|
||||
VkPhysicalDeviceUniformBufferStandardLayoutFeatures std430_layout;
|
||||
if (khr_uniform_buffer_standard_layout) {
|
||||
std430_layout = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR,
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES,
|
||||
.pNext = nullptr,
|
||||
.uniformBufferStandardLayout = true,
|
||||
};
|
||||
@ -606,10 +606,10 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||
LOG_INFO(Render_Vulkan, "Device doesn't support vertex input dynamic state");
|
||||
}
|
||||
|
||||
VkPhysicalDeviceShaderAtomicInt64FeaturesKHR atomic_int64;
|
||||
VkPhysicalDeviceShaderAtomicInt64Features atomic_int64;
|
||||
if (ext_shader_atomic_int64) {
|
||||
atomic_int64 = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR,
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES,
|
||||
.pNext = nullptr,
|
||||
.shaderBufferInt64Atomics = VK_TRUE,
|
||||
.shaderSharedInt64Atomics = VK_TRUE,
|
||||
@ -965,8 +965,8 @@ void Device::CheckSuitability(bool requires_swapchain) const {
|
||||
demote.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES;
|
||||
demote.pNext = nullptr;
|
||||
|
||||
VkPhysicalDeviceVariablePointerFeaturesKHR variable_pointers{};
|
||||
variable_pointers.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR;
|
||||
VkPhysicalDeviceVariablePointerFeatures variable_pointers{};
|
||||
variable_pointers.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES;
|
||||
variable_pointers.pNext = &demote;
|
||||
|
||||
VkPhysicalDeviceRobustness2FeaturesEXT robustness2{};
|
||||
@ -989,11 +989,11 @@ void Device::CheckSuitability(bool requires_swapchain) const {
|
||||
host_query_reset.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES;
|
||||
host_query_reset.pNext = &bit8_storage;
|
||||
|
||||
VkPhysicalDeviceFeatures2KHR features2{};
|
||||
VkPhysicalDeviceFeatures2 features2{};
|
||||
features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
|
||||
features2.pNext = &host_query_reset;
|
||||
|
||||
physical.GetFeatures2KHR(features2);
|
||||
physical.GetFeatures2(features2);
|
||||
|
||||
const VkPhysicalDeviceFeatures& features{features2.features};
|
||||
std::array feature_report{
|
||||
@ -1126,37 +1126,37 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME, false);
|
||||
}
|
||||
}
|
||||
VkPhysicalDeviceFeatures2KHR features{};
|
||||
features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR;
|
||||
VkPhysicalDeviceFeatures2 features{};
|
||||
features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
|
||||
|
||||
VkPhysicalDeviceProperties2KHR physical_properties{};
|
||||
physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
|
||||
VkPhysicalDeviceProperties2 physical_properties{};
|
||||
physical_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||
|
||||
if (has_khr_shader_float16_int8) {
|
||||
VkPhysicalDeviceFloat16Int8FeaturesKHR float16_int8_features;
|
||||
float16_int8_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR;
|
||||
VkPhysicalDeviceShaderFloat16Int8Features float16_int8_features;
|
||||
float16_int8_features.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES;
|
||||
float16_int8_features.pNext = nullptr;
|
||||
features.pNext = &float16_int8_features;
|
||||
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
is_float16_supported = float16_int8_features.shaderFloat16;
|
||||
is_int8_supported = float16_int8_features.shaderInt8;
|
||||
extensions.push_back(VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME);
|
||||
}
|
||||
if (has_ext_subgroup_size_control) {
|
||||
VkPhysicalDeviceSubgroupSizeControlFeaturesEXT subgroup_features;
|
||||
subgroup_features.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT;
|
||||
VkPhysicalDeviceSubgroupSizeControlFeatures subgroup_features;
|
||||
subgroup_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES;
|
||||
subgroup_features.pNext = nullptr;
|
||||
features.pNext = &subgroup_features;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
VkPhysicalDeviceSubgroupSizeControlPropertiesEXT subgroup_properties;
|
||||
VkPhysicalDeviceSubgroupSizeControlProperties subgroup_properties;
|
||||
subgroup_properties.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT;
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES;
|
||||
subgroup_properties.pNext = nullptr;
|
||||
physical_properties.pNext = &subgroup_properties;
|
||||
physical.GetProperties2KHR(physical_properties);
|
||||
physical.GetProperties2(physical_properties);
|
||||
|
||||
is_warp_potentially_bigger = subgroup_properties.maxSubgroupSize > GuestWarpSize;
|
||||
|
||||
@ -1175,7 +1175,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
provoking_vertex.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT;
|
||||
provoking_vertex.pNext = nullptr;
|
||||
features.pNext = &provoking_vertex;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
if (provoking_vertex.provokingVertexLast &&
|
||||
provoking_vertex.transformFeedbackPreservesProvokingVertex) {
|
||||
@ -1189,7 +1189,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT;
|
||||
vertex_input.pNext = nullptr;
|
||||
features.pNext = &vertex_input;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
if (vertex_input.vertexInputDynamicState) {
|
||||
extensions.push_back(VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME);
|
||||
@ -1201,7 +1201,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
atomic_int64.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES;
|
||||
atomic_int64.pNext = nullptr;
|
||||
features.pNext = &atomic_int64;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
if (atomic_int64.shaderBufferInt64Atomics && atomic_int64.shaderSharedInt64Atomics) {
|
||||
extensions.push_back(VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME);
|
||||
@ -1213,13 +1213,13 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
tfb_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT;
|
||||
tfb_features.pNext = nullptr;
|
||||
features.pNext = &tfb_features;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
VkPhysicalDeviceTransformFeedbackPropertiesEXT tfb_properties;
|
||||
tfb_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT;
|
||||
tfb_properties.pNext = nullptr;
|
||||
physical_properties.pNext = &tfb_properties;
|
||||
physical.GetProperties2KHR(physical_properties);
|
||||
physical.GetProperties2(physical_properties);
|
||||
|
||||
if (tfb_features.transformFeedback && tfb_features.geometryStreams &&
|
||||
tfb_properties.maxTransformFeedbackStreams >= 4 &&
|
||||
@ -1234,7 +1234,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
border_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT;
|
||||
border_features.pNext = nullptr;
|
||||
features.pNext = &border_features;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
if (border_features.customBorderColors && border_features.customBorderColorWithoutFormat) {
|
||||
extensions.push_back(VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME);
|
||||
@ -1247,7 +1247,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT;
|
||||
extended_dynamic_state.pNext = nullptr;
|
||||
features.pNext = &extended_dynamic_state;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
if (extended_dynamic_state.extendedDynamicState) {
|
||||
extensions.push_back(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
|
||||
@ -1259,7 +1259,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
line_raster.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT;
|
||||
line_raster.pNext = nullptr;
|
||||
features.pNext = &line_raster;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
if (line_raster.rectangularLines && line_raster.smoothLines) {
|
||||
extensions.push_back(VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME);
|
||||
ext_line_rasterization = true;
|
||||
@ -1271,7 +1271,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR;
|
||||
layout.pNext = nullptr;
|
||||
features.pNext = &layout;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
if (layout.workgroupMemoryExplicitLayout &&
|
||||
layout.workgroupMemoryExplicitLayout8BitAccess &&
|
||||
@ -1287,7 +1287,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR;
|
||||
executable_properties.pNext = nullptr;
|
||||
features.pNext = &executable_properties;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
if (executable_properties.pipelineExecutableInfo) {
|
||||
extensions.push_back(VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME);
|
||||
@ -1300,7 +1300,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT;
|
||||
primitive_topology_list_restart.pNext = nullptr;
|
||||
features.pNext = &primitive_topology_list_restart;
|
||||
physical.GetFeatures2KHR(features);
|
||||
physical.GetFeatures2(features);
|
||||
|
||||
is_topology_list_restart_supported =
|
||||
primitive_topology_list_restart.primitiveTopologyListRestart;
|
||||
@ -1318,7 +1318,7 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
|
||||
push_descriptor.pNext = nullptr;
|
||||
|
||||
physical_properties.pNext = &push_descriptor;
|
||||
physical.GetProperties2KHR(physical_properties);
|
||||
physical.GetProperties2(physical_properties);
|
||||
|
||||
max_push_descriptors = push_descriptor.maxPushDescriptors;
|
||||
}
|
||||
@ -1369,18 +1369,18 @@ void Device::SetupFeatures() {
|
||||
}
|
||||
|
||||
void Device::SetupProperties() {
|
||||
float_controls.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR;
|
||||
float_controls.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES;
|
||||
|
||||
VkPhysicalDeviceProperties2KHR properties2{};
|
||||
properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
|
||||
properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||
properties2.pNext = &float_controls;
|
||||
|
||||
physical.GetProperties2KHR(properties2);
|
||||
physical.GetProperties2(properties2);
|
||||
}
|
||||
|
||||
void Device::CollectTelemetryParameters() {
|
||||
VkPhysicalDeviceDriverPropertiesKHR driver{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR,
|
||||
VkPhysicalDeviceDriverProperties driver{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES,
|
||||
.pNext = nullptr,
|
||||
.driverID = {},
|
||||
.driverName = {},
|
||||
@ -1388,12 +1388,12 @@ void Device::CollectTelemetryParameters() {
|
||||
.conformanceVersion = {},
|
||||
};
|
||||
|
||||
VkPhysicalDeviceProperties2KHR device_properties{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR,
|
||||
VkPhysicalDeviceProperties2 device_properties{
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
|
||||
.pNext = &driver,
|
||||
.properties = {},
|
||||
};
|
||||
physical.GetProperties2KHR(device_properties);
|
||||
physical.GetProperties2(device_properties);
|
||||
|
||||
driver_id = driver.driverID;
|
||||
vendor_name = driver.driverName;
|
||||
@ -1449,23 +1449,10 @@ void Device::CollectToolingInfo() {
|
||||
if (!ext_tooling_info) {
|
||||
return;
|
||||
}
|
||||
const auto vkGetPhysicalDeviceToolPropertiesEXT =
|
||||
reinterpret_cast<PFN_vkGetPhysicalDeviceToolPropertiesEXT>(
|
||||
dld.vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceToolPropertiesEXT"));
|
||||
if (!vkGetPhysicalDeviceToolPropertiesEXT) {
|
||||
return;
|
||||
}
|
||||
u32 tool_count = 0;
|
||||
if (vkGetPhysicalDeviceToolPropertiesEXT(physical, &tool_count, nullptr) != VK_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
std::vector<VkPhysicalDeviceToolPropertiesEXT> tools(tool_count);
|
||||
if (vkGetPhysicalDeviceToolPropertiesEXT(physical, &tool_count, tools.data()) != VK_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
for (const VkPhysicalDeviceToolPropertiesEXT& tool : tools) {
|
||||
auto tools{physical.GetPhysicalDeviceToolProperties()};
|
||||
for (const VkPhysicalDeviceToolProperties& tool : tools) {
|
||||
const std::string_view name = tool.name;
|
||||
LOG_INFO(Render_Vulkan, "{}", name);
|
||||
LOG_INFO(Render_Vulkan, "Attached debugging tool: {}", name);
|
||||
has_renderdoc = has_renderdoc || name == "RenderDoc";
|
||||
has_nsight_graphics = has_nsight_graphics || name == "NVIDIA Nsight Graphics";
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public:
|
||||
}
|
||||
|
||||
/// Returns true if VK_KHR_pipeline_executable_properties is enabled.
|
||||
bool IsKhrPipelineEexecutablePropertiesEnabled() const {
|
||||
bool IsKhrPipelineExecutablePropertiesEnabled() const {
|
||||
return khr_pipeline_executable_properties;
|
||||
}
|
||||
|
||||
|
@ -235,12 +235,13 @@ bool Load(VkInstance instance, InstanceDispatch& dld) noexcept {
|
||||
X(vkCreateDebugUtilsMessengerEXT);
|
||||
X(vkDestroyDebugUtilsMessengerEXT);
|
||||
X(vkDestroySurfaceKHR);
|
||||
X(vkGetPhysicalDeviceFeatures2KHR);
|
||||
X(vkGetPhysicalDeviceProperties2KHR);
|
||||
X(vkGetPhysicalDeviceFeatures2);
|
||||
X(vkGetPhysicalDeviceProperties2);
|
||||
X(vkGetPhysicalDeviceSurfaceCapabilitiesKHR);
|
||||
X(vkGetPhysicalDeviceSurfaceFormatsKHR);
|
||||
X(vkGetPhysicalDeviceSurfacePresentModesKHR);
|
||||
X(vkGetPhysicalDeviceSurfaceSupportKHR);
|
||||
X(vkGetPhysicalDeviceToolProperties);
|
||||
X(vkGetSwapchainImagesKHR);
|
||||
X(vkQueuePresentKHR);
|
||||
|
||||
@ -868,20 +869,20 @@ VkPhysicalDeviceProperties PhysicalDevice::GetProperties() const noexcept {
|
||||
return properties;
|
||||
}
|
||||
|
||||
void PhysicalDevice::GetProperties2KHR(VkPhysicalDeviceProperties2KHR& properties) const noexcept {
|
||||
dld->vkGetPhysicalDeviceProperties2KHR(physical_device, &properties);
|
||||
void PhysicalDevice::GetProperties2(VkPhysicalDeviceProperties2& properties) const noexcept {
|
||||
dld->vkGetPhysicalDeviceProperties2(physical_device, &properties);
|
||||
}
|
||||
|
||||
VkPhysicalDeviceFeatures PhysicalDevice::GetFeatures() const noexcept {
|
||||
VkPhysicalDeviceFeatures2KHR features2;
|
||||
features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR;
|
||||
VkPhysicalDeviceFeatures2 features2;
|
||||
features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
|
||||
features2.pNext = nullptr;
|
||||
dld->vkGetPhysicalDeviceFeatures2KHR(physical_device, &features2);
|
||||
dld->vkGetPhysicalDeviceFeatures2(physical_device, &features2);
|
||||
return features2.features;
|
||||
}
|
||||
|
||||
void PhysicalDevice::GetFeatures2KHR(VkPhysicalDeviceFeatures2KHR& features) const noexcept {
|
||||
dld->vkGetPhysicalDeviceFeatures2KHR(physical_device, &features);
|
||||
void PhysicalDevice::GetFeatures2(VkPhysicalDeviceFeatures2& features) const noexcept {
|
||||
dld->vkGetPhysicalDeviceFeatures2(physical_device, &features);
|
||||
}
|
||||
|
||||
VkFormatProperties PhysicalDevice::GetFormatProperties(VkFormat format) const noexcept {
|
||||
@ -906,6 +907,18 @@ std::vector<VkQueueFamilyProperties> PhysicalDevice::GetQueueFamilyProperties()
|
||||
return properties;
|
||||
}
|
||||
|
||||
std::vector<VkPhysicalDeviceToolProperties> PhysicalDevice::GetPhysicalDeviceToolProperties()
|
||||
const {
|
||||
u32 num = 0;
|
||||
if (!dld->vkGetPhysicalDeviceToolProperties) {
|
||||
return {};
|
||||
}
|
||||
dld->vkGetPhysicalDeviceToolProperties(physical_device, &num, nullptr);
|
||||
std::vector<VkPhysicalDeviceToolProperties> properties(num);
|
||||
dld->vkGetPhysicalDeviceToolProperties(physical_device, &num, properties.data());
|
||||
return properties;
|
||||
}
|
||||
|
||||
bool PhysicalDevice::GetSurfaceSupportKHR(u32 queue_family_index, VkSurfaceKHR surface) const {
|
||||
VkBool32 supported;
|
||||
Check(dld->vkGetPhysicalDeviceSurfaceSupportKHR(physical_device, queue_family_index, surface,
|
||||
|
@ -168,12 +168,13 @@ struct InstanceDispatch {
|
||||
PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties{};
|
||||
PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices{};
|
||||
PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr{};
|
||||
PFN_vkGetPhysicalDeviceFeatures2KHR vkGetPhysicalDeviceFeatures2KHR{};
|
||||
PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2{};
|
||||
PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties{};
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties{};
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties2 vkGetPhysicalDeviceMemoryProperties2{};
|
||||
PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties{};
|
||||
PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR{};
|
||||
PFN_vkGetPhysicalDeviceProperties2 vkGetPhysicalDeviceProperties2{};
|
||||
PFN_vkGetPhysicalDeviceToolProperties vkGetPhysicalDeviceToolProperties{};
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties{};
|
||||
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR{};
|
||||
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR{};
|
||||
@ -910,11 +911,11 @@ public:
|
||||
|
||||
VkPhysicalDeviceProperties GetProperties() const noexcept;
|
||||
|
||||
void GetProperties2KHR(VkPhysicalDeviceProperties2KHR&) const noexcept;
|
||||
void GetProperties2(VkPhysicalDeviceProperties2&) const noexcept;
|
||||
|
||||
VkPhysicalDeviceFeatures GetFeatures() const noexcept;
|
||||
|
||||
void GetFeatures2KHR(VkPhysicalDeviceFeatures2KHR&) const noexcept;
|
||||
void GetFeatures2(VkPhysicalDeviceFeatures2&) const noexcept;
|
||||
|
||||
VkFormatProperties GetFormatProperties(VkFormat) const noexcept;
|
||||
|
||||
@ -922,6 +923,8 @@ public:
|
||||
|
||||
std::vector<VkQueueFamilyProperties> GetQueueFamilyProperties() const;
|
||||
|
||||
std::vector<VkPhysicalDeviceToolProperties> GetPhysicalDeviceToolProperties() const;
|
||||
|
||||
bool GetSurfaceSupportKHR(u32 queue_family_index, VkSurfaceKHR) const;
|
||||
|
||||
VkSurfaceCapabilitiesKHR GetSurfaceCapabilitiesKHR(VkSurfaceKHR) const;
|
||||
|
Loading…
Reference in New Issue
Block a user