Skip to content

Commit

Permalink
Merge pull request #1552 from dpogue/nsprocessinfo
Browse files Browse the repository at this point in the history
Use metal-cpp's NS::ProcessInfo to get version
  • Loading branch information
Hoikas authored Jan 9, 2024
2 parents 1908290 + 27c4967 commit 63026e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ FetchContent_MakeAvailable(metalcpp)
set(pfMetalPipeline_SOURCES
plMetalDevice.cpp
plMetalDeviceRefs.cpp
plMetalEnumerate.cpp
plMetalMaterialShaderRef.cpp
plMetalPipeline.cpp
plMetalPipelineState.cpp
Expand All @@ -19,7 +20,6 @@ set(pfMetalPipeline_SOURCES
plMetalFragmentShader.cpp
plMetalVertexShader.cpp
plMetalTextFont.cpp
plMetalEnumerate.mm
plMetalDevicePerformanceShaders.mm
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@
#include "HeadSpin.h"

#include <vector>
#include <string_theory/format>
#include <Foundation/Foundation.hpp>

#include <Foundation/Foundation.h>

#include <sys/utsname.h>
#include "plMetalPipeline.h"

void plMetalEnumerate::Enumerate(std::vector<hsG3DDeviceRecord>& records)
Expand All @@ -62,17 +61,11 @@
devRec.SetG3DDeviceType(hsG3DDeviceSelector::kDevTypeMetal);
devRec.SetDriverName("Metal");
devRec.SetDeviceDesc(device->name()->utf8String());

// Metal has ways to query capabilities, but doesn't expose a flat version
// Populate with the OS version
@autoreleasepool {
NSProcessInfo* processInfo = [NSProcessInfo processInfo];
NSOperatingSystemVersion version = processInfo.operatingSystemVersion;
NSString* versionString =
[NSString stringWithFormat:@"%li.%li.%li", (long)version.majorVersion,
(long)version.minorVersion, version.patchVersion];
devRec.SetDriverVersion([versionString cStringUsingEncoding:NSUTF8StringEncoding]);
}
devRec.SetDriverDesc(device->name()->utf8String());
auto version = NS::ProcessInfo::processInfo()->operatingSystemVersion();
devRec.SetDriverVersion(ST::format("{}.{}.{}", version.majorVersion, version.minorVersion, version.patchVersion));

devRec.SetCap(hsG3DDeviceSelector::kCapsMipmap);
devRec.SetCap(hsG3DDeviceSelector::kCapsPerspective);
Expand Down

0 comments on commit 63026e7

Please sign in to comment.