summaryrefslogtreecommitdiffstats
path: root/cc/test/render_pass_test_common.cc
diff options
context:
space:
mode:
authorvmiura@chromium.org <vmiura@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-16 06:19:48 +0000
committervmiura@chromium.org <vmiura@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-16 06:21:41 +0000
commit71108f2cad83dc4522f2a9894eafe281e45d6585 (patch)
treea90f6b7dbcead1c9eab979a2063e483ca1d9f5a3 /cc/test/render_pass_test_common.cc
parentd117e52880e6e1fb52c43a3d6d55b634afce7975 (diff)
downloadchromium_src-71108f2cad83dc4522f2a9894eafe281e45d6585.zip
chromium_src-71108f2cad83dc4522f2a9894eafe281e45d6585.tar.gz
chromium_src-71108f2cad83dc4522f2a9894eafe281e45d6585.tar.bz2
Early wait on texture resource sync points in gl_renderer.
Previously texture resource sync points were waited on a just-in-time basis, just before drawing with the texture. This change moves all sync point waits ahead of drawing a frame, to ensure that we don't switch GLContexts in the middle of drawing. BUG=394547 Review URL: https://codereview.chromium.org/411643002 Cr-Commit-Position: refs/heads/master@{#290109} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/render_pass_test_common.cc')
-rw-r--r--cc/test/render_pass_test_common.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc
index 8e81320..9b04370 100644
--- a/cc/test/render_pass_test_common.cc
+++ b/cc/test/render_pass_test_common.cc
@@ -4,6 +4,7 @@
#include "cc/test/render_pass_test_common.h"
+#include "base/bind.h"
#include "cc/quads/checkerboard_draw_quad.h"
#include "cc/quads/debug_border_draw_quad.h"
#include "cc/quads/io_surface_draw_quad.h"
@@ -19,6 +20,9 @@
namespace cc {
+static void EmptyReleaseCallback(uint32 sync_point, bool lost_resource) {
+}
+
void TestRenderPass::AppendOneOfEveryQuadType(
ResourceProvider* resource_provider,
RenderPass::Id child_pass) {
@@ -26,6 +30,7 @@ void TestRenderPass::AppendOneOfEveryQuadType(
gfx::Rect opaque_rect(10, 10, 80, 80);
gfx::Rect visible_rect(0, 0, 100, 100);
const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f};
+
ResourceProvider::ResourceId resource1 = resource_provider->CreateResource(
gfx::Size(45, 5),
GL_CLAMP_TO_EDGE,
@@ -69,6 +74,17 @@ void TestRenderPass::AppendOneOfEveryQuadType(
resource_provider->best_texture_format());
resource_provider->AllocateForTesting(resource7);
+ unsigned target = GL_TEXTURE_2D;
+ gpu::Mailbox gpu_mailbox;
+ memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1);
+ scoped_ptr<SingleReleaseCallback> callback =
+ SingleReleaseCallback::Create(base::Bind(&EmptyReleaseCallback));
+ TextureMailbox mailbox(gpu_mailbox, target, kSyncPointForMailboxTextureQuad);
+ ResourceProvider::ResourceId resource8 =
+ resource_provider->CreateResourceFromTextureMailbox(mailbox,
+ callback.Pass());
+ resource_provider->AllocateForTesting(resource8);
+
SharedQuadState* shared_state = this->CreateAndAppendSharedQuadState();
shared_state->SetAll(gfx::Transform(),
rect.size(),
@@ -151,6 +167,20 @@ void TestRenderPass::AppendOneOfEveryQuadType(
vertex_opacity,
false);
+ TextureDrawQuad* mailbox_texture_quad =
+ this->CreateAndAppendDrawQuad<TextureDrawQuad>();
+ mailbox_texture_quad->SetNew(shared_state,
+ rect,
+ opaque_rect,
+ visible_rect,
+ resource8,
+ false,
+ gfx::PointF(0.f, 0.f),
+ gfx::PointF(1.f, 1.f),
+ SK_ColorTRANSPARENT,
+ vertex_opacity,
+ false);
+
TileDrawQuad* scaled_tile_quad =
this->CreateAndAppendDrawQuad<TileDrawQuad>();
scaled_tile_quad->SetNew(shared_state,