Commit 0acf80f1 authored by shrekshao's avatar shrekshao Committed by Commit Bot

Fix ASTC HDR WebGL extension.

Tested on Pixel 3 XL (with HDR support) (validating) and Nexus 5X (without HDR support)(validating/passthrough) with up-to-date WebGL ASTC test.
Not tested with passthrough angle on Pixel 3 XL due to the build config and cmd line settings for passthrough angle
not work properly locally (reported to Geoff). But given that angle exposes the
extension with the same name as OpenGL it should be fine.

Bug: 1049880
Change-Id: Iadc1a78591068927bbed9523131924187f53fe3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2080823
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746146}
parent ca38b22f
......@@ -634,6 +634,12 @@ void FeatureInfo::InitializeFeatures() {
feature_flags_.ext_texture_format_astc = true;
AddExtensionString("GL_KHR_texture_compression_astc_ldr");
bool have_astc_hdr =
gfx::HasExtension(extensions, "GL_KHR_texture_compression_astc_hdr");
if (have_astc_hdr) {
AddExtensionString("GL_KHR_texture_compression_astc_hdr");
}
// GL_COMPRESSED_RGBA_ASTC(0x93B0 ~ 0x93BD)
GLint astc_format_it = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
GLint astc_format_max = GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
......
......@@ -32,6 +32,9 @@ WebGLCompressedTextureASTC::WebGLCompressedTextureASTC(
context->ExtensionsUtil()->EnsureExtensionEnabled(
"GL_KHR_texture_compression_astc_ldr");
supports_hdr = context->ExtensionsUtil()->EnsureExtensionEnabled(
"GL_KHR_texture_compression_astc_hdr");
const int kAlphaFormatGap =
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR - GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
......@@ -59,15 +62,14 @@ bool WebGLCompressedTextureASTC::Supported(WebGLRenderingContextBase* context) {
}
const char* WebGLCompressedTextureASTC::ExtensionName() {
// TODO(crbug.com/1049880): implement extension for
// GL_KHR_texture_compression_astc_hdr.
return "WEBGL_compressed_texture_astc";
}
Vector<String> WebGLCompressedTextureASTC::getSupportedProfiles() {
// TODO(crbug.com/1049880): temporarily always return ["ldr"].
// Update when hdr is supported.
Vector<String> result = {"ldr"};
if (supports_hdr) {
result.emplace_back("hdr");
}
return result;
}
......
......@@ -12,6 +12,8 @@ namespace blink {
class WebGLCompressedTextureASTC final : public WebGLExtension {
DEFINE_WRAPPERTYPEINFO();
bool supports_hdr;
public:
typedef struct {
int compress_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment