Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 #include "wtf/text/StringBuilder.h" | 87 #include "wtf/text/StringBuilder.h" |
| 88 | 88 |
| 89 namespace WebCore { | 89 namespace WebCore { |
| 90 | 90 |
| 91 const double secondsBetweenRestoreAttempts = 1.0; | 91 const double secondsBetweenRestoreAttempts = 1.0; |
| 92 const int maxGLErrorsAllowedToConsole = 256; | 92 const int maxGLErrorsAllowedToConsole = 256; |
| 93 const unsigned maxGLActiveContexts = 16; | 93 const unsigned maxGLActiveContexts = 16; |
| 94 | 94 |
| 95 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::activeContexts() | 95 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::activeContexts() |
| 96 { | 96 { |
| 97 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, activeContexts, ()); | 97 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, activeContexts, ()); |
|
haraken
2014/07/02 07:47:38
Can we make this a PersistentHeapVector<WeakMember
sof
2014/07/02 11:43:53
Weaks aren't supported in heap vectors.
These are
| |
| 98 return activeContexts; | 98 return activeContexts; |
| 99 } | 99 } |
| 100 | 100 |
| 101 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::forciblyEvictedCo ntexts() | 101 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::forciblyEvictedCo ntexts() |
| 102 { | 102 { |
| 103 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, forciblyEvictedConte xts, ()); | 103 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, forciblyEvictedConte xts, ()); |
|
haraken
2014/07/02 07:47:38
Ditto. This should be a PersistentHeapVector<WeakM
sof
2014/07/02 11:43:53
See above.
| |
| 104 return forciblyEvictedContexts; | 104 return forciblyEvictedContexts; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void WebGLRenderingContextBase::forciblyLoseOldestContext(const String& reason) | 107 void WebGLRenderingContextBase::forciblyLoseOldestContext(const String& reason) |
| 108 { | 108 { |
| 109 size_t candidateID = oldestContextIndex(); | 109 size_t candidateID = oldestContextIndex(); |
| 110 if (candidateID >= activeContexts().size()) | 110 if (candidateID >= activeContexts().size()) |
| 111 return; | 111 return; |
| 112 | 112 |
| 113 WebGLRenderingContextBase* candidate = activeContexts()[candidateID]; | 113 WebGLRenderingContextBase* candidate = activeContexts()[candidateID]; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 { | 181 { |
| 182 size_t position = forciblyEvictedContexts().find(context); | 182 size_t position = forciblyEvictedContexts().find(context); |
| 183 if (position != WTF::kNotFound) | 183 if (position != WTF::kNotFound) |
| 184 forciblyEvictedContexts().remove(position); | 184 forciblyEvictedContexts().remove(position); |
| 185 | 185 |
| 186 deactivateContext(context, false); | 186 deactivateContext(context, false); |
| 187 | 187 |
| 188 // Try to re-enable the oldest inactive contexts. | 188 // Try to re-enable the oldest inactive contexts. |
| 189 while(activeContexts().size() < maxGLActiveContexts && forciblyEvictedContex ts().size()) { | 189 while(activeContexts().size() < maxGLActiveContexts && forciblyEvictedContex ts().size()) { |
| 190 WebGLRenderingContextBase* evictedContext = forciblyEvictedContexts().fi rst(); | 190 WebGLRenderingContextBase* evictedContext = forciblyEvictedContexts().fi rst(); |
| 191 if (!evictedContext->m_restoreAllowed) { | 191 if (!evictedContext->m_restoreAllowed) { |
|
haraken
2014/07/02 07:47:39
willDestroyContext() is called in WebGLRenderingCo
sof
2014/07/02 11:43:53
I think it is safe, as long as each context takes
| |
| 192 forciblyEvictedContexts().remove(0); | 192 forciblyEvictedContexts().remove(0); |
| 193 continue; | 193 continue; |
| 194 } | 194 } |
| 195 | 195 |
| 196 IntSize desiredSize = DrawingBuffer::adjustSize(evictedContext->clampedC anvasSize(), IntSize(), evictedContext->m_maxTextureSize); | 196 IntSize desiredSize = DrawingBuffer::adjustSize(evictedContext->clampedC anvasSize(), IntSize(), evictedContext->m_maxTextureSize); |
| 197 | 197 |
| 198 // If there's room in the pixel budget for this context, restore it. | 198 // If there's room in the pixel budget for this context, restore it. |
| 199 if (!desiredSize.isEmpty()) { | 199 if (!desiredSize.isEmpty()) { |
| 200 forciblyEvictedContexts().remove(0); | 200 forciblyEvictedContexts().remove(0); |
| 201 evictedContext->forceRestoreContext(); | 201 evictedContext->forceRestoreContext(); |
| 202 activeContexts().append(evictedContext); | 202 activeContexts().append(evictedContext); |
| 203 } | 203 } |
| 204 break; | 204 break; |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 class WebGLRenderingContextEvictionManager : public ContextEvictionManager { | 208 class WebGLRenderingContextEvictionManager : public ContextEvictionManager { |
| 209 public: | 209 public: |
| 210 void forciblyLoseOldestContext(const String& reason) { | 210 void forciblyLoseOldestContext(const String& reason) { |
| 211 WebGLRenderingContextBase::forciblyLoseOldestContext(reason); | 211 WebGLRenderingContextBase::forciblyLoseOldestContext(reason); |
| 212 }; | 212 }; |
| 213 IntSize oldestContextSize() { | 213 IntSize oldestContextSize() { |
| 214 return WebGLRenderingContextBase::oldestContextSize(); | 214 return WebGLRenderingContextBase::oldestContextSize(); |
| 215 }; | 215 }; |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 namespace { | 218 namespace { |
| 219 | 219 |
| 220 class ScopedDrawingBufferBinder { | 220 class ScopedDrawingBufferBinder { |
|
haraken
2014/07/02 07:47:38
ScopedDrawingBufferBinder can be stack-allocated.
sof
2014/07/02 11:43:53
Thanks, done.
| |
| 221 public: | 221 public: |
| 222 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer * framebufferBinding) | 222 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer * framebufferBinding) |
| 223 : m_drawingBuffer(drawingBuffer) | 223 : m_drawingBuffer(drawingBuffer) |
| 224 , m_framebufferBinding(framebufferBinding) | 224 , m_framebufferBinding(framebufferBinding) |
| 225 { | 225 { |
| 226 // Commit DrawingBuffer if needed (e.g., for multisampling) | 226 // Commit DrawingBuffer if needed (e.g., for multisampling) |
| 227 if (!m_framebufferBinding && m_drawingBuffer) | 227 if (!m_framebufferBinding && m_drawingBuffer) |
| 228 m_drawingBuffer->commit(); | 228 m_drawingBuffer->commit(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 ~ScopedDrawingBufferBinder() | 231 ~ScopedDrawingBufferBinder() |
| 232 { | 232 { |
| 233 // Restore DrawingBuffer if needed | 233 // Restore DrawingBuffer if needed |
| 234 if (!m_framebufferBinding && m_drawingBuffer) | 234 if (!m_framebufferBinding && m_drawingBuffer) |
| 235 m_drawingBuffer->bind(); | 235 m_drawingBuffer->bind(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 private: | 238 private: |
| 239 DrawingBuffer* m_drawingBuffer; | 239 DrawingBuffer* m_drawingBuffer; |
| 240 WebGLFramebuffer* m_framebufferBinding; | 240 WebGLFramebuffer* m_framebufferBinding; |
|
haraken
2014/07/02 07:47:38
WebGLFramebuffer is on-heap, so this should be a M
sof
2014/07/02 11:43:53
Added transition type.
| |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 Platform3DObject objectOrZero(WebGLObject* object) | 243 Platform3DObject objectOrZero(WebGLObject* object) |
| 244 { | 244 { |
| 245 return object ? object->object() : 0; | 245 return object ? object->object() : 0; |
| 246 } | 246 } |
| 247 | 247 |
| 248 GLint clamp(GLint value, GLint min, GLint max) | 248 GLint clamp(GLint value, GLint min, GLint max) |
| 249 { | 249 { |
| 250 if (value < min) | 250 if (value < min) |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 | 455 |
| 456 // Swallow all other characters. Unclear whether we may | 456 // Swallow all other characters. Unclear whether we may |
| 457 // want or need to just emit a space per character to try | 457 // want or need to just emit a space per character to try |
| 458 // to preserve column numbers for debugging purposes. | 458 // to preserve column numbers for debugging purposes. |
| 459 break; | 459 break; |
| 460 } | 460 } |
| 461 } | 461 } |
| 462 } // namespace anonymous | 462 } // namespace anonymous |
| 463 | 463 |
| 464 class ScopedTexture2DRestorer { | 464 class ScopedTexture2DRestorer { |
| 465 STACK_ALLOCATED(); | |
| 465 public: | 466 public: |
| 466 ScopedTexture2DRestorer(WebGLRenderingContextBase* context) | 467 explicit ScopedTexture2DRestorer(WebGLRenderingContextBase* context) |
| 467 : m_context(context) | 468 : m_context(context) |
| 468 { | 469 { |
| 469 } | 470 } |
| 470 | 471 |
| 471 ~ScopedTexture2DRestorer() | 472 ~ScopedTexture2DRestorer() |
| 472 { | 473 { |
| 473 m_context->restoreCurrentTexture2D(); | 474 m_context->restoreCurrentTexture2D(); |
| 474 } | 475 } |
| 475 | 476 |
| 476 private: | 477 private: |
| 477 WebGLRenderingContextBase* m_context; | 478 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; |
| 478 }; | 479 }; |
| 479 | 480 |
| 480 class WebGLRenderingContextLostCallback : public blink::WebGraphicsContext3D::We bGraphicsContextLostCallback { | 481 class WebGLRenderingContextLostCallback : public blink::WebGraphicsContext3D::We bGraphicsContextLostCallback { |
| 481 WTF_MAKE_FAST_ALLOCATED; | 482 WTF_MAKE_FAST_ALLOCATED; |
| 482 public: | 483 public: |
| 483 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* cb) : m_context(cb) { } | 484 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* cb) : m_context(cb) { } |
| 484 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext); } | 485 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext); } |
| 485 virtual ~WebGLRenderingContextLostCallback() {} | 486 virtual ~WebGLRenderingContextLostCallback() {} |
| 486 private: | 487 private: |
| 488 // Oilpan: kept as a bare pointer, with WebGLRenderingContextBase ensuring | |
| 489 // that it will not be used past its lifetime. | |
| 487 WebGLRenderingContextBase* m_context; | 490 WebGLRenderingContextBase* m_context; |
|
haraken
2014/07/02 07:47:38
Would you add a comment about why we can't make it
sof
2014/07/02 11:43:53
That creates a leak of WebGLRenderingContextBase o
| |
| 488 }; | 491 }; |
| 489 | 492 |
| 490 class WebGLRenderingContextErrorMessageCallback : public blink::WebGraphicsConte xt3D::WebGraphicsErrorMessageCallback { | 493 class WebGLRenderingContextErrorMessageCallback : public blink::WebGraphicsConte xt3D::WebGraphicsErrorMessageCallback { |
| 491 WTF_MAKE_FAST_ALLOCATED; | 494 WTF_MAKE_FAST_ALLOCATED; |
| 492 public: | 495 public: |
| 493 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase * cb) : m_context(cb) { } | 496 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase * cb) : m_context(cb) { } |
| 494 virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint ) | 497 virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint ) |
| 495 { | 498 { |
| 496 if (m_context->m_synthesizedErrorsToConsole) | 499 if (m_context->m_synthesizedErrorsToConsole) |
| 497 m_context->printGLErrorToConsole(message); | 500 m_context->printGLErrorToConsole(message); |
| 498 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message); | 501 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message); |
| 499 } | 502 } |
| 500 virtual ~WebGLRenderingContextErrorMessageCallback() { } | 503 virtual ~WebGLRenderingContextErrorMessageCallback() { } |
| 501 private: | 504 private: |
| 505 // Oilpan: kept as a bare pointer, with WebGLRenderingContextBase ensuring | |
| 506 // that it will not be used past its lifetime. | |
| 502 WebGLRenderingContextBase* m_context; | 507 WebGLRenderingContextBase* m_context; |
|
haraken
2014/07/02 07:47:38
Ditto.
| |
| 503 }; | 508 }; |
| 504 | 509 |
| 505 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa nvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* r equestedAttributes) | 510 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa nvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* r equestedAttributes) |
| 506 : CanvasRenderingContext(passedCanvas) | 511 : CanvasRenderingContext(passedCanvas) |
| 507 , ActiveDOMObject(&passedCanvas->document()) | 512 , ActiveDOMObject(&passedCanvas->document()) |
| 508 , m_drawingBuffer(nullptr) | 513 , m_drawingBuffer(nullptr) |
| 509 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch ContextLostEvent) | 514 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch ContextLostEvent) |
| 510 , m_restoreAllowed(false) | 515 , m_restoreAllowed(false) |
| 511 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) | 516 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) |
| 512 , m_generatedImageCache(4) | 517 , m_generatedImageCache(4) |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 // Helper function for V8 bindings to identify what version of WebGL a CanvasRen deringContext supports. | 670 // Helper function for V8 bindings to identify what version of WebGL a CanvasRen deringContext supports. |
| 666 unsigned WebGLRenderingContextBase::getWebGLVersion(const CanvasRenderingContext * context) | 671 unsigned WebGLRenderingContextBase::getWebGLVersion(const CanvasRenderingContext * context) |
| 667 { | 672 { |
| 668 if (!context->is3d()) | 673 if (!context->is3d()) |
| 669 return 0; | 674 return 0; |
| 670 return static_cast<const WebGLRenderingContextBase*>(context)->version(); | 675 return static_cast<const WebGLRenderingContextBase*>(context)->version(); |
| 671 } | 676 } |
| 672 | 677 |
| 673 WebGLRenderingContextBase::~WebGLRenderingContextBase() | 678 WebGLRenderingContextBase::~WebGLRenderingContextBase() |
| 674 { | 679 { |
| 680 #if !ENABLE(OILPAN) | |
| 675 // Remove all references to WebGLObjects so if they are the last reference | 681 // Remove all references to WebGLObjects so if they are the last reference |
| 676 // they will be freed before the last context is removed from the context gr oup. | 682 // they will be freed before the last context is removed from the context gr oup. |
| 677 m_boundArrayBuffer = nullptr; | 683 m_boundArrayBuffer = nullptr; |
| 678 m_defaultVertexArrayObject = nullptr; | 684 m_defaultVertexArrayObject = nullptr; |
| 679 m_boundVertexArrayObject = nullptr; | 685 m_boundVertexArrayObject = nullptr; |
| 680 m_vertexAttrib0Buffer = nullptr; | 686 m_vertexAttrib0Buffer = nullptr; |
| 681 m_currentProgram = nullptr; | 687 m_currentProgram = nullptr; |
| 682 m_framebufferBinding = nullptr; | 688 m_framebufferBinding = nullptr; |
| 683 m_renderbufferBinding = nullptr; | 689 m_renderbufferBinding = nullptr; |
| 684 | 690 |
| 685 for (size_t i = 0; i < m_textureUnits.size(); ++i) { | 691 for (size_t i = 0; i < m_textureUnits.size(); ++i) { |
| 686 m_textureUnits[i].m_texture2DBinding = nullptr; | 692 m_textureUnits[i].m_texture2DBinding = nullptr; |
| 687 m_textureUnits[i].m_textureCubeMapBinding = nullptr; | 693 m_textureUnits[i].m_textureCubeMapBinding = nullptr; |
|
haraken
2014/07/02 07:47:38
Nit: Wrong indentation.
sof
2014/07/02 11:43:53
Tidied.
| |
| 688 } | 694 } |
| 689 | 695 |
| 690 m_blackTexture2D = nullptr; | 696 m_blackTexture2D = nullptr; |
| 691 m_blackTextureCubeMap = nullptr; | 697 m_blackTextureCubeMap = nullptr; |
| 692 | 698 |
| 693 detachAndRemoveAllObjects(); | 699 detachAndRemoveAllObjects(); |
|
haraken
2014/07/02 07:47:38
Is it OK to not call detachContext() on detached c
sof
2014/07/02 11:43:52
I don't think it is acceptable not to do so, i.e.,
| |
| 694 | 700 |
| 695 // release all extensions | 701 // release all extensions |
| 696 for (size_t i = 0; i < m_extensions.size(); ++i) | 702 for (size_t i = 0; i < m_extensions.size(); ++i) |
| 697 delete m_extensions[i]; | 703 delete m_extensions[i]; |
| 698 | 704 |
| 699 // Context must be removed from the group prior to the destruction of the | 705 // Context must be removed from the group prior to the destruction of the |
| 700 // WebGraphicsContext3D, otherwise shared objects may not be properly delete d. | 706 // WebGraphicsContext3D, otherwise shared objects may not be properly delete d. |
| 701 m_contextGroup->removeContext(this); | 707 m_contextGroup->removeContext(this); |
| 702 | 708 |
| 709 if (m_multisamplingObserverRegistered) | |
| 710 if (Page* page = canvas()->document().page()) | |
| 711 page->removeMultisamplingChangedObserver(this); | |
| 712 #endif | |
| 713 | |
| 703 destroyContext(); | 714 destroyContext(); |
|
haraken
2014/07/02 07:47:38
It looks safe to call destroyContext() in the dest
| |
| 704 | 715 |
| 705 #if !ENABLE(OILPAN) | |
| 706 if (m_multisamplingObserverRegistered) { | |
| 707 Page* page = canvas()->document().page(); | |
| 708 if (page) | |
| 709 page->removeMultisamplingChangedObserver(this); | |
| 710 } | |
| 711 #endif | |
| 712 | |
| 713 willDestroyContext(this); | 716 willDestroyContext(this); |
|
haraken
2014/07/02 07:47:39
Not related to this CL, it looks strange we call w
sof
2014/07/02 11:43:53
Sort of agree, but it does a bit more.
| |
| 714 } | 717 } |
| 715 | 718 |
| 716 void WebGLRenderingContextBase::destroyContext() | 719 void WebGLRenderingContextBase::destroyContext() |
| 717 { | 720 { |
| 718 m_contextLost = true; | 721 m_contextLost = true; |
| 719 | 722 |
| 720 if (!m_drawingBuffer) | 723 if (!m_drawingBuffer) |
| 721 return; | 724 return; |
| 722 | 725 |
| 723 m_extensionsUtil.clear(); | 726 m_extensionsUtil.clear(); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 753 | 756 |
| 754 bool WebGLRenderingContextBase::clearIfComposited(GLbitfield mask) | 757 bool WebGLRenderingContextBase::clearIfComposited(GLbitfield mask) |
| 755 { | 758 { |
| 756 if (isContextLost()) | 759 if (isContextLost()) |
| 757 return false; | 760 return false; |
| 758 | 761 |
| 759 if (!m_drawingBuffer->layerComposited() || m_layerCleared | 762 if (!m_drawingBuffer->layerComposited() || m_layerCleared |
| 760 || m_requestedAttributes->preserveDrawingBuffer() || (mask && m_framebuf ferBinding)) | 763 || m_requestedAttributes->preserveDrawingBuffer() || (mask && m_framebuf ferBinding)) |
| 761 return false; | 764 return false; |
| 762 | 765 |
| 763 RefPtr<WebGLContextAttributes> contextAttributes = getContextAttributes(); | 766 RefPtrWillBeRawPtr<WebGLContextAttributes> contextAttributes = getContextAtt ributes(); |
| 764 | 767 |
| 765 // Determine if it's possible to combine the clear the user asked for and th is clear. | 768 // Determine if it's possible to combine the clear the user asked for and th is clear. |
| 766 bool combinedClear = mask && !m_scissorEnabled; | 769 bool combinedClear = mask && !m_scissorEnabled; |
| 767 | 770 |
| 768 webContext()->disable(GL_SCISSOR_TEST); | 771 webContext()->disable(GL_SCISSOR_TEST); |
| 769 if (combinedClear && (mask & GL_COLOR_BUFFER_BIT)) { | 772 if (combinedClear && (mask & GL_COLOR_BUFFER_BIT)) { |
| 770 webContext()->clearColor(m_colorMask[0] ? m_clearColor[0] : 0, | 773 webContext()->clearColor(m_colorMask[0] ? m_clearColor[0] : 0, |
| 771 m_colorMask[1] ? m_clearColor[1] : 0, | 774 m_colorMask[1] ? m_clearColor[1] : 0, |
| 772 m_colorMask[2] ? m_clearColor[2] : 0, | 775 m_colorMask[2] ? m_clearColor[2] : 0, |
| 773 m_colorMask[3] ? m_clearColor[3] : 0); | 776 m_colorMask[3] ? m_clearColor[3] : 0); |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1480 const char* reason = "framebuffer incomplete"; | 1483 const char* reason = "framebuffer incomplete"; |
| 1481 if (m_framebufferBinding && !m_framebufferBinding->onAccess(webContext(), &r eason)) { | 1484 if (m_framebufferBinding && !m_framebufferBinding->onAccess(webContext(), &r eason)) { |
| 1482 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D", reason); | 1485 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D", reason); |
| 1483 return; | 1486 return; |
| 1484 } | 1487 } |
| 1485 clearIfComposited(); | 1488 clearIfComposited(); |
| 1486 ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding .get()); | 1489 ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding .get()); |
| 1487 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height); | 1490 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height); |
| 1488 } | 1491 } |
| 1489 | 1492 |
| 1490 PassRefPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer() | 1493 PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer() |
| 1491 { | 1494 { |
| 1492 if (isContextLost()) | 1495 if (isContextLost()) |
| 1493 return nullptr; | 1496 return nullptr; |
| 1494 RefPtr<WebGLBuffer> o = WebGLBuffer::create(this); | 1497 RefPtrWillBeRawPtr<WebGLBuffer> o = WebGLBuffer::create(this); |
| 1495 addSharedObject(o.get()); | 1498 addSharedObject(o.get()); |
| 1496 return o; | 1499 return o; |
|
haraken
2014/07/02 07:47:38
This should be o.release(). The same comment for o
sof
2014/07/02 11:43:53
Alright, added.
| |
| 1497 } | 1500 } |
| 1498 | 1501 |
| 1499 PassRefPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFramebuffer() | 1502 PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFrameb uffer() |
| 1500 { | 1503 { |
| 1501 if (isContextLost()) | 1504 if (isContextLost()) |
| 1502 return nullptr; | 1505 return nullptr; |
| 1503 RefPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this); | 1506 RefPtrWillBeRawPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this); |
| 1504 addContextObject(o.get()); | 1507 addContextObject(o.get()); |
| 1505 return o; | 1508 return o; |
| 1506 } | 1509 } |
| 1507 | 1510 |
| 1508 PassRefPtr<WebGLTexture> WebGLRenderingContextBase::createTexture() | 1511 PassRefPtrWillBeRawPtr<WebGLTexture> WebGLRenderingContextBase::createTexture() |
| 1509 { | 1512 { |
| 1510 if (isContextLost()) | 1513 if (isContextLost()) |
| 1511 return nullptr; | 1514 return nullptr; |
| 1512 RefPtr<WebGLTexture> o = WebGLTexture::create(this); | 1515 RefPtrWillBeRawPtr<WebGLTexture> o = WebGLTexture::create(this); |
| 1513 addSharedObject(o.get()); | 1516 addSharedObject(o.get()); |
| 1514 return o; | 1517 return o; |
| 1515 } | 1518 } |
| 1516 | 1519 |
| 1517 PassRefPtr<WebGLProgram> WebGLRenderingContextBase::createProgram() | 1520 PassRefPtrWillBeRawPtr<WebGLProgram> WebGLRenderingContextBase::createProgram() |
| 1518 { | 1521 { |
| 1519 if (isContextLost()) | 1522 if (isContextLost()) |
| 1520 return nullptr; | 1523 return nullptr; |
| 1521 RefPtr<WebGLProgram> o = WebGLProgram::create(this); | 1524 RefPtrWillBeRawPtr<WebGLProgram> o = WebGLProgram::create(this); |
| 1522 addSharedObject(o.get()); | 1525 addSharedObject(o.get()); |
| 1523 return o; | 1526 return o; |
| 1524 } | 1527 } |
| 1525 | 1528 |
| 1526 PassRefPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRenderbuffer() | 1529 PassRefPtrWillBeRawPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRende rbuffer() |
| 1527 { | 1530 { |
| 1528 if (isContextLost()) | 1531 if (isContextLost()) |
| 1529 return nullptr; | 1532 return nullptr; |
| 1530 RefPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this); | 1533 RefPtrWillBeRawPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this); |
| 1531 addSharedObject(o.get()); | 1534 addSharedObject(o.get()); |
| 1532 return o; | 1535 return o; |
| 1533 } | 1536 } |
| 1534 | 1537 |
| 1535 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) | 1538 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) |
| 1536 { | 1539 { |
| 1537 if (isContextLost()) | 1540 if (isContextLost()) |
| 1538 return 0; | 1541 return 0; |
| 1539 if (!renderbuffer->emulatedStencilBuffer()) { | 1542 if (!renderbuffer->emulatedStencilBuffer()) { |
| 1540 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer()); | 1543 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer()); |
| 1541 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer())); | 1544 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer())); |
| 1542 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get())); | 1545 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get())); |
| 1543 } | 1546 } |
| 1544 return renderbuffer->emulatedStencilBuffer(); | 1547 return renderbuffer->emulatedStencilBuffer(); |
| 1545 } | 1548 } |
| 1546 | 1549 |
| 1547 PassRefPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLenum type) | 1550 PassRefPtrWillBeRawPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLen um type) |
| 1548 { | 1551 { |
| 1549 if (isContextLost()) | 1552 if (isContextLost()) |
| 1550 return nullptr; | 1553 return nullptr; |
| 1551 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) { | 1554 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) { |
| 1552 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" ); | 1555 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" ); |
| 1553 return nullptr; | 1556 return nullptr; |
| 1554 } | 1557 } |
| 1555 | 1558 |
| 1556 RefPtr<WebGLShader> o = WebGLShader::create(this, type); | 1559 RefPtrWillBeRawPtr<WebGLShader> o = WebGLShader::create(this, type); |
| 1557 addSharedObject(o.get()); | 1560 addSharedObject(o.get()); |
| 1558 return o; | 1561 return o; |
| 1559 } | 1562 } |
| 1560 | 1563 |
| 1561 void WebGLRenderingContextBase::cullFace(GLenum mode) | 1564 void WebGLRenderingContextBase::cullFace(GLenum mode) |
| 1562 { | 1565 { |
| 1563 if (isContextLost()) | 1566 if (isContextLost()) |
| 1564 return; | 1567 return; |
| 1565 switch (mode) { | 1568 switch (mode) { |
| 1566 case GL_FRONT_AND_BACK: | 1569 case GL_FRONT_AND_BACK: |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1994 } | 1997 } |
| 1995 #endif | 1998 #endif |
| 1996 webContext()->generateMipmap(target); | 1999 webContext()->generateMipmap(target); |
| 1997 #if OS(MACOSX) | 2000 #if OS(MACOSX) |
| 1998 if (needToResetMinFilter) | 2001 if (needToResetMinFilter) |
| 1999 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter()); | 2002 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter()); |
| 2000 #endif | 2003 #endif |
| 2001 tex->generateMipmapLevelInfo(); | 2004 tex->generateMipmapLevelInfo(); |
| 2002 } | 2005 } |
| 2003 | 2006 |
| 2004 PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProg ram* program, GLuint index) | 2007 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttr ib(WebGLProgram* program, GLuint index) |
| 2005 { | 2008 { |
| 2006 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) | 2009 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) |
| 2007 return nullptr; | 2010 return nullptr; |
| 2008 blink::WebGraphicsContext3D::ActiveInfo info; | 2011 blink::WebGraphicsContext3D::ActiveInfo info; |
| 2009 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) | 2012 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) |
| 2010 return nullptr; | 2013 return nullptr; |
| 2011 return WebGLActiveInfo::create(info.name, info.type, info.size); | 2014 return WebGLActiveInfo::create(info.name, info.type, info.size); |
| 2012 } | 2015 } |
| 2013 | 2016 |
| 2014 PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLPro gram* program, GLuint index) | 2017 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUnif orm(WebGLProgram* program, GLuint index) |
| 2015 { | 2018 { |
| 2016 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) | 2019 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) |
| 2017 return nullptr; | 2020 return nullptr; |
| 2018 blink::WebGraphicsContext3D::ActiveInfo info; | 2021 blink::WebGraphicsContext3D::ActiveInfo info; |
| 2019 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) | 2022 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) |
| 2020 return nullptr; | 2023 return nullptr; |
| 2021 return WebGLActiveInfo::create(info.name, info.type, info.size); | 2024 return WebGLActiveInfo::create(info.name, info.type, info.size); |
| 2022 } | 2025 } |
| 2023 | 2026 |
| 2024 bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, Vector <RefPtr<WebGLShader> >& shaderObjects) | 2027 bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, WillBe HeapVector<RefPtrWillBeMember<WebGLShader> >& shaderObjects) |
| 2025 { | 2028 { |
| 2026 shaderObjects.clear(); | 2029 shaderObjects.clear(); |
| 2027 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) | 2030 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) |
| 2028 return false; | 2031 return false; |
| 2029 | 2032 |
| 2030 const GLenum shaderType[] = { | 2033 const GLenum shaderType[] = { |
| 2031 GL_VERTEX_SHADER, | 2034 GL_VERTEX_SHADER, |
| 2032 GL_FRAGMENT_SHADER | 2035 GL_FRAGMENT_SHADER |
| 2033 }; | 2036 }; |
| 2034 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { | 2037 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2070 return WebGLGetInfo(); | 2073 return WebGLGetInfo(); |
| 2071 } | 2074 } |
| 2072 | 2075 |
| 2073 GLint value = 0; | 2076 GLint value = 0; |
| 2074 webContext()->getBufferParameteriv(target, pname, &value); | 2077 webContext()->getBufferParameteriv(target, pname, &value); |
| 2075 if (pname == GL_BUFFER_SIZE) | 2078 if (pname == GL_BUFFER_SIZE) |
| 2076 return WebGLGetInfo(value); | 2079 return WebGLGetInfo(value); |
| 2077 return WebGLGetInfo(static_cast<unsigned>(value)); | 2080 return WebGLGetInfo(static_cast<unsigned>(value)); |
| 2078 } | 2081 } |
| 2079 | 2082 |
| 2080 PassRefPtr<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttribut es() | 2083 PassRefPtrWillBeRawPtr<WebGLContextAttributes> WebGLRenderingContextBase::getCon textAttributes() |
| 2081 { | 2084 { |
| 2082 if (isContextLost()) | 2085 if (isContextLost()) |
| 2083 return nullptr; | 2086 return nullptr; |
| 2084 // We always need to return a new WebGLContextAttributes object to | 2087 // We always need to return a new WebGLContextAttributes object to |
| 2085 // prevent the user from mutating any cached version. | 2088 // prevent the user from mutating any cached version. |
| 2086 blink::WebGraphicsContext3D::Attributes attrs = m_drawingBuffer->getActualAt tributes(); | 2089 blink::WebGraphicsContext3D::Attributes attrs = m_drawingBuffer->getActualAt tributes(); |
| 2087 RefPtr<WebGLContextAttributes> attributes = m_requestedAttributes->clone(); | 2090 RefPtrWillBeMember<WebGLContextAttributes> attributes = m_requestedAttribute s->clone(); |
|
haraken
2014/07/02 07:47:38
This should be RefPtrWillBeRawPtr.
sof
2014/07/02 11:43:53
Oops, thanks - well spotted.
| |
| 2088 // Some requested attributes may not be honored, so we need to query the und erlying | 2091 // Some requested attributes may not be honored, so we need to query the und erlying |
| 2089 // context/drawing buffer and adjust accordingly. | 2092 // context/drawing buffer and adjust accordingly. |
| 2090 if (m_requestedAttributes->depth() && !attrs.depth) | 2093 if (m_requestedAttributes->depth() && !attrs.depth) |
| 2091 attributes->setDepth(false); | 2094 attributes->setDepth(false); |
| 2092 if (m_requestedAttributes->stencil() && !attrs.stencil) | 2095 if (m_requestedAttributes->stencil() && !attrs.stencil) |
| 2093 attributes->setStencil(false); | 2096 attributes->setStencil(false); |
| 2094 attributes->setAntialias(m_drawingBuffer->multisample()); | 2097 attributes->setAntialias(m_drawingBuffer->multisample()); |
| 2095 return attributes.release(); | 2098 return attributes.release(); |
| 2096 } | 2099 } |
| 2097 | 2100 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2130 bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac ker* tracker) | 2133 bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac ker* tracker) |
| 2131 { | 2134 { |
| 2132 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ()) | 2135 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ()) |
| 2133 return false; | 2136 return false; |
| 2134 if (!tracker->supported(this)) | 2137 if (!tracker->supported(this)) |
| 2135 return false; | 2138 return false; |
| 2136 return true; | 2139 return true; |
| 2137 } | 2140 } |
| 2138 | 2141 |
| 2139 | 2142 |
| 2140 PassRefPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String& name) | 2143 PassRefPtrWillBeRawPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(c onst String& name) |
| 2141 { | 2144 { |
| 2142 if (isContextLost()) | 2145 if (isContextLost()) |
| 2143 return nullptr; | 2146 return nullptr; |
| 2144 | 2147 |
| 2145 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2148 for (size_t i = 0; i < m_extensions.size(); ++i) { |
| 2146 ExtensionTracker* tracker = m_extensions[i]; | 2149 ExtensionTracker* tracker = m_extensions[i]; |
| 2147 if (tracker->matchesNameWithPrefixes(name)) { | 2150 if (tracker->matchesNameWithPrefixes(name)) { |
| 2148 if (!extensionSupportedAndAllowed(tracker)) | 2151 if (!extensionSupportedAndAllowed(tracker)) |
| 2149 return nullptr; | 2152 return nullptr; |
| 2150 | 2153 |
| 2151 RefPtr<WebGLExtension> extension = tracker->getExtension(this); | 2154 RefPtrWillBeRawPtr<WebGLExtension> extension = tracker->getExtension (this); |
| 2152 if (extension) | 2155 if (extension) |
| 2153 m_extensionEnabled[extension->name()] = true; | 2156 m_extensionEnabled[extension->name()] = true; |
| 2154 return extension.release(); | 2157 return extension.release(); |
| 2155 } | 2158 } |
| 2156 } | 2159 } |
| 2157 | 2160 |
| 2158 return nullptr; | 2161 return nullptr; |
| 2159 } | 2162 } |
| 2160 | 2163 |
| 2161 WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname) | 2164 WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 2177 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name"); | 2180 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name"); |
| 2178 return WebGLGetInfo(); | 2181 return WebGLGetInfo(); |
| 2179 } | 2182 } |
| 2180 | 2183 |
| 2181 ASSERT(object->isTexture() || object->isRenderbuffer()); | 2184 ASSERT(object->isTexture() || object->isRenderbuffer()); |
| 2182 if (object->isTexture()) { | 2185 if (object->isTexture()) { |
| 2183 switch (pname) { | 2186 switch (pname) { |
| 2184 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 2187 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2185 return WebGLGetInfo(GL_TEXTURE); | 2188 return WebGLGetInfo(GL_TEXTURE); |
| 2186 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2189 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2187 return WebGLGetInfo(PassRefPtr<WebGLTexture>(static_cast<WebGLTextur e*>(object))); | 2190 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(static_cast <WebGLTexture*>(object))); |
| 2188 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: | 2191 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2189 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: | 2192 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2190 { | 2193 { |
| 2191 GLint value = 0; | 2194 GLint value = 0; |
| 2192 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); | 2195 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); |
| 2193 return WebGLGetInfo(value); | 2196 return WebGLGetInfo(value); |
| 2194 } | 2197 } |
| 2195 default: | 2198 default: |
| 2196 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment"); | 2199 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment"); |
| 2197 return WebGLGetInfo(); | 2200 return WebGLGetInfo(); |
| 2198 } | 2201 } |
| 2199 } else { | 2202 } else { |
| 2200 switch (pname) { | 2203 switch (pname) { |
| 2201 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 2204 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2202 return WebGLGetInfo(GL_RENDERBUFFER); | 2205 return WebGLGetInfo(GL_RENDERBUFFER); |
| 2203 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2206 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2204 return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(static_cast<WebGLR enderbuffer*>(object))); | 2207 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLRenderbuffer>(static _cast<WebGLRenderbuffer*>(object))); |
| 2205 default: | 2208 default: |
| 2206 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); | 2209 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); |
| 2207 return WebGLGetInfo(); | 2210 return WebGLGetInfo(); |
| 2208 } | 2211 } |
| 2209 } | 2212 } |
| 2210 } | 2213 } |
| 2211 | 2214 |
| 2212 WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname) | 2215 WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname) |
| 2213 { | 2216 { |
| 2214 if (isContextLost()) | 2217 if (isContextLost()) |
| 2215 return WebGLGetInfo(); | 2218 return WebGLGetInfo(); |
| 2216 const int intZero = 0; | 2219 const int intZero = 0; |
| 2217 switch (pname) { | 2220 switch (pname) { |
| 2218 case GL_ACTIVE_TEXTURE: | 2221 case GL_ACTIVE_TEXTURE: |
| 2219 return getUnsignedIntParameter(pname); | 2222 return getUnsignedIntParameter(pname); |
| 2220 case GL_ALIASED_LINE_WIDTH_RANGE: | 2223 case GL_ALIASED_LINE_WIDTH_RANGE: |
| 2221 return getWebGLFloatArrayParameter(pname); | 2224 return getWebGLFloatArrayParameter(pname); |
| 2222 case GL_ALIASED_POINT_SIZE_RANGE: | 2225 case GL_ALIASED_POINT_SIZE_RANGE: |
| 2223 return getWebGLFloatArrayParameter(pname); | 2226 return getWebGLFloatArrayParameter(pname); |
| 2224 case GL_ALPHA_BITS: | 2227 case GL_ALPHA_BITS: |
| 2225 return getIntParameter(pname); | 2228 return getIntParameter(pname); |
| 2226 case GL_ARRAY_BUFFER_BINDING: | 2229 case GL_ARRAY_BUFFER_BINDING: |
| 2227 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundArrayBuffer)); | 2230 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(m_boundArrayBuff er.get())); |
| 2228 case GL_BLEND: | 2231 case GL_BLEND: |
| 2229 return getBooleanParameter(pname); | 2232 return getBooleanParameter(pname); |
| 2230 case GL_BLEND_COLOR: | 2233 case GL_BLEND_COLOR: |
| 2231 return getWebGLFloatArrayParameter(pname); | 2234 return getWebGLFloatArrayParameter(pname); |
| 2232 case GL_BLEND_DST_ALPHA: | 2235 case GL_BLEND_DST_ALPHA: |
| 2233 return getUnsignedIntParameter(pname); | 2236 return getUnsignedIntParameter(pname); |
| 2234 case GL_BLEND_DST_RGB: | 2237 case GL_BLEND_DST_RGB: |
| 2235 return getUnsignedIntParameter(pname); | 2238 return getUnsignedIntParameter(pname); |
| 2236 case GL_BLEND_EQUATION_ALPHA: | 2239 case GL_BLEND_EQUATION_ALPHA: |
| 2237 return getUnsignedIntParameter(pname); | 2240 return getUnsignedIntParameter(pname); |
| 2238 case GL_BLEND_EQUATION_RGB: | 2241 case GL_BLEND_EQUATION_RGB: |
| 2239 return getUnsignedIntParameter(pname); | 2242 return getUnsignedIntParameter(pname); |
| 2240 case GL_BLEND_SRC_ALPHA: | 2243 case GL_BLEND_SRC_ALPHA: |
| 2241 return getUnsignedIntParameter(pname); | 2244 return getUnsignedIntParameter(pname); |
| 2242 case GL_BLEND_SRC_RGB: | 2245 case GL_BLEND_SRC_RGB: |
| 2243 return getUnsignedIntParameter(pname); | 2246 return getUnsignedIntParameter(pname); |
| 2244 case GL_BLUE_BITS: | 2247 case GL_BLUE_BITS: |
| 2245 return getIntParameter(pname); | 2248 return getIntParameter(pname); |
| 2246 case GL_COLOR_CLEAR_VALUE: | 2249 case GL_COLOR_CLEAR_VALUE: |
| 2247 return getWebGLFloatArrayParameter(pname); | 2250 return getWebGLFloatArrayParameter(pname); |
| 2248 case GL_COLOR_WRITEMASK: | 2251 case GL_COLOR_WRITEMASK: |
| 2249 return getBooleanArrayParameter(pname); | 2252 return getBooleanArrayParameter(pname); |
| 2250 case GL_COMPRESSED_TEXTURE_FORMATS: | 2253 case GL_COMPRESSED_TEXTURE_FORMATS: |
| 2251 return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data( ), m_compressedTextureFormats.size())); | 2254 return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data( ), m_compressedTextureFormats.size())); |
| 2252 case GL_CULL_FACE: | 2255 case GL_CULL_FACE: |
| 2253 return getBooleanParameter(pname); | 2256 return getBooleanParameter(pname); |
| 2254 case GL_CULL_FACE_MODE: | 2257 case GL_CULL_FACE_MODE: |
| 2255 return getUnsignedIntParameter(pname); | 2258 return getUnsignedIntParameter(pname); |
| 2256 case GL_CURRENT_PROGRAM: | 2259 case GL_CURRENT_PROGRAM: |
| 2257 return WebGLGetInfo(PassRefPtr<WebGLProgram>(m_currentProgram)); | 2260 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLProgram>(m_currentProgra m.get())); |
| 2258 case GL_DEPTH_BITS: | 2261 case GL_DEPTH_BITS: |
| 2259 if (!m_framebufferBinding && !m_requestedAttributes->depth()) | 2262 if (!m_framebufferBinding && !m_requestedAttributes->depth()) |
| 2260 return WebGLGetInfo(intZero); | 2263 return WebGLGetInfo(intZero); |
| 2261 return getIntParameter(pname); | 2264 return getIntParameter(pname); |
| 2262 case GL_DEPTH_CLEAR_VALUE: | 2265 case GL_DEPTH_CLEAR_VALUE: |
| 2263 return getFloatParameter(pname); | 2266 return getFloatParameter(pname); |
| 2264 case GL_DEPTH_FUNC: | 2267 case GL_DEPTH_FUNC: |
| 2265 return getUnsignedIntParameter(pname); | 2268 return getUnsignedIntParameter(pname); |
| 2266 case GL_DEPTH_RANGE: | 2269 case GL_DEPTH_RANGE: |
| 2267 return getWebGLFloatArrayParameter(pname); | 2270 return getWebGLFloatArrayParameter(pname); |
| 2268 case GL_DEPTH_TEST: | 2271 case GL_DEPTH_TEST: |
| 2269 return getBooleanParameter(pname); | 2272 return getBooleanParameter(pname); |
| 2270 case GL_DEPTH_WRITEMASK: | 2273 case GL_DEPTH_WRITEMASK: |
| 2271 return getBooleanParameter(pname); | 2274 return getBooleanParameter(pname); |
| 2272 case GL_DITHER: | 2275 case GL_DITHER: |
| 2273 return getBooleanParameter(pname); | 2276 return getBooleanParameter(pname); |
| 2274 case GL_ELEMENT_ARRAY_BUFFER_BINDING: | 2277 case GL_ELEMENT_ARRAY_BUFFER_BINDING: |
| 2275 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundVertexArrayObject->bo undElementArrayBuffer())); | 2278 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(m_boundVertexArr ayObject->boundElementArrayBuffer())); |
| 2276 case GL_FRAMEBUFFER_BINDING: | 2279 case GL_FRAMEBUFFER_BINDING: |
| 2277 return WebGLGetInfo(PassRefPtr<WebGLFramebuffer>(m_framebufferBinding)); | 2280 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLFramebuffer>(m_framebuff erBinding.get())); |
| 2278 case GL_FRONT_FACE: | 2281 case GL_FRONT_FACE: |
| 2279 return getUnsignedIntParameter(pname); | 2282 return getUnsignedIntParameter(pname); |
| 2280 case GL_GENERATE_MIPMAP_HINT: | 2283 case GL_GENERATE_MIPMAP_HINT: |
| 2281 return getUnsignedIntParameter(pname); | 2284 return getUnsignedIntParameter(pname); |
| 2282 case GL_GREEN_BITS: | 2285 case GL_GREEN_BITS: |
| 2283 return getIntParameter(pname); | 2286 return getIntParameter(pname); |
| 2284 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: | 2287 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: |
| 2285 return getIntParameter(pname); | 2288 return getIntParameter(pname); |
| 2286 case GL_IMPLEMENTATION_COLOR_READ_TYPE: | 2289 case GL_IMPLEMENTATION_COLOR_READ_TYPE: |
| 2287 return getIntParameter(pname); | 2290 return getIntParameter(pname); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 2316 return getIntParameter(pname); | 2319 return getIntParameter(pname); |
| 2317 case GL_POLYGON_OFFSET_FACTOR: | 2320 case GL_POLYGON_OFFSET_FACTOR: |
| 2318 return getFloatParameter(pname); | 2321 return getFloatParameter(pname); |
| 2319 case GL_POLYGON_OFFSET_FILL: | 2322 case GL_POLYGON_OFFSET_FILL: |
| 2320 return getBooleanParameter(pname); | 2323 return getBooleanParameter(pname); |
| 2321 case GL_POLYGON_OFFSET_UNITS: | 2324 case GL_POLYGON_OFFSET_UNITS: |
| 2322 return getFloatParameter(pname); | 2325 return getFloatParameter(pname); |
| 2323 case GL_RED_BITS: | 2326 case GL_RED_BITS: |
| 2324 return getIntParameter(pname); | 2327 return getIntParameter(pname); |
| 2325 case GL_RENDERBUFFER_BINDING: | 2328 case GL_RENDERBUFFER_BINDING: |
| 2326 return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(m_renderbufferBinding) ); | 2329 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLRenderbuffer>(m_renderbu fferBinding.get())); |
| 2327 case GL_RENDERER: | 2330 case GL_RENDERER: |
| 2328 return WebGLGetInfo(String("WebKit WebGL")); | 2331 return WebGLGetInfo(String("WebKit WebGL")); |
| 2329 case GL_SAMPLE_BUFFERS: | 2332 case GL_SAMPLE_BUFFERS: |
| 2330 return getIntParameter(pname); | 2333 return getIntParameter(pname); |
| 2331 case GL_SAMPLE_COVERAGE_INVERT: | 2334 case GL_SAMPLE_COVERAGE_INVERT: |
| 2332 return getBooleanParameter(pname); | 2335 return getBooleanParameter(pname); |
| 2333 case GL_SAMPLE_COVERAGE_VALUE: | 2336 case GL_SAMPLE_COVERAGE_VALUE: |
| 2334 return getFloatParameter(pname); | 2337 return getFloatParameter(pname); |
| 2335 case GL_SAMPLES: | 2338 case GL_SAMPLES: |
| 2336 return getIntParameter(pname); | 2339 return getIntParameter(pname); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2372 return getIntParameter(pname); | 2375 return getIntParameter(pname); |
| 2373 case GL_STENCIL_TEST: | 2376 case GL_STENCIL_TEST: |
| 2374 return getBooleanParameter(pname); | 2377 return getBooleanParameter(pname); |
| 2375 case GL_STENCIL_VALUE_MASK: | 2378 case GL_STENCIL_VALUE_MASK: |
| 2376 return getUnsignedIntParameter(pname); | 2379 return getUnsignedIntParameter(pname); |
| 2377 case GL_STENCIL_WRITEMASK: | 2380 case GL_STENCIL_WRITEMASK: |
| 2378 return getUnsignedIntParameter(pname); | 2381 return getUnsignedIntParameter(pname); |
| 2379 case GL_SUBPIXEL_BITS: | 2382 case GL_SUBPIXEL_BITS: |
| 2380 return getIntParameter(pname); | 2383 return getIntParameter(pname); |
| 2381 case GL_TEXTURE_BINDING_2D: | 2384 case GL_TEXTURE_BINDING_2D: |
| 2382 return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeText ureUnit].m_texture2DBinding)); | 2385 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(m_textureUnits[ m_activeTextureUnit].m_texture2DBinding.get())); |
| 2383 case GL_TEXTURE_BINDING_CUBE_MAP: | 2386 case GL_TEXTURE_BINDING_CUBE_MAP: |
| 2384 return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeText ureUnit].m_textureCubeMapBinding)); | 2387 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(m_textureUnits[ m_activeTextureUnit].m_textureCubeMapBinding.get())); |
| 2385 case GL_UNPACK_ALIGNMENT: | 2388 case GL_UNPACK_ALIGNMENT: |
| 2386 return getIntParameter(pname); | 2389 return getIntParameter(pname); |
| 2387 case GC3D_UNPACK_FLIP_Y_WEBGL: | 2390 case GC3D_UNPACK_FLIP_Y_WEBGL: |
| 2388 return WebGLGetInfo(m_unpackFlipY); | 2391 return WebGLGetInfo(m_unpackFlipY); |
| 2389 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL: | 2392 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL: |
| 2390 return WebGLGetInfo(m_unpackPremultiplyAlpha); | 2393 return WebGLGetInfo(m_unpackPremultiplyAlpha); |
| 2391 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: | 2394 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: |
| 2392 return WebGLGetInfo(m_unpackColorspaceConversion); | 2395 return WebGLGetInfo(m_unpackColorspaceConversion); |
| 2393 case GL_VENDOR: | 2396 case GL_VENDOR: |
| 2394 return WebGLGetInfo(String("WebKit")); | 2397 return WebGLGetInfo(String("WebKit")); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 2407 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); | 2410 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); |
| 2408 return WebGLGetInfo(); | 2411 return WebGLGetInfo(); |
| 2409 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: | 2412 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: |
| 2410 if (extensionEnabled(WebGLDebugRendererInfoName)) | 2413 if (extensionEnabled(WebGLDebugRendererInfoName)) |
| 2411 return WebGLGetInfo(webContext()->getString(GL_VENDOR)); | 2414 return WebGLGetInfo(webContext()->getString(GL_VENDOR)); |
| 2412 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); | 2415 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); |
| 2413 return WebGLGetInfo(); | 2416 return WebGLGetInfo(); |
| 2414 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object | 2417 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object |
| 2415 if (extensionEnabled(OESVertexArrayObjectName)) { | 2418 if (extensionEnabled(OESVertexArrayObjectName)) { |
| 2416 if (!m_boundVertexArrayObject->isDefaultObject()) | 2419 if (!m_boundVertexArrayObject->isDefaultObject()) |
| 2417 return WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES>(m_boun dVertexArrayObject)); | 2420 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLVertexArrayObjec tOES>(m_boundVertexArrayObject.get())); |
| 2418 return WebGLGetInfo(); | 2421 return WebGLGetInfo(); |
| 2419 } | 2422 } |
| 2420 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled"); | 2423 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled"); |
| 2421 return WebGLGetInfo(); | 2424 return WebGLGetInfo(); |
| 2422 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic | 2425 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| 2423 if (extensionEnabled(EXTTextureFilterAnisotropicName)) | 2426 if (extensionEnabled(EXTTextureFilterAnisotropicName)) |
| 2424 return getUnsignedIntParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); | 2427 return getUnsignedIntParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); |
| 2425 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled"); | 2428 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled"); |
| 2426 return WebGLGetInfo(); | 2429 return WebGLGetInfo(); |
| 2427 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN | 2430 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2547 | 2550 |
| 2548 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) | 2551 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) |
| 2549 { | 2552 { |
| 2550 if (isContextLost()) | 2553 if (isContextLost()) |
| 2551 return String(); | 2554 return String(); |
| 2552 if (!validateWebGLObject("getShaderInfoLog", shader)) | 2555 if (!validateWebGLObject("getShaderInfoLog", shader)) |
| 2553 return ""; | 2556 return ""; |
| 2554 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); | 2557 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); |
| 2555 } | 2558 } |
| 2556 | 2559 |
| 2557 PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::getShaderPreci sionFormat(GLenum shaderType, GLenum precisionType) | 2560 PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::ge tShaderPrecisionFormat(GLenum shaderType, GLenum precisionType) |
| 2558 { | 2561 { |
| 2559 if (isContextLost()) | 2562 if (isContextLost()) |
| 2560 return nullptr; | 2563 return nullptr; |
| 2561 switch (shaderType) { | 2564 switch (shaderType) { |
| 2562 case GL_VERTEX_SHADER: | 2565 case GL_VERTEX_SHADER: |
| 2563 case GL_FRAGMENT_SHADER: | 2566 case GL_FRAGMENT_SHADER: |
| 2564 break; | 2567 break; |
| 2565 default: | 2568 default: |
| 2566 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type"); | 2569 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type"); |
| 2567 return nullptr; | 2570 return nullptr; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2783 notImplemented(); | 2786 notImplemented(); |
| 2784 } | 2787 } |
| 2785 } | 2788 } |
| 2786 } | 2789 } |
| 2787 } | 2790 } |
| 2788 // If we get here, something went wrong in our unfortunately complex logic a bove | 2791 // If we get here, something went wrong in our unfortunately complex logic a bove |
| 2789 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); | 2792 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); |
| 2790 return WebGLGetInfo(); | 2793 return WebGLGetInfo(); |
| 2791 } | 2794 } |
| 2792 | 2795 |
| 2793 PassRefPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUniformLocation(W ebGLProgram* program, const String& name) | 2796 PassRefPtrWillBeRawPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUnifo rmLocation(WebGLProgram* program, const String& name) |
| 2794 { | 2797 { |
| 2795 if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) | 2798 if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) |
| 2796 return nullptr; | 2799 return nullptr; |
| 2797 if (!validateLocationLength("getUniformLocation", name)) | 2800 if (!validateLocationLength("getUniformLocation", name)) |
| 2798 return nullptr; | 2801 return nullptr; |
| 2799 if (!validateString("getUniformLocation", name)) | 2802 if (!validateString("getUniformLocation", name)) |
| 2800 return nullptr; | 2803 return nullptr; |
| 2801 if (isPrefixReserved(name)) | 2804 if (isPrefixReserved(name)) |
| 2802 return nullptr; | 2805 return nullptr; |
| 2803 if (!program->linkStatus()) { | 2806 if (!program->linkStatus()) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 2820 } | 2823 } |
| 2821 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArr ayObject->getVertexAttribState(index); | 2824 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArr ayObject->getVertexAttribState(index); |
| 2822 | 2825 |
| 2823 if (extensionEnabled(ANGLEInstancedArraysName) && pname == GL_VERTEX_ATTRIB_ ARRAY_DIVISOR_ANGLE) | 2826 if (extensionEnabled(ANGLEInstancedArraysName) && pname == GL_VERTEX_ATTRIB_ ARRAY_DIVISOR_ANGLE) |
| 2824 return WebGLGetInfo(state.divisor); | 2827 return WebGLGetInfo(state.divisor); |
| 2825 | 2828 |
| 2826 switch (pname) { | 2829 switch (pname) { |
| 2827 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: | 2830 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: |
| 2828 if (!state.bufferBinding || !state.bufferBinding->object()) | 2831 if (!state.bufferBinding || !state.bufferBinding->object()) |
| 2829 return WebGLGetInfo(); | 2832 return WebGLGetInfo(); |
| 2830 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(state.bufferBinding)); | 2833 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(state.bufferBind ing.get())); |
| 2831 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: | 2834 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: |
| 2832 return WebGLGetInfo(state.enabled); | 2835 return WebGLGetInfo(state.enabled); |
| 2833 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: | 2836 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
| 2834 return WebGLGetInfo(state.normalized); | 2837 return WebGLGetInfo(state.normalized); |
| 2835 case GL_VERTEX_ATTRIB_ARRAY_SIZE: | 2838 case GL_VERTEX_ATTRIB_ARRAY_SIZE: |
| 2836 return WebGLGetInfo(state.size); | 2839 return WebGLGetInfo(state.size); |
| 2837 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: | 2840 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: |
| 2838 return WebGLGetInfo(state.originalStride); | 2841 return WebGLGetInfo(state.originalStride); |
| 2839 case GL_VERTEX_ATTRIB_ARRAY_TYPE: | 2842 case GL_VERTEX_ATTRIB_ARRAY_TYPE: |
| 2840 return WebGLGetInfo(state.type); | 2843 return WebGLGetInfo(state.type); |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4291 } | 4294 } |
| 4292 | 4295 |
| 4293 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) | 4296 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) |
| 4294 { | 4297 { |
| 4295 ASSERT(!isContextLost()); | 4298 ASSERT(!isContextLost()); |
| 4296 m_contextObjects.add(object); | 4299 m_contextObjects.add(object); |
| 4297 } | 4300 } |
| 4298 | 4301 |
| 4299 void WebGLRenderingContextBase::detachAndRemoveAllObjects() | 4302 void WebGLRenderingContextBase::detachAndRemoveAllObjects() |
| 4300 { | 4303 { |
| 4301 while (m_contextObjects.size() > 0) { | 4304 while (m_contextObjects.size() > 0) { |
|
haraken
2014/07/02 07:47:38
This loop will cause an issue in oilpan builds. In
sof
2014/07/02 11:43:53
It's fine as it is; WebGLContextObject::detachCont
| |
| 4302 HashSet<WebGLContextObject*>::iterator it = m_contextObjects.begin(); | 4305 WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject> >::iterator it = m_contextObjects.begin(); |
| 4303 (*it)->detachContext(); | 4306 (*it)->detachContext(); |
| 4304 } | 4307 } |
| 4305 } | 4308 } |
| 4306 | 4309 |
| 4307 bool WebGLRenderingContextBase::hasPendingActivity() const | 4310 bool WebGLRenderingContextBase::hasPendingActivity() const |
| 4308 { | 4311 { |
| 4309 return false; | 4312 return false; |
| 4310 } | 4313 } |
| 4311 | 4314 |
| 4312 void WebGLRenderingContextBase::stop() | 4315 void WebGLRenderingContextBase::stop() |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5624 InspectorInstrumentation::didFireWebGLWarning(canvas()); | 5627 InspectorInstrumentation::didFireWebGLWarning(canvas()); |
| 5625 } | 5628 } |
| 5626 | 5629 |
| 5627 void WebGLRenderingContextBase::applyStencilTest() | 5630 void WebGLRenderingContextBase::applyStencilTest() |
| 5628 { | 5631 { |
| 5629 bool haveStencilBuffer = false; | 5632 bool haveStencilBuffer = false; |
| 5630 | 5633 |
| 5631 if (m_framebufferBinding) | 5634 if (m_framebufferBinding) |
| 5632 haveStencilBuffer = m_framebufferBinding->hasStencilBuffer(); | 5635 haveStencilBuffer = m_framebufferBinding->hasStencilBuffer(); |
| 5633 else { | 5636 else { |
| 5634 RefPtr<WebGLContextAttributes> attributes = getContextAttributes(); | 5637 RefPtrWillBeRawPtr<WebGLContextAttributes> attributes = getContextAttrib utes(); |
| 5635 haveStencilBuffer = attributes->stencil(); | 5638 haveStencilBuffer = attributes->stencil(); |
| 5636 } | 5639 } |
| 5637 enableOrDisable(GL_STENCIL_TEST, | 5640 enableOrDisable(GL_STENCIL_TEST, |
| 5638 m_stencilEnabled && haveStencilBuffer); | 5641 m_stencilEnabled && haveStencilBuffer); |
| 5639 } | 5642 } |
| 5640 | 5643 |
| 5641 void WebGLRenderingContextBase::enableOrDisable(GLenum capability, bool enable) | 5644 void WebGLRenderingContextBase::enableOrDisable(GLenum capability, bool enable) |
| 5642 { | 5645 { |
| 5643 if (isContextLost()) | 5646 if (isContextLost()) |
| 5644 return; | 5647 return; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5718 for (int i = startIndex; i >= 0; --i) { | 5721 for (int i = startIndex; i >= 0; --i) { |
| 5719 if (m_textureUnits[i].m_texture2DBinding | 5722 if (m_textureUnits[i].m_texture2DBinding |
| 5720 || m_textureUnits[i].m_textureCubeMapBinding) { | 5723 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5721 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5724 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5722 return; | 5725 return; |
| 5723 } | 5726 } |
| 5724 } | 5727 } |
| 5725 m_onePlusMaxNonDefaultTextureUnit = 0; | 5728 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5726 } | 5729 } |
| 5727 | 5730 |
| 5731 void WebGLRenderingContextBase::TextureUnitState::trace(Visitor* visitor) | |
| 5732 { | |
| 5733 visitor->trace(m_texture2DBinding); | |
| 5734 visitor->trace(m_textureCubeMapBinding); | |
| 5735 } | |
| 5736 | |
| 5737 void WebGLRenderingContextBase::trace(Visitor* visitor) | |
| 5738 { | |
| 5739 visitor->trace(m_contextGroup); | |
| 5740 visitor->trace(m_contextObjects); | |
| 5741 visitor->trace(m_boundArrayBuffer); | |
| 5742 visitor->trace(m_defaultVertexArrayObject); | |
| 5743 visitor->trace(m_boundVertexArrayObject); | |
| 5744 visitor->trace(m_vertexAttrib0Buffer); | |
| 5745 visitor->trace(m_currentProgram); | |
| 5746 visitor->trace(m_framebufferBinding); | |
| 5747 visitor->trace(m_renderbufferBinding); | |
| 5748 visitor->trace(m_textureUnits); | |
| 5749 visitor->trace(m_blackTexture2D); | |
| 5750 visitor->trace(m_blackTextureCubeMap); | |
| 5751 visitor->trace(m_requestedAttributes); | |
| 5752 #if ENABLE(OILPAN) | |
| 5753 visitor->trace(m_extensions); | |
| 5754 #endif | |
| 5755 CanvasRenderingContext::trace(visitor); | |
| 5756 } | |
| 5757 | |
| 5728 } // namespace WebCore | 5758 } // namespace WebCore |
| OLD | NEW |