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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTestHelpers.h

Issue 2812963003: Add DrawingBuffer multisample resolve unit test. (Closed)
Patch Set: Use enum. Created 3 years, 8 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 | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #include "gpu/command_buffer/common/capabilities.h" 5 #include "gpu/command_buffer/common/capabilities.h"
6 #include "platform/RuntimeEnabledFeatures.h" 6 #include "platform/RuntimeEnabledFeatures.h"
7 #include "platform/graphics/gpu/DrawingBuffer.h" 7 #include "platform/graphics/gpu/DrawingBuffer.h"
8 #include "platform/graphics/gpu/Extensions3DUtil.h" 8 #include "platform/graphics/gpu/Extensions3DUtil.h"
9 #include "public/platform/WebGraphicsContext3DProvider.h" 9 #include "public/platform/WebGraphicsContext3DProvider.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 enum { 15 enum {
16 kInitialWidth = 100, 16 kInitialWidth = 100,
17 kInitialHeight = 100, 17 kInitialHeight = 100,
18 kAlternateHeight = 50, 18 kAlternateHeight = 50,
19 }; 19 };
20 20
21 enum UseMultisampling {
22 kDisableMultisampling,
23 kEnableMultisampling,
24 };
25
21 class DrawingBufferForTests : public DrawingBuffer { 26 class DrawingBufferForTests : public DrawingBuffer {
22 public: 27 public:
23 static PassRefPtr<DrawingBufferForTests> Create( 28 static PassRefPtr<DrawingBufferForTests> Create(
24 std::unique_ptr<WebGraphicsContext3DProvider> context_provider, 29 std::unique_ptr<WebGraphicsContext3DProvider> context_provider,
25 DrawingBuffer::Client* client, 30 DrawingBuffer::Client* client,
26 const IntSize& size, 31 const IntSize& size,
27 PreserveDrawingBuffer preserve) { 32 PreserveDrawingBuffer preserve,
33 UseMultisampling use_multisampling) {
28 std::unique_ptr<Extensions3DUtil> extensions_util = 34 std::unique_ptr<Extensions3DUtil> extensions_util =
29 Extensions3DUtil::Create(context_provider->ContextGL()); 35 Extensions3DUtil::Create(context_provider->ContextGL());
30 RefPtr<DrawingBufferForTests> drawing_buffer = 36 RefPtr<DrawingBufferForTests> drawing_buffer =
31 AdoptRef(new DrawingBufferForTests(std::move(context_provider), 37 AdoptRef(new DrawingBufferForTests(std::move(context_provider),
32 std::move(extensions_util), client, 38 std::move(extensions_util), client,
33 preserve)); 39 preserve));
34 bool multisample_extension_supported = false; 40 if (!drawing_buffer->Initialize(
35 if (!drawing_buffer->Initialize(size, multisample_extension_supported)) { 41 size, use_multisampling != kDisableMultisampling)) {
36 drawing_buffer->BeginDestruction(); 42 drawing_buffer->BeginDestruction();
37 return nullptr; 43 return nullptr;
38 } 44 }
39 return drawing_buffer.Release(); 45 return drawing_buffer.Release();
40 } 46 }
41 47
42 DrawingBufferForTests( 48 DrawingBufferForTests(
43 std::unique_ptr<WebGraphicsContext3DProvider> context_provider, 49 std::unique_ptr<WebGraphicsContext3DProvider> context_provider,
44 std::unique_ptr<Extensions3DUtil> extensions_util, 50 std::unique_ptr<Extensions3DUtil> extensions_util,
45 DrawingBuffer::Client* client, 51 DrawingBuffer::Client* client,
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 GLbyte current_mailbox_byte_ = 0; 400 GLbyte current_mailbox_byte_ = 0;
395 IntSize most_recently_produced_size_; 401 IntSize most_recently_produced_size_;
396 bool create_image_chromium_fail_ = false; 402 bool create_image_chromium_fail_ = false;
397 GLuint current_image_id_ = 1; 403 GLuint current_image_id_ = 1;
398 HashMap<GLuint, IntSize> texture_sizes_; 404 HashMap<GLuint, IntSize> texture_sizes_;
399 HashMap<GLuint, IntSize> image_sizes_; 405 HashMap<GLuint, IntSize> image_sizes_;
400 HashMap<GLuint, GLuint> image_to_texture_map_; 406 HashMap<GLuint, GLuint> image_to_texture_map_;
401 }; 407 };
402 408
403 } // blink 409 } // blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698