Make MTLContext more extendable
OskarGroth opened this issue · 4 comments
I want to create a texture from a CGImage
. Great, MTLContext
has a method for that:
Lines 75 to 78 in 56c46ca
But I want to specify custom storageMode
, which the current function doesn't support. Okay, so I'll make an extension on MTLContext
to add this functionality. Unfortunately, that is not possible because MTKTextureLoader
being private on MTLContext
. Now I'm forced to create my own MTKTextureLoader
alongside my already existing MTLContext
and get less of the benefit of using MTLContext in the first place.
Maybe it's a small thing, but it would be nice if MTLContext
could be optimized for extendability by making its MTKTextureLoader
public. What do you think?
Honestly I just didn’t know MTKTextureLoader allows to customize storage mode, if it does, the it is basically a bug that MTLContext does not have this argument in this method
Oh yeah I just checked and it really does provide this option. For some reason I was sure MTKTextureLoader
only supports shared storage.
I think we should add all proxy methods of MTKTextureLoader
to MTLContext
, like we did with MTLDevice
and MTLCommandQueue
. @eugenebokhan what do you think?
In regards of making it public, I think we can do that too also?
@s1ddok I like the idea, its going to be consistent with our current approach. Maybe I'll do the corresponding PR soon.
@OskarGroth I've addressed this in latest release (0.16.2), by making texture loader public. We will proceed with the API additions shortly. Thanks for raising the issue!