Post

Replies

Boosts

Views

Activity

Reply to Xcode defaults ARC to off. CMake-based builds leak large amounts of memory.
CMake says this needs to be fixed by Xcode team, and Xcode teams says the issue needs to be fixed by CMake. So until one side fixes this, I'll continue to use the workaround. But I let the CMake team know the response here. Defaulting ARC to off in a newly create xcodeproject seems incorrect for modern builds, and just having the GUI creation templates override the default value seems like a poor workaround to the underlying problem.
Feb ’21
Reply to Does MTLBlitEncoder allow uploading more than one array texture per call?
I already have an entire level of the array texture loaded into the buffer with a single memcpy. The way KTX and KTX2 store data is an entire level of the same mip size are stored together. I can upload them all at once in GL, so why not in Metal? There should be no iteration on a blit encoder. I should be able to upload 2048 array layers at 1x1 or 2x2 each in a single call., but there is no call in Metal from what I see. I think this would be a big improvement to the MTLBlitEncoder. I shouldn’t have to upload faces, arrays, slices one a time. For mips yes, I can iterate but that count is much less than the array count.
Feb ’21
Reply to Does MTLBlitEncoder allow uploading more than one array texture per call?
Here's the most basic op on a 2d array, where in GL one can easily specify all the array layers. This is going up the mip chain in one call for each mip, not each mip x each layer. Metal should offer the same ability. The buffer can then be twiddled to the private texture as needed. Here's a ticket on it. https://feedbackassistant.apple.com/feedback/9009192 See the Khronos wiki page on Array Textures, since I can't include the link. glBindTexture(GL_TEXTURE_2D_ARRAY, tex); glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, format, width, height, num_layers, ...); glTexImage3D(GL_TEXTURE_2D_ARRAY, 1, format, width/2, height/2, num_layers, ...); glTexImage3D(GL_TEXTURE_2D_ARRAY, 2, format, width/4, height/4, num_layers, ...);
Feb ’21
Reply to Accelerate simd library isn't complete for C++/ObjC/ObjC++
I think for now, we'll just offer some simpler functional ctors. Seems like for ObjC bridging and all that these typedefs can't be derived from. It just means our vector ops can't use any member functions, they all have to be functional constructs. We can derive and provide members on the matrix types since those are struct { float3 }. This includes the operator[] and a non-initializing ctor. All the float3x3/4x4 ctors init the columns in the void ctor which is safer, but often unnecessary work that simd_float3x3/4x4 don't do. float3 float3m( float a ) { return {a,a,a}; } float3 v = float3m(3.0f); - { 3, 3, 3 } - using function and discouraging float3 v = { 3.0f }; - { 3, 0, 0 } - avoid, this is most dangerous construct of this library, doesn't match MSL or most vecmath libs v = normalize(v); -v.normalize() can't use members v = float3_zero - float3::zero can't use class constants
Mar ’21
Reply to Accelerate simd library isn't complete for C++/ObjC/ObjC++
Also noticing many of the oft-used routines like matrix transpose only have SIMD paths for SSE. Do the Neon paths on these go to scalar or simd ops? static simd_float2x2 SIMD_CFUNC simd_transpose(simd_float2x2 __x) { #if defined __SSE__ - why no Neon path?   simd_float4 __x0, __x1;   __x0.xy = __x.columns[0];   __x1.xy = __x.columns[1];   simd_float4 __r01 = _mm_unpacklo_ps(__x0, __x1);   return simd_matrix(__r01.lo, __r01.hi); #else   return simd_matrix((simd_float2){__x.columns[0][0], __x.columns[1][0]},                 (simd_float2){__x.columns[0][1], __x.columns[1][1]}); #endif } Also there are two abs ops that are a part of AVX512 that are used under __AVX2__ flag. static inline SIMD_CFUNC simd_long2 simd_abs(simd_long2 x) { #if defined __arm64__  return vabsq_s64(x); #elif defined __SSE4_1__ - should be __AVX512F__  return (simd_long2) _mm_abs_epi64((__m128i)x); #else  simd_long2 mask = x 63; return (x ^ mask) - mask; #endif } static inline SIMD_CFUNC simd_long4 simd_abs(simd_long4 x) { #if defined __AVX2__ - should be __AVX512F__  return _mm256_abs_epi64(x); #else  return simd_make_long4(simd_abs(x.lo), simd_abs(x.hi)); #endif }
Mar ’21
Reply to readFromURL only called once on NSDocument-based app for each "Open Recent" menu item
Here's my hack for now. This deletes any existing documents that aren't the current document, but this seems pretty ugly. The docs state the following, but not how to handle once a document URL already has an associated NSDocument. Hence the hack. If you can following any of the flow of commentary in NSDocumentController, then you are wiser than I. /* This will be called for any URLs your application is asked to open. This includes URL types (CFBundleURLTypes) defined in your Info.plist, and Document types (CFBundleDocumentTypes) that have no associated NSDocument class. Document URLs that have an associated NSDocument class will be opened through NSDocumentController. If this is implemented, application:openFiles: and application:openFile: will not be called.  */ (void)application:(NSApplication *)application openURLs:(NSArrayNSURL * *)urls API_AVAILABLE(macos(10.13)); (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)typeName error:(NSError **)outError { ... BOOL isLoaded = [self loadFromURL: url]; if (isLoaded) { NSDocumentController* dc = [NSDocumentController sharedDocumentController];     NSDocument* currentDoc = dc.currentDocument;     NSMutableArray* docsToRemove = [[NSMutableArray alloc] init];     for (NSDocument* doc in dc.documents) {       if (doc != currentDoc)         [docsToRemove addObject: doc];     }           for (NSDocument* doc in docsToRemove) {       [dc removeDocument: doc];     } } return isLoaded }
May ’21
Reply to QLThumbnailProvider doesn't work
I've set the UTI types in the Info.plist and followed all the instructions for setting up the template from the Apple documentation. When it works, this is the output. But I don't think these was generated via my plugin, but via a system generator for .ktx. /Users/Foo/tests/mac/Toof-a.ktx 2021-05-28 10:21:46.623 qlmanage[23586:4236472] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x634b, name = 'com.apple.tsm.portname' See /usr/include/servers/bootstrap_defs.h for the error codes. 2021-05-28 10:21:46.629 qlmanage[23586:4236472] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x650f, name = 'com.apple.coredrag' See /usr/include/servers/bootstrap_defs.h for the error codes. * /Users/Foo/tests/mac/Toof-a.ktx produced one thumbnail Done producing thumbnails 2021-05-28 10:21:46.996 qlmanage[23586:4236472] TISFileInterrogator updateSystemInputSources false but old data invalid: currentCacheHeaderPtr nonNULL? 0, ->cacheFormatVersion 0, ->magicCookie 00000000, inputSourceTableCountSys 0 Keyboard Layouts: duplicate keyboard layout identifier -17410. Keyboard Layouts: keyboard layout identifier -17410 has been replaced with -28673. Keyboard Layouts: duplicate keyboard layout identifier -30769. Keyboard Layouts: keyboard layout identifier -30769 has been replaced with -28674. Keyboard Layouts: duplicate keyboard layout identifier -14934. Keyboard Layouts: keyboard layout identifier -14934 has been replaced with -28675. 2021-05-28 10:21:48.296 qlmanage[23586:4236498] Persistent UI failed to open file file:///var/root/Library/Saved%20Application%20State/com.apple.quicklook.qlmanage.savedState/window_2.data: No such file or directory (2)
May ’21
Reply to QLThumbnailProvider doesn't work
I see the following messages when I turn on the logging trying qlmanage on a .ktx2 file. qlmanage -t /Users/Foo/tests/Toof-a.ktx2 -x QuicklookSatellite extractOptions:142: *** unknown hint identifier 'kCGImageSourceTypeIdentifierHint:public.ktx2' -- ignoring... Will not generate thumbnail from image because it has an incorrect size: (0.000000, 0.000000) com.apple.quicklook.ThumbnailsAgent CGBitmapContextCreateImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. distnoted register name: com.apple.nsquiet_safe_quit_give_reason object: com.apple.quicklook.qlmanage token: 380000003e pid: 31960
May ’21
Reply to QLThumbnailProvider doesn't work
I can see the appex listed in the "Extensions" and it's enabled. And it's sandboxes=d, and the app the appex is inside is sandboxed. I have built versions of the app and plugin in various parts of my drive, but can't QL handle that? Why is it getting confused as to which one to run. I have the one I want QL (and qlmanage) to run in the Applications folder. Then qlmanage just sits there running, and doesn't ever finish. I can quit or kill the app. Sometimes when it does finish, it just says "no thumbnail created". [d ] [u com.foo.app.thumbnailer] [()] detected another plugin with a newer modification date: [u 22C44ECE-8E9A-4D9D-A303-XXXXXXX] [()] [d ] [u com.foo.app.thumbnailer] [()] rejecting; another plugin has precedent: [u 22C44ECE-8E9A-4D9D-A303-XXXXXXXX] [()] Ultimately qlmanage is just sitting there, with the only relevant last message being this timeout. qlmanage: LSExceptions shared instance invalidated for timeout.
Jun ’21
Reply to `assert` in metal?
I also need an assert. The MBP 16" is generating valid uv, with 0 length derivatives and that causes problems. Being able to assert on this condition would help. Drew's recommendation just seems to result in a compilation failure on macOS Big Sur.
Jun ’21
Reply to Metal ClampToZero should be ClampToEdge until uv outside [0,1].
Yes, the problem is that CLAMP_TO_ZERO on a fully opaque 4x4 pixel texture brings down those outer pixels to transparent. So if you were drawing a quad or particles and expected the texture to fill to the edge, then that won't happen. The bilinear filter will pull in those pixels leading to a 3x3 pixel area and a half pixel transparent border around the quad. When magnified this ramp is even more obvious and the black tinting of even premul color looks bad. Switching back to CLAMP_TO_EDGE fixes the issue, but now get stretching of pixels if you try to draw uv outside the [0,1] range.
Jun ’21
Reply to vkCmdDrawIndexedIndirectCount functionality under Metal
So there is no way to emulate multi-draw indirect count There is. But you have to call drawPrimitive or drawIndexedPrimitive multiple times, each one indexing into the next indirect draw in the buffer. I don't know why Metal left the drawCount out of the api, but the current implementation has a drawLimit of 1. Nice thing is indirect draw works back to iPhone 5S. You can even do GPU buffers with compute, and then indirect draw them. But you have to call draw 10 times, even if compute culls and produces 5 results, so make sure to set numInstances to 0 on the remaining draws. Or if you can wait a frame, then you could return a count to the cpu.
Jun ’21