Post

Replies

Boosts

Views

Activity

Reply to Does Metal on iOS do async compute by default?
My understanding is that MTLFence don't work across command buffers. That's so you don't get a race on a resource that is changed within a command buffer. So when you go to untracked resources, Metal stops injecting fences for you. You said you had two command buffers. MTLEvent for cross command buffer, and MTLSharedEvent for synchronization across command queues, but few people do that.
Mar ’23
Reply to Why can't MSL cast float4x4 to float3x3?
Since there are never any responds to posts to the forums. I'll just post the solution for now. This is less than ideal, since it creates a whole new matrix, when a cast should be fine and is in HLSL. Neither cast not construction works directly from a float4x4/half4x4, but this does. inline float3x3 tofloat3x3(float4x4 m) { return float3x3(m[0].xyz, m[1].xyz, m[2].xyz); } inline half3x3 tohalf3x3(half4x4 m) { return half3x3(m[0].xyz, m[1].xyz, m[2].xyz); }
Mar ’23
Reply to OpenGL on future iPhones and Macs?
GL and ES are all dead everywhere. Vulkan has supplanted them on Android/Windows/Linux. ES 3.2 and GL 4.6 is probably the last version. On macOS, you only have GL4.1 which lacks compute, glClipControl, error callbacks, BC6/7 support, and much more. You can still use GL on M1, but it is emulated atop Metal. So it's time for devs to move on.
Mar ’23
Reply to Tile Rendering in Metal
You have to tile it yourself, or use one of Apple's tiling classes. UIKit has some of these. But handling blurs across tiles isn't fun. The M1/iOS hw is TBDR, so it's further tiling up the image into 32x32 tiles, and only drawing elements within. So that is how you reduce bandwidth. Otherwise, you need a dirty rect system. The sparse texture is mostly for reading textures. Like in game, having a megatexture, and only pulling int tiles that were needed to display. It's also only on A13 and higher.
Mar ’23
Reply to What does it mean when there are two rows of shaders in Metal performance graph?
There are multiple CUs processing both Vertex and Fragment work. So that's what you are seeing the capture. You really shouldn't have one draw per command buffer. You should have one (or a small number of command buffers) that are enqued in the order you want the queue to process them in, and then use a series of render passes on the command buffer to submit draws that pertain to a particular set of render targets. The encoders of the render passes will run in sequence within a command buffer, but command buffers are allowed to execute out of order if there are no dependencies. CommandBuffers aren't cheap.
Mar ’23
Reply to Xcode lacks syntax highlighting in editor for .metal files
I finally got the dummy project to print warnings/errors from running the CLI tool. Quinn had posted a message 7 years ago on the forums, but printf needs the following format. This doesn't fix the lack of syntax highlighting, but at least does provide error clickthrough. /AbsolutePath/filename.metal:12: error: mesage /AbsolutePath/filename.metal:12: warning: mesage Log_Error("%s:%d: %s: %s\n", m_fileName, m_lineNumber, isError ? "error" : "warning", buffer);
Mar ’23
Reply to Xcode lacks syntax highlighting in editor for .metal files
I added a dummy xcodeproject and add the files to that project and even that doesn't help. I use the syntax highlighting for metal even though I have source hlsl files. These have u/int, float, half elements that are valid MSL types. These should be highlighted but are not. It's like Xcode tries to parse them as MSL, but fails, and then doesn't highlight anything. Syntax highlighting should be simple name lookup and coloring at a basic level. It shouldn't need complex parsing. Also the plugin architecture for the editor seems undocumented, but there are few brave souls that reverse engineered it for lua/typescript. A code editor shouldn't be this hard to use and extend.
Mar ’23