OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "platform/graphics/gpu/Extensions3DUtil.h" | 38 #include "platform/graphics/gpu/Extensions3DUtil.h" |
39 #include "platform/graphics/test/MockWebGraphicsContext3D.h" | 39 #include "platform/graphics/test/MockWebGraphicsContext3D.h" |
40 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
41 #include "public/platform/WebExternalTextureMailbox.h" | 41 #include "public/platform/WebExternalTextureMailbox.h" |
42 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
43 | 43 |
44 #include <gmock/gmock.h> | 44 #include <gmock/gmock.h> |
45 #include <gtest/gtest.h> | 45 #include <gtest/gtest.h> |
46 | 46 |
47 using namespace blink; | 47 using namespace blink; |
48 using namespace blink; | |
49 using testing::Test; | 48 using testing::Test; |
50 using testing::_; | 49 using testing::_; |
51 | 50 |
52 namespace { | 51 namespace { |
53 | 52 |
54 class FakeContextEvictionManager : public ContextEvictionManager { | 53 class FakeContextEvictionManager : public ContextEvictionManager { |
55 public: | 54 public: |
56 void forciblyLoseOldestContext(const String& reason) { } | 55 void forciblyLoseOldestContext(const String& reason) { } |
57 IntSize oldestContextSize() { return IntSize(); } | 56 IntSize oldestContextSize() { return IntSize(); } |
58 }; | 57 }; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 HashMap<WGC3Duint, IntSize> m_imageSizes; | 165 HashMap<WGC3Duint, IntSize> m_imageSizes; |
167 HashMap<WGC3Duint, WebGLId> m_imageToTextureMap; | 166 HashMap<WGC3Duint, WebGLId> m_imageToTextureMap; |
168 }; | 167 }; |
169 | 168 |
170 static const int initialWidth = 100; | 169 static const int initialWidth = 100; |
171 static const int initialHeight = 100; | 170 static const int initialHeight = 100; |
172 static const int alternateHeight = 50; | 171 static const int alternateHeight = 50; |
173 | 172 |
174 class DrawingBufferForTests : public DrawingBuffer { | 173 class DrawingBufferForTests : public DrawingBuffer { |
175 public: | 174 public: |
176 static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<blink::WebGraphic
sContext3D> context, | 175 static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<WebGraphicsContex
t3D> context, |
177 const IntSize& size, PreserveDrawingBuffer preserve, PassRefPtr<ContextE
victionManager> contextEvictionManager) | 176 const IntSize& size, PreserveDrawingBuffer preserve, PassRefPtr<ContextE
victionManager> contextEvictionManager) |
178 { | 177 { |
179 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(conte
xt.get()); | 178 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(conte
xt.get()); |
180 RefPtr<DrawingBufferForTests> drawingBuffer = | 179 RefPtr<DrawingBufferForTests> drawingBuffer = |
181 adoptRef(new DrawingBufferForTests(context, extensionsUtil.release()
, preserve, contextEvictionManager)); | 180 adoptRef(new DrawingBufferForTests(context, extensionsUtil.release()
, preserve, contextEvictionManager)); |
182 if (!drawingBuffer->initialize(size)) { | 181 if (!drawingBuffer->initialize(size)) { |
183 drawingBuffer->beginDestruction(); | 182 drawingBuffer->beginDestruction(); |
184 return PassRefPtr<DrawingBufferForTests>(); | 183 return PassRefPtr<DrawingBufferForTests>(); |
185 } | 184 } |
186 return drawingBuffer.release(); | 185 return drawingBuffer.release(); |
187 } | 186 } |
188 | 187 |
189 DrawingBufferForTests(PassOwnPtr<blink::WebGraphicsContext3D> context, | 188 DrawingBufferForTests(PassOwnPtr<WebGraphicsContext3D> context, |
190 PassOwnPtr<Extensions3DUtil> extensionsUtil, | 189 PassOwnPtr<Extensions3DUtil> extensionsUtil, |
191 PreserveDrawingBuffer preserve, | 190 PreserveDrawingBuffer preserve, |
192 PassRefPtr<ContextEvictionManager> contextEvictionManager) | 191 PassRefPtr<ContextEvictionManager> contextEvictionManager) |
193 : DrawingBuffer(context, extensionsUtil, false /* multisampleExtensionSu
pported */, | 192 : DrawingBuffer(context, extensionsUtil, false /* multisampleExtensionSu
pported */, |
194 false /* packedDepthStencilExtensionSupported */, preserve, blink::W
ebGraphicsContext3D::Attributes(), contextEvictionManager) | 193 false /* packedDepthStencilExtensionSupported */, preserve, WebGraph
icsContext3D::Attributes(), contextEvictionManager) |
195 , m_live(0) | 194 , m_live(0) |
196 { } | 195 { } |
197 | 196 |
198 virtual ~DrawingBufferForTests() | 197 virtual ~DrawingBufferForTests() |
199 { | 198 { |
200 if (m_live) | 199 if (m_live) |
201 *m_live = false; | 200 *m_live = false; |
202 } | 201 } |
203 | 202 |
204 bool* m_live; | 203 bool* m_live; |
(...skipping 29 matching lines...) Expand all Loading... |
234 EXPECT_FALSE(imageBuffer->isAccelerated()); | 233 EXPECT_FALSE(imageBuffer->isAccelerated()); |
235 EXPECT_FALSE(imageBuffer->bitmap().isNull()); | 234 EXPECT_FALSE(imageBuffer->bitmap().isNull()); |
236 m_drawingBuffer->paintRenderingResultsToCanvas(imageBuffer.get()); | 235 m_drawingBuffer->paintRenderingResultsToCanvas(imageBuffer.get()); |
237 EXPECT_FALSE(imageBuffer->isAccelerated()); | 236 EXPECT_FALSE(imageBuffer->isAccelerated()); |
238 EXPECT_FALSE(imageBuffer->bitmap().isNull()); | 237 EXPECT_FALSE(imageBuffer->bitmap().isNull()); |
239 m_drawingBuffer->beginDestruction(); | 238 m_drawingBuffer->beginDestruction(); |
240 } | 239 } |
241 | 240 |
242 TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes) | 241 TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes) |
243 { | 242 { |
244 blink::WebExternalTextureMailbox mailbox; | 243 WebExternalTextureMailbox mailbox; |
245 | 244 |
246 IntSize initialSize(initialWidth, initialHeight); | 245 IntSize initialSize(initialWidth, initialHeight); |
247 IntSize alternateSize(initialWidth, alternateHeight); | 246 IntSize alternateSize(initialWidth, alternateHeight); |
248 | 247 |
249 // Produce one mailbox at size 100x100. | 248 // Produce one mailbox at size 100x100. |
250 m_drawingBuffer->markContentsChanged(); | 249 m_drawingBuffer->markContentsChanged(); |
251 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 250 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
252 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 251 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
253 | 252 |
254 // Resize to 100x50. | 253 // Resize to 100x50. |
(...skipping 20 matching lines...) Expand all Loading... |
275 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 274 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
276 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 275 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
277 m_drawingBuffer->beginDestruction(); | 276 m_drawingBuffer->beginDestruction(); |
278 } | 277 } |
279 | 278 |
280 TEST_F(DrawingBufferTest, verifyDestructionCompleteAfterAllMailboxesReleased) | 279 TEST_F(DrawingBufferTest, verifyDestructionCompleteAfterAllMailboxesReleased) |
281 { | 280 { |
282 bool live = true; | 281 bool live = true; |
283 m_drawingBuffer->m_live = &live; | 282 m_drawingBuffer->m_live = &live; |
284 | 283 |
285 blink::WebExternalTextureMailbox mailbox1; | 284 WebExternalTextureMailbox mailbox1; |
286 blink::WebExternalTextureMailbox mailbox2; | 285 WebExternalTextureMailbox mailbox2; |
287 blink::WebExternalTextureMailbox mailbox3; | 286 WebExternalTextureMailbox mailbox3; |
288 | 287 |
289 IntSize initialSize(initialWidth, initialHeight); | 288 IntSize initialSize(initialWidth, initialHeight); |
290 | 289 |
291 // Produce mailboxes. | 290 // Produce mailboxes. |
292 m_drawingBuffer->markContentsChanged(); | 291 m_drawingBuffer->markContentsChanged(); |
293 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0)); | 292 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0)); |
294 m_drawingBuffer->markContentsChanged(); | 293 m_drawingBuffer->markContentsChanged(); |
295 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox2, 0)); | 294 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox2, 0)); |
296 m_drawingBuffer->markContentsChanged(); | 295 m_drawingBuffer->markContentsChanged(); |
297 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox3, 0)); | 296 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox3, 0)); |
(...skipping 14 matching lines...) Expand all Loading... |
312 | 311 |
313 weakPointer->markContentsChanged(); | 312 weakPointer->markContentsChanged(); |
314 weakPointer->mailboxReleased(mailbox3); | 313 weakPointer->mailboxReleased(mailbox3); |
315 EXPECT_EQ(live, false); | 314 EXPECT_EQ(live, false); |
316 } | 315 } |
317 | 316 |
318 TEST_F(DrawingBufferTest, verifyDrawingBufferStaysAliveIfResourcesAreLost) | 317 TEST_F(DrawingBufferTest, verifyDrawingBufferStaysAliveIfResourcesAreLost) |
319 { | 318 { |
320 bool live = true; | 319 bool live = true; |
321 m_drawingBuffer->m_live = &live; | 320 m_drawingBuffer->m_live = &live; |
322 blink::WebExternalTextureMailbox mailbox1; | 321 WebExternalTextureMailbox mailbox1; |
323 blink::WebExternalTextureMailbox mailbox2; | 322 WebExternalTextureMailbox mailbox2; |
324 blink::WebExternalTextureMailbox mailbox3; | 323 WebExternalTextureMailbox mailbox3; |
325 | 324 |
326 m_drawingBuffer->markContentsChanged(); | 325 m_drawingBuffer->markContentsChanged(); |
327 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0)); | 326 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0)); |
328 m_drawingBuffer->markContentsChanged(); | 327 m_drawingBuffer->markContentsChanged(); |
329 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox2, 0)); | 328 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox2, 0)); |
330 m_drawingBuffer->markContentsChanged(); | 329 m_drawingBuffer->markContentsChanged(); |
331 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox3, 0)); | 330 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox3, 0)); |
332 | 331 |
333 m_drawingBuffer->markContentsChanged(); | 332 m_drawingBuffer->markContentsChanged(); |
334 m_drawingBuffer->mailboxReleased(mailbox1, true); | 333 m_drawingBuffer->mailboxReleased(mailbox1, true); |
(...skipping 10 matching lines...) Expand all Loading... |
345 m_drawingBuffer.clear(); | 344 m_drawingBuffer.clear(); |
346 EXPECT_EQ(live, true); | 345 EXPECT_EQ(live, true); |
347 | 346 |
348 weakPtr->markContentsChanged(); | 347 weakPtr->markContentsChanged(); |
349 weakPtr->mailboxReleased(mailbox3, true); | 348 weakPtr->mailboxReleased(mailbox3, true); |
350 EXPECT_EQ(live, false); | 349 EXPECT_EQ(live, false); |
351 } | 350 } |
352 | 351 |
353 class TextureMailboxWrapper { | 352 class TextureMailboxWrapper { |
354 public: | 353 public: |
355 explicit TextureMailboxWrapper(const blink::WebExternalTextureMailbox& mailb
ox) | 354 explicit TextureMailboxWrapper(const WebExternalTextureMailbox& mailbox) |
356 : m_mailbox(mailbox) | 355 : m_mailbox(mailbox) |
357 { } | 356 { } |
358 | 357 |
359 bool operator==(const TextureMailboxWrapper& other) const | 358 bool operator==(const TextureMailboxWrapper& other) const |
360 { | 359 { |
361 return !memcmp(m_mailbox.name, other.m_mailbox.name, sizeof(m_mailbox.na
me)); | 360 return !memcmp(m_mailbox.name, other.m_mailbox.name, sizeof(m_mailbox.na
me)); |
362 } | 361 } |
363 | 362 |
364 bool operator!=(const TextureMailboxWrapper& other) const | 363 bool operator!=(const TextureMailboxWrapper& other) const |
365 { | 364 { |
366 return !(*this == other); | 365 return !(*this == other); |
367 } | 366 } |
368 | 367 |
369 private: | 368 private: |
370 blink::WebExternalTextureMailbox m_mailbox; | 369 WebExternalTextureMailbox m_mailbox; |
371 }; | 370 }; |
372 | 371 |
373 TEST_F(DrawingBufferTest, verifyOnlyOneRecycledMailboxMustBeKept) | 372 TEST_F(DrawingBufferTest, verifyOnlyOneRecycledMailboxMustBeKept) |
374 { | 373 { |
375 blink::WebExternalTextureMailbox mailbox1; | 374 WebExternalTextureMailbox mailbox1; |
376 blink::WebExternalTextureMailbox mailbox2; | 375 WebExternalTextureMailbox mailbox2; |
377 blink::WebExternalTextureMailbox mailbox3; | 376 WebExternalTextureMailbox mailbox3; |
378 | 377 |
379 // Produce mailboxes. | 378 // Produce mailboxes. |
380 m_drawingBuffer->markContentsChanged(); | 379 m_drawingBuffer->markContentsChanged(); |
381 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0)); | 380 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox1, 0)); |
382 m_drawingBuffer->markContentsChanged(); | 381 m_drawingBuffer->markContentsChanged(); |
383 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox2, 0)); | 382 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox2, 0)); |
384 m_drawingBuffer->markContentsChanged(); | 383 m_drawingBuffer->markContentsChanged(); |
385 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox3, 0)); | 384 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox3, 0)); |
386 | 385 |
387 // Release mailboxes by specific order; 1, 3, 2. | 386 // Release mailboxes by specific order; 1, 3, 2. |
388 m_drawingBuffer->markContentsChanged(); | 387 m_drawingBuffer->markContentsChanged(); |
389 m_drawingBuffer->mailboxReleased(mailbox1); | 388 m_drawingBuffer->mailboxReleased(mailbox1); |
390 m_drawingBuffer->markContentsChanged(); | 389 m_drawingBuffer->markContentsChanged(); |
391 m_drawingBuffer->mailboxReleased(mailbox3); | 390 m_drawingBuffer->mailboxReleased(mailbox3); |
392 m_drawingBuffer->markContentsChanged(); | 391 m_drawingBuffer->markContentsChanged(); |
393 m_drawingBuffer->mailboxReleased(mailbox2); | 392 m_drawingBuffer->mailboxReleased(mailbox2); |
394 | 393 |
395 // The first recycled mailbox must be 2. 1 and 3 were deleted by FIFO order
because | 394 // The first recycled mailbox must be 2. 1 and 3 were deleted by FIFO order
because |
396 // DrawingBuffer never keeps more than one mailbox. | 395 // DrawingBuffer never keeps more than one mailbox. |
397 blink::WebExternalTextureMailbox recycledMailbox1; | 396 WebExternalTextureMailbox recycledMailbox1; |
398 m_drawingBuffer->markContentsChanged(); | 397 m_drawingBuffer->markContentsChanged(); |
399 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox1, 0)); | 398 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox1, 0)); |
400 EXPECT_EQ(TextureMailboxWrapper(mailbox2), TextureMailboxWrapper(recycledMai
lbox1)); | 399 EXPECT_EQ(TextureMailboxWrapper(mailbox2), TextureMailboxWrapper(recycledMai
lbox1)); |
401 | 400 |
402 // The second recycled mailbox must be a new mailbox. | 401 // The second recycled mailbox must be a new mailbox. |
403 blink::WebExternalTextureMailbox recycledMailbox2; | 402 WebExternalTextureMailbox recycledMailbox2; |
404 m_drawingBuffer->markContentsChanged(); | 403 m_drawingBuffer->markContentsChanged(); |
405 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox2, 0)); | 404 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&recycledMailbox2, 0)); |
406 EXPECT_NE(TextureMailboxWrapper(mailbox1), TextureMailboxWrapper(recycledMai
lbox2)); | 405 EXPECT_NE(TextureMailboxWrapper(mailbox1), TextureMailboxWrapper(recycledMai
lbox2)); |
407 EXPECT_NE(TextureMailboxWrapper(mailbox2), TextureMailboxWrapper(recycledMai
lbox2)); | 406 EXPECT_NE(TextureMailboxWrapper(mailbox2), TextureMailboxWrapper(recycledMai
lbox2)); |
408 EXPECT_NE(TextureMailboxWrapper(mailbox3), TextureMailboxWrapper(recycledMai
lbox2)); | 407 EXPECT_NE(TextureMailboxWrapper(mailbox3), TextureMailboxWrapper(recycledMai
lbox2)); |
409 | 408 |
410 m_drawingBuffer->mailboxReleased(recycledMailbox1); | 409 m_drawingBuffer->mailboxReleased(recycledMailbox1); |
411 m_drawingBuffer->mailboxReleased(recycledMailbox2); | 410 m_drawingBuffer->mailboxReleased(recycledMailbox2); |
412 m_drawingBuffer->beginDestruction(); | 411 m_drawingBuffer->beginDestruction(); |
413 } | 412 } |
414 | 413 |
415 TEST_F(DrawingBufferTest, verifyInsertAndWaitSyncPointCorrectly) | 414 TEST_F(DrawingBufferTest, verifyInsertAndWaitSyncPointCorrectly) |
416 { | 415 { |
417 blink::WebExternalTextureMailbox mailbox; | 416 WebExternalTextureMailbox mailbox; |
418 | 417 |
419 // Produce mailboxes. | 418 // Produce mailboxes. |
420 m_drawingBuffer->markContentsChanged(); | 419 m_drawingBuffer->markContentsChanged(); |
421 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint()); | 420 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint()); |
422 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 421 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
423 // prepareMailbox() does not wait for any sync point. | 422 // prepareMailbox() does not wait for any sync point. |
424 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint()); | 423 EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncPoint()); |
425 | 424 |
426 unsigned waitSyncPoint = webContext()->insertSyncPoint(); | 425 unsigned waitSyncPoint = webContext()->insertSyncPoint(); |
427 mailbox.syncPoint = waitSyncPoint; | 426 mailbox.syncPoint = waitSyncPoint; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 458 |
460 virtual void TearDown() | 459 virtual void TearDown() |
461 { | 460 { |
462 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(false); | 461 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(false); |
463 } | 462 } |
464 WGC3Duint m_imageId0; | 463 WGC3Duint m_imageId0; |
465 }; | 464 }; |
466 | 465 |
467 TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) | 466 TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) |
468 { | 467 { |
469 blink::WebExternalTextureMailbox mailbox; | 468 WebExternalTextureMailbox mailbox; |
470 | 469 |
471 IntSize initialSize(initialWidth, initialHeight); | 470 IntSize initialSize(initialWidth, initialHeight); |
472 IntSize alternateSize(initialWidth, alternateHeight); | 471 IntSize alternateSize(initialWidth, alternateHeight); |
473 | 472 |
474 WGC3Duint m_imageId1 = webContext()->nextImageIdToBeCreated(); | 473 WGC3Duint m_imageId1 = webContext()->nextImageIdToBeCreated(); |
475 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId1)).Times(1); | 474 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId1)).Times(1); |
476 // Produce one mailbox at size 100x100. | 475 // Produce one mailbox at size 100x100. |
477 m_drawingBuffer->markContentsChanged(); | 476 m_drawingBuffer->markContentsChanged(); |
478 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 477 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
479 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 478 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 DepthStencilTestCase(true, true, true, 1, "both"), | 617 DepthStencilTestCase(true, true, true, 1, "both"), |
619 }; | 618 }; |
620 | 619 |
621 for (size_t i = 0; i < arraysize(cases); i++) { | 620 for (size_t i = 0; i < arraysize(cases); i++) { |
622 SCOPED_TRACE(cases[i].testCaseName); | 621 SCOPED_TRACE(cases[i].testCaseName); |
623 OwnPtr<DepthStencilTrackingContext> context = adoptPtr(new DepthStencilT
rackingContext); | 622 OwnPtr<DepthStencilTrackingContext> context = adoptPtr(new DepthStencilT
rackingContext); |
624 DepthStencilTrackingContext* trackingContext = context.get(); | 623 DepthStencilTrackingContext* trackingContext = context.get(); |
625 DrawingBuffer::PreserveDrawingBuffer preserve = DrawingBuffer::Preserve; | 624 DrawingBuffer::PreserveDrawingBuffer preserve = DrawingBuffer::Preserve; |
626 RefPtr<ContextEvictionManager> contextEvictionManager = adoptRef(new Fak
eContextEvictionManager); | 625 RefPtr<ContextEvictionManager> contextEvictionManager = adoptRef(new Fak
eContextEvictionManager); |
627 | 626 |
628 blink::WebGraphicsContext3D::Attributes requestedAttributes; | 627 WebGraphicsContext3D::Attributes requestedAttributes; |
629 requestedAttributes.stencil = cases[i].requestStencil; | 628 requestedAttributes.stencil = cases[i].requestStencil; |
630 requestedAttributes.depth = cases[i].requestDepth; | 629 requestedAttributes.depth = cases[i].requestDepth; |
631 RefPtr<DrawingBuffer> drawingBuffer = DrawingBuffer::create(context.rele
ase(), IntSize(10, 10), preserve, requestedAttributes, contextEvictionManager); | 630 RefPtr<DrawingBuffer> drawingBuffer = DrawingBuffer::create(context.rele
ase(), IntSize(10, 10), preserve, requestedAttributes, contextEvictionManager); |
632 | 631 |
633 EXPECT_EQ(cases[i].requestDepth, drawingBuffer->getActualAttributes().de
pth); | 632 EXPECT_EQ(cases[i].requestDepth, drawingBuffer->getActualAttributes().de
pth); |
634 EXPECT_EQ(cases[i].requestStencil, drawingBuffer->getActualAttributes().
stencil); | 633 EXPECT_EQ(cases[i].requestStencil, drawingBuffer->getActualAttributes().
stencil); |
635 EXPECT_EQ(cases[i].expectedRenderBuffers, trackingContext->numAllocatedR
enderBuffer()); | 634 EXPECT_EQ(cases[i].expectedRenderBuffers, trackingContext->numAllocatedR
enderBuffer()); |
636 if (cases[i].expectDepthStencil) { | 635 if (cases[i].expectDepthStencil) { |
637 EXPECT_EQ(trackingContext->stencilAttachment(), trackingContext->dep
thAttachment()); | 636 EXPECT_EQ(trackingContext->stencilAttachment(), trackingContext->dep
thAttachment()); |
638 } else if (cases[i].requestStencil || cases[i].requestDepth) { | 637 } else if (cases[i].requestStencil || cases[i].requestDepth) { |
(...skipping 14 matching lines...) Expand all Loading... |
653 } else { | 652 } else { |
654 EXPECT_EQ(0u, trackingContext->stencilAttachment()); | 653 EXPECT_EQ(0u, trackingContext->stencilAttachment()); |
655 EXPECT_EQ(0u, trackingContext->depthAttachment()); | 654 EXPECT_EQ(0u, trackingContext->depthAttachment()); |
656 } | 655 } |
657 | 656 |
658 drawingBuffer->beginDestruction(); | 657 drawingBuffer->beginDestruction(); |
659 } | 658 } |
660 } | 659 } |
661 | 660 |
662 } // namespace | 661 } // namespace |
OLD | NEW |