Giter VIP home page Giter VIP logo

Comments (10)

mellinoe avatar mellinoe commented on August 23, 2024

I believe I have a fix here: 6517a4d

It was simpler than my previous guess, so there's always the possibility that I'm missing something.

    if (_isDepthStencilClear) {
        _rpsKey.enable(kMVKAttachmentFormatDepthStencilIndex);
+       _rpsKey.attachmentMTLPixelFormats[kMVKAttachmentFormatDepthStencilIndex] =_image->getMTLPixelFormat();

from moltenvk.

mellinoe avatar mellinoe commented on August 23, 2024

Never mind, the above fixes one issue, but there seem to be at least one more in the vicinity. Without my patch above, calling vkCmdClearDepthStencilImage actually gives this validation error:

-[MTLRenderPipelineDescriptorInternal validateWithDevice:]:2400: failed assertion `No valid pixelFormats set.'

Obviously, setting the attachments's pixel format fixes it.

There's some other issue which causes the problem in the issue title, but it seems related as it's in the same function.

from moltenvk.

csmartdalton86 avatar csmartdalton86 commented on August 23, 2024

I'm having the same issue:

-[MTLRenderPipelineDescriptorInternal validateWithDevice:]:2400: failed assertion `No valid pixelFormats set.'

With extended validation I get:

validateAttachmentOnDevice:248: failed assertion `PixelFormat MTLPixelFormatStencil8 is not color renderable'

Any luck on finding a solution?

from moltenvk.

mellinoe avatar mellinoe commented on August 23, 2024

I believe the No valid pixelFormats set problem is fixed by #161.

The PixelFormat xyz is not color renderable problem is still happening for me, even on master. Luckily, it's just a debugger validation error, and I don't notice any major rendering artifacts.

from moltenvk.

csmartdalton86 avatar csmartdalton86 commented on August 23, 2024

#161 fixes several issues we were having with stencil buffers. Thank you @mellinoe !

I wonder if this issue can be closed now?

from moltenvk.

mellinoe avatar mellinoe commented on August 23, 2024

I believe there's still a bug here somewhere, but unfortunately I haven't had time to debug through everything since a week ago.

When clearing a depth image, MoltenVK seems to use a synthetic render pass (with the appropriate clearing properties set). That synthetic render pass seems to have an issue where it attaches the depth image as a "color target", but with the format set to MTLPixelFormatDepth16Unorm (or whatever other depth format is in use). That triggers the "PixelFormat xyz is not color renderable" error mentioned above. Based on that, I don't think the problem should be too hard to fix, but it was taking me a while to debug through that process, and I gave up after #161 fixed all of my "critical" (aka app-crashing) problems.

There might be more to the issue, but the above is what I learned from my last debugging session.

from moltenvk.

billhollings avatar billhollings commented on August 23, 2024

@mellinoe

Thanks for all your work on this. Is there anything left to work on here? Can we close this issue?

from moltenvk.

mellinoe avatar mellinoe commented on August 23, 2024

@billhollings The validation error I described above is still happening whenever my app is run under the Xcode debugger. Despite that, I don't see any rendering artifacts or experience any other crashes when running outside the debugger. Does the description I wrote above make any sense, particularly the part about the synthetic render pass used for image clearing operations?

from moltenvk.

billhollings avatar billhollings commented on August 23, 2024

Fixed in PR #181. Please retest and close.

Further clearing enhancements are under development and will be released soon...but the basic depth clearing should be working now...with no Metal validation errors.

from moltenvk.

mellinoe avatar mellinoe commented on August 23, 2024

Yes, after updating I am completely error-free. Thanks for the fix.

from moltenvk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.