diff --git a/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp b/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp index 8393cdd20..e75ea70d4 100644 --- a/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp +++ b/desmume/src/frontend/cocoa/OGLDisplayOutput.cpp @@ -3937,7 +3937,7 @@ enum OGLVertexAttributeID static const GLint filterVtxBuffer[8] = {-1, -1, 1, -1, -1, 1, 1, 1}; -void GetGLVersionOGL(GLint *outMajor, GLint *outMinor, GLint *outRevision) +static void GetGLVersionOGL(GLint *outMajor, GLint *outMinor, GLint *outRevision) { const char *oglVersionString = (const char *)glGetString(GL_VERSION); if (oglVersionString == NULL) @@ -4076,6 +4076,11 @@ void DeleteHQnxLUTs_OGL(GLenum textureIndex, GLuint &texLQ2xLUT, GLuint &texHQ2x OGLContextInfo::OGLContextInfo() { GetGLVersionOGL(&_versionMajor, &_versionMinor, &_versionRevision); + + const char *oglRendererString = (const char *)glGetString(GL_RENDERER); + memset(_rendererString, 0, sizeof(_rendererString)); + strlcpy(_rendererString, oglRendererString, sizeof(_rendererString) - 1); + _shaderSupport = ShaderSupport_Unsupported; _useShader150 = false; @@ -4090,6 +4095,26 @@ ShaderSupportTier OGLContextInfo::GetShaderSupport() return this->_shaderSupport; } +int OGLContextInfo::GetVersionMajor() const +{ + return (int)this->_versionMajor; +} + +int OGLContextInfo::GetVersionMinor() const +{ + return (int)this->_versionMinor; +} + +int OGLContextInfo::GetVersionRevision() const +{ + return (int)this->_versionRevision; +} + +const char* OGLContextInfo::GetRendererString() const +{ + return this->_rendererString; +} + bool OGLContextInfo::IsUsingShader150() { return this->_useShader150; diff --git a/desmume/src/frontend/cocoa/OGLDisplayOutput.h b/desmume/src/frontend/cocoa/OGLDisplayOutput.h index 6b667544f..1524b7476 100644 --- a/desmume/src/frontend/cocoa/OGLDisplayOutput.h +++ b/desmume/src/frontend/cocoa/OGLDisplayOutput.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2018 DeSmuME team + Copyright (C) 2014-2022 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,6 +65,7 @@ protected: GLint _versionMajor; GLint _versionMinor; GLint _versionRevision; + char _rendererString[256]; ShaderSupportTier _shaderSupport; bool _useShader150; @@ -76,6 +77,11 @@ protected: public: OGLContextInfo(); virtual ~OGLContextInfo() {}; + + int GetVersionMajor() const; + int GetVersionMinor() const; + int GetVersionRevision() const; + const char* GetRendererString() const; bool IsUsingShader150(); bool IsVBOSupported(); diff --git a/desmume/src/frontend/cocoa/userinterface/MacMetalDisplayView.h b/desmume/src/frontend/cocoa/userinterface/MacMetalDisplayView.h index c030e8494..43ea54eab 100644 --- a/desmume/src/frontend/cocoa/userinterface/MacMetalDisplayView.h +++ b/desmume/src/frontend/cocoa/userinterface/MacMetalDisplayView.h @@ -86,6 +86,9 @@ typedef DisplayViewShaderProperties DisplayViewShaderProperties; @interface MetalDisplayViewSharedData : MacClientSharedObject { id device; + NSString *name; + NSString *description; + id _fetchCommandQueue; id commandQueue; id defaultLibrary; @@ -139,6 +142,9 @@ typedef DisplayViewShaderProperties DisplayViewShaderProperties; } @property (readonly, nonatomic) id device; +@property (readonly, nonatomic) NSString *name; +@property (readonly, nonatomic) NSString *description; + @property (readonly, nonatomic) id commandQueue; @property (readonly, nonatomic) id defaultLibrary; diff --git a/desmume/src/frontend/cocoa/userinterface/MacMetalDisplayView.mm b/desmume/src/frontend/cocoa/userinterface/MacMetalDisplayView.mm index 5903d903c..6b8860a73 100644 --- a/desmume/src/frontend/cocoa/userinterface/MacMetalDisplayView.mm +++ b/desmume/src/frontend/cocoa/userinterface/MacMetalDisplayView.mm @@ -27,6 +27,8 @@ @implementation MetalDisplayViewSharedData @synthesize device; +@synthesize name; +@synthesize description; @synthesize commandQueue; @synthesize defaultLibrary; @@ -68,6 +70,33 @@ [device retain]; + NSString *tempVersionStr = @"Metal - Unknown GPU Family"; + const BOOL isRWTexSupported = [device supportsFeatureSet:10002]; // MTLFeatureSet_macOS_ReadWriteTextureTier2 + + if ([device supportsFeatureSet:10005]) // MTLFeatureSet_macOS_GPUFamily2_v1 + { + tempVersionStr = @"macOS Metal GPUFamily2_v1"; + } + else if ([device supportsFeatureSet:10004]) // MTLFeatureSet_macOS_GPUFamily1_v4 + { + tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v4 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v4"; + } + else if ([device supportsFeatureSet:10003]) // MTLFeatureSet_macOS_GPUFamily1_v3 + { + tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v3 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v3"; + } + else if ([device supportsFeatureSet:10001]) // MTLFeatureSet_macOS_GPUFamily1_v2 + { + tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v2 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v2"; + } + else if ([device supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) + { + tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v1 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v1"; + } + + name = [[NSString alloc] initWithString:tempVersionStr]; + description = [[NSString alloc] initWithString:[device name]]; + commandQueue = [device newCommandQueue]; [commandQueue setLabel:@"CQ_DeSmuME_VideoBlitter"]; @@ -325,6 +354,9 @@ [samplerHUDBox release]; [samplerHUDText release]; + [name release]; + [description release]; + [super dealloc]; } @@ -2424,6 +2456,8 @@ MacMetalFetchObject::MacMetalFetchObject() } _clientData = [[MetalDisplayViewSharedData alloc] init]; + strlcpy(_name, [[(MetalDisplayViewSharedData *)_clientData name] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_name) - 1); + strlcpy(_description, [[(MetalDisplayViewSharedData *)_clientData description] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_description) - 1); } MacMetalFetchObject::~MacMetalFetchObject() diff --git a/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.mm b/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.mm index c6d232b46..7444fa799 100644 --- a/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.mm +++ b/desmume/src/frontend/cocoa/userinterface/MacOGLDisplayView.mm @@ -156,6 +156,9 @@ MacOGLClientFetchObject::MacOGLClientFetchObject() CGLSetCurrentContext(prevContext); + snprintf(_name, sizeof(_name) - 1, "macOS OpenGL v%i.%i.%i", _contextInfo->GetVersionMajor(), _contextInfo->GetVersionMinor(), _contextInfo->GetVersionRevision()); + strlcpy(_description, _contextInfo->GetRendererString(), sizeof(_description) - 1); + _clientData = [[MacClientSharedObject alloc] init]; _unfairlockTexFetch[NDSDisplayID_Main] = apple_unfairlock_create(); diff --git a/desmume/src/frontend/cocoa/userinterface/troubleshootingWindowDelegate.mm b/desmume/src/frontend/cocoa/userinterface/troubleshootingWindowDelegate.mm index 87b1ad1ef..0de18d09b 100644 --- a/desmume/src/frontend/cocoa/userinterface/troubleshootingWindowDelegate.mm +++ b/desmume/src/frontend/cocoa/userinterface/troubleshootingWindowDelegate.mm @@ -95,13 +95,13 @@ romSerialStr = unspecifiedStr; } - NSString *finalFormTextStr = @"App Version: "; - finalFormTextStr = [finalFormTextStr stringByAppendingString:appVersionStr]; + NSString *finalFormTextStr = @"[ BEGIN DESMUME RUNTIME INFORMATION ]\n"; + finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nApp Version: "] stringByAppendingString:appVersionStr]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nOperating System: "] stringByAppendingString:[CocoaDSUtil operatingSystemString]]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nModel Identifier: "] stringByAppendingString:[CocoaDSUtil modelIdentifierString]]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nROM Name: "] stringByAppendingString:romNameStr]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nROM Serial: "] stringByAppendingString:romSerialStr]; - finalFormTextStr = [finalFormTextStr stringByAppendingString:@"\n-----------------------------------"]; + finalFormTextStr = [finalFormTextStr stringByAppendingString:@"\n"]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nEmulation Speed: "] stringByAppendingString:([cdsCore isSpeedLimitEnabled] ? [NSString stringWithFormat:@"%1.2fx", [emuControl lastSetSpeedScalar]] : @"Unlimited")]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nAuto Frame Skip: "] stringByAppendingString:([cdsCore isFrameSkipEnabled] ? @"YES" : @"NO")]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nSLOT-1 Device Type: "] stringByAppendingString:[cdsCore slot1DeviceTypeString]]; @@ -147,13 +147,14 @@ finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\n3D Renderer - Texture Scaling Factor: "] stringByAppendingString:[NSString stringWithFormat:@"%ldx", (unsigned long)[[cdsCore cdsGPU] render3DTextureScalingFactor]]]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\n3D Renderer - Edge Marking: "] stringByAppendingString:([[cdsCore cdsGPU] render3DEdgeMarking] ? @"YES" : @"NO")]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\n3D Renderer - Fog: "] stringByAppendingString:([[cdsCore cdsGPU] render3DFog] ? @"YES" : @"NO")]; + finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nVideo - Output Engine: "] stringByAppendingString:[NSString stringWithFormat:@"%s (%s)", [[cdsCore cdsGPU] fetchObject]->GetName(), [[cdsCore cdsGPU] fetchObject]->GetDescription()]]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nAudio - Output Engine: "] stringByAppendingString:[[emuControl cdsSpeaker] audioOutputEngineString]]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nAudio - Advanced SPU Logic: "] stringByAppendingString:([[emuControl cdsSpeaker] spuAdvancedLogic] ? @"YES" : @"NO")]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nAudio - Sound Interpolation Method: "] stringByAppendingString:[[emuControl cdsSpeaker] spuInterpolationModeString]]; finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nAudio - Sound Synchronization Method: "] stringByAppendingString:[[emuControl cdsSpeaker] spuSyncMethodString]]; - finalFormTextStr = [finalFormTextStr stringByAppendingString:@"\n-----------------------------------"]; - finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nCheats: "] stringByAppendingString:([cdsCore isCheatingEnabled] ? [NSString stringWithFormat:@"YES (ActiveCheatCount=%ld)", (unsigned long)[[emuControl cdsCheats] activeCount]] : @"NO")]; - finalFormTextStr = [finalFormTextStr stringByAppendingString:@"\n-----------------------------------"]; + finalFormTextStr = [finalFormTextStr stringByAppendingString:@"\n"]; + finalFormTextStr = [[finalFormTextStr stringByAppendingString:@"\nCheats: "] stringByAppendingString:(([cdsCore isCheatingEnabled] && ([[emuControl cdsCheats] activeCount] > 0)) ? [NSString stringWithFormat:@"YES (ActiveCheatCount=%ld)", (unsigned long)[[emuControl cdsCheats] activeCount]] : @"NO")]; + finalFormTextStr = [finalFormTextStr stringByAppendingString:@"\n"]; if ([window contentView] == viewSupportRequest) { @@ -187,6 +188,8 @@ [bindings setValue:NSSTRING_TITLE_GO_BUG_REPORT_WEBPAGE_TITLE forKey:@"goWebpageButtonTitle"]; } + finalFormTextStr = [finalFormTextStr stringByAppendingString:@"\n\n[ END DESMUME RUNTIME INFORMATION ]"]; + [bindings setValue:finalFormTextStr forKey:@"finalFormText"]; // Remember the current form and switch the window view.