dmitri.shuralyov.com/gpu/mtl

deprecate FeatureSet and Device.SupportsFeatureSet

The upstream Metal API has deprecated this part of its API.
Explicitly ignore a compilation warning about the deprecation.
dmitshur committed 1 year ago commit b78c9fe623cca0431d866c9e206d3f83665bcf8b
Showing partial commit. Full Commit
Collapse all
mtl.go
@@ -50,10 +50,12 @@ const (
	GPUFamilyMetal3  GPUFamily = 5001 // Metal 3 features.
)

// FeatureSet defines a specific platform, hardware, and software configuration.
//
// Deprecated: Use GPUFamily instead.
//
// Reference: https://developer.apple.com/documentation/metal/mtlfeatureset.
type FeatureSet uint16

// The device feature sets that define specific platform, hardware, and software configurations.
const (
@@ -365,10 +367,12 @@ func (d Device) SupportsFamily(gf GPUFamily) bool {
	return bool(C.Device_SupportsFamily(d.device, C.uint16_t(gf)))
}

// SupportsFeatureSet reports whether device d supports feature set fs.
//
// Deprecated: Use SupportsFamily instead.
//
// Reference: https://developer.apple.com/documentation/metal/mtldevice/1433418-supportsfeatureset.
func (d Device) SupportsFeatureSet(fs FeatureSet) bool {
	return bool(C.Device_SupportsFeatureSet(d.device, C.uint16_t(fs)))
}

mtl.m
@@ -44,13 +44,16 @@ bool Device_SupportsFamily(void * device, uint16_t gpuFamily) {
		return [(id<MTLDevice>)device supportsFamily:gpuFamily];
	}
	@throw @"API not available";
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
bool Device_SupportsFeatureSet(void * device, uint16_t featureSet) {
	return [(id<MTLDevice>)device supportsFeatureSet:featureSet];
}
#pragma clang diagnostic pop

void * Device_MakeCommandQueue(void * device) {
	return [(id<MTLDevice>)device newCommandQueue];
}