[maxwell, vk] VK_EXT_Sample_Locations

This commit is contained in:
CamilleLaVey 2025-11-26 00:01:42 -04:00 committed by Caio Oliveira
parent 1bd8012450
commit e66bc40b8b
No known key found for this signature in database
GPG key ID: AAAE6C7FD4186B0C
9 changed files with 133 additions and 2 deletions

View file

@ -1108,6 +1108,11 @@ bool Device::GetSuitability(bool requires_swapchain) {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT;
SetNext(next, properties.transform_feedback);
}
if (extensions.sample_locations) {
properties.sample_locations.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT;
SetNext(next, properties.sample_locations);
}
if (extensions.maintenance5) {
properties.maintenance5.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR;
@ -1385,6 +1390,11 @@ void Device::RemoveUnsuitableExtensions() {
properties.transform_feedback.transformFeedbackQueries);
}
// VK_EXT_sample_locations
extensions.sample_locations = features.sample_locations.sampleLocations;
RemoveExtensionFeatureIfUnsuitable(extensions.sample_locations, features.sample_locations,
VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME);
// VK_EXT_vertex_input_dynamic_state
extensions.vertex_input_dynamic_state =
features.vertex_input_dynamic_state.vertexInputDynamicState;

View file

@ -63,6 +63,7 @@ VK_DEFINE_HANDLE(VmaAllocator)
FEATURE(EXT, ProvokingVertex, PROVOKING_VERTEX, provoking_vertex) \
FEATURE(EXT, Robustness2, ROBUSTNESS_2, robustness2) \
FEATURE(EXT, TransformFeedback, TRANSFORM_FEEDBACK, transform_feedback) \
FEATURE(EXT, SampleLocations, SAMPLE_LOCATIONS, sample_locations) \
FEATURE(EXT, VertexInputDynamicState, VERTEX_INPUT_DYNAMIC_STATE, vertex_input_dynamic_state) \
FEATURE(EXT, SwapchainMaintenance1, SWAPCHAIN_MAINTENANCE_1, swapchain_maintenance1) \
FEATURE(KHR, Maintenance5, MAINTENANCE_5, maintenance5) \
@ -342,6 +343,11 @@ public:
return properties.float_controls;
}
/// Returns sample location properties (VK_EXT_sample_locations).
const VkPhysicalDeviceSampleLocationsPropertiesEXT& SampleLocationProperties() const {
return properties.sample_locations;
}
/// Returns true if ASTC is natively supported.
bool IsOptimalAstcSupported() const {
return features.features.textureCompressionASTC_LDR;
@ -550,6 +556,17 @@ public:
return extensions.transform_feedback;
}
/// Returns true if the device supports VK_EXT_sample_locations.
bool IsExtSampleLocationsSupported() const {
return extensions.sample_locations;
}
/// Returns true if the device supports custom sample locations for the given sample count.
bool SupportsSampleLocationsFor(VkSampleCountFlagBits samples) const {
return extensions.sample_locations &&
(properties.sample_locations.sampleLocationSampleCounts & samples) != 0;
}
/// Returns true if the device supports VK_EXT_transform_feedback properly.
bool AreTransformFeedbackGeometryStreamsSupported() const {
return features.transform_feedback.geometryStreams;
@ -1017,6 +1034,7 @@ private:
VkPhysicalDevicePushDescriptorPropertiesKHR push_descriptor{};
VkPhysicalDeviceSubgroupSizeControlProperties subgroup_size_control{};
VkPhysicalDeviceTransformFeedbackPropertiesEXT transform_feedback{};
VkPhysicalDeviceSampleLocationsPropertiesEXT sample_locations{};
VkPhysicalDeviceMaintenance5PropertiesKHR maintenance5{};
VkPhysicalDeviceMultiDrawPropertiesEXT multi_draw{};

View file

@ -166,6 +166,7 @@ void Load(VkDevice device, DeviceDispatch& dld) noexcept {
X(vkCmdSetColorWriteMaskEXT);
X(vkCmdSetColorBlendEnableEXT);
X(vkCmdSetColorBlendEquationEXT);
X(vkCmdSetSampleLocationsEXT);
X(vkCmdResolveImage);
X(vkCreateBuffer);
X(vkCreateBufferView);

View file

@ -266,6 +266,7 @@ struct DeviceDispatch : InstanceDispatch {
PFN_vkCmdSetColorWriteMaskEXT vkCmdSetColorWriteMaskEXT{};
PFN_vkCmdSetColorBlendEnableEXT vkCmdSetColorBlendEnableEXT{};
PFN_vkCmdSetColorBlendEquationEXT vkCmdSetColorBlendEquationEXT{};
PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT{};
PFN_vkCmdWaitEvents vkCmdWaitEvents{};
PFN_vkCreateBuffer vkCreateBuffer{};
PFN_vkCreateBufferView vkCreateBufferView{};
@ -1525,6 +1526,10 @@ public:
dld->vkCmdSetColorBlendEquationEXT(handle, first, equations.size(), equations.data());
}
void SetSampleLocationsEXT(const VkSampleLocationsInfoEXT& info) const noexcept {
dld->vkCmdSetSampleLocationsEXT(handle, &info);
}
void SetLineWidth(float line_width) const noexcept {
dld->vkCmdSetLineWidth(handle, line_width);
}