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

PVRTC1 textures must have dimensions that are power-of-two #1991

Closed
spnda opened this issue Nov 17, 2022 · 7 comments
Closed

PVRTC1 textures must have dimensions that are power-of-two #1991

spnda opened this issue Nov 17, 2022 · 7 comments

Comments

@spnda
Copy link
Contributor

spnda commented Nov 17, 2022

The Vulkan spec currently allows the use of PVRTC1 textures that do not have power-of-two dimensions. For one, this requirement is in the OpenGL ES spec and in the Khronos Data Format Specification. Secondly, this seems to be a design requirement of the texture format itself, meaning that images with non-power-of-two dimensions would simply not work. This does not apply to PVRTC2.

However, I could not find a source from imgtec explicitely saying that PVRTC1 textures have this requirement and instead I only found this PDF about PVRTC2 which states:

  • Non-Power-of-Two (NPOT) dimensions: PVRTC2 offers the developer the use of arbitrary-sized NPOT textures, which are textures that do not have dimensions that are limited to powers of two.

And a few other sources I found:

Remember that PVRTC1 requires square power of 2 size textures, [...] (BasisU)

Textures compressed with PVRTC1 formats must be square and power-of-two sized. (Love2d)

The layout of PVRTC1 does not require the images to be square (only power-of-two), however there's some hardware which restricts itself to square textures such as iOS devices.

This issue stems from KhronosGroup/MoltenVK#1760.

@Degerz
Copy link

Degerz commented Nov 21, 2022

PVRTC has been deprecated.

@fluppeteer
Copy link

PVRTC is deprecated, but PVRTC1 does need to have dimensions that are powers of two (partly because you're expected to upload the texture in Morton order and there's no allowance for padding); PVRTC2 (which is almost completely a superset) does not have this requirement, and the driver would insert padding as necessary (possibly including not backing pages which fall beyond the limits). The official PVRTexTool will only allow PVRTC1 output for textures with power-of-two dimensions, although they don't need to be square. The square requirement is specific to Apple, though.

The PVRTC1 description in the KDFS should be considered to be authoritative (barring any accidental errors). However, it's true that Vulkan doesn't currently contain validation to confirm that a user hasn't attempted to create an image of PVRTC1 format with npot sizes; we're working on adding this, so thank you for the catch.

@spnda
Copy link
Contributor Author

spnda commented Nov 30, 2022

PVRTC has been deprecated.

Does that disallow any spec changes to happen now? The extension still allows for invalid textures, which imo should still be changed after the fact, regardless of it being deprecated. It's still a flaw in the spec.

@Degerz
Copy link

Degerz commented Dec 1, 2022

Does that disallow any spec changes to happen now? The extension still allows for invalid textures, which imo should still be changed after the fact, regardless of it being deprecated. It's still a flaw in the spec.

Don't know if the Vulkan working group will consider spending time fixing this issue but I don't think they're opposed to letting the community resolving this ?

@fluppeteer
Copy link

fluppeteer commented Dec 1, 2022

Yes, deprecated or not we (with a working group hat on) should still fix it. The working group is aware, a clarification line has been written, and I'm on the hook to get validation in once it bubbles through the pipeline (sorry, I'm the stumbling block at the moment, but I'm on it).

@carlosVirella

This comment was marked as spam.

@oddhack
Copy link
Contributor

oddhack commented Mar 2, 2024

This should be fixed in the current spec update.

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

5 participants