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

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: Comments from piman. 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
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..80ba4e877c6f4353ab9f4f40c2d588a606857a53
--- /dev/null
+++ b/gpu/command_buffer/tests/gl_deschedule_unittest.cc
@@ -0,0 +1,60 @@
+// 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);
+}
+
+} // namespace gpu

Powered by Google App Engine
This is Rietveld 408576698