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

Side by Side 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, 6 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h>
7 #include <GLES2/gl2extchromium.h>
8
9 #include "gpu/command_buffer/tests/gl_manager.h"
10 #include "gpu/command_buffer/tests/gl_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace gpu {
14
15 class GLDescheduleTest : public testing::Test {
16 protected:
17 void SetUp() override {
18 GLManager::Options options;
19 gl1_.Initialize(options);
20 }
21
22 void TearDown() override {
23 gl1_.Destroy();
24 }
25
26 GLManager gl1_;
27 };
28
29 TEST_F(GLDescheduleTest, Deschedule) {
30 gl1_.MakeCurrent();
31
32 GLuint tex = 0;
33 glGenTextures(1, &tex);
34 glBindTexture(GL_TEXTURE_2D, tex);
35 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
36 NULL);
37
38 GLuint fbo = 0;
39 glGenFramebuffers(1, &fbo);
40 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
41 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
42 tex, 0);
43
44 glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
45 glClear(GL_COLOR_BUFFER_BIT);
46 glDescheduleUntilFinishedCHROMIUM();
47 glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
48 glClear(GL_COLOR_BUFFER_BIT);
49 glFlush();
50 glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
51 glClear(GL_COLOR_BUFFER_BIT);
52 glFlush();
53
54 uint32_t result;
55 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
56 &result);
57 EXPECT_EQ(0xFF00FF00u, result);
58
59 // GLManager doesn't implement the callbacks necessary to support
60 // glDescheduleUntilFinishedCHROMIUM, so there should be an error generated.
61 EXPECT_EQ(static_cast<GLenum>(GL_INVALID_OPERATION), glGetError());
62 }
63
64 } // namespace gpu
OLDNEW
« 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