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

Support for cubemap arrays #1040

Open
mothfuzz opened this issue May 5, 2024 · 1 comment
Open

Support for cubemap arrays #1040

mothfuzz opened this issue May 5, 2024 · 1 comment

Comments

@mothfuzz
Copy link

mothfuzz commented May 5, 2024

Just a proposal, but how hard would it be to add support for cubemap arrays as an image/sampler type?

I noticed if I write textureCubeArray in glsl, then sokol-shdc will compile it just fine to the correct equivalent in each backend, the only issue is that the Image Type is INVALID in the sokol glue code, and obviously there's no way yet to specify a cube array in sokol's current sg_image_desc.

I only have first-hand experience with OpenGL and WebGPU, I've never touched DirectX or Metal else I'd try to add it myself in a PR. I'm not sure what it would take to add cube arrays to the existing texture loading/binding functions, or how much work it would be for each backend. I have done some cursory research on the different APIs, and I'm certain they all have roughly similar support for the feature - minus WebGL which would require a way to simply ignore the feature, or instead implement a workaround (such as using a texture array of size N*6 with a manual lookup function added to the shader).

On a pragmatic note, cubemap arrays are pretty much the only real way to implement shadow mapping for multiple point lights in a single pass. To say nothing of things like baked environment maps or light probes or other similar things that make use of several cubemaps at once, which would eat up all the bind slots otherwise.

@floooh
Copy link
Owner

floooh commented May 5, 2024

Yeah would make sense. They're definitely not supported in WebGL2, but now that WebGPU is "around the corner" it's not such a big deal as a couple of years ago to have features that don't work on WebGL (they wouldn't be emulated, but simply not supported, e.g. there would need to be a feature flag in sg_features).

No promises on a timeline though :)

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

No branches or pull requests

2 participants