Delve into the world of graphics and game development. Discuss creating stunning visuals, optimizing game mechanics, and share resources for game developers.

Post

Replies

Boosts

Views

Activity

MLTIO Unavailable in Simulator/iOS 17.x?
I'm trying to use MTLIO Resource Loading in XCode 15.1 b3, but MTLIOCommandQueue, Buffer, etc, come up as undefined types. The Apple sample MetalFastResourceLoading seems to work. But creating a new project from template doesn't recognize the symbols. Anyone see similar? Digging in, it seems the MTLIOCommandQueue.h file in Simulator 17.2 only contains #import <Metal/MTLDefines.h> #import <Metal/MTLDevice.h> Whereas the working sample that links to 14.x contains lots of code. Also, the iOS 17.2 Framework ALSO contains headers with code. However, building for device also comes up with undefined symbols. In addition, the documentation for the type https://developer.apple.com/documentation/metal/mtliocommandqueue lists support for iOS 16+, Vision Beta, etc. Does anyone know if earlier betas work?
0
0
308
Nov ’23
GPTK Installation Error: No Such File or Directory
I am attempting to install Apple's Game Porting Toolkit. I have been following the 'read me' instructions that Apple provides when you install the Game Porting Toolkit package on Apple's developer website. I ran $ brew -v install apple/apple/game-porting-toolkit, which downloaded for around 20 minutes before it reached: ==> Pouring pkg-config--0.29.2_3.sonoma.bottle.tar.gz ln -s ../Cellar/pkg-config/0.29.2_3/bin/pkg-config pkg-config ln -s ../../Cellar/pkg-config/0.29.2_3/share/aclocal/pkg.m4 pkg.m4 ln -s ../../Cellar/pkg-config/0.29.2_3/share/doc/pkg-config pkg-config ln -s ../../../Cellar/pkg-config/0.29.2_3/share/man/man1/pkg-config.1 pkg-config.1 Error: No such file or directory @ rb_sysopen - /Users/anna/Library/Caches/Homebrew/downloads/c5b6da58fb5d679eeb1765833596e7394625255fb46b165955fc4c4de746080e--pkg-config--0.29.2_3.sonoma.bottle.tar.gz I am completely stumped as to what to do in this case. I've tried uninstalling and reinstalling homebrew, trying to install GPTK on a fresh user on my mac, and running brew cleanup and trying to GPTK install again. I would really appreciate any help or suggestions for me to fix this! This is the output of brew doctor: Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks! Warning: Unbrewed dylibs were found in /usr/local/lib. If you didn't put them there on purpose they could cause problems when building Homebrew formulae, and may need to be deleted. Unexpected dylibs: /usr/local/lib/libtlImageIO.dylib /usr/local/lib/libtliadjust50.dylib /usr/local/lib/libtliclean30.dylib /usr/local/lib/libtlidejpeg40.dylib /usr/local/lib/libtlieffecta11.dylib /usr/local/lib/libtlieffecta12.dylib /usr/local/lib/libtliinfocus10.dylib /usr/local/lib/libtlistar10.dylib And this is the output of brew config HOMEBREW_VERSION: 4.1.20 ORIGIN: https://github.com/Homebrew/brew HEAD: d3d51d3448966b5250b5c60110c945040054803d Last commit: 8 days ago Core tap JSON: 19 Nov 22:15 UTC HOMEBREW_PREFIX: /usr/local HOMEBREW_CASK_OPTS: [] HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.6zCg6FefHr/org.macosforge.xquartz:0 HOMEBREW_MAKE_JOBS: 10 Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby CPU: 10-core 64-bit westmere Clang: 15.0.0 build 1500 Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git Curl: 8.1.2 => /usr/bin/curl macOS: 14.1.1-x86_64 CLT: 15.1.0.0.1.1699597245 Xcode: 15.1 => /Applications/Xcode-beta.app/Contents/Developer Rosetta 2: true
1
0
956
Nov ’23
Can anyone help me with this problem? most of the games i downloaded from app store or even in steam won't run. even they are compatible with macOS
Translated Report (Full Report Below) Process: Asphalt8 [1703] Path: /Applications/Asphalt8.app/Contents/MacOS/Asphalt8 Identifier: com.gameloft.asphalt8 Version: 7.4.0 (5.0.144) Code Type: X86-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2023-11-22 19:06:58.3982 +0800 OS Version: macOS 14.1.1 (23B81) Report Version: 12 Anonymous UUID: AEBBC989-7D55-FCAB-97CE-851A3B261A43 Sleep/Wake UUID: A1667D0D-B0AE-49E2-A94C-7E34B07BA5B8 Time Awake Since Boot: 1308 seconds Time Since Wake: 444 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000000c0 Exception Codes: 0x0000000000000001, 0x00000000000000c0 Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [1703] VM Region Info: 0xc0 is not in any region. Bytes before following region: 140737487834944 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> shared memory 7ffffff81000-7ffffff82000 [ 4K] r-x/r-x SM=SHM Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 Asphalt8 0x10ecdfda2 0x10d56e000 + 24583586 1 Asphalt8 0x10ecdfac5 0x10d56e000 + 24582853 2 Asphalt8 0x10ec30adb 0x10d56e000 + 23866075 3 Asphalt8 0x10d7fecc9 0x10d56e000 + 2690249 4 Asphalt8 0x10ec103c6 0x10d56e000 + 23733190 5 Asphalt8 0x10d57b89d 0x10d56e000 + 55453 6 Asphalt8 0x10d57bc85 0x10d56e000 + 56453 7 Asphalt8 0x10d575947 0x10d56e000 + 31047 8 CoreFoundation 0x7ff81b872ef6 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 137 9 CoreFoundation 0x7ff81b902cac ___CFXRegistrationPost_block_invoke + 86 10 CoreFoundation 0x7ff81b902bfd _CFXRegistrationPost + 530 11 CoreFoundation 0x7ff81b842e49 _CFXNotificationPost + 826 12 Foundation 0x7ff81c72422e -[NSNotificationCenter postNotificationName:object:userInfo:] + 82 13 AppKit 0x7ff81edf603a -[NSApplication _postDidFinishNotification] + 311 14 AppKit 0x7ff81edf5d82 -[NSApplication _sendFinishLaunchingNotification] + 215 15 AppKit 0x7ff81edf3e27 -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 542 16 AppKit 0x7ff81edf3a7c -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 679 17 Foundation 0x7ff81c74cd4e -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 308 18 Foundation 0x7ff81c74cb61 _NSAppleEventManagerGenericHandler + 80 19 AE 0x7ff8228ea9da 0x7ff8228df000 + 47578 20 AE 0x7ff8228ea228 0x7ff8228df000 + 45608 21 AE 0x7ff8228e3b7d aeProcessAppleEvent + 409 22 HIToolbox 0x7ff8265f3664 AEProcessAppleEvent + 55 23 AppKit 0x7ff81ededbae _DPSNextEvent + 1689 24 AppKit 0x7ff81f6e1348 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1304 25 AppKit 0x7ff81eddedfa -[NSApplication run] + 603 26 AppKit 0x7ff81edb2e10 NSApplicationMain + 816 27 Asphalt8 0x10d586484 0x10d56e000 + 99460 28 dyld 0x7ff81b41a3a6 start + 1942
0
0
687
Nov ’23
MTLTexture streaming to app directory
For better memory usage when working with MTLTextures (editing + displaying in render passes, compute shaders, etc.) is it possible to save the texture to the app's Documents folder, and then use an UnsafeMutablePointer to access/modify the contents of the texture before displaying in a render pass? And would this be performant (i.e 60fps)? That way the texture won't be directly in memory all the time, but the contents can still be edited and displayed when needed.
1
0
656
Nov ’23
MTLCompiler crash when using SIMD permute
I have a metal compute kernel that crashes MTLCompiler when I try to load the .metallib on an iPhone SE running iOS 14.4. I get the following error: MTLCompiler: Compilation failed with XPC_ERROR_CONNECTION_INTERRUPTED on 3 try Unable to init metal: Compiler encountered an internal error By selectively commenting out code I narrowed it down to the use of SIMD permute functions. These functions are supported by the iOS/Metal version running on the device, but not by the actual hardware (according to the metal features set table). I have 2 variants of this code, one that uses the SIMD permute functions and one that doesn't. My thought was to check the GPU family in Swift, then set a function constant supportsSIMDPermute and use this to ensure the correct variation runs on the device, like this: constant bool supportsSIMDPermute [[ function_constant(1) ]]; // kernel code if(supportsSIMDPermute) { // variant of code that uses SIMD permute } else { // Variant that uses slightly slower code that does not use SIMD permute } The library compiles without complaints in Xcode, but then crashes the on-device compiler when loading the library. Is this expected behaviour?
0
0
288
Nov ’23
Scene Kit Rotation - rotating around X and Y axis only, causing Z rotation
I am trying to control the orientation of a box in Scene Kit (iOS) using gestures. I am using the translation in x and y to update the x and y rotation of the SCNNode. After a long search I have realised that x and y rotation will always lead to z rotation, thanks to this excellent post: [https://gamedev.stackexchange.com/questions/136174/im-rotating-an-object-on-two-axes-so-why-does-it-keep-twisting-around-the-thir?newreg=130c66c673f848a7be2873bf675573a9) So I am trying to get the z rotation causes, and then remove this from my object by applying the inverse quaternion however when I rotate the object 90 deg around x, and then 90 deg around Y it behaves VERY weirdly. It is almost behaving as it is in gimbal lock, but I did not think that using quaternion in the way that I am would cause gimbal lock in this way. I am sure it is something I am missing, or perhaps I am not able to remove the z rotation in this way. Thanks! I have added a video of the strange behaviour here [https://github.com/marcusraty/RotationExample/blob/main/Example.MP4) And the code example is here [https://github.com/marcusraty/RotationExample)
0
0
821
Dec ’23
Crash when running custom train step and layers
My environment: Tensorflow: 2.14, tf-metal: 1.1, M3 Max I am working on an GAN full of residual sum and concatenation. It is trained correctly if using CPU only. However, if I enable GPU, it would cause: oc("mps_slice_1"("(mpsFileLoc): /AppleInternal/Library/BuildRoots/d615290d-668b-11ee-9734-0697ca55970a/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm":359:0)): error: 'mps.slice' op failed: length value 32 does not fit within the dimension size (33) with start value (32) /AppleInternal/Library/BuildRoots/d615290d-668b-11ee-9734-0697ca55970a/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphExecutable.mm:2133: failed assertion `Error: MLIR pass manager failed' Some customization I guess might be related to the error: tf.bitwise.bitwise_xor, tf.concat, tf.pad in custom layers numpy.random in train steps. Another debug hint I found is that the "32" is the number of channel of my models' conv layer, and change as I change the number of channel. Is there anyone know what is wrong? Thank you so much
1
1
491
Dec ’23
GPTK on Apple TV
I did not know that you can also get GPTK when you're working on an AppleTV app. I'm getting back into game programming so I booted up an app I installed on my AppleTV a few months ago and the display showed GPTK so I was able to see performance. Drew
0
0
659
Dec ’23
Create CGColorSpace from CFPropertyList
I am trying to create a custom CGColorSpace in Swift on macOS but am not sure I really understand the concepts. I want to use a custom color space called Spot1 and if I extract the spot color from a PDF I get the following: "ColorSpace<Dictionary>" = { "Cs2<Array>" = ( Separation, Spot1, DeviceCMYK, { "BitsPerSample<Integer>" = 8; "Domain<Array>" = ( 0, 1 ); "Filter<Name>" = FlateDecode; "FunctionType<Integer>" = 0; "Length<Integer>" = 526; "Range<Array>" = ( 0, 1, 0, 1, 0, 1, 0, 1 ); "Size<Array>" = ( 1024 ); } ); }; How can I create this same color space using the CGColorSpace(propertyListPlist: CFPropertyList) API func createSpot1() -> CGColorSpace? { let dict0 : NSDictionary = [ "BitsPerSample": 8, "Domain" : [0,1], "Filter" : "FlateDecode", "FunctionType" : 0, "Length" : 526, "Range" : [0,1,0,1,0,1,0,1], "Size" : [1024]] let dict : NSDictionary = [ "Cs2" : ["Separation","Spot1", "DeviceCMYK", dict0] ] let space = CGColorSpace(propertyListPlist: dict as CFPropertyList) if space == nil { DebugLog("Spot1 color space is nil!") } return space }
0
0
485
Dec ’23
Overloaded operator & device memory
Hi, In a metal shader I have a user-defined struct with a square brackets operator. This is a simplified version of it: struct MyData { float data[12]; float operator[](int i) const { return data[i]; } }; I pass a device buffer of that type in a compute kernel function: device const MyData* myDataBuffer Using the operator with a thread-space object works fine: MyData data_object = myDataBuffer[0]; float x = data_object[0]; // ok ..but trying to use it with the device-space buffer fails: float x = myDataBuffer[0][0]; // compilation error No viable overloaded operator[] for type 'const device MyData' Candidate function not viable: address space mismatch in 'this' argument ('const device MyData'), parameter type must be 'const MyData' For other operators I could define the function outside the struct and pass a reference to a device-memory object but the function for the square brackets operator can only be a member function. Am I missing something that could make the above statement compile?
2
0
310
Dec ’23
How do I change the background color of a visionOS immersive space?
In visionOS, once an immersive space is opened, the background color is solid black. How do I change this? I just need to set a static color without any shading, but I can't find any documentation or examples on how to do this, and the template that comes with Xcode 15.1 beta 3 doesn't change the background color. I've searched around for information, but all I can find points back to MTKView.clearColor, which I can't use when drawing into an immersive space, since immersive spaces on visionOS use Compositor Services and not MTKView or CAMetalLayer for drawing 3D content.
2
0
871
Dec ’23
iOS 16 & 17 touch input stutter on Pro Motion devices. Workaround?
The touch input stutter issue that exists since iOS 16 on devices with Pro Motion Displays has not been fixed yet. I filed a bug report in July but there isn't any progress since months. I see the problem in all games I tried. My game is fast paced so the stutters are quite obvious and I receive a lot of complaining emails. My game did run smoothly on Pro Motion devices with iOS 15. Is there a known workaround? I am seeing other developers having the same issue but I can't find any solutions. Other threads about this issue: IPhone 14 Pro stuttering in most games when using touch controls FPS drops when tapping the screen on iPhone 13 Pro Max
0
0
685
Dec ’23
MTLVertexDescriptor's offset -- everybody's doing it wrong
In pretty much every Metal tutorial out there, people use MTLVertexDescriptor like this: they create a struct like struct Vertex { var position: float3 var color: float3 } then a vertex array and buffer: let vertices: [Vertex] = ... guard let vertexBuffer = device.makeBuffer(bytes: vertices, length: MemoryLayout<Vertex>.stride * vertices.count, options: []) else { ... } This is all good, we have a buffer with interleaved position and color data. The problem is, when creating a vertex descriptor, they use MemoryLayout<float3>.stride as the offset for the second attribute: let vertexDescriptor = MTLVertexDescriptor() vertexDescriptor.attributes[0].format = .float3 vertexDescriptor.attributes[0].offset = 0 vertexDescriptor.attributes[0].bufferIndex = 0 vertexDescriptor.attributes[1].format = .float3 vertexDescriptor.attributes[1].offset = MemoryLayout<float3>.stride // <-- here! vertexDescriptor.attributes[1].bufferIndex = 0 vertexDescriptor.layouts[0].stride = MemoryLayout<Vertex>.stride This does not look correct to me. The code happens to work only because the stride of SIMD3<Float> (a.k.a. float3) matches the alignment of the fields in this particular struct. But if we have something like this: struct Vertex { var attr0: Float var attr1: Float var attr2: SIMD3<Float> } then the naive approach of using stride won't work. Because of padding, attr2 does not start right after the two floats, at offset 2 * MemoryLayout<Float>.stride but at offset = 16. So it seems to me that the only correct and robust way to set the vertex descriptor's offset is to use offset(of:), like this: vertexDescriptor.attributes[2].offset = MemoryLayout<Vertex>.offset(of: \.attr2)! Yet, I'm not able to find a single code example that does this. Am I missing something, or is everybody else just being careless with their offsets?
0
0
290
Dec ’23
Seeking Clarification on UsdPrimvarReader Node Functionality
Hello fellow developers, I am currently exploring the functionality of the UsdPrimvarReader node in Shader Graph Editor and would appreciate some clarification on its operational principles. Despite my efforts to understand its functionality, I find myself in need of some guidance. Specifically, I would appreciate insights into the proper functioning of the UsdPrimvarReader node, including how it should ideally operate, the essential data that should be specified in the Varname field, and the Primvars that can be extracted from a USD file. Additionally, I am curious about the correct code representation of a Primvar in USD file to ensure it can be invoked successfully. If anyone could share their expertise or point me in the right direction to relevant documentation, I would be immensely grateful. Thank you in advance for your time and consideration. I look forward to any insights or recommendations you may have.
1
0
606
Dec ’23