2019-11-23 20:27:39 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2018-2019 Xiamen Yaji Software Co., Ltd.
|
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
https://axmolengine.github.io/
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../DeviceInfo.h"
|
|
|
|
#import <Metal/Metal.h>
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_BACKEND_BEGIN
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
enum class FeatureSet : int32_t
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
Unknown = -1,
|
2019-11-23 20:27:39 +08:00
|
|
|
FeatureSet_iOS_GPUFamily1_v1 = 0,
|
|
|
|
FeatureSet_iOS_GPUFamily2_v1 = 1,
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
FeatureSet_iOS_GPUFamily1_v2 = 2,
|
|
|
|
FeatureSet_iOS_GPUFamily2_v2 = 3,
|
|
|
|
FeatureSet_iOS_GPUFamily3_v1 = 4,
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
FeatureSet_iOS_GPUFamily1_v3 = 5,
|
|
|
|
FeatureSet_iOS_GPUFamily2_v3 = 6,
|
|
|
|
FeatureSet_iOS_GPUFamily3_v2 = 7,
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
FeatureSet_iOS_GPUFamily1_v4 = 8,
|
|
|
|
FeatureSet_iOS_GPUFamily2_v4 = 9,
|
|
|
|
FeatureSet_iOS_GPUFamily3_v3 = 10,
|
|
|
|
FeatureSet_iOS_GPUFamily4_v1 = 11,
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
FeatureSet_iOS_GPUFamily1_v5 = 12,
|
|
|
|
FeatureSet_iOS_GPUFamily2_v5 = 13,
|
|
|
|
FeatureSet_iOS_GPUFamily3_v4 = 14,
|
|
|
|
FeatureSet_iOS_GPUFamily4_v2 = 15,
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
FeatureSet_macOS_GPUFamily1_v1 = 10000,
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
FeatureSet_macOS_GPUFamily1_v2 = 10001,
|
2019-11-23 20:27:39 +08:00
|
|
|
FeatureSet_macOS_ReadWriteTextureTier2 = 10002,
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
FeatureSet_macOS_GPUFamily1_v3 = 10003,
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
FeatureSet_macOS_GPUFamily1_v4 = 10004,
|
|
|
|
FeatureSet_macOS_GPUFamily2_v1 = 10005,
|
|
|
|
};
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
inline FeatureSet operator--(FeatureSet& x)
|
|
|
|
{
|
|
|
|
return x = (FeatureSet)(std::underlying_type<FeatureSet>::type(x) - 1);
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup _metal
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to query features and implementation limits
|
|
|
|
*/
|
|
|
|
class DeviceInfoMTL : public DeviceInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// @name Constructor, Destructor and Initializers
|
|
|
|
/**
|
|
|
|
* @param device To query MTLDevice features and implementation limits in Metal.
|
|
|
|
*/
|
|
|
|
DeviceInfoMTL(id<MTLDevice> device);
|
2021-12-25 10:04:45 +08:00
|
|
|
virtual ~DeviceInfoMTL() = default;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gather features and implementation limits
|
|
|
|
*/
|
|
|
|
virtual bool init() override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
/// @name Setters & Getters
|
|
|
|
/**
|
|
|
|
* Get vendor device name.
|
|
|
|
* @return Vendor device name.
|
|
|
|
*/
|
|
|
|
virtual const char* getVendor() const override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
/**
|
|
|
|
* Get the full name of the vendor device.
|
|
|
|
* @return The full name of the vendor device.
|
|
|
|
*/
|
|
|
|
virtual const char* getRenderer() const override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
/**
|
|
|
|
* Get featureSet name.
|
|
|
|
* @return FeatureSet name.
|
|
|
|
*/
|
|
|
|
virtual const char* getVersion() const override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
/**
|
|
|
|
* Check if feature supported by Metal.
|
|
|
|
* @param feature Specify feature to be query.
|
|
|
|
* @return true if the feature is supported, false otherwise.
|
|
|
|
*/
|
|
|
|
virtual bool checkForFeatureSupported(FeatureType feature) override;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
static bool supportD24S8() { return _isDepth24Stencil8PixelFormatSupported; }
|
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
private:
|
|
|
|
std::string _deviceName;
|
|
|
|
FeatureSet _featureSet = FeatureSet::Unknown;
|
2020-09-25 11:07:56 +08:00
|
|
|
static bool _isDepth24Stencil8PixelFormatSupported;
|
2019-11-23 20:27:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// end of _metal group
|
|
|
|
/// @}
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_BACKEND_END
|