Bug 133561 - WEBGL_compressed_texture_pvrtc doesn't accept PVRTC format enums in compressedTexImage2D
Summary: WEBGL_compressed_texture_pvrtc doesn't accept PVRTC format enums in compresse...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad Other
: P2 Normal
Assignee: Alex Christensen
URL: http://floooh.github.io/oryol/DDSText...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-05 15:36 PDT by Andre Weissflog
Modified: 2014-06-19 09:39 PDT (History)
7 users (show)

See Also:


Attachments
Patch (4.30 KB, patch)
2014-06-17 17:22 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (2.79 KB, patch)
2014-06-18 15:55 PDT, Alex Christensen
dino: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Weissflog 2014-06-05 15:36:39 PDT
The URL (http://floooh.github.io/oryol/DDSTextureLoading.html) points to an emscripten/WebGL demo which tries to load several texture formats. The upper row loads 3 DXT formats (on platforms supporting DXT), and 2 PVRTC formats (on platforms exposing the PVRTC GL extensions). On iOS8 Safari an error message is printed to the JS console "WebGL: INVALID_ENUM: compressedTexImage2D: invalid internalformat" when trying to create the PVRTC textures for the format codes 0x8C02 (GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG) and 0x8C03 (GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG).

Here's another page which crashes when trying to load PVRTC textures:

http://toji.github.io/texture-tester/
Comment 1 Andre Weissflog 2014-06-05 15:39:03 PDT
PS: this is on iOS8 Safari, tested on an iPad4.
Comment 2 Dean Jackson 2014-06-05 23:54:20 PDT
<rdar://problem/17193506>
Comment 3 Alex Christensen 2014-06-17 17:22:13 PDT
Created attachment 233273 [details]
Patch
Comment 4 Alex Christensen 2014-06-17 18:11:36 PDT
Also, the bitmaps in the test from https://bugs.webkit.org/show_bug.cgi?id=110497 don't work correctly, but the images in http://toji.github.io/texture-tester/ show up correctly.  Where did these images come from?  Would they be a better test than the test, which itself has a FIXME in it?
Comment 5 Alex Christensen 2014-06-18 15:53:38 PDT
I'm going to not worry about updating the test until https://github.com/KhronosGroup/WebGL/pull/527 and hopefully updating the compressed images goes through.
Comment 6 Alex Christensen 2014-06-18 15:55:39 PDT
Created attachment 233333 [details]
Patch
Comment 7 Alex Christensen 2014-06-18 16:15:43 PDT
Committed with GraphicsContext3D::INVALID_OPERATION instead of GL_INVALID_OPERATION to http://trac.webkit.org/changeset/170128
Comment 8 Alex Christensen 2014-06-18 16:17:07 PDT
Andre, http://floooh.github.io/oryol/DDSTextureLoading.html has two black squares on the top right with this fix, but http://toji.github.io/texture-tester/ shows the images correctly.  Could you verify that your images are compressed correctly?
Comment 9 Andre Weissflog 2014-06-18 23:45:10 PDT
The images work in a native iOS version of the same demo and have been compressed with PVRTexToolCLI from the PowerVR SDK. You can download the files here (http://floooh.github.io/oryol/lok_bpp2.pvr) and here (https://github.com/floooh/oryol/lok_bpp4.pvr) for inspection.

The pixel formats for these textures should be

COMPRESSED_RGBA_PVRTC_2BPPV1_IMG (0x8C03) and COMPRESSED_RGBA_PVRTC_4BPPV1_IMG (0x8C02h

Is the JS console message "WebGL: INVALID_ENUM: compressedTexImage2D: invalid internalformat" still showing up with your fix?

If Toji's demo works now then the problem is very likely on my side or maybe emscripten's GL translation layer, I'll see if I can find out more over the weekend.

Do you know when your fix will go live? iOS8 Beta 3?

Cheers & Thanks!
-Floh.

(In reply to comment #8)
> Andre, http://floooh.github.io/oryol/DDSTextureLoading.html has two black squares on the top right with this fix, but http://toji.github.io/texture-tester/ shows the images correctly.  Could you verify that your images are compressed correctly?
Comment 10 Alex Christensen 2014-06-19 09:39:36 PDT
(In reply to comment #9)
> Is the JS console message "WebGL: INVALID_ENUM: compressedTexImage2D: invalid internalformat" still showing up with your fix?
No.  The message is gone.