mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-23 07:49:00 +02:00
[spv, qcom] Implement warp intrinsics support
This commit is contained in:
parent
a793a132fc
commit
458302b3f5
9 changed files with 204 additions and 14 deletions
|
|
@ -92,6 +92,11 @@ constexpr std::array VK_FORMAT_A4B4G4R4_UNORM_PACK16{
|
|||
|
||||
} // namespace Alternatives
|
||||
|
||||
constexpr VkShaderStageFlags GraphicsStageMask =
|
||||
VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT |
|
||||
VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT | VK_SHADER_STAGE_GEOMETRY_BIT |
|
||||
VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
|
||||
template <typename T>
|
||||
void SetNext(void**& next, T& data) {
|
||||
*next = &data;
|
||||
|
|
@ -1550,6 +1555,44 @@ void Device::RemoveUnsuitableExtensions() {
|
|||
RemoveExtensionIfUnsuitable(extensions.maintenance9, VK_KHR_MAINTENANCE_9_EXTENSION_NAME);
|
||||
}
|
||||
|
||||
bool Device::SupportsSubgroupStage(VkShaderStageFlags stage_mask) const {
|
||||
if (stage_mask == 0) {
|
||||
return true;
|
||||
}
|
||||
const VkShaderStageFlags supported = properties.subgroup_properties.supportedStages;
|
||||
if ((supported & stage_mask) == stage_mask) {
|
||||
return true;
|
||||
}
|
||||
if ((stage_mask & GraphicsStageMask) != 0 &&
|
||||
(supported & (VK_SHADER_STAGE_ALL_GRAPHICS | VK_SHADER_STAGE_ALL)) != 0) {
|
||||
return true;
|
||||
}
|
||||
if ((stage_mask & VK_SHADER_STAGE_COMPUTE_BIT) != 0 &&
|
||||
(supported & (VK_SHADER_STAGE_COMPUTE_BIT | VK_SHADER_STAGE_ALL)) != 0) {
|
||||
return true;
|
||||
}
|
||||
return (supported & VK_SHADER_STAGE_ALL) != 0;
|
||||
}
|
||||
|
||||
bool Device::IsSubgroupFeatureSupported(VkSubgroupFeatureFlagBits feature,
|
||||
VkShaderStageFlags stage_mask) const {
|
||||
if ((properties.subgroup_properties.supportedOperations & feature) == 0) {
|
||||
return false;
|
||||
}
|
||||
return SupportsSubgroupStage(stage_mask);
|
||||
}
|
||||
|
||||
bool Device::SupportsWarpIntrinsics(VkShaderStageFlagBits stage) const {
|
||||
constexpr VkSubgroupFeatureFlags required_ops =
|
||||
VK_SUBGROUP_FEATURE_BASIC_BIT | VK_SUBGROUP_FEATURE_VOTE_BIT |
|
||||
VK_SUBGROUP_FEATURE_ARITHMETIC_BIT | VK_SUBGROUP_FEATURE_BALLOT_BIT |
|
||||
VK_SUBGROUP_FEATURE_SHUFFLE_BIT | VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT;
|
||||
if ((properties.subgroup_properties.supportedOperations & required_ops) != required_ops) {
|
||||
return false;
|
||||
}
|
||||
return SupportsSubgroupStage(stage);
|
||||
}
|
||||
|
||||
void Device::SetupFamilies(VkSurfaceKHR surface) {
|
||||
const std::vector queue_family_properties = physical.GetQueueFamilyProperties();
|
||||
std::optional<u32> graphics;
|
||||
|
|
|
|||
|
|
@ -401,11 +401,26 @@ public:
|
|||
return properties.subgroup_size_control.requiredSubgroupSizeStages & stage;
|
||||
}
|
||||
|
||||
/// Returns true if the device supports the provided subgroup feature.
|
||||
bool IsSubgroupFeatureSupported(VkSubgroupFeatureFlagBits feature) const {
|
||||
return properties.subgroup_properties.supportedOperations & feature;
|
||||
/// Returns true if the device supports the provided subgroup feature for the given stages.
|
||||
bool IsSubgroupFeatureSupported(VkSubgroupFeatureFlagBits feature,
|
||||
VkShaderStageFlags stage_mask = 0) const;
|
||||
|
||||
/// Returns true if the device reports subgroup support for the provided shader stages.
|
||||
bool SupportsSubgroupStage(VkShaderStageFlags stage_mask) const;
|
||||
|
||||
/// Returns the set of stages that report subgroup support.
|
||||
VkShaderStageFlags GetSubgroupSupportedStages() const {
|
||||
return properties.subgroup_properties.supportedStages;
|
||||
}
|
||||
|
||||
/// Returns the set of subgroup operations reported by the driver.
|
||||
VkSubgroupFeatureFlags GetSubgroupSupportedOperations() const {
|
||||
return properties.subgroup_properties.supportedOperations;
|
||||
}
|
||||
|
||||
/// Returns true if the driver can execute all warp intrinsics for the given shader stage.
|
||||
bool SupportsWarpIntrinsics(VkShaderStageFlagBits stage) const;
|
||||
|
||||
/// Returns the maximum number of push descriptors.
|
||||
u32 MaxPushDescriptors() const {
|
||||
return properties.push_descriptor.maxPushDescriptors;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue