Commit 3a1ae8cc authored by Kai Ninomiya's avatar Kai Ninomiya Committed by Commit Bot

Add coverage to regression test for issue 768324

Regression test for
GLVirtualContextsTest.VertexArrayObjectRestoreDefault
on devices with use_client_side_arrays_for_stream_buffers and
use_virtualized_gl_contexts.

Bug: 768324
Test: WithWorkarounds/GLVirtualContextsTest.VertexArrayObjectRestoreDefault/1
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I1b1f8fb791a02c614f1a4c9f869016c198902a16
Reviewed-on: https://chromium-review.googlesource.com/699459
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506606}
parent 64821367
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <GLES2/gl2extchromium.h> #include <GLES2/gl2extchromium.h>
#include <stdint.h> #include <stdint.h>
#include "build/build_config.h"
#include "gpu/command_buffer/tests/gl_manager.h" #include "gpu/command_buffer/tests/gl_manager.h"
#include "gpu/command_buffer/tests/gl_test_utils.h" #include "gpu/command_buffer/tests/gl_test_utils.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
...@@ -16,27 +17,24 @@ ...@@ -16,27 +17,24 @@
namespace gpu { namespace gpu {
class GLVirtualContextsTest : public testing::Test { class GLVirtualContextsTest
: public testing::TestWithParam<GpuDriverBugWorkarounds> {
protected: protected:
static const int kSize0 = 4; static const int kSize0 = 4;
static const int kSize1 = 8; static const int kSize1 = 8;
static const int kSize2 = 16; static const int kSize2 = 16;
static const GLfloat kFloatRed[4];
static const GLfloat kFloatGreen[4];
static const uint8_t kExpectedRed[4];
static const uint8_t kExpectedGreen[4];
void SetUp() override { void SetUp() override {
GpuDriverBugWorkarounds workarounds = GetParam();
GLManager::Options options; GLManager::Options options;
options.size = gfx::Size(kSize0, kSize0); options.size = gfx::Size(kSize0, kSize0);
gl_real_.Initialize(options); gl_real_.InitializeWithWorkarounds(options, workarounds);
gl_real_shared_.Initialize(options); gl_real_shared_.InitializeWithWorkarounds(options, workarounds);
options.virtual_manager = &gl_real_shared_; options.virtual_manager = &gl_real_shared_;
options.size = gfx::Size(kSize1, kSize1); options.size = gfx::Size(kSize1, kSize1);
gl1_.Initialize(options); gl1_.InitializeWithWorkarounds(options, workarounds);
options.size = gfx::Size(kSize2, kSize2); options.size = gfx::Size(kSize2, kSize2);
gl2_.Initialize(options); gl2_.InitializeWithWorkarounds(options, workarounds);
} }
void TearDown() override { void TearDown() override {
...@@ -86,16 +84,16 @@ class GLVirtualContextsTest : public testing::Test { ...@@ -86,16 +84,16 @@ class GLVirtualContextsTest : public testing::Test {
GLManager gl2_; GLManager gl2_;
}; };
const GLfloat GLVirtualContextsTest::kFloatRed[4] = { constexpr GLfloat kFloatRed[4] = {
1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
}; };
const GLfloat GLVirtualContextsTest::kFloatGreen[4] = { constexpr GLfloat kFloatGreen[4] = {
0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f,
}; };
const uint8_t GLVirtualContextsTest::kExpectedRed[4] = { constexpr uint8_t kExpectedRed[4] = {
255, 0, 0, 255, 255, 0, 0, 255,
}; };
const uint8_t GLVirtualContextsTest::kExpectedGreen[4] = { constexpr uint8_t kExpectedGreen[4] = {
0, 255, 0, 255, 0, 255, 0, 255,
}; };
...@@ -149,7 +147,7 @@ void TestDraw(int size) { ...@@ -149,7 +147,7 @@ void TestDraw(int size) {
} // anonymous namespace } // anonymous namespace
// http://crbug.com/281565 // http://crbug.com/281565
TEST_F(GLVirtualContextsTest, Basic) { TEST_P(GLVirtualContextsTest, Basic) {
struct TestInfo { struct TestInfo {
int size; int size;
uint8_t color[4]; uint8_t color[4];
...@@ -193,7 +191,7 @@ TEST_F(GLVirtualContextsTest, Basic) { ...@@ -193,7 +191,7 @@ TEST_F(GLVirtualContextsTest, Basic) {
} }
// http://crbug.com/363407 // http://crbug.com/363407
TEST_F(GLVirtualContextsTest, VertexArrayObjectRestore) { TEST_P(GLVirtualContextsTest, VertexArrayObjectRestore) {
GLuint vao1 = 0, vao2 = 0; GLuint vao1 = 0, vao2 = 0;
gl1_.MakeCurrent(); gl1_.MakeCurrent();
...@@ -228,7 +226,7 @@ TEST_F(GLVirtualContextsTest, VertexArrayObjectRestore) { ...@@ -228,7 +226,7 @@ TEST_F(GLVirtualContextsTest, VertexArrayObjectRestore) {
} }
// http://crbug.com/363407 // http://crbug.com/363407
TEST_F(GLVirtualContextsTest, VertexArrayObjectRestoreRebind) { TEST_P(GLVirtualContextsTest, VertexArrayObjectRestoreRebind) {
GLuint vao1 = 0, vao2 = 0; GLuint vao1 = 0, vao2 = 0;
gl1_.MakeCurrent(); gl1_.MakeCurrent();
...@@ -270,7 +268,7 @@ TEST_F(GLVirtualContextsTest, VertexArrayObjectRestoreRebind) { ...@@ -270,7 +268,7 @@ TEST_F(GLVirtualContextsTest, VertexArrayObjectRestoreRebind) {
} }
// http://crbug.com/363407 // http://crbug.com/363407
TEST_F(GLVirtualContextsTest, VertexArrayObjectRestoreDefault) { TEST_P(GLVirtualContextsTest, VertexArrayObjectRestoreDefault) {
gl1_.MakeCurrent(); gl1_.MakeCurrent();
// Set up red quad in default VAO. // Set up red quad in default VAO.
SetUpColoredUnitQuad(kFloatRed); SetUpColoredUnitQuad(kFloatRed);
...@@ -307,7 +305,7 @@ TEST_F(GLVirtualContextsTest, VertexArrayObjectRestoreDefault) { ...@@ -307,7 +305,7 @@ TEST_F(GLVirtualContextsTest, VertexArrayObjectRestoreDefault) {
GLTestHelper::CheckGLError("no errors", __LINE__); GLTestHelper::CheckGLError("no errors", __LINE__);
} }
TEST_F(GLVirtualContextsTest, VirtualQueries) { TEST_P(GLVirtualContextsTest, VirtualQueries) {
const GLenum query_targets[] = { const GLenum query_targets[] = {
GL_ANY_SAMPLES_PASSED_EXT, GL_ANY_SAMPLES_PASSED_EXT,
GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
...@@ -365,5 +363,26 @@ TEST_F(GLVirtualContextsTest, VirtualQueries) { ...@@ -365,5 +363,26 @@ TEST_F(GLVirtualContextsTest, VirtualQueries) {
} }
} }
static const GpuDriverBugWorkarounds workarounds_cases[] = {
// No extra workarounds.
GpuDriverBugWorkarounds(),
#if defined(OS_ANDROID)
// Regression tests for https://crbug.com/768324
//
// TODO(kainino): The #if is added because this case does not pass on Mac
// or Linux. My guess is that this workaround requires the backing context
// to be OpenGL ES (not OpenGL Core Profile).
GpuDriverBugWorkarounds({
USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS,
}),
#endif
};
INSTANTIATE_TEST_CASE_P(WithWorkarounds,
GLVirtualContextsTest,
::testing::ValuesIn(workarounds_cases));
} // namespace gpu } // namespace gpu
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