mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-15 05:38:11 +02:00
kk: Query device for supported sample counts
Instead of hard-coding supported samples, check the Metal device. Reviewed-by: Aitor Camacho <aitor@lunarg.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41534>
This commit is contained in:
parent
ccef88173b
commit
e9d96125e2
4 changed files with 24 additions and 6 deletions
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "mtl_types.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* TODO_KOSMICKRISP Remove */
|
||||
|
|
@ -27,6 +28,7 @@ void mtl_device_get_architecture_name(mtl_device *dev, char buffer[256]);
|
|||
uint64_t mtl_device_get_peer_group_id(mtl_device *dev);
|
||||
uint32_t mtl_device_get_peer_index(mtl_device *dev);
|
||||
uint64_t mtl_device_get_registry_id(mtl_device *dev);
|
||||
bool mtl_device_supports_sample_count(mtl_device *dev, uint32_t sample_count);
|
||||
struct mtl_size mtl_device_max_threads_per_threadgroup(mtl_device *dev);
|
||||
uint32_t mtl_device_max_threadgroup_memory_length(mtl_device *dev);
|
||||
uint64_t mtl_device_max_buffer_length(mtl_device *dev);
|
||||
|
|
|
|||
|
|
@ -118,6 +118,15 @@ mtl_device_get_registry_id(mtl_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
mtl_device_supports_sample_count(mtl_device *dev, uint32_t sample_count)
|
||||
{
|
||||
@autoreleasepool {
|
||||
id<MTLDevice> device = (id<MTLDevice>)dev;
|
||||
return [device supportsTextureSampleCount:sample_count];
|
||||
}
|
||||
}
|
||||
|
||||
struct mtl_size
|
||||
mtl_device_max_threads_per_threadgroup(mtl_device *dev)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,6 +53,12 @@ mtl_device_get_registry_id(mtl_device *dev)
|
|||
return 0u;
|
||||
}
|
||||
|
||||
bool
|
||||
mtl_device_supports_sample_count(mtl_device *dev, uint32_t sample_count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
struct mtl_size
|
||||
mtl_device_max_threads_per_threadgroup(mtl_device *dev)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -365,12 +365,13 @@ kk_get_device_properties(const struct kk_physical_device *pdev,
|
|||
const struct kk_instance *instance,
|
||||
struct vk_properties *properties)
|
||||
{
|
||||
const VkSampleCountFlagBits sample_counts =
|
||||
VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_2_BIT |
|
||||
// TODO_KOSMICKRISP Modify sample count based on what pdev supports
|
||||
VK_SAMPLE_COUNT_4_BIT /* |
|
||||
VK_SAMPLE_COUNT_8_BIT */
|
||||
;
|
||||
VkSampleCountFlagBits sample_counts = VK_SAMPLE_COUNT_1_BIT;
|
||||
for (uint32_t sample_count = VK_SAMPLE_COUNT_2_BIT;
|
||||
sample_count <= VK_SAMPLE_COUNT_8_BIT; sample_count <<= 1) {
|
||||
if (mtl_device_supports_sample_count(pdev->mtl_dev_handle,
|
||||
sample_count))
|
||||
sample_counts |= sample_count;
|
||||
}
|
||||
|
||||
assert(sample_counts <= (KK_MAX_SAMPLES << 1) - 1);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue