| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 { | 60 { |
| 61 DEFINE_STATIC_LOCAL(WTF::RefCountedLeakCounter, staticDrawingBufferCounter,
("DrawingBuffer")); | 61 DEFINE_STATIC_LOCAL(WTF::RefCountedLeakCounter, staticDrawingBufferCounter,
("DrawingBuffer")); |
| 62 return staticDrawingBufferCounter; | 62 return staticDrawingBufferCounter; |
| 63 } | 63 } |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 class ScopedTextureUnit0BindingRestorer { | 66 class ScopedTextureUnit0BindingRestorer { |
| 67 STACK_ALLOCATED(); | 67 STACK_ALLOCATED(); |
| 68 WTF_MAKE_NONCOPYABLE(ScopedTextureUnit0BindingRestorer); | 68 WTF_MAKE_NONCOPYABLE(ScopedTextureUnit0BindingRestorer); |
| 69 public: | 69 public: |
| 70 ScopedTextureUnit0BindingRestorer(gpu::gles2::GLES2Interface* gl, GLenum act
iveTextureUnit, Platform3DObject textureUnitZeroId) | 70 ScopedTextureUnit0BindingRestorer(gpu::gles2::GLES2Interface* gl, GLenum act
iveTextureUnit, GLuint textureUnitZeroId) |
| 71 : m_gl(gl) | 71 : m_gl(gl) |
| 72 , m_oldActiveTextureUnit(activeTextureUnit) | 72 , m_oldActiveTextureUnit(activeTextureUnit) |
| 73 , m_oldTextureUnitZeroId(textureUnitZeroId) | 73 , m_oldTextureUnitZeroId(textureUnitZeroId) |
| 74 { | 74 { |
| 75 m_gl->ActiveTexture(GL_TEXTURE0); | 75 m_gl->ActiveTexture(GL_TEXTURE0); |
| 76 } | 76 } |
| 77 ~ScopedTextureUnit0BindingRestorer() | 77 ~ScopedTextureUnit0BindingRestorer() |
| 78 { | 78 { |
| 79 m_gl->BindTexture(GL_TEXTURE_2D, m_oldTextureUnitZeroId); | 79 m_gl->BindTexture(GL_TEXTURE_2D, m_oldTextureUnitZeroId); |
| 80 m_gl->ActiveTexture(m_oldActiveTextureUnit); | 80 m_gl->ActiveTexture(m_oldActiveTextureUnit); |
| 81 } | 81 } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 gpu::gles2::GLES2Interface* m_gl; | 84 gpu::gles2::GLES2Interface* m_gl; |
| 85 GLenum m_oldActiveTextureUnit; | 85 GLenum m_oldActiveTextureUnit; |
| 86 Platform3DObject m_oldTextureUnitZeroId; | 86 GLuint m_oldTextureUnitZeroId; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 static bool shouldFailDrawingBufferCreationForTesting = false; | 89 static bool shouldFailDrawingBufferCreationForTesting = false; |
| 90 | 90 |
| 91 } // namespace | 91 } // namespace |
| 92 | 92 |
| 93 PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3DP
rovider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserve, W
ebGraphicsContext3D::Attributes requestedAttributes) | 93 PassRefPtr<DrawingBuffer> DrawingBuffer::create(PassOwnPtr<WebGraphicsContext3DP
rovider> contextProvider, const IntSize& size, PreserveDrawingBuffer preserve, W
ebGraphicsContext3D::Attributes requestedAttributes) |
| 94 { | 94 { |
| 95 ASSERT(contextProvider); | 95 ASSERT(contextProvider); |
| 96 | 96 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer); | 289 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer); |
| 290 // It appears safe to overwrite the context's framebuffer binding in the
Discard case since there will always be a | 290 // It appears safe to overwrite the context's framebuffer binding in the
Discard case since there will always be a |
| 291 // WebGLRenderingContext::clearIfComposited() call made before the next
draw call which restores the framebuffer binding. | 291 // WebGLRenderingContext::clearIfComposited() call made before the next
draw call which restores the framebuffer binding. |
| 292 // If this stops being true at some point, we should track the current f
ramebuffer binding in the DrawingBuffer and restore | 292 // If this stops being true at some point, we should track the current f
ramebuffer binding in the DrawingBuffer and restore |
| 293 // it after attaching the new back buffer here. | 293 // it after attaching the new back buffer here. |
| 294 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 294 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
| 295 attachColorBufferToCurrentFBO(); | 295 attachColorBufferToCurrentFBO(); |
| 296 | 296 |
| 297 if (m_discardFramebufferSupported) { | 297 if (m_discardFramebufferSupported) { |
| 298 // Explicitly discard framebuffer to save GPU memory bandwidth for t
ile-based GPU arch. | 298 // Explicitly discard framebuffer to save GPU memory bandwidth for t
ile-based GPU arch. |
| 299 const WGC3Denum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_AT
TACHMENT, GL_STENCIL_ATTACHMENT}; | 299 const GLenum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTAC
HMENT, GL_STENCIL_ATTACHMENT}; |
| 300 m_gl->DiscardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments); | 300 m_gl->DiscardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments); |
| 301 } | 301 } |
| 302 } else { | 302 } else { |
| 303 m_gl->CopyTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMailb
ox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.inter
nalColorFormat, GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_FALSE); | 303 m_gl->CopyTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMailb
ox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.inter
nalColorFormat, GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_FALSE); |
| 304 } | 304 } |
| 305 | 305 |
| 306 restoreFramebufferBindings(); | 306 restoreFramebufferBindings(); |
| 307 m_contentsChanged = false; | 307 m_contentsChanged = false; |
| 308 | 308 |
| 309 m_gl->ProduceTextureDirectCHROMIUM(frontColorBufferMailbox->textureInfo.text
ureId, frontColorBufferMailbox->textureInfo.parameters.target, frontColorBufferM
ailbox->mailbox.name); | 309 m_gl->ProduceTextureDirectCHROMIUM(frontColorBufferMailbox->textureInfo.text
ureId, frontColorBufferMailbox->textureInfo.parameters.target, frontColorBufferM
ailbox->mailbox.name); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 m_gl->GenFramebuffers(1, &m_fbo); | 473 m_gl->GenFramebuffers(1, &m_fbo); |
| 474 | 474 |
| 475 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 475 m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
| 476 createSecondaryBuffers(); | 476 createSecondaryBuffers(); |
| 477 // We first try to initialize everything with the requested attributes. | 477 // We first try to initialize everything with the requested attributes. |
| 478 if (!reset(size)) | 478 if (!reset(size)) |
| 479 return false; | 479 return false; |
| 480 // If that succeeds, we then see what we actually got and update our actual
attributes to reflect that. | 480 // If that succeeds, we then see what we actually got and update our actual
attributes to reflect that. |
| 481 m_actualAttributes = m_requestedAttributes; | 481 m_actualAttributes = m_requestedAttributes; |
| 482 if (m_requestedAttributes.alpha) { | 482 if (m_requestedAttributes.alpha) { |
| 483 WGC3Dint alphaBits = 0; | 483 GLint alphaBits = 0; |
| 484 m_gl->GetIntegerv(GL_ALPHA_BITS, &alphaBits); | 484 m_gl->GetIntegerv(GL_ALPHA_BITS, &alphaBits); |
| 485 m_actualAttributes.alpha = alphaBits > 0; | 485 m_actualAttributes.alpha = alphaBits > 0; |
| 486 } | 486 } |
| 487 if (m_requestedAttributes.depth) { | 487 if (m_requestedAttributes.depth) { |
| 488 WGC3Dint depthBits = 0; | 488 GLint depthBits = 0; |
| 489 m_gl->GetIntegerv(GL_DEPTH_BITS, &depthBits); | 489 m_gl->GetIntegerv(GL_DEPTH_BITS, &depthBits); |
| 490 m_actualAttributes.depth = depthBits > 0; | 490 m_actualAttributes.depth = depthBits > 0; |
| 491 } | 491 } |
| 492 if (m_requestedAttributes.stencil) { | 492 if (m_requestedAttributes.stencil) { |
| 493 WGC3Dint stencilBits = 0; | 493 GLint stencilBits = 0; |
| 494 m_gl->GetIntegerv(GL_STENCIL_BITS, &stencilBits); | 494 m_gl->GetIntegerv(GL_STENCIL_BITS, &stencilBits); |
| 495 m_actualAttributes.stencil = stencilBits > 0; | 495 m_actualAttributes.stencil = stencilBits > 0; |
| 496 } | 496 } |
| 497 m_actualAttributes.antialias = multisample(); | 497 m_actualAttributes.antialias = multisample(); |
| 498 | 498 |
| 499 if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { | 499 if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
| 500 // It's possible that the drawing buffer allocation provokes a context l
oss, so check again just in case. http://crbug.com/512302 | 500 // It's possible that the drawing buffer allocation provokes a context l
oss, so check again just in case. http://crbug.com/512302 |
| 501 return false; | 501 return false; |
| 502 } | 502 } |
| 503 | 503 |
| 504 return true; | 504 return true; |
| 505 } | 505 } |
| 506 | 506 |
| 507 bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gl
es2::GLES2Interface* gl, Platform3DObject texture, GLenum internalFormat, | 507 bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gl
es2::GLES2Interface* gl, GLuint texture, GLenum internalFormat, |
| 508 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceDrawi
ngBuffer sourceBuffer) | 508 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceDrawi
ngBuffer sourceBuffer) |
| 509 { | 509 { |
| 510 if (m_contentsChanged) { | 510 if (m_contentsChanged) { |
| 511 if (m_antiAliasingMode != None) { | 511 if (m_antiAliasingMode != None) { |
| 512 commit(); | 512 commit(); |
| 513 restoreFramebufferBindings(); | 513 restoreFramebufferBindings(); |
| 514 } | 514 } |
| 515 m_gl->Flush(); | 515 m_gl->Flush(); |
| 516 } | 516 } |
| 517 | 517 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 533 m_gl->GenMailboxCHROMIUM(mailbox.name); | 533 m_gl->GenMailboxCHROMIUM(mailbox.name); |
| 534 m_gl->ProduceTextureDirectCHROMIUM(textureId, target, mailbox.name); | 534 m_gl->ProduceTextureDirectCHROMIUM(textureId, target, mailbox.name); |
| 535 const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); | 535 const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); |
| 536 m_gl->Flush(); | 536 m_gl->Flush(); |
| 537 m_gl->GenSyncTokenCHROMIUM(fenceSync, mailbox.syncToken); | 537 m_gl->GenSyncTokenCHROMIUM(fenceSync, mailbox.syncToken); |
| 538 mailbox.validSyncToken = true; | 538 mailbox.validSyncToken = true; |
| 539 } | 539 } |
| 540 | 540 |
| 541 if (mailbox.validSyncToken) | 541 if (mailbox.validSyncToken) |
| 542 gl->WaitSyncTokenCHROMIUM(mailbox.syncToken); | 542 gl->WaitSyncTokenCHROMIUM(mailbox.syncToken); |
| 543 Platform3DObject sourceTexture = gl->CreateAndConsumeTextureCHROMIUM(target,
mailbox.name); | 543 GLuint sourceTexture = gl->CreateAndConsumeTextureCHROMIUM(target, mailbox.n
ame); |
| 544 | 544 |
| 545 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; | 545 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; |
| 546 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; | 546 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; |
| 547 if (m_actualAttributes.alpha && m_actualAttributes.premultipliedAlpha && !pr
emultiplyAlpha) | 547 if (m_actualAttributes.alpha && m_actualAttributes.premultipliedAlpha && !pr
emultiplyAlpha) |
| 548 unpackUnpremultiplyAlphaNeeded = GL_TRUE; | 548 unpackUnpremultiplyAlphaNeeded = GL_TRUE; |
| 549 else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha
&& premultiplyAlpha) | 549 else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha
&& premultiplyAlpha) |
| 550 unpackPremultiplyAlphaNeeded = GL_TRUE; | 550 unpackPremultiplyAlphaNeeded = GL_TRUE; |
| 551 | 551 |
| 552 gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, fl
ipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded); | 552 gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, fl
ipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded); |
| 553 | 553 |
| 554 gl->DeleteTextures(1, &sourceTexture); | 554 gl->DeleteTextures(1, &sourceTexture); |
| 555 | 555 |
| 556 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); | 556 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); |
| 557 | 557 |
| 558 gl->Flush(); | 558 gl->Flush(); |
| 559 GLbyte syncToken[24]; | 559 GLbyte syncToken[24]; |
| 560 gl->GenSyncTokenCHROMIUM(fenceSync, syncToken); | 560 gl->GenSyncTokenCHROMIUM(fenceSync, syncToken); |
| 561 m_gl->WaitSyncTokenCHROMIUM(syncToken); | 561 m_gl->WaitSyncTokenCHROMIUM(syncToken); |
| 562 | 562 |
| 563 return true; | 563 return true; |
| 564 } | 564 } |
| 565 | 565 |
| 566 Platform3DObject DrawingBuffer::framebuffer() const | 566 GLuint DrawingBuffer::framebuffer() const |
| 567 { | 567 { |
| 568 return m_fbo; | 568 return m_fbo; |
| 569 } | 569 } |
| 570 | 570 |
| 571 WebLayer* DrawingBuffer::platformLayer() | 571 WebLayer* DrawingBuffer::platformLayer() |
| 572 { | 572 { |
| 573 if (!m_layer) { | 573 if (!m_layer) { |
| 574 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExter
nalTextureLayer(this)); | 574 m_layer = adoptPtr(Platform::current()->compositorSupport()->createExter
nalTextureLayer(this)); |
| 575 | 575 |
| 576 m_layer->setOpaque(!m_actualAttributes.alpha); | 576 m_layer->setOpaque(!m_actualAttributes.alpha); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 m_frontColorBuffer = FrontBufferInfo(); | 624 m_frontColorBuffer = FrontBufferInfo(); |
| 625 m_multisampleColorBuffer = 0; | 625 m_multisampleColorBuffer = 0; |
| 626 m_depthStencilBuffer = 0; | 626 m_depthStencilBuffer = 0; |
| 627 m_multisampleFBO = 0; | 627 m_multisampleFBO = 0; |
| 628 m_fbo = 0; | 628 m_fbo = 0; |
| 629 | 629 |
| 630 if (m_layer) | 630 if (m_layer) |
| 631 GraphicsLayer::unregisterContentsLayer(m_layer->layer()); | 631 GraphicsLayer::unregisterContentsLayer(m_layer->layer()); |
| 632 } | 632 } |
| 633 | 633 |
| 634 WebGLId DrawingBuffer::createColorTexture(const TextureParameters& parameters) | 634 GLuint DrawingBuffer::createColorTexture(const TextureParameters& parameters) |
| 635 { | 635 { |
| 636 GLuint offscreenColorTexture; | 636 GLuint offscreenColorTexture; |
| 637 m_gl->GenTextures(1, &offscreenColorTexture); | 637 m_gl->GenTextures(1, &offscreenColorTexture); |
| 638 m_gl->BindTexture(parameters.target, offscreenColorTexture); | 638 m_gl->BindTexture(parameters.target, offscreenColorTexture); |
| 639 m_gl->TexParameteri(parameters.target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 639 m_gl->TexParameteri(parameters.target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 640 m_gl->TexParameteri(parameters.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 640 m_gl->TexParameteri(parameters.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 641 m_gl->TexParameteri(parameters.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 641 m_gl->TexParameteri(parameters.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 642 m_gl->TexParameteri(parameters.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 642 m_gl->TexParameteri(parameters.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 643 return offscreenColorTexture; | 643 return offscreenColorTexture; |
| 644 } | 644 } |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 // https://crbug.com/581777. | 968 // https://crbug.com/581777. |
| 969 if (!m_requestedAttributes.alpha) | 969 if (!m_requestedAttributes.alpha) |
| 970 return createDefaultTextureAndAllocateMemory(size); | 970 return createDefaultTextureAndAllocateMemory(size); |
| 971 | 971 |
| 972 if (!RuntimeEnabledFeatures::webGLImageChromiumEnabled()) | 972 if (!RuntimeEnabledFeatures::webGLImageChromiumEnabled()) |
| 973 return createDefaultTextureAndAllocateMemory(size); | 973 return createDefaultTextureAndAllocateMemory(size); |
| 974 | 974 |
| 975 // First, try to allocate a CHROMIUM_image. This always has the potential to | 975 // First, try to allocate a CHROMIUM_image. This always has the potential to |
| 976 // fail. | 976 // fail. |
| 977 TextureParameters parameters = chromiumImageTextureParameters(); | 977 TextureParameters parameters = chromiumImageTextureParameters(); |
| 978 WGC3Duint imageId = m_gl->CreateGpuMemoryBufferImageCHROMIUM(size.width(), s
ize.height(), parameters.internalColorFormat, GC3D_SCANOUT_CHROMIUM); | 978 GLuint imageId = m_gl->CreateGpuMemoryBufferImageCHROMIUM(size.width(), size
.height(), parameters.internalColorFormat, GC3D_SCANOUT_CHROMIUM); |
| 979 if (!imageId) | 979 if (!imageId) |
| 980 return createDefaultTextureAndAllocateMemory(size); | 980 return createDefaultTextureAndAllocateMemory(size); |
| 981 | 981 |
| 982 WebGLId textureId = createColorTexture(parameters); | 982 GLuint textureId = createColorTexture(parameters); |
| 983 m_gl->BindTexImage2DCHROMIUM(parameters.target, imageId); | 983 m_gl->BindTexImage2DCHROMIUM(parameters.target, imageId); |
| 984 | 984 |
| 985 TextureInfo info; | 985 TextureInfo info; |
| 986 info.textureId = textureId; | 986 info.textureId = textureId; |
| 987 info.imageId = imageId; | 987 info.imageId = imageId; |
| 988 info.parameters = parameters; | 988 info.parameters = parameters; |
| 989 return info; | 989 return info; |
| 990 } | 990 } |
| 991 | 991 |
| 992 DrawingBuffer::TextureInfo DrawingBuffer::createDefaultTextureAndAllocateMemory(
const IntSize& size) | 992 DrawingBuffer::TextureInfo DrawingBuffer::createDefaultTextureAndAllocateMemory(
const IntSize& size) |
| 993 { | 993 { |
| 994 TextureParameters parameters = defaultTextureParameters(); | 994 TextureParameters parameters = defaultTextureParameters(); |
| 995 WebGLId textureId = createColorTexture(parameters); | 995 GLuint textureId = createColorTexture(parameters); |
| 996 texImage2DResourceSafe(parameters.target, 0, parameters.internalColorFormat,
size.width(), size.height(), 0, parameters.colorFormat, GL_UNSIGNED_BYTE); | 996 texImage2DResourceSafe(parameters.target, 0, parameters.internalColorFormat,
size.width(), size.height(), 0, parameters.colorFormat, GL_UNSIGNED_BYTE); |
| 997 | 997 |
| 998 DrawingBuffer::TextureInfo info; | 998 DrawingBuffer::TextureInfo info; |
| 999 info.textureId = textureId; | 999 info.textureId = textureId; |
| 1000 info.parameters = parameters; | 1000 info.parameters = parameters; |
| 1001 return info; | 1001 return info; |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 void DrawingBuffer::resizeTextureMemory(TextureInfo* info, const IntSize& size) | 1004 void DrawingBuffer::resizeTextureMemory(TextureInfo* info, const IntSize& size) |
| 1005 { | 1005 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1018 if (chromiumImageTextureParameters().target != defaultTextureParameters(
).target) | 1018 if (chromiumImageTextureParameters().target != defaultTextureParameters(
).target) |
| 1019 return; | 1019 return; |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 m_gl->BindTexture(info->parameters.target, info->textureId); | 1022 m_gl->BindTexture(info->parameters.target, info->textureId); |
| 1023 texImage2DResourceSafe(info->parameters.target, 0, info->parameters.internal
ColorFormat, size.width(), size.height(), 0, info->parameters.colorFormat, GL_UN
SIGNED_BYTE); | 1023 texImage2DResourceSafe(info->parameters.target, 0, info->parameters.internal
ColorFormat, size.width(), size.height(), 0, info->parameters.colorFormat, GL_UN
SIGNED_BYTE); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 void DrawingBuffer::attachColorBufferToCurrentFBO() | 1026 void DrawingBuffer::attachColorBufferToCurrentFBO() |
| 1027 { | 1027 { |
| 1028 WGC3Denum target = m_colorBuffer.parameters.target; | 1028 GLenum target = m_colorBuffer.parameters.target; |
| 1029 | 1029 |
| 1030 m_gl->BindTexture(target, m_colorBuffer.textureId); | 1030 m_gl->BindTexture(target, m_colorBuffer.textureId); |
| 1031 | 1031 |
| 1032 if (m_antiAliasingMode == MSAAImplicitResolve) | 1032 if (m_antiAliasingMode == MSAAImplicitResolve) |
| 1033 m_gl->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACH
MENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); | 1033 m_gl->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACH
MENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); |
| 1034 else | 1034 else |
| 1035 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
m_colorBuffer.textureId, 0); | 1035 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
m_colorBuffer.textureId, 0); |
| 1036 | 1036 |
| 1037 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); | 1037 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 } // namespace blink | 1040 } // namespace blink |
| OLD | NEW |