Commit 1094d324 by Alexey Knyazev Committed by Commit Bot

GL: Add allow_etc_formats workaround

Enable ETC2/EAC formats on newer Intel GPUs. Bug: angleproject:1552 Change-Id: I240b07d6d81d48e1e03dfcd56aad6fa9f1d7817f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2690952Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
parent 5be6ee96
...@@ -37,6 +37,10 @@ struct FeaturesGL : FeatureSetBase ...@@ -37,6 +37,10 @@ struct FeaturesGL : FeatureSetBase
FeatureCategory::OpenGLWorkarounds, FeatureCategory::OpenGLWorkarounds,
"GL_RGBA4 is not color renderable", &members}; "GL_RGBA4 is not color renderable", &members};
// Newer Intel GPUs natively support ETC2/EAC compressed texture formats.
Feature allowEtcFormats = {"allow_etc_formats", FeatureCategory::OpenGLWorkarounds,
"Enable ETC2/EAC on desktop OpenGL", &members};
// When clearing a framebuffer on Intel or AMD drivers, when GL_FRAMEBUFFER_SRGB is enabled, the // When clearing a framebuffer on Intel or AMD drivers, when GL_FRAMEBUFFER_SRGB is enabled, the
// driver clears to the linearized clear color despite the framebuffer not supporting SRGB // driver clears to the linearized clear color despite the framebuffer not supporting SRGB
// blending. It only seems to do this when the framebuffer has only linear attachments, mixed // blending. It only seems to do this when the framebuffer has only linear attachments, mixed
......
...@@ -31,6 +31,9 @@ namespace rx ...@@ -31,6 +31,9 @@ namespace rx
// Referenced from https://cgit.freedesktop.org/vaapi/intel-driver/tree/src/i965_pciids.h // Referenced from https://cgit.freedesktop.org/vaapi/intel-driver/tree/src/i965_pciids.h
namespace namespace
{ {
// gen6
const uint32_t SandyBridge[] = {0x0102, 0x0106, 0x010A, 0x0112, 0x0122, 0x0116, 0x0126};
// gen7 // gen7
const uint32_t IvyBridge[] = {0x0152, 0x0156, 0x015A, 0x0162, 0x0166, 0x016A}; const uint32_t IvyBridge[] = {0x0152, 0x0156, 0x015A, 0x0162, 0x0166, 0x016A};
...@@ -101,6 +104,12 @@ bool IntelDriverVersion::operator>=(const IntelDriverVersion &version) ...@@ -101,6 +104,12 @@ bool IntelDriverVersion::operator>=(const IntelDriverVersion &version)
return !(*this < version); return !(*this < version);
} }
bool IsSandyBridge(uint32_t DeviceId)
{
return std::find(std::begin(SandyBridge), std::end(SandyBridge), DeviceId) !=
std::end(SandyBridge);
}
bool IsIvyBridge(uint32_t DeviceId) bool IsIvyBridge(uint32_t DeviceId)
{ {
return std::find(std::begin(IvyBridge), std::end(IvyBridge), DeviceId) != std::end(IvyBridge); return std::find(std::begin(IvyBridge), std::end(IvyBridge), DeviceId) != std::end(IvyBridge);
......
...@@ -137,6 +137,7 @@ class IntelDriverVersion ...@@ -137,6 +137,7 @@ class IntelDriverVersion
uint16_t mVersionPart; uint16_t mVersionPart;
}; };
bool IsSandyBridge(uint32_t DeviceId);
bool IsIvyBridge(uint32_t DeviceId); bool IsIvyBridge(uint32_t DeviceId);
bool IsHaswell(uint32_t DeviceId); bool IsHaswell(uint32_t DeviceId);
bool IsBroadwell(uint32_t DeviceId); bool IsBroadwell(uint32_t DeviceId);
......
...@@ -1534,8 +1534,9 @@ void GenerateCaps(const FunctionsGL *functions, ...@@ -1534,8 +1534,9 @@ void GenerateCaps(const FunctionsGL *functions,
// ANGLE_compressed_texture_etc // ANGLE_compressed_texture_etc
// Expose this extension only when we support the formats or we're running on top of a native // Expose this extension only when we support the formats or we're running on top of a native
// ES driver. // ES driver.
extensions->compressedTextureETC = functions->standard == STANDARD_GL_ES && extensions->compressedTextureETC =
gl::DetermineCompressedTextureETCSupport(*textureCapsMap); (features.allowEtcFormats.enabled || functions->standard == STANDARD_GL_ES) &&
gl::DetermineCompressedTextureETCSupport(*textureCapsMap);
// To work around broken unsized sRGB textures, sized sRGB textures are used. Disable EXT_sRGB // To work around broken unsized sRGB textures, sized sRGB textures are used. Disable EXT_sRGB
// if those formats are not available. // if those formats are not available.
...@@ -1656,6 +1657,12 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ...@@ -1656,6 +1657,12 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
ANGLE_FEATURE_CONDITION(features, rgba4IsNotSupportedForColorRendering, ANGLE_FEATURE_CONDITION(features, rgba4IsNotSupportedForColorRendering,
functions->standard == STANDARD_GL_DESKTOP && isIntel); functions->standard == STANDARD_GL_DESKTOP && isIntel);
// Although "Sandy Bridge", "Ivy Bridge", and "Haswell" may support GL_ARB_ES3_compatibility
// extension, ETC2/EAC formats are emulated there. Newer Intel GPUs support them natively.
ANGLE_FEATURE_CONDITION(
features, allowEtcFormats,
isIntel && !IsSandyBridge(device) && !IsIvyBridge(device) && !IsHaswell(device));
// Ported from gpu_driver_bug_list.json (#183) // Ported from gpu_driver_bug_list.json (#183)
ANGLE_FEATURE_CONDITION(features, emulateAbsIntFunction, IsApple() && isIntel); ANGLE_FEATURE_CONDITION(features, emulateAbsIntFunction, IsApple() && isIntel);
......
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