Also when I specify pasteboardOptions, then folder drops stop working. I need to be able to drop files and folders. Are there any modern samples of using the clipboard? The docs Apple publishes on clipboard handling are from 2010.
NSArray<NSString *>* pasteboardTypes = @[
// don't really want generic urls, but need folders to drop
//NSPasteboardTypeURL
// this is preventing folder drops ?
NSPasteboardTypeFileURL
];
// added for drag-drop support
[self registerForDraggedTypes:pasteboardTypes];
// ktx, ktx2, png, and dds for images
// zip, metallib
// gltf, glb files for models
NSArray<NSString*>* utis = @[
[UTType typeWithFilenameExtension: @"png"].identifier,
[UTType typeWithFilenameExtension: @"ktx"].identifier,
[UTType typeWithFilenameExtension: @"ktx2"].identifier,
[UTType typeWithFilenameExtension: @"dds"].identifier,
[UTType typeWithFilenameExtension: @"zip"].identifier,
[UTType typeWithFilenameExtension: @"metallib"].identifier,
#if USE_GLTF
[UTType typeWithFilenameExtension: @"gltf"].identifier,
[UTType typeWithFilenameExtension: @"glb"].identifier
//@"model/gltf+json",
//@"model/gltf+binary"
#endif
];
NSDictionary* pasteboardOptions = @{
// This means only these uti can be droped.
NSPasteboardURLReadingContentsConformToTypesKey: utis
// Don't use this it prevents folder urls ?
//, NSPasteboardURLReadingFileURLsOnlyKey: @YES
};
- (NSDragOperation)draggingEntered:(id)sender
{
if (([sender draggingSourceOperationMask] & NSDragOperationGeneric) ==
NSDragOperationGeneric) {
NSPasteboard* pasteboard = [sender draggingPasteboard];
bool canReadPasteboardObjects =
[pasteboard canReadObjectForClasses:@[ [NSURL class] ]
options:pasteboardOptions];
// when this fails, toss the pasteboardOptions
// like when I drag folders
if (!canReadPasteboardObjects) {
canReadPasteboardObjects =
[pasteboard canReadObjectForClasses:@[ [NSURL class] ]
options:@{}];
}
// don't copy dropped item, want to alias large files on disk without that
if (canReadPasteboardObjects) {
return NSDragOperationGeneric;
}
}
// not a drag we can use
return NSDragOperationNone;
}
Post
Replies
Boosts
Views
Activity
I use BC7 textures fine on Intel and M1 systems. But these are 2018 MBP with AMD and Intel parts.
One problem with KTX files is that each mip level has a 4 byte length. This messes up the upload of data, and Metal typically wants 16B alignment of each mip level. Metal validation should flag that.
If you are doing a memcpy then that may not be the issue. I was originally trying to mmap uncompressed ktx files when I hit this issue.
Okay, I tracked this down. The project setting for "Precompile prefix header" was being overridden with "No" by both targets. Now the build takes 11s to parse instead of 78s. So precompiled headers are still a huge win.
So I renamed the file to AppPrefix.h, designated that as the both GCC_/CPP_PREFIX_HEADER. Removed all explicit includes of AppPrefix.h in the sources. And that file is getting prepended onto every compile. It's just not being precompiled. I can see the same files parsed over and over. Is it that stl type template headers must be re-parsed regardless of the pch setting?
Seems like on arm64 builds all Xcode does is prepend the file to each file, and doesn't bother to do the precompile. Does clang not support pch. I even renamed the file to AppPrefix.pch which still works, but with no precompile.
Also how do CPP_PREFIX_HEADER and GCC_PREFIX_HEADER differ? This is a C++ project, so I tried setting both. But I don't see any output lines with my App.pch file. I even renamed it to AppPrefix.pch, and still don't see that text in the output.
Even putting garbage into the .pch file still succeeds on the build. This is latest Xcode on an M1. Is Xcode just ignoring these directives?
Just use the spriv tools to generate your reflection data. It's a shame that Apple's MSL can't output spir-v. So then end up having to write everything in HLSL or GLSL.
I'd recommend using reverseZ and infiniteFar plane. There are plenty of online resources for this.
I don't see anything in the build output that indicates that the pch was compiled and used. And the build timings aren't any faster. -ftime-trace shows the same header file being parsed as used again and again, adding up to a large overall time.
Also the microscopic single color super-thin display of the signposts in Instruments is really not that helpful. This should be displayed as a real flame chart. We'll keep using Perfetto for now.
Apple's OpenGL 4.1 lacks BC6/7, compute, validation layers, and glClipControl, and much more. So if you're still using OpenGL, then good luck.
Sorry, you'll have to buy a Mac. Then you can install Windows on Bootcamp if it's Intel based, but not if it's M1 based. We dev games on all platforms using Parallels VM.
There are no armv9 parts from Apple yet. it's all arm64e/arm64 which are variants of ARMv8 I think. What's nice is fp16 conversions and other features often missing from Android are present.
Fastest method is to use Neon vcvt_f32_f16 and vcvt_f16_f32. Intel also has ops for f16c extension, but note that Rosetta2 doesn't support emulated AVX for f16c.
Also seems like one of the main reasons to switch to C++20 isn't implemented either - C++20 modules. So I can't seem to still use clang modules, and can't switch to C++20 modules.
This is all fine, but C++20 modules don't apply to Objective-C and C++ libraries. Would be nice to just have this work, so interop continues to work. I had to go through and replace all @import usages with #import.