Error reading from a texture using Metal

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
jwwalker
Goblin
Posts: 224
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 17
Contact:

Error reading from a texture using Metal

Post by jwwalker »

I'm trying to read back the color buffer from a window and use that as an input to a Material, and I get a Metal assertion failure:

Code: Select all

failed assertion `Draw Errors Validation
Fragment Function(main_metal): Shader reads texture (colorMap[1]) whose usage (0x04) doesn't specify MTLTextureUsageShaderRead (0x01)

How can I get a texture that does specify MTLTextureUsageShaderRead?

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Error reading from a texture using Metal

Post by dark_sylinc »

I don't know how well that will work (normally we don't support sampling from the window; it's unsupported on GL3+ and in Vulkan you have to check support and request it*; and in D3D11 I don't remember).

According to Metal's documentation you'll need to set mMetalLayer.framebufferOnly = NO; which can be done in OgreNext by calling window->setWantsToDownload( true );

*Which we don't

jwwalker
Goblin
Posts: 224
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 17
Contact:

Re: Error reading from a texture using Metal

Post by jwwalker »

So, is this because of special properties of a window? That is, if I render to an offscreen texture, I should be able to then use it as an input to a shader?

Post Reply