Post

Replies

Boosts

Views

Activity

Xcode lacks syntax highlighting in editor for .metal files
I have MSL .metal files generated by a parser that go into a blue reference folder. Xcode barely highlights "half" and "return" in purple and nothing else. .metal files that are included in project have blue and other highlights. It's also quite limiting that VSCode has hlsl and a metal plugin, but Xcode doesn't syntax highlight my source HLSL files that I generate the .metal files from. This is quite common to go from HLSL or spirv back to MSL, since there is no path from MSL to spriv.
5
0
1.2k
Mar ’23
xcode 14.1 displays all characters from fixed char[256] array.
char str[256] = {}; strcpy(buffer, "unknown"); Shows up in the debuggre as unknown\0\0\0\0\0\0\0\0\0\0\0.... This holds a simple 7 character string, but Xcode insists on displaying all 256 characters even past the \0. That's the "Default" setting. "Show as c-string" doesn't help either, but should only display up to the end of the string. Can this go back to the way it was before?
0
0
481
Mar ’23
Why is there no UTI for gltf/glb/metallib files?
I need to be able to drop these onto my app kram. But using the UTType library reports the following: metallib - "application/octet-stream" gltf - "model/gltf+json", glb - "model/gltf+binary"  [UTType typeWithFilenameExtension: @"metallib"].identifier,    [UTType typeWithFilenameExtension: @"gltf"].identifier,  [UTType typeWithFilenameExtension: @"glb"].identifier dyn.ah62d4rv4ge8043pyqf0g24pc, // ick - metallib dyn.ah62d4rv4ge80s5dyq2,    // ick - gltf dyn.ah62d4rv4ge80s5dc     // ick - glb  ```
2
0
760
Oct ’22
RenderPassDescriptor fails for VS input/output only
I have a shader that sets rasterizationEnabled to NO on the MTLRenderPipeline. It's essentially using a vertex shader to do compute. This vertex shader reads vertex buffer data, and writes out to another buffer from within the same shader. The problem is I don't know how to correctly wrap this in a render pass. The MTLRenderPass creation from a MTLRenderPassDescriptor complains that no width/height/format or renderTarget/depth is set on this pass. But it's not dependent on rasterization or render textures. What is the correct way to specify the enclosing RenderPass to Metal?
0
0
529
Aug ’22
Apple's STL basic_string slows C++ builds
I've been looking at C++ build times with Xcode. The Apple STL library for basic_string auto-instantiates basic_string for 5 types into all files that include it. I'm trying to use alternate STL libraries like EASTL and FASTL which have their own string types, but have to mix in the following types where there are holes. 1. <mutex>, <condition_variable>, <thread> include <system_error> which includes <string> 2. <random> includes <string>. So these slow the build even if header are precompiled, but creates 5x versions of basic_string in char, char8_t, char16_t, char32_t, and wchar_t flavors into every file that happens to include this even indirectly through the headers above. I only use string and basic_string<char> with utf8 data anyhow. I don't need the other 4 types. How can this be improved?
0
0
534
Aug ’22
How to setup precompiled headers in Xcode for C++?
Does this setup seem correct to get precompiled headers? When I look at the file compile times they're way too long, like it's not using the pch. App.pch file, I set #include "MyConfig.h" Then in Build Settings: GCC_PREFIX_HEADER = pathto/App.pch GCC_PRECOMPILE_PREFIX_HEADER = YES Force include of a header. This avoids needing to include the header first in every file. -include MyConfig.h or should it be? -include App.pch
4
0
2.1k
Aug ’22
ETC2 not supported as 3d texture format on M1
Is this a new development? I have a texture viewer that I develop, and Metal is failing to create a texture for ETC2_RGBA textures when the type is a 3D texture. 2d, cube, and 2d array seem to have support. Are other ETC2 textures preserved as compressed textures in the L1, or are these being decompressed?
0
0
493
Jul ’22
How does Apple Silicon interpolate fp16 inputs/outputs?
I'm hoping the answer here is that the fp16 values get written out to the parameter buffer to save space on TBDR, but then the gpu promotes them back to fp32 for interpolation, and then back to fp16 for the receiving fragment shader. This would then work around banding if the output and interpolation was done in fp16 math like on Android. There is no documentation that I've found on this, or even on the PowerVR documentation about their gpu.
0
0
610
Jun ’22
Xcode "Issue Navigator" shows stale errors and warnings
For as long as I've used Xcode, the Issue navigator shows stale errors and warnings even after the build is completely building and executing. It would be nice to have a way to retain file warnings without having to set "warnings as errors", but here the problems have already been fixed. Also need a "Reveal in Report Navigator" since half the time these errors/warnings lack 90% of the info needed to actually fix them. There's already a "Reveal in Project Navigator" that is almost never needed.
4
2
2.6k
Jun ’22
All Objective-C++ code breaks when setting C++20
I'm trying to update all my projects to C++20. The C++ only projects work fine. All the Objective-C++ files, though, suddenly stop compiling. Is this supposed to work. I can't imagine [NSString stringWithUTF8String:foo] should be failing. Setting the project back to C++17 works. I do have -fmodules and -fcxx-modules for clang modules in some projects. Do those all need to be removed for C++20 modules?
4
0
1.7k
May ’22
Non-standard pthread_setname_np can't set thread name from other threads.
All major platform pthread APIs except for Apple, provide a pthread_setname_np call that takes a pthread_t handle as the first argument. Even pthread_getname_np takes a pthread_t handle. But Apple, only allows setting the name from within the thread. This means std::thread abstractions in C++ can't or don't provide a reasonable call to set or change the thread name from another thread. pthread_setname_np(pthread_t thread, const char* name); <- standard api pthread_setname_np(const char* name); <- Apple's api Could this be standardized? Given that [NSThread setName:] exists and can perform this function, there must be a way to perform this.
0
0
1.2k
May ’22
NSTableView doesn't gap vertically from top
I have an scrolling NSTableView that has an isFlipped MTKView as the parent. No matter how I set the growth constraints, frame.y (which seems to offset from bottom left still) or adjust the height, I can't get a gap from the top. I have a hud that this then clobbers over. I want to offset from the top-left so this doesn't happen. What is the magic to do this?
1
0
591
Apr ’22
Hidden NSTableView shows vertical scrollbar and responds to gestures
This must be a bug in NSTableView, but when I hide the view, the NSScroller shows its scrollbar moving through an empty list and still responds to vertical gestures. Since this is over a view that already handles panning, this causes a giant deadzone where the table was displayed and vertical panning stops on that section of the view because the table view is intercepting it. All I do is supply an NSTableViewDelegate. The autohide property is set on the scrollers. This should not be responding to gestures either.
3
0
817
Apr ’22
MTKView on macOS is printing CVDisplayLink strings on M1
How do I suppress these strings? These are flooding my logs when I hit pause/resume. These seem to have been left in the debug/release builds. I'm on Xcode 13.1, and building for macOS 10.15. But I'm running on an M1 mac. 2022-02-26 12:56:43.169437-0800 app[96801:1760817] [] [0x1238a0000] CVDisplayLinkStart 2022-02-26 12:56:43.169584-0800 app[96801:1760817] [] [0x1238a0020] CVDisplayLink::start 2022-02-26 12:56:43.169772-0800 app[96801:1761488] [] [0x6000029f6bc0] CVXTime::reset 2022-02-26 12:56:43.926183-0800 app[96801:1760817] [] [0x1238a0000] CVDisplayLinkStop
2
0
613
Feb ’22