Hi,
I was looking at the documentation for Metal and saw there are 3 instance methods for creating a Metal buffer:
makeBuffer(length:)
makeBuffer(bytes:, length:)
makeBuffer(bytesNoCopy:, length:)
Though, I was wondering what the purpose is of using the bytes alternative when the bytesNoCopy method exists. Especially when working within the unified memory model of the iPhone and newer Mac models.
I would assume the noCopy method has less overhead since it just wraps an existing contiguous memory block, while the normal bytes version creates a full copy (and thus, more overhead?).
Is there a simple answer for them both existing, or could you point me to some documentation explaining their difference in greater detail than the Apple developer docs?
Thanks in advance!
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi!
I'm currently trying to convert this Objective-C example project ( https://developer.apple.com/documentation/metal/performing_calculations_on_a_gpu?language=objc ) to one using the metal-cpp wrapper.
However when I make the MetalAdder class extend NS::Object (just like in the original codebase) it removes my constructor.
class MetalAdder : public NS::Object{ ... } is what I have.
When I instantiate this MetalAdder class as:
MetalAdder adder;
adder.initWithDevice(device);
or
auto adder = NS::TransferPtr(new MetalAdder);
I get the error Call to implicitly-deleted default constructor of 'MetalAdder'.
Is there something I'm doing wrong? Should I instantiate in a different way or should my MetalAdder class just not extend the NS::Object class?
Thanks in advance!