[Compat] float16/float32 renderable fixes
Per newest compat proposal, float16 and float32 renderable are
required capabilities.
Update format multisample support for compat;
Request compat required extensions under forceES31 path;
Update tests;
Bug: 381214487, 388318201
Change-Id: Ia9f55e6048b965ce99d42835ea5ce75e541484b8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/224035
Commit-Queue: Shrek Shao <shrekshao@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
diff --git a/src/dawn/native/Format.cpp b/src/dawn/native/Format.cpp
index eac1f57..8740edd 100644
--- a/src/dawn/native/Format.cpp
+++ b/src/dawn/native/Format.cpp
@@ -481,10 +481,12 @@
SampleTypeBit sampleTypeFor32BitFloatFormats = device->HasFeature(Feature::Float32Filterable) ? kAnyFloat : SampleTypeBit::UnfilterableFloat;
auto supportsPLS = device->HasFeature(Feature::PixelLocalStorageCoherent) || device->HasFeature(Feature::PixelLocalStorageNonCoherent) ? Cap::PLS : Cap::None;
auto float32BlendableCaps = device->HasFeature(Feature::Float32Blendable) ? Cap::Blendable : Cap::None;
+ // (github.com/gpuweb/gpuweb/issues/5049): r32float compat multisampled support is optional
+ auto r32FloatMultisampleCaps = device->IsCompatibilityMode() ? Cap::None : Cap::Multisample;
AddColorFormat(wgpu::TextureFormat::R32Uint, Cap::Renderable | Cap::StorageROrW | Cap::StorageRW | supportsPLS, ByteSize(4), SampleTypeBit::Uint, ComponentCount(1), RenderTargetPixelByteCost(4), RenderTargetComponentAlignment(4));
AddColorFormat(wgpu::TextureFormat::R32Sint, Cap::Renderable | Cap::StorageROrW | Cap::StorageRW | supportsPLS, ByteSize(4), SampleTypeBit::Sint, ComponentCount(1), RenderTargetPixelByteCost(4), RenderTargetComponentAlignment(4));
- AddColorFormat(wgpu::TextureFormat::R32Float, Cap::Renderable | Cap::Multisample | Cap::StorageROrW | Cap::StorageRW | supportsPLS | float32BlendableCaps, ByteSize(4), sampleTypeFor32BitFloatFormats, ComponentCount(1), RenderTargetPixelByteCost(4), RenderTargetComponentAlignment(4));
+ AddColorFormat(wgpu::TextureFormat::R32Float, Cap::Renderable | r32FloatMultisampleCaps | Cap::StorageROrW | Cap::StorageRW | supportsPLS | float32BlendableCaps, ByteSize(4), sampleTypeFor32BitFloatFormats, ComponentCount(1), RenderTargetPixelByteCost(4), RenderTargetComponentAlignment(4));
AddColorFormat(wgpu::TextureFormat::RG16Uint, Cap::Renderable | Cap::Multisample, ByteSize(4), SampleTypeBit::Uint, ComponentCount(2), RenderTargetPixelByteCost(4), RenderTargetComponentAlignment(2));
AddColorFormat(wgpu::TextureFormat::RG16Sint, Cap::Renderable | Cap::Multisample, ByteSize(4), SampleTypeBit::Sint, ComponentCount(2), RenderTargetPixelByteCost(4), RenderTargetComponentAlignment(2));
AddColorFormat(wgpu::TextureFormat::RG16Float, Cap::Renderable | Cap::Multisample | Cap::Resolve | Cap::Blendable, ByteSize(4), kAnyFloat, ComponentCount(2), RenderTargetPixelByteCost(4), RenderTargetComponentAlignment(2));
@@ -509,13 +511,15 @@
// 8 bytes color formats
auto rg32StorageCaps = device->IsCompatibilityMode() ? Cap::None : Cap::StorageROrW;
+ // (github.com/gpuweb/gpuweb/issues/5049): rgba16float compat multisampled support is optional
+ auto rgba16FloatMultisampleCaps = device->IsCompatibilityMode() ? Cap::None : Cap::Multisample;
AddColorFormat(wgpu::TextureFormat::RG32Uint, Cap::Renderable | rg32StorageCaps, ByteSize(8), SampleTypeBit::Uint, ComponentCount(2), RenderTargetPixelByteCost(8), RenderTargetComponentAlignment(4));
AddColorFormat(wgpu::TextureFormat::RG32Sint, Cap::Renderable | rg32StorageCaps, ByteSize(8), SampleTypeBit::Sint, ComponentCount(2), RenderTargetPixelByteCost(8), RenderTargetComponentAlignment(4));
AddColorFormat(wgpu::TextureFormat::RG32Float, Cap::Renderable | rg32StorageCaps | float32BlendableCaps, ByteSize(8), sampleTypeFor32BitFloatFormats, ComponentCount(2), RenderTargetPixelByteCost(8), RenderTargetComponentAlignment(4));
AddColorFormat(wgpu::TextureFormat::RGBA16Uint, Cap::Renderable | Cap::StorageROrW | Cap::Multisample, ByteSize(8), SampleTypeBit::Uint, ComponentCount(4), RenderTargetPixelByteCost(8), RenderTargetComponentAlignment(2));
AddColorFormat(wgpu::TextureFormat::RGBA16Sint, Cap::Renderable | Cap::StorageROrW | Cap::Multisample, ByteSize(8), SampleTypeBit::Sint, ComponentCount(4), RenderTargetPixelByteCost(8), RenderTargetComponentAlignment(2));
- AddColorFormat(wgpu::TextureFormat::RGBA16Float, Cap::Renderable | Cap::StorageROrW | Cap::Multisample | Cap::Resolve | Cap::Blendable, ByteSize(8), kAnyFloat, ComponentCount(4), RenderTargetPixelByteCost(8), RenderTargetComponentAlignment(2));
+ AddColorFormat(wgpu::TextureFormat::RGBA16Float, Cap::Renderable | Cap::StorageROrW | rgba16FloatMultisampleCaps | Cap::Resolve | Cap::Blendable, ByteSize(8), kAnyFloat, ComponentCount(4), RenderTargetPixelByteCost(8), RenderTargetComponentAlignment(2));
// 16 bytes color formats
AddColorFormat(wgpu::TextureFormat::RGBA32Uint, Cap::Renderable | Cap::StorageROrW, ByteSize(16), SampleTypeBit::Uint, ComponentCount(4), RenderTargetPixelByteCost(16), RenderTargetComponentAlignment(4));
diff --git a/src/dawn/native/opengl/BackendGL.cpp b/src/dawn/native/opengl/BackendGL.cpp
index a24172c..d4f05a4 100644
--- a/src/dawn/native/opengl/BackendGL.cpp
+++ b/src/dawn/native/opengl/BackendGL.cpp
@@ -63,12 +63,12 @@
return {};
}
- bool forceES31AndNoExtensions = false;
+ bool forceES31AndMinExtensions = false;
if (auto* togglesDesc = options.Get<DawnTogglesDescriptor>()) {
TogglesState toggles =
TogglesState::CreateFromTogglesDescriptor(togglesDesc, ToggleStage::Adapter);
if (toggles.IsEnabled(Toggle::GLForceES31AndNoExtensions)) {
- forceES31AndNoExtensions = true;
+ forceES31AndMinExtensions = true;
}
}
@@ -90,7 +90,7 @@
Ref<PhysicalDevice> device;
DAWN_TRY_ASSIGN(device, PhysicalDevice::Create(GetType(), std::move(display),
- forceES31AndNoExtensions));
+ forceES31AndMinExtensions));
devices.push_back(device);
return {};
diff --git a/src/dawn/native/opengl/ContextEGL.cpp b/src/dawn/native/opengl/ContextEGL.cpp
index db9704c..2a45ff1 100644
--- a/src/dawn/native/opengl/ContextEGL.cpp
+++ b/src/dawn/native/opengl/ContextEGL.cpp
@@ -56,10 +56,10 @@
wgpu::BackendType backend,
bool useRobustness,
bool useANGLETextureSharing,
- bool forceES31AndNoExtensionss) {
+ bool forceES31AndMinExtensions) {
auto context = std::make_unique<ContextEGL>(std::move(display));
DAWN_TRY(context->Initialize(backend, useRobustness, useANGLETextureSharing,
- forceES31AndNoExtensionss));
+ forceES31AndMinExtensions));
return std::move(context);
}
@@ -79,7 +79,7 @@
MaybeError ContextEGL::Initialize(wgpu::BackendType backend,
bool useRobustness,
bool useANGLETextureSharing,
- bool forceES31AndNoExtensionss) {
+ bool forceES31AndMinExtensions) {
const EGLFunctions& egl = mDisplay->egl;
// Unless EGL_KHR_no_config is present, we need to choose an EGLConfig on context creation that
@@ -139,7 +139,8 @@
AddAttrib(EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE, EGL_TRUE);
}
- if (forceES31AndNoExtensionss) {
+ mForceES31AndMinExtensions = forceES31AndMinExtensions;
+ if (forceES31AndMinExtensions) {
if (egl.HasExt(EGLExt::ANGLECreateContextBackwardsCompatible)) {
AddAttrib(EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE, EGL_FALSE);
}
@@ -183,6 +184,34 @@
return {};
}
+// Request compat mode required extensions explicitly when mForceES31AndMinExtensions is true
+void ContextEGL::RequestRequiredExtensionsExplicitly() {
+ if (!mForceES31AndMinExtensions) {
+ return;
+ }
+
+ const EGLFunctions& egl = mDisplay->egl;
+ // Copied from third_party/angle/include/GLES/gl.h
+ typedef void(KHRONOS_APIENTRY * PFNGLREQUESTEXTENSIONANGLEPROC)(const GLchar* name);
+
+ auto proc = egl.GetProcAddress("glRequestExtensionANGLE");
+ if (!proc) {
+ return;
+ }
+
+ auto glRequestExtension = reinterpret_cast<PFNGLREQUESTEXTENSIONANGLEPROC>(proc);
+
+ // src/dawn/native/opengl/supported_extensions.json
+ glRequestExtension("GL_OES_texture_stencil8");
+ glRequestExtension("GL_EXT_texture_compression_s3tc");
+ glRequestExtension("GL_EXT_texture_compression_s3tc_srgb");
+ glRequestExtension("GL_OES_EGL_image");
+ glRequestExtension("GL_EXT_texture_format_BGRA8888");
+ glRequestExtension("GL_APPLE_texture_format_BGRA8888");
+ glRequestExtension("GL_EXT_color_buffer_float");
+ glRequestExtension("GL_EXT_color_buffer_half_float");
+}
+
void ContextEGL::MakeCurrent() {
EGLBoolean success = mDisplay->egl.MakeCurrent(mDisplay->GetDisplay(), mCurrentSurface,
mCurrentSurface, mContext);
diff --git a/src/dawn/native/opengl/ContextEGL.h b/src/dawn/native/opengl/ContextEGL.h
index 77f3b40..1a6c7e7 100644
--- a/src/dawn/native/opengl/ContextEGL.h
+++ b/src/dawn/native/opengl/ContextEGL.h
@@ -47,7 +47,7 @@
wgpu::BackendType backend,
bool useRobustness,
bool useANGLETextureSharing,
- bool forceES31AndNoExtensionss);
+ bool forceES31AndMinExtensions);
explicit ContextEGL(Ref<DisplayEGL> display);
~ContextEGL();
@@ -55,7 +55,8 @@
MaybeError Initialize(wgpu::BackendType backend,
bool useRobustness,
bool useANGLETextureSharing,
- bool forceES31AndNoExtensionss);
+ bool forceES31AndMinExtensions);
+ void RequestRequiredExtensionsExplicitly();
// Make the surface used by all MakeCurrent until the scoper gets out of scope.
class ScopedMakeSurfaceCurrent : NonMovable {
@@ -75,6 +76,7 @@
EGLContext mContext = EGL_NO_CONTEXT;
EGLSurface mCurrentSurface = EGL_NO_SURFACE;
EGLSurface mOffscreenSurface = EGL_NO_SURFACE;
+ bool mForceES31AndMinExtensions = false;
};
} // namespace dawn::native::opengl
diff --git a/src/dawn/native/opengl/DeviceGL.cpp b/src/dawn/native/opengl/DeviceGL.cpp
index dbd193a..8759af3 100644
--- a/src/dawn/native/opengl/DeviceGL.cpp
+++ b/src/dawn/native/opengl/DeviceGL.cpp
@@ -158,6 +158,8 @@
// Directly set the context current and use mGL instead of calling GetGL as GetGL will notify
// the (yet inexistent) queue that GL was used.
mContext->MakeCurrent();
+ mContext->RequestRequiredExtensionsExplicitly();
+
const OpenGLFunctions& gl = mGL;
mFormatTable = BuildGLFormatTable(gl);
diff --git a/src/dawn/native/opengl/PhysicalDeviceGL.cpp b/src/dawn/native/opengl/PhysicalDeviceGL.cpp
index f8e8a77..caf3314 100644
--- a/src/dawn/native/opengl/PhysicalDeviceGL.cpp
+++ b/src/dawn/native/opengl/PhysicalDeviceGL.cpp
@@ -104,7 +104,7 @@
// static
ResultOrError<Ref<PhysicalDevice>> PhysicalDevice::Create(wgpu::BackendType backendType,
Ref<DisplayEGL> display,
- bool forceES31AndNoExtensions) {
+ bool forceES31AndMinExtensions) {
const EGLFunctions& egl = display->egl;
EGLDisplay eglDisplay = display->GetDisplay();
@@ -115,13 +115,15 @@
DAWN_TRY_ASSIGN(context,
ContextEGL::Create(display, backendType, /*useRobustness*/ false,
/*useANGLETextureSharing*/ false,
- /*forceES31AndNoExtensions*/ forceES31AndNoExtensions));
+ /*forceES31AndMinExtensions*/ forceES31AndMinExtensions));
EGLSurface prevDrawSurface = egl.GetCurrentSurface(EGL_DRAW);
EGLSurface prevReadSurface = egl.GetCurrentSurface(EGL_READ);
EGLContext prevContext = egl.GetCurrentContext();
context->MakeCurrent();
+ // Needed to request extensions here to initialize supported gl extensions set
+ context->RequestRequiredExtensionsExplicitly();
Ref<PhysicalDevice> physicalDevice =
AcquireRef(new PhysicalDevice(backendType, std::move(display)));
@@ -468,11 +470,11 @@
}
bool useRobustness = !deviceToggles.IsEnabled(Toggle::DisableRobustness);
- bool forceES31AndNoExtensions = deviceToggles.IsEnabled(Toggle::GLForceES31AndNoExtensions);
+ bool forceES31AndMinExtensions = deviceToggles.IsEnabled(Toggle::GLForceES31AndNoExtensions);
std::unique_ptr<ContextEGL> context;
DAWN_TRY_ASSIGN(context, ContextEGL::Create(mDisplay, GetBackendType(), useRobustness,
- useANGLETextureSharing, forceES31AndNoExtensions));
+ useANGLETextureSharing, forceES31AndMinExtensions));
return Device::Create(adapter, descriptor, mFunctions, std::move(context), deviceToggles,
std::move(lostEvent));
diff --git a/src/dawn/native/opengl/PhysicalDeviceGL.h b/src/dawn/native/opengl/PhysicalDeviceGL.h
index e9004e4..8f12b6a 100644
--- a/src/dawn/native/opengl/PhysicalDeviceGL.h
+++ b/src/dawn/native/opengl/PhysicalDeviceGL.h
@@ -43,7 +43,7 @@
public:
static ResultOrError<Ref<PhysicalDevice>> Create(wgpu::BackendType backendType,
Ref<DisplayEGL> display,
- bool forceES31AndNoExtensions);
+ bool forceES31AndMinExtensions);
~PhysicalDevice() override = default;
diff --git a/src/dawn/native/opengl/supported_extensions.json b/src/dawn/native/opengl/supported_extensions.json
index b74ba3b..e852ab0 100644
--- a/src/dawn/native/opengl/supported_extensions.json
+++ b/src/dawn/native/opengl/supported_extensions.json
@@ -34,6 +34,8 @@
"GL_EXT_texture_compression_s3tc_srgb",
"GL_OES_EGL_image",
"GL_EXT_texture_format_BGRA8888",
- "GL_APPLE_texture_format_BGRA8888"
+ "GL_APPLE_texture_format_BGRA8888",
+ "GL_EXT_color_buffer_float",
+ "GL_EXT_color_buffer_half_float"
]
}
diff --git a/src/dawn/tests/end2end/BufferZeroInitTests.cpp b/src/dawn/tests/end2end/BufferZeroInitTests.cpp
index 7fa1102..bb9d1c2 100644
--- a/src/dawn/tests/end2end/BufferZeroInitTests.cpp
+++ b/src/dawn/tests/end2end/BufferZeroInitTests.cpp
@@ -915,10 +915,6 @@
// Test that the code path of CopyTextureToBuffer clears the destination buffer correctly when it is
// the first use of the buffer and the texture is a 2D non-array texture.
TEST_P(BufferZeroInitTest, Copy2DTextureToBuffer) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
-
constexpr wgpu::Extent3D kTextureSize = {64u, 8u, 1u};
// TODO(crbug.com/dawn/2295): diagnose this failure on Pixel 4 OpenGLES
@@ -958,10 +954,6 @@
// Test that the code path of CopyTextureToBuffer clears the destination buffer correctly when it is
// the first use of the buffer and the texture is a 2D array texture.
TEST_P(BufferZeroInitTest, Copy2DArrayTextureToBuffer) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
-
constexpr wgpu::Extent3D kTextureSize = {64u, 4u, 3u};
// bytesPerRow == texelBlockSizeInBytes * copySize.width && rowsPerImage == copySize.height &&
diff --git a/src/dawn/tests/end2end/CopyTests.cpp b/src/dawn/tests/end2end/CopyTests.cpp
index 537cf49..f8e27f2 100644
--- a/src/dawn/tests/end2end/CopyTests.cpp
+++ b/src/dawn/tests/end2end/CopyTests.cpp
@@ -281,36 +281,29 @@
void SetUp() override {
DawnTestWithParams<CopyTextureFormatParams>::SetUp();
- // TODO(crbug.com/388318201): Suppress for turning on OpenGLES ANGLE Swiftshader backend
- // with gl_force_es_31_and_no_extensions
- if (IsCompatibilityMode() && HasToggleEnabled("gl_force_es_31_and_no_extensions")) {
- auto format = GetParam().mTextureFormat;
- // GL_EXT_texture_format_BGRA8888 or GL_APPLE_texture_format_BGRA8888 is required for
- // compat mode.
- DAWN_TEST_UNSUPPORTED_IF(format == wgpu::TextureFormat::BGRA8Unorm);
- }
+ auto format = GetParam().mTextureFormat;
// TODO(dawn:2129): Fail for Win ANGLE D3D11
- DAWN_SUPPRESS_TEST_IF((GetParam().mTextureFormat == wgpu::TextureFormat::RGB9E5Ufloat) &&
- IsANGLED3D11() && IsWindows());
+ DAWN_SUPPRESS_TEST_IF((format == wgpu::TextureFormat::RGB9E5Ufloat) && IsANGLED3D11() &&
+ IsWindows());
// TODO(crbug.com/dawn/2294): diagnose BGRA T2B failures on Pixel 4 OpenGLES
- DAWN_SUPPRESS_TEST_IF(GetParam().mTextureFormat == wgpu::TextureFormat::BGRA8Unorm &&
- IsOpenGLES() && IsAndroid() && IsQualcomm());
+ DAWN_SUPPRESS_TEST_IF(format == wgpu::TextureFormat::BGRA8Unorm && IsOpenGLES() &&
+ IsAndroid() && IsQualcomm());
// TODO(dawn:1913): Many float formats tests failing for Metal backend on Mac Intel.
- DAWN_SUPPRESS_TEST_IF((GetParam().mTextureFormat == wgpu::TextureFormat::R32Float ||
- GetParam().mTextureFormat == wgpu::TextureFormat::RG32Float ||
- GetParam().mTextureFormat == wgpu::TextureFormat::RGBA32Float ||
- GetParam().mTextureFormat == wgpu::TextureFormat::RGBA16Float ||
- GetParam().mTextureFormat == wgpu::TextureFormat::RG11B10Ufloat) &&
+ DAWN_SUPPRESS_TEST_IF((format == wgpu::TextureFormat::R32Float ||
+ format == wgpu::TextureFormat::RG32Float ||
+ format == wgpu::TextureFormat::RGBA32Float ||
+ format == wgpu::TextureFormat::RGBA16Float ||
+ format == wgpu::TextureFormat::RG11B10Ufloat) &&
IsMacOS() && IsIntel() && IsMetal());
// TODO(dawn:1935): Many 16 float formats tests failing for D3D11 and OpenGLES backends on
// Intel Gen12.
- DAWN_SUPPRESS_TEST_IF((GetParam().mTextureFormat == wgpu::TextureFormat::R16Float ||
- GetParam().mTextureFormat == wgpu::TextureFormat::RGBA16Float ||
- GetParam().mTextureFormat == wgpu::TextureFormat::RG11B10Ufloat) &&
+ DAWN_SUPPRESS_TEST_IF((format == wgpu::TextureFormat::R16Float ||
+ format == wgpu::TextureFormat::RGBA16Float ||
+ format == wgpu::TextureFormat::RG11B10Ufloat) &&
(IsD3D11() || IsOpenGLES()) && IsIntelGen12());
}
uint32_t GetTextureBytesPerRowAlignment() const {
@@ -2791,12 +2784,6 @@
// A regression test (from WebGPU CTS) for an Intel D3D12 driver bug about T2T copy with specific
// texture formats. See http://crbug.com/1161355 for more details.
TEST_P(CopyTests_T2T, CopyFromNonZeroMipLevelWithTexelBlockSizeLessThan4Bytes) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions") &&
- (GetParam().mTextureFormat == wgpu::TextureFormat::RGB9E5Ufloat ||
- GetParam().mTextureFormat == wgpu::TextureFormat::RGBA8Unorm));
-
constexpr std::array<wgpu::TextureFormat, 11> kFormats = {
{wgpu::TextureFormat::RG8Sint, wgpu::TextureFormat::RG8Uint, wgpu::TextureFormat::RG8Snorm,
wgpu::TextureFormat::RG8Unorm, wgpu::TextureFormat::R16Float, wgpu::TextureFormat::R16Sint,
diff --git a/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp b/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp
index 9d223af..380a4e5 100644
--- a/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp
+++ b/src/dawn/tests/end2end/CopyTextureForBrowserTests.cpp
@@ -1141,16 +1141,6 @@
// Verify |CopyTextureForBrowser| doing color conversion correctly when
// the source texture is RGBA8Unorm format.
TEST_P(CopyTextureForBrowser_Formats, ColorConversion) {
- // TODO(crbug.com/388318201): investigate: framebuffer incomplete
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions") &&
- (GetParam().mSrcFormat == wgpu::TextureFormat::RGBA16Float ||
- GetParam().mSrcFormat == wgpu::TextureFormat::BGRA8Unorm ||
- GetParam().mSrcFormat == wgpu::TextureFormat::RGBA8Unorm ||
- GetParam().mDstFormat == wgpu::TextureFormat::RGBA16Float ||
- GetParam().mDstFormat == wgpu::TextureFormat::BGRA8Unorm ||
- GetParam().mDstFormat == wgpu::TextureFormat::RGBA8Unorm));
-
// BGRA8UnormSrgb is unsupported in Compatibility mode.
DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
GetParam().mDstFormat == wgpu::TextureFormat::BGRA8UnormSrgb);
@@ -1224,13 +1214,6 @@
// Verify |CopyTextureForBrowser| doing color space conversion.
TEST_P(CopyTextureForBrowser_ColorSpace, colorSpaceConversion) {
- // TODO(crbug.com/381214487): float16-renderable and float32-renderable features. framebuffer
- // incomplete.
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions") &&
- (GetParam().mDstFormat == wgpu::TextureFormat::RGBA16Float ||
- GetParam().mDstFormat == wgpu::TextureFormat::RGBA32Float));
-
DAWN_SUPPRESS_TEST_IF(IsOpenGL() && IsLinux());
// Tests skip due to crbug.com/dawn/1104.
diff --git a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp
index b965141..5057a55 100644
--- a/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp
+++ b/src/dawn/tests/end2end/DepthStencilSamplingTests.cpp
@@ -648,11 +648,6 @@
// Repro test for crbug.com/dawn/1187 where sampling a depth texture returns values not in [0, 1]
TEST_P(DepthStencilSamplingTest, CheckDepthTextureRange) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions") &&
- GetParam().mTextureFormat == wgpu::TextureFormat::Depth24PlusStencil8);
-
// TODO(crbug.com/dawn/1187): The test fails on ANGLE D3D11, investigate why.
DAWN_SUPPRESS_TEST_IF(IsANGLED3D11());
@@ -976,10 +971,6 @@
// Test that sampling in a render pipeline with all of the compare functions works.
TEST_P(DepthSamplingTest, CompareFunctionsRender) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
-
// Initialization via renderPass loadOp doesn't work on Mac Intel.
DAWN_SUPPRESS_TEST_IF(IsMetal() && IsIntel());
diff --git a/src/dawn/tests/end2end/GLExplicitExtensionsTests.cpp b/src/dawn/tests/end2end/GLExplicitExtensionsTests.cpp
index aa05786..f75a601 100644
--- a/src/dawn/tests/end2end/GLExplicitExtensionsTests.cpp
+++ b/src/dawn/tests/end2end/GLExplicitExtensionsTests.cpp
@@ -54,8 +54,6 @@
// Make sure this toggle is inherited correctly during re-initialization
EXPECT_EQ(HasToggleEnabled("gl_force_es_31_and_no_extensions"), true);
- // GL_OES_texture_stencil8
- EXPECT_EQ(HasToggleEnabled("use_blit_for_stencil_texture_write"), true);
// GL_EXT_read_format_bgra
EXPECT_EQ(HasToggleEnabled("use_blit_for_bgra8unorm_texture_to_buffer_copy"), true);
}
diff --git a/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp b/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp
index 1f4cfd1..af7fb65 100644
--- a/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp
+++ b/src/dawn/tests/end2end/RenderPassLoadOpTests.cpp
@@ -486,10 +486,6 @@
// Test clearing multiple color attachments with different big signed and unsigned integers can
// still work correctly.
TEST_P(RenderPassLoadOpTests, LoadOpClearWithBig32BitIntegralValuesOnMultipleColorAttachments) {
- // TODO(crbug.com/388318201): investigate: framebuffer incomplete
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
-
// TODO(383733873): ApplyClearBigIntegerColorValueWithDraw workaround doesn't work with multiple
// outputs in compat mode.
DAWN_TEST_UNSUPPORTED_IF(IsD3D11() && IsCompatibilityMode());
diff --git a/src/dawn/tests/end2end/TextureFormatTests.cpp b/src/dawn/tests/end2end/TextureFormatTests.cpp
index f174f7c..0e04dc4 100644
--- a/src/dawn/tests/end2end/TextureFormatTests.cpp
+++ b/src/dawn/tests/end2end/TextureFormatTests.cpp
@@ -573,17 +573,11 @@
// Test the R8Unorm format
TEST_P(TextureFormatTest, R8Unorm) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
DoUnormTest<uint8_t>({wgpu::TextureFormat::R8Unorm, 1, TextureComponentType::Float, 1});
}
// Test the RG8Unorm format
TEST_P(TextureFormatTest, RG8Unorm) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
DoUnormTest<uint8_t>({wgpu::TextureFormat::RG8Unorm, 2, TextureComponentType::Float, 2});
}
@@ -604,19 +598,11 @@
// Test the RGBA8Unorm format
TEST_P(TextureFormatTest, RGBA8Unorm) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
DoUnormTest<uint8_t>({wgpu::TextureFormat::RGBA8Unorm, 4, TextureComponentType::Float, 4});
}
// Test the BGRA8Unorm format
TEST_P(TextureFormatTest, BGRA8Unorm) {
- // TODO(crbug.com/388318201): GL_EXT_texture_format_BGRA8888 or GL_APPLE_texture_format_BGRA8888
- // is required for compat mode.
- DAWN_TEST_UNSUPPORTED_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
-
// Intel's implementation of BGRA on ES is broken: it claims to support
// GL_EXT_texture_format_BGRA8888, but won't accept GL_BGRA or GL_BGRA8_EXT as internalFormat.
DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGLES() && IsLinux());
@@ -635,25 +621,16 @@
// Test the R8Snorm format
TEST_P(TextureFormatTest, R8Snorm) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
DoSnormTest<int8_t>({wgpu::TextureFormat::R8Snorm, 1, TextureComponentType::Float, 1});
}
// Test the RG8Snorm format
TEST_P(TextureFormatTest, RG8Snorm) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
DoSnormTest<int8_t>({wgpu::TextureFormat::RG8Snorm, 2, TextureComponentType::Float, 2});
}
// Test the RGBA8Snorm format
TEST_P(TextureFormatTest, RGBA8Snorm) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
DoSnormTest<int8_t>({wgpu::TextureFormat::RGBA8Snorm, 4, TextureComponentType::Float, 4});
}
@@ -782,25 +759,16 @@
// Test the R32Float format
TEST_P(TextureFormatTest, R32Float) {
- // TODO(crbug.com/381214487): float32-renderable
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
DoFloat32Test({wgpu::TextureFormat::R32Float, 4, TextureComponentType::Float, 1});
}
// Test the RG32Float format
TEST_P(TextureFormatTest, RG32Float) {
- // TODO(crbug.com/381214487): float32-renderable
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
DoFloat32Test({wgpu::TextureFormat::RG32Float, 8, TextureComponentType::Float, 2});
}
// Test the RGBA32Float format
TEST_P(TextureFormatTest, RGBA32Float) {
- // TODO(crbug.com/381214487): float32-renderable
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
DoFloat32Test({wgpu::TextureFormat::RGBA32Float, 16, TextureComponentType::Float, 4});
}
@@ -833,10 +801,6 @@
// Test the RGBA8Unorm format
TEST_P(TextureFormatTest, RGBA8UnormSrgb) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
-
uint8_t maxValue = std::numeric_limits<uint8_t>::max();
std::vector<uint8_t> textureData = {0, 1, maxValue, 64, 35, 68, 152, 168};
@@ -910,10 +874,6 @@
// Test the RGB10A2Unorm format
TEST_P(TextureFormatTest, RGB10A2Unorm) {
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
-
auto MakeRGB10A2 = [](uint32_t r, uint32_t g, uint32_t b, uint32_t a) -> uint32_t {
DAWN_ASSERT((r & 0x3FF) == r);
DAWN_ASSERT((g & 0x3FF) == g);
@@ -1013,10 +973,6 @@
// the r9 as a 9bit uint. B the number of bits of the mantissa (9), and N the offset for the
// exponent (15).
- // TODO(crbug.com/388318201): investigate
- DAWN_SUPPRESS_TEST_IF(IsCompatibilityMode() &&
- HasToggleEnabled("gl_force_es_31_and_no_extensions"));
-
float smallestExponent = std::pow(2.0f, -24.0f);
float largestExponent = std::pow(2.0f, float{31 - 24});
diff --git a/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
index b81613c..9f3edd7 100644
--- a/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
+++ b/src/dawn/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
@@ -1178,7 +1178,7 @@
// Tests the texture format of the resolve target must support being used as resolve target.
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetFormat) {
for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
- if (!utils::TextureFormatSupportsMultisampling(device, format) ||
+ if (!utils::TextureFormatSupportsMultisampling(device, format, UseCompatibilityMode()) ||
utils::IsDepthOrStencilFormat(format)) {
continue;
}
diff --git a/src/dawn/tests/unittests/validation/TextureValidationTests.cpp b/src/dawn/tests/unittests/validation/TextureValidationTests.cpp
index 70d1780..265ae3c 100644
--- a/src/dawn/tests/unittests/validation/TextureValidationTests.cpp
+++ b/src/dawn/tests/unittests/validation/TextureValidationTests.cpp
@@ -161,7 +161,7 @@
for (wgpu::TextureFormat format : utils::kFormatsInCoreSpec) {
descriptor.format = format;
- if (utils::TextureFormatSupportsMultisampling(device, format)) {
+ if (utils::TextureFormatSupportsMultisampling(device, format, UseCompatibilityMode())) {
device.CreateTexture(&descriptor);
} else {
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
diff --git a/src/dawn/utils/TextureUtils.cpp b/src/dawn/utils/TextureUtils.cpp
index 714e6f5..306092d 100644
--- a/src/dawn/utils/TextureUtils.cpp
+++ b/src/dawn/utils/TextureUtils.cpp
@@ -200,7 +200,8 @@
}
bool TextureFormatSupportsMultisampling(const wgpu::Device& device,
- wgpu::TextureFormat textureFormat) {
+ wgpu::TextureFormat textureFormat,
+ bool isCompatibilityMode) {
if (IsBCTextureFormat(textureFormat) || IsETC2TextureFormat(textureFormat) ||
IsASTCTextureFormat(textureFormat)) {
return false;
@@ -234,6 +235,10 @@
case wgpu::TextureFormat::RG11B10Ufloat:
return device.HasFeature(wgpu::FeatureName::RG11B10UfloatRenderable);
+ case wgpu::TextureFormat::RGBA16Float:
+ case wgpu::TextureFormat::R32Float:
+ return !isCompatibilityMode;
+
default:
return true;
}
diff --git a/src/dawn/utils/TextureUtils.h b/src/dawn/utils/TextureUtils.h
index b6a7715..69c1ae8 100644
--- a/src/dawn/utils/TextureUtils.h
+++ b/src/dawn/utils/TextureUtils.h
@@ -300,7 +300,8 @@
bool IsRenderableFormat(const wgpu::Device& device, wgpu::TextureFormat textureFormat);
bool TextureFormatSupportsMultisampling(const wgpu::Device& device,
- wgpu::TextureFormat textureFormat);
+ wgpu::TextureFormat textureFormat,
+ bool isCompatibilityMode);
bool TextureFormatSupportsResolveTarget(const wgpu::Device& device,
wgpu::TextureFormat textureFormat);