| Summary: | PVRTC compressed textures are failing with ANGLE backend | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Dean Jackson <dino> | ||||||
| Component: | WebGL | Assignee: | Dean Jackson <dino> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | dino, ews-watchlist, graouts, jdarpinian, justin_fan, kbr, kondapallykalyan, webkit-bug-importer | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Nightly Build | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 212612 | ||||||||
| Attachments: |
|
||||||||
|
Description
Dean Jackson
2020-05-21 16:51:27 PDT
Inside ANGLE, ValidateCompressedTexImage2D in src/libANGLE/validationES2.cpp, this is the code which is failing:
GLuint blockSize = 0;
if (!formatInfo.computeCompressedImageSize(Extents(width, height, 1), &blockSize))
{
context->validationError(GL_INVALID_OPERATION, kIntegerOverflow);
return false;
}
if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSize)
{
context->validationError(GL_INVALID_VALUE, kCompressedTextureDimensionsMustMatchData); // <--- fails
return false;
}
Here, imageSize is 32 but blockSize is 0. computeCompressedImageSize failed to compute the compressed image size.
It comes from formatutils.cpp AddCompressedFormat(&map, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG.... produces a pixelBytes value of 0, because compressedBlockSize is 1, and it is divided by 8 to produce 0. If I update the values in formatutils.cpp to use 32 and 16 for blocksize on 4bpp and 2bpp respectively, things start working much better. The rendering looks good too. I still get some errors though: testing COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 4x4 PASS getError was expected value: NO_ERROR : uploading compressed texture PASS getError was expected value: INVALID_OPERATION : trying to generate mipmaps from compressed texture expected actual PASS texture rendered correctly PASS getError was expected value: INVALID_VALUE : non 0 border FAIL getError expected: INVALID_OPERATION. Was INVALID_VALUE : invalid dimensions FAIL getError expected: INVALID_OPERATION. Was INVALID_VALUE : invalid dimensions FAIL getError expected: INVALID_OPERATION. Was INVALID_VALUE : invalid dimensions FAIL getError expected: INVALID_OPERATION. Was INVALID_VALUE : invalid dimensions PASS getError was expected value: NO_ERROR : compressedTexSubImage2D allowed for reloading of complete textures PASS getError was expected value: INVALID_OPERATION : compressedTexSubImage2D not allowed for partial texture updates PASS getError was expected value: INVALID_OPERATION : compressedTexSubImage2D not allowed for partial texture updates PASS getError was expected value: INVALID_OPERATION : compressedTexSubImage2D not allowed for partial texture updates PASS getError was expected value: INVALID_OPERATION : compressedTexSubImage2D not allowed for partial texture updates Created attachment 400013 [details]
Patch for testing
Patch for testing
Dean, could you try this patch instead? From reading the PVRTC extension spec: https://www.khronos.org/registry/OpenGL/extensions/IMG/IMG_texture_compression_pvrtc.txt I think the compressed block size for 2BPP textures is 16x8, and for 4BPP textures, 8x8. This equates to a block size of 256 bits for both formats. Created attachment 400016 [details]
Patch
Note that there are important steps to take when updating ANGLE. See http://trac.webkit.org/wiki/UpdatingANGLE Comment on attachment 400016 [details]
Patch
LGTM
Looks good to me but I think the CQ's going to reject my review bit! I will land manually to avoid any robots checking your status! Committed r262044: <https://trac.webkit.org/changeset/262044> |