mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
Detect metal counter sampling style
Use MTLDevice::supports_counter_sampling() to select the appropriate counter style.
This commit is contained in:
parent
02cc867950
commit
867b97f41d
|
@ -55,7 +55,7 @@ pub struct MtlDevice {
|
||||||
/// Type of counter sampling.
|
/// Type of counter sampling.
|
||||||
///
|
///
|
||||||
/// See https://developer.apple.com/documentation/metal/counter_sampling/sampling_gpu_data_into_counter_sample_buffers
|
/// See https://developer.apple.com/documentation/metal/counter_sampling/sampling_gpu_data_into_counter_sample_buffers
|
||||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||||
enum CounterStyle {
|
enum CounterStyle {
|
||||||
None,
|
None,
|
||||||
Stage,
|
Stage,
|
||||||
|
@ -244,12 +244,18 @@ impl MtlDevice {
|
||||||
// Timer stuff
|
// Timer stuff
|
||||||
let timer_set = CounterSet::get_timer_counter_set(&device);
|
let timer_set = CounterSet::get_timer_counter_set(&device);
|
||||||
let counter_style = if timer_set.is_some() {
|
let counter_style = if timer_set.is_some() {
|
||||||
// TODO: M1 is stage style, but should do proper runtime detection.
|
if device.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtStageBoundary) {
|
||||||
CounterStyle::Stage
|
CounterStyle::Stage
|
||||||
|
} else if device
|
||||||
|
.supports_counter_sampling(metal::MTLCounterSamplingPoint::AtDispatchBoundary)
|
||||||
|
{
|
||||||
|
CounterStyle::Command
|
||||||
|
} else {
|
||||||
|
CounterStyle::None
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CounterStyle::None
|
CounterStyle::None
|
||||||
};
|
};
|
||||||
|
|
||||||
MtlDevice {
|
MtlDevice {
|
||||||
device,
|
device,
|
||||||
cmd_queue: Arc::new(Mutex::new(cmd_queue)),
|
cmd_queue: Arc::new(Mutex::new(cmd_queue)),
|
||||||
|
|
Loading…
Reference in a new issue