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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 2826043002: Do not share FBOs/VAOs/Transform feedback objects across contexts (Closed)
Patch Set: added DeleteFramebuffers() expectation Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Tests for GLES2Implementation. 5 // Tests for GLES2Implementation.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 gl_impl->GenBuffers(n, ids); 336 gl_impl->GenBuffers(n, ids);
337 } 337 }
338 338
339 static void Delete(GLES2Implementation* gl_impl, 339 static void Delete(GLES2Implementation* gl_impl,
340 GLsizei n, 340 GLsizei n,
341 const GLuint* ids) { 341 const GLuint* ids) {
342 gl_impl->DeleteBuffers(n, ids); 342 gl_impl->DeleteBuffers(n, ids);
343 } 343 }
344 }; 344 };
345 345
346 // API wrapper for Framebuffers.
347 class GenFramebuffersAPI {
348 public:
349 static void Gen(GLES2Implementation* gl_impl, GLsizei n, GLuint* ids) {
350 gl_impl->GenFramebuffers(n, ids);
351 }
352
353 static void Delete(GLES2Implementation* gl_impl,
354 GLsizei n,
355 const GLuint* ids) {
356 gl_impl->DeleteFramebuffers(n, ids);
357 }
358 };
359
360 // API wrapper for Renderbuffers. 346 // API wrapper for Renderbuffers.
361 class GenRenderbuffersAPI { 347 class GenRenderbuffersAPI {
362 public: 348 public:
363 static void Gen(GLES2Implementation* gl_impl, GLsizei n, GLuint* ids) { 349 static void Gen(GLES2Implementation* gl_impl, GLsizei n, GLuint* ids) {
364 gl_impl->GenRenderbuffers(n, ids); 350 gl_impl->GenRenderbuffers(n, ids);
365 } 351 }
366 352
367 static void Delete(GLES2Implementation* gl_impl, 353 static void Delete(GLES2Implementation* gl_impl,
368 GLsizei n, 354 GLsizei n,
369 const GLuint* ids) { 355 const GLuint* ids) {
(...skipping 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after
3141 EXPECT_TRUE(CheckRect( 3127 EXPECT_TRUE(CheckRect(
3142 kWidth, 2, kFormat, kType, kPixelStoreUnpackAlignment, 3128 kWidth, 2, kFormat, kType, kPixelStoreUnpackAlignment,
3143 reinterpret_cast<uint8_t*>(pixels.get()) + offset_to_last, mem2_2.ptr)); 3129 reinterpret_cast<uint8_t*>(pixels.get()) + offset_to_last, mem2_2.ptr));
3144 } 3130 }
3145 3131
3146 // glGen* Ids must not be reused until glDelete* commands have been 3132 // glGen* Ids must not be reused until glDelete* commands have been
3147 // flushed by glFlush. 3133 // flushed by glFlush.
3148 TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestBuffers) { 3134 TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestBuffers) {
3149 FlushGenerationTest<GenBuffersAPI>(); 3135 FlushGenerationTest<GenBuffersAPI>();
3150 } 3136 }
3151 TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestFramebuffers) {
3152 FlushGenerationTest<GenFramebuffersAPI>();
3153 }
3154 TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestRenderbuffers) { 3137 TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestRenderbuffers) {
3155 FlushGenerationTest<GenRenderbuffersAPI>(); 3138 FlushGenerationTest<GenRenderbuffersAPI>();
3156 } 3139 }
3157 TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestTextures) { 3140 TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestTextures) {
3158 FlushGenerationTest<GenTexturesAPI>(); 3141 FlushGenerationTest<GenTexturesAPI>();
3159 } 3142 }
3160 3143
3161 // glGen* Ids must not be reused cross-context until glDelete* commands are 3144 // glGen* Ids must not be reused cross-context until glDelete* commands are
3162 // flushed by glFlush, and the Ids are lazily freed after. 3145 // flushed by glFlush, and the Ids are lazily freed after.
3163 TEST_F(GLES2ImplementationStrictSharedTest, CrossContextGenerationTestBuffers) { 3146 TEST_F(GLES2ImplementationStrictSharedTest, CrossContextGenerationTestBuffers) {
3164 CrossContextGenerationTest<GenBuffersAPI>(); 3147 CrossContextGenerationTest<GenBuffersAPI>();
3165 } 3148 }
3166 TEST_F(GLES2ImplementationStrictSharedTest, 3149 TEST_F(GLES2ImplementationStrictSharedTest,
3167 CrossContextGenerationTestFramebuffers) {
3168 CrossContextGenerationTest<GenFramebuffersAPI>();
3169 }
3170 TEST_F(GLES2ImplementationStrictSharedTest,
3171 CrossContextGenerationTestRenderbuffers) { 3150 CrossContextGenerationTestRenderbuffers) {
3172 CrossContextGenerationTest<GenRenderbuffersAPI>(); 3151 CrossContextGenerationTest<GenRenderbuffersAPI>();
3173 } 3152 }
3174 TEST_F(GLES2ImplementationStrictSharedTest, 3153 TEST_F(GLES2ImplementationStrictSharedTest,
3175 CrossContextGenerationTestTextures) { 3154 CrossContextGenerationTestTextures) {
3176 CrossContextGenerationTest<GenTexturesAPI>(); 3155 CrossContextGenerationTest<GenTexturesAPI>();
3177 } 3156 }
3178 3157
3179 // Test Delete which causes auto flush. Tests a regression case that occurred 3158 // Test Delete which causes auto flush. Tests a regression case that occurred
3180 // in testing. 3159 // in testing.
3181 TEST_F(GLES2ImplementationStrictSharedTest, 3160 TEST_F(GLES2ImplementationStrictSharedTest,
3182 CrossContextGenerationAutoFlushTestBuffers) { 3161 CrossContextGenerationAutoFlushTestBuffers) {
3183 CrossContextGenerationAutoFlushTest<GenBuffersAPI>(); 3162 CrossContextGenerationAutoFlushTest<GenBuffersAPI>();
3184 } 3163 }
3185 TEST_F(GLES2ImplementationStrictSharedTest, 3164 TEST_F(GLES2ImplementationStrictSharedTest,
3186 CrossContextGenerationAutoFlushTestFramebuffers) {
3187 CrossContextGenerationAutoFlushTest<GenFramebuffersAPI>();
3188 }
3189 TEST_F(GLES2ImplementationStrictSharedTest,
3190 CrossContextGenerationAutoFlushTestRenderbuffers) { 3165 CrossContextGenerationAutoFlushTestRenderbuffers) {
3191 CrossContextGenerationAutoFlushTest<GenRenderbuffersAPI>(); 3166 CrossContextGenerationAutoFlushTest<GenRenderbuffersAPI>();
3192 } 3167 }
3193 TEST_F(GLES2ImplementationStrictSharedTest, 3168 TEST_F(GLES2ImplementationStrictSharedTest,
3194 CrossContextGenerationAutoFlushTestTextures) { 3169 CrossContextGenerationAutoFlushTestTextures) {
3195 CrossContextGenerationAutoFlushTest<GenTexturesAPI>(); 3170 CrossContextGenerationAutoFlushTest<GenTexturesAPI>();
3196 } 3171 }
3197 3172
3198 TEST_F(GLES2ImplementationTest, GetString) { 3173 TEST_F(GLES2ImplementationTest, GetString) {
3199 const uint32_t kBucketId = GLES2Implementation::kResultBucketId; 3174 const uint32_t kBucketId = GLES2Implementation::kResultBucketId;
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
4628 ContextInitOptions init_options; 4603 ContextInitOptions init_options;
4629 init_options.transfer_buffer_initialize_fail = true; 4604 init_options.transfer_buffer_initialize_fail = true;
4630 EXPECT_FALSE(Initialize(init_options)); 4605 EXPECT_FALSE(Initialize(init_options));
4631 } 4606 }
4632 4607
4633 #include "base/macros.h" 4608 #include "base/macros.h"
4634 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 4609 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
4635 4610
4636 } // namespace gles2 4611 } // namespace gles2
4637 } // namespace gpu 4612 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698