Add ANGLE_multiview_multisample
We add a novel multiview multisampling extension that includes the
requirement to explicitly resolve the multisampled framebuffer. The
explicit resolve is much more straightforward to implement on top of
OpenGL and D3D11 than implicit resolve found in the native extension
OVR_multiview_multisampled_render_to_texture. It also has predictable
performance characteristics.
The extension allows multiview drawing to 2D multisample texture
arrays and is now enabled on both the GL backend and the D3D11
backend. The implementation is fairly simple, as it involves just
small changes in validation to allow multisampled framebuffer
attachments. The multiview rendering logic is exactly the same
regardless of whether multisampling is enabled.
For the most part the same tests are used to test both multisampled
and non-multisampled rendering. The tests will use a different
framebuffer setup depending on the test param. They resolve the
multisampled framebuffer to a non-multisampled framebuffer prior to
any readbacks from the framebuffer.
Some of the tests are adjusted so that they have the correct sub-pixel
positioning of multisampled quads, so there won't be any pixels that
would be just partially covered.
The tests don't have any tolerance for partially covered pixels - if
we find any platforms where the tests run into a sub-pixel positioning
corner case, tolerance may need to be added later.
BUG=angleproject:2775
TEST=angle_end2end_tests
Change-Id: I590d7f300a92ea5439f2720d9db14a7976db2e1d
Reviewed-on: https://chromium-review.googlesource.com/1221214
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/tests/gl_tests/FramebufferMultiviewTest.cpp b/src/tests/gl_tests/FramebufferMultiviewTest.cpp
index fadc469..f373f2d 100644
--- a/src/tests/gl_tests/FramebufferMultiviewTest.cpp
+++ b/src/tests/gl_tests/FramebufferMultiviewTest.cpp
@@ -90,7 +90,7 @@
glGenTextures(1, &mDepthTex);
}
- CreateMultiviewBackingTextures(GL_FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE, 2, 2, 2,
+ CreateMultiviewBackingTextures(GL_FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE, 0, 2, 2, 2,
mColorTex, mDepthTex, mDepthStencilTex);
glGenFramebuffers(1, &mMultiviewFBO);
@@ -232,7 +232,7 @@
glGenTextures(1, &mDepthTex);
}
- CreateMultiviewBackingTextures(GL_FRAMEBUFFER_MULTIVIEW_LAYERED_ANGLE, width, height,
+ CreateMultiviewBackingTextures(GL_FRAMEBUFFER_MULTIVIEW_LAYERED_ANGLE, 0, width, height,
numLayers, mColorTex, mDepthTex, mDepthStencilTex);
glGenFramebuffers(1, &mMultiviewFBO);
@@ -1420,6 +1420,28 @@
EXPECT_EQ(GLColor::green, getLayerColor(1, GL_COLOR_ATTACHMENT0));
}
+// Test that attaching a multisampled texture array is not possible if all the required extensions
+// are not enabled.
+TEST_P(FramebufferMultiviewTest, NegativeMultisampledFramebufferTest)
+{
+ ANGLE_SKIP_TEST_IF(!requestMultiviewExtension());
+
+ ANGLE_SKIP_TEST_IF(!ensureExtensionEnabled("GL_OES_texture_storage_multisample_2d_array"));
+
+ // We don't enable ANGLE_multiview_multisample
+
+ GLTexture multisampleTexture;
+ glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES, multisampleTexture);
+
+ GLFramebuffer fbo;
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ glFramebufferTextureMultiviewLayeredANGLE(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ multisampleTexture, 0, 0, 2);
+ // From the extension spec: "An INVALID_OPERATION error is generated if texture is not zero, and
+ // does not name an existing texture object of type TEXTURE_2D_ARRAY."
+ EXPECT_GL_ERROR(GL_INVALID_OPERATION);
+}
+
ANGLE_INSTANTIATE_TEST(FramebufferMultiviewTest, VertexShaderOpenGL(3, 0), GeomShaderD3D11(3, 0));
ANGLE_INSTANTIATE_TEST(FramebufferMultiviewSideBySideClearTest,
VertexShaderOpenGL(3, 0),