renderMetal: device/vendor name and API version
This commit is contained in:
parent
c64a0f51c4
commit
18334b2018
2 changed files with 82 additions and 2 deletions
|
|
@ -185,6 +185,30 @@ int FurnaceGUIRenderMetal::getWindowFlags() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int FurnaceGUIRenderMetal::getMaxTextureWidth() {
|
||||
return bigTextures?16384:8192;
|
||||
}
|
||||
|
||||
int FurnaceGUIRenderMetal::getMaxTextureHeight() {
|
||||
return bigTextures?16384:8192;
|
||||
}
|
||||
|
||||
const char* FurnaceGUIRenderMetal::getBackendName() {
|
||||
return "Metal";
|
||||
}
|
||||
|
||||
const char* FurnaceGUIRenderMetal::getVendorName() {
|
||||
return vendorName.c_str();
|
||||
}
|
||||
|
||||
const char* FurnaceGUIRenderMetal::getDeviceName() {
|
||||
return deviceName.c_str();
|
||||
}
|
||||
|
||||
const char* FurnaceGUIRenderMetal::getAPIVersion() {
|
||||
return apiVersion.c_str();
|
||||
}
|
||||
|
||||
void FurnaceGUIRenderMetal::setSwapInterval(int swapInterval) {
|
||||
if (SDL_RenderSetVSync(sdlRend,(swapInterval>=0)?1:0)!=0) {
|
||||
swapIntervalSet=false;
|
||||
|
|
@ -199,6 +223,33 @@ void FurnaceGUIRenderMetal::preInit() {
|
|||
priv=new FurnaceGUIRenderMetalPrivate;
|
||||
}
|
||||
|
||||
static const char* metalFamilyNames[]={
|
||||
"Apple1",
|
||||
"Apple2",
|
||||
"Apple3",
|
||||
"Apple4",
|
||||
"Apple5",
|
||||
"Apple6",
|
||||
"Apple7",
|
||||
"Apple8",
|
||||
"Apple9",
|
||||
"Mac1",
|
||||
"Mac2",
|
||||
"Common1",
|
||||
"Common2",
|
||||
"Common3",
|
||||
"Metal3",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const NSInteger metalFamilies[]={
|
||||
1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, // Apple
|
||||
2001, 2002, // Mac
|
||||
3001, 3002, 3003, // Common
|
||||
5001, // Metal3
|
||||
0
|
||||
};
|
||||
|
||||
bool FurnaceGUIRenderMetal::init(SDL_Window* win, int swapInterval) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER,"metal");
|
||||
|
||||
|
|
@ -222,6 +273,24 @@ bool FurnaceGUIRenderMetal::init(SDL_Window* win, int swapInterval) {
|
|||
return false;
|
||||
}
|
||||
|
||||
vendorName=[priv->context.device.architecture.name UTF8String];
|
||||
deviceName=[priv->context.device.name UTF8String];
|
||||
apiVersion="";
|
||||
|
||||
bool comma=false;
|
||||
for (int i=0; metalFamilies[i]; i++) {
|
||||
const char* familyName=metalFamilyNames[i];
|
||||
MTLGPUFamily family=(MTLGPUFamily)metalFamilies[i];
|
||||
|
||||
if ([priv->context.device supportsFamily:family]) {
|
||||
if (comma) {
|
||||
apiVersion+=", ";
|
||||
}
|
||||
apiVersion+=familyName;
|
||||
comma=true;
|
||||
}
|
||||
}
|
||||
|
||||
priv->context.pixelFormat=MTLPixelFormatBGRA8Unorm;
|
||||
|
||||
priv->cmdQueue=[priv->context.device newCommandQueue];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue