Skip to content

Add support to return the number of created mip levels #245

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

Merged
merged 2 commits into from
Jan 28, 2021

Conversation

cabanier
Copy link
Member

@cabanier cabanier commented Jan 28, 2021

Copy link
Member

@toji toji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks!

I was weighing the pros/cons of this approach vs advertising a maxMipLevels and erroring if the developer requests more, and I don't think there's a significant difference either way. That approach would surface errors earlier, and they'd be WebXR errors rather than WebGL errors, but I don't think that actually makes much difference? Neither approach prevents developers testing on a system that support a full mip chain from accidentally writing code that errors on systems that don't.

The most common scenarios I see happening are: developer calls gl.generateMipmap() which does the right thing automatically no matter mow many mip levels there are, or they do a for loop through each level to upload something. In that case if we provide the mipLevels on the layer itself they're more likely to use that, which would offer some slight protection from error cases. (And in WebGL if you try to upload to mip levels that don't exist it'll just error but not fundamentally break anything. WebGPU will be trickier in this regard.)

So all of that is a long way of saying: This approach seems like the better option! LGTM!

@cabanier
Copy link
Member Author

Thanks @toji !

@cabanier cabanier merged commit 8efb5eb into immersive-web:main Jan 28, 2021
@cabanier cabanier deleted the report-mips branch January 28, 2021 17:31
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

Successfully merging this pull request may close these issues.

2 participants