Extended support for mipmaps level settings for compressed textures#241
Extended support for mipmaps level settings for compressed textures#241krapnikkk wants to merge 1 commit intogreggman:mainfrom
Conversation
- Removed duplicate test cases
|
@greggman |
|
I don't think this PR will actually work. I put up an alternative PR here https://github.com/greggman/twgl.js/compare/main...mipmap-upload?diff=split&w With tests for both compressed and uncompressed textures which is more inline with twgl (compressed texture should not be a special case) and passing in blockWidth and blockHeight seems like something twgl should just take care of. please take a look. It works by you passing the exact amount of data needed for however many mip levels you want. So for example, if you have a 4x4 RGBA8 texture.
It works in blocks so similarly for a compressed texture that has a 4x4 block size where each block is 8 bytes. Assume we're making a 12x8 texture
so
Note that it's a breaking change though because it guesses the number of mip levels you want uploaded based on the size of your data. In other words, let's say you had a 4x4 RGBA8 texture. That needs 444 bytes (64 bytes) for mip level 0. Before this change, passing 70 bytes of data was ok. It would just use the first 64 bytes. After this change, passing 70 bytes of data will generate an error because it's more than the first mip level (444 = 64 bytes) but it's not enough for the next mip level (224 16 bytes). I suspect almost no one is passing the wrong number of bytes but just to be safe I would bump the major version |
|
Yes, you are right. Your approach is more clear and clever. |
compressed texture format WEBGL_compressed_texture_s3tc with mipmap levelstest cases