Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp MSAA images and render passes. #816

Closed
floooh opened this issue Apr 3, 2023 · 2 comments
Closed

Revamp MSAA images and render passes. #816

floooh opened this issue Apr 3, 2023 · 2 comments
Assignees

Comments

@floooh
Copy link
Owner

floooh commented Apr 3, 2023

This brings the API closer to Metal and WebGPU and addresses a couple of long-standing issues:

  • remove the hidden 'msaa vs resolve' magic in sg_image and sg_end_pass()
    • the msaa-resolve texture is no longer implicit part of an sg_image with sample_count > 1, instead the msaa and resolve textures are now separate sg_image objects
    • sg_pass_attachment_desc gets a separate resolve image entry, if this is present, an MSAA resolve will be performed in sg_end_pass() => NOTE: depth/stencil attachments cannot be MSAA-resolved (see WebGPU spec), for color attachment resolve, there will be a separate sg_pass_desc.resolve_attachments[] array.
  • sg_action is split into sg_load_action and sg_store_action, where sg_store_action only contains dontcare and store (this is similar to WebGPU, but not similar to Metal - e.g. the Metal store actions 'resolve' and 'resolve-and-store' are implicit by the presence or absence of a resolve attachment
  • depth/stencil image objects should now be regular textures in the GL backend (if this means dropping WebGL support, so be it)

...optional: get rid of baked pass objects completely? It's unclear whether would actually still be needed even with a Vulkan backend in place. => still a good idea in the GL backends, because framebuffer setup is pretty elaborate.

Related issues and PRs:

Also see:

@floooh floooh self-assigned this Apr 3, 2023
floooh added a commit that referenced this issue Apr 3, 2023
Excplicitly sets MTLStoreActionStore on offscreen depth/stencil
surfaces, not great from perspective point of view, but addresses
#815.

Also see #816 for a proper
cleanup proposal.
This was referenced Apr 26, 2023
@floooh
Copy link
Owner Author

floooh commented May 8, 2023

UPDATE: Fixed in the recent master branch commits, the NSOpenGLContext generally wasn't active inside event handlers.

The new _sg_gl_create_image() now crashes in the mrt-sapp sample when resizing the window because glGenTexture() fails to create a texture, wtf?

=> more things wrong, in the webgl2 version the sokol-gfx validation triggers for trying to bind an MSAA image as texture (this was an actual bug)

...this seems to be a separate issue, also happens on the master branch... need to bisect whether this is a sokol-gfx GL backend regression, or a macOS problem (the SAPP_EVENTTYPE_RESIZED event is called from within the NSOpenGLView.reshape method, maybe there's not GL context bound in this function => the glGenTextures function which fails is the first GL function in that code path).

@floooh
Copy link
Owner Author

floooh commented May 19, 2023

PR: #834

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant