| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 memset(mailbox, m_currentMailboxByte, sizeof(temp.name)); | 111 memset(mailbox, m_currentMailboxByte, sizeof(temp.name)); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ProduceTextureDirectCHROMIUM(GLuint texture, GLenum target, const GLbyt
e* mailbox) override | 114 void ProduceTextureDirectCHROMIUM(GLuint texture, GLenum target, const GLbyt
e* mailbox) override |
| 115 { | 115 { |
| 116 ASSERT_EQ(target, drawingBufferTextureTarget(m_allowImageChromium)); | 116 ASSERT_EQ(target, drawingBufferTextureTarget(m_allowImageChromium)); |
| 117 ASSERT_TRUE(m_textureSizes.contains(texture)); | 117 ASSERT_TRUE(m_textureSizes.contains(texture)); |
| 118 m_mostRecentlyProducedSize = m_textureSizes.get(texture); | 118 m_mostRecentlyProducedSize = m_textureSizes.get(texture); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei wi
dth, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixel
s) override |
| 122 { |
| 123 if (target == GL_TEXTURE_2D && !level) { |
| 124 m_textureSizes.set(m_boundTexture, IntSize(width, height)); |
| 125 } |
| 126 } |
| 127 |
| 128 WGC3Duint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width, GLsizei height,
GLenum internalformat, GLenum usage) override |
| 129 { |
| 130 if (!m_allowImageChromium) |
| 131 return false; |
| 132 m_imageSizes.set(m_currentImageId, IntSize(width, height)); |
| 133 return m_currentImageId++; |
| 134 } |
| 135 |
| 136 MOCK_METHOD1(DestroyImageMock, void(GLuint imageId)); |
| 137 void DestroyImageCHROMIUM(GLuint imageId) |
| 138 { |
| 139 m_imageSizes.remove(imageId); |
| 140 // No textures should be bound to this. |
| 141 ASSERT(m_imageToTextureMap.find(imageId) == m_imageToTextureMap.end()); |
| 142 m_imageSizes.remove(imageId); |
| 143 DestroyImageMock(imageId); |
| 144 } |
| 145 |
| 146 MOCK_METHOD1(BindTexImage2DMock, void(GLint imageId)); |
| 147 void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) |
| 148 { |
| 149 if (target == imageTextureTarget()) { |
| 150 m_textureSizes.set(m_boundTexture, m_imageSizes.find(imageId)->value
); |
| 151 m_imageToTextureMap.set(imageId, m_boundTexture); |
| 152 BindTexImage2DMock(imageId); |
| 153 } |
| 154 } |
| 155 |
| 156 MOCK_METHOD1(ReleaseTexImage2DMock, void(GLint imageId)); |
| 157 void ReleaseTexImage2DCHROMIUM(GLenum target, GLint imageId) |
| 158 { |
| 159 if (target == imageTextureTarget()) { |
| 160 m_imageSizes.set(m_currentImageId, IntSize()); |
| 161 m_imageToTextureMap.remove(imageId); |
| 162 ReleaseTexImage2DMock(imageId); |
| 163 } |
| 164 } |
| 165 |
| 121 uint32_t boundTexture() const { return m_boundTexture; } | 166 uint32_t boundTexture() const { return m_boundTexture; } |
| 122 uint32_t boundTextureTarget() const { return m_boundTextureTarget; } | 167 uint32_t boundTextureTarget() const { return m_boundTextureTarget; } |
| 123 uint32_t mostRecentlyWaitedSyncToken() const { return m_mostRecentlyWaitedSy
ncToken; } | 168 uint32_t mostRecentlyWaitedSyncToken() const { return m_mostRecentlyWaitedSy
ncToken; } |
| 169 uint32_t currentImageId() const { return m_currentImageId; } |
| 124 IntSize mostRecentlyProducedSize() const { return m_mostRecentlyProducedSize
; } | 170 IntSize mostRecentlyProducedSize() const { return m_mostRecentlyProducedSize
; } |
| 125 bool allowImageChromium() const { return m_allowImageChromium; } | 171 bool allowImageChromium() const { return m_allowImageChromium; } |
| 126 HashMap<WebGLId, IntSize>& textureSizes() { return m_textureSizes; } | |
| 127 const HashMap<WebGLId, IntSize>& textureSizes() const { return m_textureSize
s; } | |
| 128 | 172 |
| 129 void setAllowImageChromium(bool allow) { m_allowImageChromium = allow; } | 173 void setAllowImageChromium(bool allow) { m_allowImageChromium = allow; } |
| 130 | 174 |
| 131 private: | 175 private: |
| 132 uint32_t m_boundTexture = 0; | 176 uint32_t m_boundTexture = 0; |
| 133 uint32_t m_boundTextureTarget = 0; | 177 uint32_t m_boundTextureTarget = 0; |
| 134 uint32_t m_mostRecentlyWaitedSyncToken = 0; | 178 uint32_t m_mostRecentlyWaitedSyncToken = 0; |
| 135 HashMap<WebGLId, IntSize> m_textureSizes; | |
| 136 WGC3Dbyte m_currentMailboxByte = 0; | 179 WGC3Dbyte m_currentMailboxByte = 0; |
| 137 IntSize m_mostRecentlyProducedSize; | 180 IntSize m_mostRecentlyProducedSize; |
| 138 bool m_allowImageChromium = true; | 181 bool m_allowImageChromium = true; |
| 182 uint32_t m_currentImageId = 1; |
| 183 HashMap<uint32_t, IntSize> m_textureSizes; |
| 184 HashMap<uint32_t, IntSize> m_imageSizes; |
| 185 HashMap<uint32_t, uint32_t> m_imageToTextureMap; |
| 139 }; | 186 }; |
| 140 | 187 |
| 141 class WebGraphicsContext3DForTests : public MockWebGraphicsContext3D { | 188 class WebGraphicsContext3DForTests : public MockWebGraphicsContext3D { |
| 142 public: | 189 public: |
| 143 WebGraphicsContext3DForTests(PassOwnPtr<GLES2InterfaceForTests> contextGL) | 190 WebGraphicsContext3DForTests(PassOwnPtr<GLES2InterfaceForTests> contextGL) |
| 144 : m_currentImageId(1) | 191 : m_contextGL(std::move(contextGL)) |
| 145 , m_contextGL(std::move(contextGL)) | |
| 146 { | 192 { |
| 147 } | 193 } |
| 148 | 194 |
| 149 void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat,
WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denu
m type, const void* pixels) override | |
| 150 { | |
| 151 if (target == GL_TEXTURE_2D && !level) { | |
| 152 m_contextGL->textureSizes().set(m_contextGL->boundTexture(), IntSize
(width, height)); | |
| 153 } | |
| 154 } | |
| 155 | |
| 156 bool genSyncTokenCHROMIUM(WGC3Duint64 fenceSync, WGC3Dbyte* syncToken) overr
ide | 195 bool genSyncTokenCHROMIUM(WGC3Duint64 fenceSync, WGC3Dbyte* syncToken) overr
ide |
| 157 { | 196 { |
| 158 memcpy(syncToken, &fenceSync, sizeof(fenceSync)); | 197 memcpy(syncToken, &fenceSync, sizeof(fenceSync)); |
| 159 return true; | 198 return true; |
| 160 } | 199 } |
| 161 | 200 |
| 162 WGC3Duint createGpuMemoryBufferImageCHROMIUM(WGC3Dsizei width, WGC3Dsizei he
ight, WGC3Denum internalformat, WGC3Denum usage) override | |
| 163 { | |
| 164 if (!m_contextGL->allowImageChromium()) | |
| 165 return false; | |
| 166 m_imageSizes.set(m_currentImageId, IntSize(width, height)); | |
| 167 return m_currentImageId++; | |
| 168 } | |
| 169 | |
| 170 MOCK_METHOD1(destroyImageMock, void(WGC3Duint imageId)); | |
| 171 void destroyImageCHROMIUM(WGC3Duint imageId) | |
| 172 { | |
| 173 m_imageSizes.remove(imageId); | |
| 174 // No textures should be bound to this. | |
| 175 ASSERT(m_imageToTextureMap.find(imageId) == m_imageToTextureMap.end()); | |
| 176 m_imageSizes.remove(imageId); | |
| 177 destroyImageMock(imageId); | |
| 178 } | |
| 179 | |
| 180 MOCK_METHOD1(bindTexImage2DMock, void(WGC3Dint imageId)); | |
| 181 void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId) | |
| 182 { | |
| 183 if (target == imageTextureTarget()) { | |
| 184 m_contextGL->textureSizes().set(m_contextGL->boundTexture(), m_image
Sizes.find(imageId)->value); | |
| 185 m_imageToTextureMap.set(imageId, m_contextGL->boundTexture()); | |
| 186 bindTexImage2DMock(imageId); | |
| 187 } | |
| 188 } | |
| 189 | |
| 190 MOCK_METHOD1(releaseTexImage2DMock, void(WGC3Dint imageId)); | |
| 191 void releaseTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId) | |
| 192 { | |
| 193 if (target == imageTextureTarget()) { | |
| 194 m_imageSizes.set(m_currentImageId, IntSize()); | |
| 195 m_imageToTextureMap.remove(imageId); | |
| 196 releaseTexImage2DMock(imageId); | |
| 197 } | |
| 198 } | |
| 199 | |
| 200 WGC3Duint mostRecentlyWaitedSyncToken() | 201 WGC3Duint mostRecentlyWaitedSyncToken() |
| 201 { | 202 { |
| 202 return m_contextGL->mostRecentlyWaitedSyncToken(); | 203 return m_contextGL->mostRecentlyWaitedSyncToken(); |
| 203 } | 204 } |
| 204 | 205 |
| 205 IntSize mostRecentlyProducedSize() | 206 IntSize mostRecentlyProducedSize() |
| 206 { | 207 { |
| 207 return m_contextGL->mostRecentlyProducedSize(); | 208 return m_contextGL->mostRecentlyProducedSize(); |
| 208 } | 209 } |
| 209 | 210 |
| 210 | 211 |
| 211 WGC3Duint nextImageIdToBeCreated() | 212 WGC3Duint nextImageIdToBeCreated() |
| 212 { | 213 { |
| 213 return m_currentImageId; | 214 return m_contextGL->currentImageId(); |
| 214 } | 215 } |
| 215 | 216 |
| 216 gpu::gles2::GLES2Interface* getGLES2Interface() override | 217 gpu::gles2::GLES2Interface* getGLES2Interface() override |
| 217 { | 218 { |
| 218 return m_contextGL.get(); | 219 return m_contextGL.get(); |
| 219 } | 220 } |
| 220 | 221 |
| 221 private: | 222 private: |
| 222 WGC3Duint m_currentImageId; | |
| 223 HashMap<WGC3Duint, IntSize> m_imageSizes; | |
| 224 HashMap<WGC3Duint, WebGLId> m_imageToTextureMap; | |
| 225 OwnPtr<GLES2InterfaceForTests> m_contextGL; | 223 OwnPtr<GLES2InterfaceForTests> m_contextGL; |
| 226 }; | 224 }; |
| 227 | 225 |
| 228 static const int initialWidth = 100; | 226 static const int initialWidth = 100; |
| 229 static const int initialHeight = 100; | 227 static const int initialHeight = 100; |
| 230 static const int alternateHeight = 50; | 228 static const int alternateHeight = 50; |
| 231 | 229 |
| 232 class DrawingBufferForTests : public DrawingBuffer { | 230 class DrawingBufferForTests : public DrawingBuffer { |
| 233 public: | 231 public: |
| 234 static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<WebGraphicsContex
t3D> context, gpu::gles2::GLES2Interface* gl, const IntSize& size, PreserveDrawi
ngBuffer preserve) | 232 static PassRefPtr<DrawingBufferForTests> create(PassOwnPtr<WebGraphicsContex
t3D> context, gpu::gles2::GLES2Interface* gl, const IntSize& size, PreserveDrawi
ngBuffer preserve) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 m_drawingBuffer = DrawingBufferForTests::create(context.release(), m_gl, | 265 m_drawingBuffer = DrawingBufferForTests::create(context.release(), m_gl, |
| 268 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve); | 266 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve); |
| 269 } | 267 } |
| 270 | 268 |
| 271 WebGraphicsContext3DForTests* webContext() | 269 WebGraphicsContext3DForTests* webContext() |
| 272 { | 270 { |
| 273 return m_context; | 271 return m_context; |
| 274 } | 272 } |
| 275 | 273 |
| 276 WebGraphicsContext3DForTests* m_context; | 274 WebGraphicsContext3DForTests* m_context; |
| 277 gpu::gles2::GLES2Interface* m_gl; | 275 GLES2InterfaceForTests* m_gl; |
| 278 RefPtr<DrawingBufferForTests> m_drawingBuffer; | 276 RefPtr<DrawingBufferForTests> m_drawingBuffer; |
| 279 }; | 277 }; |
| 280 | 278 |
| 281 TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes) | 279 TEST_F(DrawingBufferTest, verifyResizingProperlyAffectsMailboxes) |
| 282 { | 280 { |
| 283 WebExternalTextureMailbox mailbox; | 281 WebExternalTextureMailbox mailbox; |
| 284 | 282 |
| 285 IntSize initialSize(initialWidth, initialHeight); | 283 IntSize initialSize(initialWidth, initialHeight); |
| 286 IntSize alternateSize(initialWidth, alternateHeight); | 284 IntSize alternateSize(initialWidth, alternateHeight); |
| 287 | 285 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 class DrawingBufferImageChromiumTest : public DrawingBufferTest { | 486 class DrawingBufferImageChromiumTest : public DrawingBufferTest { |
| 489 protected: | 487 protected: |
| 490 void SetUp() override | 488 void SetUp() override |
| 491 { | 489 { |
| 492 OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests)
; | 490 OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests)
; |
| 493 m_gl = gl.get(); | 491 m_gl = gl.get(); |
| 494 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC
ontext3DForTests(gl.release())); | 492 OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsC
ontext3DForTests(gl.release())); |
| 495 m_context = context.get(); | 493 m_context = context.get(); |
| 496 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); | 494 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); |
| 497 m_imageId0 = webContext()->nextImageIdToBeCreated(); | 495 m_imageId0 = webContext()->nextImageIdToBeCreated(); |
| 498 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId0)).Times(1); | 496 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId0)).Times(1); |
| 499 m_drawingBuffer = DrawingBufferForTests::create(context.release(), m_gl, | 497 m_drawingBuffer = DrawingBufferForTests::create(context.release(), m_gl, |
| 500 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve); | 498 IntSize(initialWidth, initialHeight), DrawingBuffer::Preserve); |
| 501 testing::Mock::VerifyAndClearExpectations(webContext()); | 499 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 502 } | 500 } |
| 503 | 501 |
| 504 void TearDown() override | 502 void TearDown() override |
| 505 { | 503 { |
| 506 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(false); | 504 RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(false); |
| 507 } | 505 } |
| 508 WGC3Duint m_imageId0; | 506 |
| 507 GLuint m_imageId0; |
| 509 }; | 508 }; |
| 510 | 509 |
| 511 TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) | 510 TEST_F(DrawingBufferImageChromiumTest, verifyResizingReallocatesImages) |
| 512 { | 511 { |
| 513 WebExternalTextureMailbox mailbox; | 512 WebExternalTextureMailbox mailbox; |
| 514 | 513 |
| 515 IntSize initialSize(initialWidth, initialHeight); | 514 IntSize initialSize(initialWidth, initialHeight); |
| 516 IntSize alternateSize(initialWidth, alternateHeight); | 515 IntSize alternateSize(initialWidth, alternateHeight); |
| 517 | 516 |
| 518 WGC3Duint m_imageId1 = webContext()->nextImageIdToBeCreated(); | 517 WGC3Duint m_imageId1 = webContext()->nextImageIdToBeCreated(); |
| 519 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId1)).Times(1); | 518 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId1)).Times(1); |
| 520 // Produce one mailbox at size 100x100. | 519 // Produce one mailbox at size 100x100. |
| 521 m_drawingBuffer->markContentsChanged(); | 520 m_drawingBuffer->markContentsChanged(); |
| 522 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 521 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 523 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 522 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
| 524 EXPECT_TRUE(mailbox.allowOverlay); | 523 EXPECT_TRUE(mailbox.allowOverlay); |
| 525 testing::Mock::VerifyAndClearExpectations(webContext()); | 524 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 526 | 525 |
| 527 WGC3Duint m_imageId2 = webContext()->nextImageIdToBeCreated(); | 526 WGC3Duint m_imageId2 = webContext()->nextImageIdToBeCreated(); |
| 528 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId2)).Times(1); | 527 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId2)).Times(1); |
| 529 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId0)).Times(1); | 528 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId0)).Times(1); |
| 530 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId0)).Times(1); | 529 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId0)).Times(1); |
| 531 // Resize to 100x50. | 530 // Resize to 100x50. |
| 532 m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight)); | 531 m_drawingBuffer->reset(IntSize(initialWidth, alternateHeight)); |
| 533 m_drawingBuffer->mailboxReleased(mailbox, false); | 532 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 534 testing::Mock::VerifyAndClearExpectations(webContext()); | 533 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 535 | 534 |
| 536 WGC3Duint m_imageId3 = webContext()->nextImageIdToBeCreated(); | 535 WGC3Duint m_imageId3 = webContext()->nextImageIdToBeCreated(); |
| 537 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId3)).Times(1); | 536 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId3)).Times(1); |
| 538 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId1)).Times(1); | 537 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId1)).Times(1); |
| 539 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId1)).Times(1); | 538 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId1)).Times(1); |
| 540 // Produce a mailbox at this size. | 539 // Produce a mailbox at this size. |
| 541 m_drawingBuffer->markContentsChanged(); | 540 m_drawingBuffer->markContentsChanged(); |
| 542 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 541 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 543 EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize()); | 542 EXPECT_EQ(alternateSize, webContext()->mostRecentlyProducedSize()); |
| 544 EXPECT_TRUE(mailbox.allowOverlay); | 543 EXPECT_TRUE(mailbox.allowOverlay); |
| 545 testing::Mock::VerifyAndClearExpectations(webContext()); | 544 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 546 | 545 |
| 547 WGC3Duint m_imageId4 = webContext()->nextImageIdToBeCreated(); | 546 WGC3Duint m_imageId4 = webContext()->nextImageIdToBeCreated(); |
| 548 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId4)).Times(1); | 547 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId4)).Times(1); |
| 549 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId2)).Times(1); | 548 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId2)).Times(1); |
| 550 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId2)).Times(1); | 549 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId2)).Times(1); |
| 551 // Reset to initial size. | 550 // Reset to initial size. |
| 552 m_drawingBuffer->reset(IntSize(initialWidth, initialHeight)); | 551 m_drawingBuffer->reset(IntSize(initialWidth, initialHeight)); |
| 553 m_drawingBuffer->mailboxReleased(mailbox, false); | 552 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 554 testing::Mock::VerifyAndClearExpectations(webContext()); | 553 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 555 | 554 |
| 556 WGC3Duint m_imageId5 = webContext()->nextImageIdToBeCreated(); | 555 WGC3Duint m_imageId5 = webContext()->nextImageIdToBeCreated(); |
| 557 EXPECT_CALL(*webContext(), bindTexImage2DMock(m_imageId5)).Times(1); | 556 EXPECT_CALL(*m_gl, BindTexImage2DMock(m_imageId5)).Times(1); |
| 558 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId3)).Times(1); | 557 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId3)).Times(1); |
| 559 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId3)).Times(1); | 558 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId3)).Times(1); |
| 560 // Prepare another mailbox and verify that it's the correct size. | 559 // Prepare another mailbox and verify that it's the correct size. |
| 561 m_drawingBuffer->markContentsChanged(); | 560 m_drawingBuffer->markContentsChanged(); |
| 562 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 561 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 563 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 562 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
| 564 EXPECT_TRUE(mailbox.allowOverlay); | 563 EXPECT_TRUE(mailbox.allowOverlay); |
| 565 testing::Mock::VerifyAndClearExpectations(webContext()); | 564 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 566 | 565 |
| 567 // Prepare one final mailbox and verify that it's the correct size. | 566 // Prepare one final mailbox and verify that it's the correct size. |
| 568 m_drawingBuffer->mailboxReleased(mailbox, false); | 567 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 569 m_drawingBuffer->markContentsChanged(); | 568 m_drawingBuffer->markContentsChanged(); |
| 570 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 569 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 571 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 570 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
| 572 EXPECT_TRUE(mailbox.allowOverlay); | 571 EXPECT_TRUE(mailbox.allowOverlay); |
| 573 m_drawingBuffer->mailboxReleased(mailbox, false); | 572 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 574 | 573 |
| 575 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId5)).Times(1); | 574 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId5)).Times(1); |
| 576 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId5)).Times(1); | 575 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId5)).Times(1); |
| 577 EXPECT_CALL(*webContext(), destroyImageMock(m_imageId4)).Times(1); | 576 EXPECT_CALL(*m_gl, DestroyImageMock(m_imageId4)).Times(1); |
| 578 EXPECT_CALL(*webContext(), releaseTexImage2DMock(m_imageId4)).Times(1); | 577 EXPECT_CALL(*m_gl, ReleaseTexImage2DMock(m_imageId4)).Times(1); |
| 579 m_drawingBuffer->beginDestruction(); | 578 m_drawingBuffer->beginDestruction(); |
| 580 testing::Mock::VerifyAndClearExpectations(webContext()); | 579 testing::Mock::VerifyAndClearExpectations(webContext()); |
| 581 } | 580 } |
| 582 | 581 |
| 583 class DepthStencilTrackingGLES2Interface : public gpu::gles2::GLES2InterfaceStub
{ | 582 class DepthStencilTrackingGLES2Interface : public gpu::gles2::GLES2InterfaceStub
{ |
| 584 public: | 583 public: |
| 585 void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum render
buffertarget, GLuint renderbuffer) override | 584 void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum render
buffertarget, GLuint renderbuffer) override |
| 586 { | 585 { |
| 587 switch (attachment) { | 586 switch (attachment) { |
| 588 case GL_DEPTH_ATTACHMENT: | 587 case GL_DEPTH_ATTACHMENT: |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 m_drawingBuffer->markContentsChanged(); | 776 m_drawingBuffer->markContentsChanged(); |
| 778 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); | 777 EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); |
| 779 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); | 778 EXPECT_EQ(initialSize, webContext()->mostRecentlyProducedSize()); |
| 780 EXPECT_FALSE(mailbox.allowOverlay); | 779 EXPECT_FALSE(mailbox.allowOverlay); |
| 781 | 780 |
| 782 m_drawingBuffer->mailboxReleased(mailbox, false); | 781 m_drawingBuffer->mailboxReleased(mailbox, false); |
| 783 m_drawingBuffer->beginDestruction(); | 782 m_drawingBuffer->beginDestruction(); |
| 784 } | 783 } |
| 785 | 784 |
| 786 } // namespace blink | 785 } // namespace blink |
| OLD | NEW |