Hi,
My macOS app has an NSScrollView to display an image. The document view is an MTKView. I have a Metal pipeline that renders the image and draws it into the view. The view supports "pinch and zoom" scaling. I set the view's drawableSize to be the size of the scaled data, and that works.
The problem I have is that when the image is zoomed in to a large size, I get:
MTKView's underlying texture is now exceeding the GPU RAM. This happens even if I don't draw anything into the drawable.
Is there a way I can get the functionality of the scroll view (i.e. scroll bars, response to mouse/touch) while still using a MTKView? A few thoughts:
Thanks!
My macOS app has an NSScrollView to display an image. The document view is an MTKView. I have a Metal pipeline that renders the image and draws it into the view. The view supports "pinch and zoom" scaling. I set the view's drawableSize to be the size of the scaled data, and that works.
The problem I have is that when the image is zoomed in to a large size, I get:
Code Block validateTextureDimensions, line 1081: error 'MTLTextureDescriptor has width (18798) greater than the maximum allowed size of 16384.'
MTKView's underlying texture is now exceeding the GPU RAM. This happens even if I don't draw anything into the drawable.
Is there a way I can get the functionality of the scroll view (i.e. scroll bars, response to mouse/touch) while still using a MTKView? A few thoughts:
Can I fix the size of the actual MTKView while "tricking" NSScrollView into thinking it was larger?
Can I make the document view large but draw into the visible (clipped) portion?
Is CATiledLayer an option? I could manage the Metal textures, but how would I draw them into the tiles?
Or another recommended option?
Thanks!