Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: gpu/command_buffer/tests/gl_deschedule_unittest.cc

Issue 2021603002: gpu: Add a new extension CHROMIUM_deschedule. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.cc ('k') | gpu/gpu.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/gl_deschedule_unittest.cc
diff --git a/gpu/command_buffer/tests/gl_deschedule_unittest.cc b/gpu/command_buffer/tests/gl_deschedule_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3fc44547cd8342c94df20690d2f9db4cb03305e2
--- /dev/null
+++ b/gpu/command_buffer/tests/gl_deschedule_unittest.cc
@@ -0,0 +1,64 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <GLES2/gl2extchromium.h>
+
+#include "gpu/command_buffer/tests/gl_manager.h"
+#include "gpu/command_buffer/tests/gl_test_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace gpu {
+
+class GLDescheduleTest : public testing::Test {
+ protected:
+ void SetUp() override {
+ GLManager::Options options;
+ gl1_.Initialize(options);
+ }
+
+ void TearDown() override {
+ gl1_.Destroy();
+ }
+
+ GLManager gl1_;
+};
+
+TEST_F(GLDescheduleTest, Deschedule) {
+ gl1_.MakeCurrent();
+
+ GLuint tex = 0;
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ NULL);
+
+ GLuint fbo = 0;
+ glGenFramebuffers(1, &fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
+ tex, 0);
+
+ glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glDescheduleUntilFinishedCHROMIUM();
+ glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glFlush();
+ glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glFlush();
+
+ uint32_t result;
+ glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
+ &result);
+ EXPECT_EQ(0xFF00FF00u, result);
+
+ // GLManager doesn't implement the callbacks necessary to support
+ // glDescheduleUntilFinishedCHROMIUM, so there should be an error generated.
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError());
+}
+
+} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.cc ('k') | gpu/gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698