| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <AppKit/NSScreen.h> |
| 7 |
#include <Metal/Metal.h> |
| 8 |
|
| 9 |
#include <vector> |
| 10 |
|
| 11 |
#include "VideoCommon/AbstractShader.h" |
| 12 |
#include "VideoCommon/TextureConfig.h" |
| 13 |
#include "VideoCommon/VideoConfig.h" |
| 14 |
|
| 15 |
#include "VideoBackends/Metal/MRCHelpers.h" |
| 16 |
|
| 17 |
namespace Metal |
| 18 |
{ |
| 19 |
struct DeviceFeatures |
| 20 |
{ |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
bool manual_buffer_upload; |
| 25 |
bool subgroup_ops; |
| 26 |
}; |
| 27 |
|
| 28 |
extern DeviceFeatures g_features; |
| 29 |
|
| 30 |
namespace Util |
| 31 |
{ |
| 32 |
struct Viewport |
| 33 |
{ |
| 34 |
float x; |
| 35 |
float y; |
| 36 |
float width; |
| 37 |
float height; |
| 38 |
float near_depth; |
| 39 |
float far_depth; |
| 40 |
}; |
| 41 |
|
| 42 |
|
| 43 |
std::vector<MRCOwned<id<MTLDevice>>> GetAdapterList(); |
| 44 |
void PopulateBackendInfo(BackendInfo* backend_info); |
| 45 |
void PopulateBackendInfoAdapters(BackendInfo* backend_info, |
| 46 |
const std::vector<MRCOwned<id<MTLDevice>>>& adapters); |
| 47 |
void PopulateBackendInfoFeatures(const VideoConfig& config, BackendInfo* backend_info, |
| 48 |
id<MTLDevice> device); |
| 49 |
|
| 50 |
AbstractTextureFormat ToAbstract(MTLPixelFormat format); |
| 51 |
MTLPixelFormat FromAbstract(AbstractTextureFormat format); |
| 52 |
static inline bool HasStencil(AbstractTextureFormat format) |
| 53 |
{ |
| 54 |
return format == AbstractTextureFormat::D24_S8 || format == AbstractTextureFormat::D32F_S8; |
| 55 |
} |
| 56 |
|
| 57 |
std::optional<std::string> TranslateShaderToMSL(ShaderStage stage, std::string_view source, |
| 58 |
VideoCommon::ShaderIncluder* shader_includer); |
| 59 |
|
| 60 |
} |
| 61 |
} |