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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 #include "wtf/PassOwnPtr.h" | 85 #include "wtf/PassOwnPtr.h" |
86 #include "wtf/Uint32Array.h" | 86 #include "wtf/Uint32Array.h" |
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 // FIXME: Oilpan: static vectors to heap allocated WebGLRenderingContextBase obj
ects |
| 96 // are kept here. This relies on the WebGLRenderingContextBase finalization to |
| 97 // explicitly retire themselves from these vectors, but it'd be preferable if |
| 98 // the references were traced as per usual. |
95 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::activeContexts() | 99 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::activeContexts() |
96 { | 100 { |
97 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, activeContexts, ()); | 101 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, activeContexts, ()); |
98 return activeContexts; | 102 return activeContexts; |
99 } | 103 } |
100 | 104 |
101 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::forciblyEvictedCo
ntexts() | 105 Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::forciblyEvictedCo
ntexts() |
102 { | 106 { |
103 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, forciblyEvictedConte
xts, ()); | 107 DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, forciblyEvictedConte
xts, ()); |
104 return forciblyEvictedContexts; | 108 return forciblyEvictedContexts; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 WebGLRenderingContextBase::forciblyLoseOldestContext(reason); | 221 WebGLRenderingContextBase::forciblyLoseOldestContext(reason); |
218 }; | 222 }; |
219 IntSize oldestContextSize() { | 223 IntSize oldestContextSize() { |
220 return WebGLRenderingContextBase::oldestContextSize(); | 224 return WebGLRenderingContextBase::oldestContextSize(); |
221 }; | 225 }; |
222 }; | 226 }; |
223 | 227 |
224 namespace { | 228 namespace { |
225 | 229 |
226 class ScopedDrawingBufferBinder { | 230 class ScopedDrawingBufferBinder { |
| 231 STACK_ALLOCATED(); |
227 public: | 232 public: |
228 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer
* framebufferBinding) | 233 ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer
* framebufferBinding) |
229 : m_drawingBuffer(drawingBuffer) | 234 : m_drawingBuffer(drawingBuffer) |
230 , m_framebufferBinding(framebufferBinding) | 235 , m_framebufferBinding(framebufferBinding) |
231 { | 236 { |
232 // Commit DrawingBuffer if needed (e.g., for multisampling) | 237 // Commit DrawingBuffer if needed (e.g., for multisampling) |
233 if (!m_framebufferBinding && m_drawingBuffer) | 238 if (!m_framebufferBinding && m_drawingBuffer) |
234 m_drawingBuffer->commit(); | 239 m_drawingBuffer->commit(); |
235 } | 240 } |
236 | 241 |
237 ~ScopedDrawingBufferBinder() | 242 ~ScopedDrawingBufferBinder() |
238 { | 243 { |
239 // Restore DrawingBuffer if needed | 244 // Restore DrawingBuffer if needed |
240 if (!m_framebufferBinding && m_drawingBuffer) | 245 if (!m_framebufferBinding && m_drawingBuffer) |
241 m_drawingBuffer->bind(); | 246 m_drawingBuffer->bind(); |
242 } | 247 } |
243 | 248 |
244 private: | 249 private: |
245 DrawingBuffer* m_drawingBuffer; | 250 DrawingBuffer* m_drawingBuffer; |
246 WebGLFramebuffer* m_framebufferBinding; | 251 RawPtrWillBeMember<WebGLFramebuffer> m_framebufferBinding; |
247 }; | 252 }; |
248 | 253 |
249 Platform3DObject objectOrZero(WebGLObject* object) | 254 Platform3DObject objectOrZero(WebGLObject* object) |
250 { | 255 { |
251 return object ? object->object() : 0; | 256 return object ? object->object() : 0; |
252 } | 257 } |
253 | 258 |
254 GLint clamp(GLint value, GLint min, GLint max) | 259 GLint clamp(GLint value, GLint min, GLint max) |
255 { | 260 { |
256 if (value < min) | 261 if (value < min) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 466 |
462 // Swallow all other characters. Unclear whether we may | 467 // Swallow all other characters. Unclear whether we may |
463 // want or need to just emit a space per character to try | 468 // want or need to just emit a space per character to try |
464 // to preserve column numbers for debugging purposes. | 469 // to preserve column numbers for debugging purposes. |
465 break; | 470 break; |
466 } | 471 } |
467 } | 472 } |
468 } // namespace anonymous | 473 } // namespace anonymous |
469 | 474 |
470 class ScopedTexture2DRestorer { | 475 class ScopedTexture2DRestorer { |
| 476 STACK_ALLOCATED(); |
471 public: | 477 public: |
472 ScopedTexture2DRestorer(WebGLRenderingContextBase* context) | 478 explicit ScopedTexture2DRestorer(WebGLRenderingContextBase* context) |
473 : m_context(context) | 479 : m_context(context) |
474 { | 480 { |
475 } | 481 } |
476 | 482 |
477 ~ScopedTexture2DRestorer() | 483 ~ScopedTexture2DRestorer() |
478 { | 484 { |
479 m_context->restoreCurrentTexture2D(); | 485 m_context->restoreCurrentTexture2D(); |
480 } | 486 } |
481 | 487 |
482 private: | 488 private: |
483 WebGLRenderingContextBase* m_context; | 489 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; |
484 }; | 490 }; |
485 | 491 |
486 class WebGLRenderingContextLostCallback : public blink::WebGraphicsContext3D::We
bGraphicsContextLostCallback { | 492 class WebGLRenderingContextLostCallback FINAL : public NoBaseWillBeGarbageCollec
tedFinalized<WebGLRenderingContextLostCallback>, public blink::WebGraphicsContex
t3D::WebGraphicsContextLostCallback { |
487 WTF_MAKE_FAST_ALLOCATED; | 493 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
488 public: | 494 public: |
489 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* cb) :
m_context(cb) { } | 495 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextLostCallback> create(WebG
LRenderingContextBase* context) |
| 496 { |
| 497 return adoptPtrWillBeNoop(new WebGLRenderingContextLostCallback(context)
); |
| 498 } |
| 499 |
| 500 virtual ~WebGLRenderingContextLostCallback() { } |
| 501 |
490 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon
textBase::RealLostContext); } | 502 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon
textBase::RealLostContext); } |
491 virtual ~WebGLRenderingContextLostCallback() {} | 503 |
| 504 void trace(Visitor* visitor) |
| 505 { |
| 506 visitor->trace(m_context); |
| 507 } |
| 508 |
492 private: | 509 private: |
493 WebGLRenderingContextBase* m_context; | 510 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex
t) |
| 511 : m_context(context) { } |
| 512 |
| 513 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; |
494 }; | 514 }; |
495 | 515 |
496 class WebGLRenderingContextErrorMessageCallback : public blink::WebGraphicsConte
xt3D::WebGraphicsErrorMessageCallback { | 516 class WebGLRenderingContextErrorMessageCallback FINAL : public NoBaseWillBeGarba
geCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public blink::W
ebGraphicsContext3D::WebGraphicsErrorMessageCallback { |
497 WTF_MAKE_FAST_ALLOCATED; | 517 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
498 public: | 518 public: |
499 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase
* cb) : m_context(cb) { } | 519 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextErrorMessageCallback> cre
ate(WebGLRenderingContextBase* context) |
| 520 { |
| 521 return adoptPtrWillBeNoop(new WebGLRenderingContextErrorMessageCallback(
context)); |
| 522 } |
| 523 |
| 524 virtual ~WebGLRenderingContextErrorMessageCallback() { } |
| 525 |
500 virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint
) | 526 virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint
) |
501 { | 527 { |
502 if (m_context->m_synthesizedErrorsToConsole) | 528 if (m_context->m_synthesizedErrorsToConsole) |
503 m_context->printGLErrorToConsole(message); | 529 m_context->printGLErrorToConsole(message); |
504 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas()
, message); | 530 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas()
, message); |
505 } | 531 } |
506 virtual ~WebGLRenderingContextErrorMessageCallback() { } | 532 |
| 533 void trace(Visitor* visitor) |
| 534 { |
| 535 visitor->trace(m_context); |
| 536 } |
| 537 |
507 private: | 538 private: |
508 WebGLRenderingContextBase* m_context; | 539 explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase
* context) |
| 540 : m_context(context) { } |
| 541 |
| 542 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; |
509 }; | 543 }; |
510 | 544 |
511 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* r
equestedAttributes) | 545 WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
nvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* r
equestedAttributes) |
512 : CanvasRenderingContext(passedCanvas) | 546 : CanvasRenderingContext(passedCanvas) |
513 , ActiveDOMObject(&passedCanvas->document()) | 547 , ActiveDOMObject(&passedCanvas->document()) |
514 , m_drawingBuffer(nullptr) | 548 , m_drawingBuffer(nullptr) |
515 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) | 549 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) |
516 , m_restoreAllowed(false) | 550 , m_restoreAllowed(false) |
517 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) | 551 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) |
518 , m_generatedImageCache(4) | 552 , m_generatedImageCache(4) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 addContextObject(m_defaultVertexArrayObject.get()); | 652 addContextObject(m_defaultVertexArrayObject.get()); |
619 m_boundVertexArrayObject = m_defaultVertexArrayObject; | 653 m_boundVertexArrayObject = m_defaultVertexArrayObject; |
620 | 654 |
621 m_vertexAttribValue.resize(m_maxVertexAttribs); | 655 m_vertexAttribValue.resize(m_maxVertexAttribs); |
622 | 656 |
623 createFallbackBlackTextures1x1(); | 657 createFallbackBlackTextures1x1(); |
624 | 658 |
625 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 659 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
626 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 660 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
627 | 661 |
628 m_contextLostCallbackAdapter = adoptPtr(new WebGLRenderingContextLostCallbac
k(this)); | 662 m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi
s); |
629 m_errorMessageCallbackAdapter = adoptPtr(new WebGLRenderingContextErrorMessa
geCallback(this)); | 663 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
reate(this); |
630 | 664 |
631 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); | 665 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); |
632 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); | 666 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); |
633 | 667 |
634 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. | 668 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. |
635 webContext()->flush(); | 669 webContext()->flush(); |
636 | 670 |
637 for (int i = 0; i < WebGLExtensionNameCount; ++i) | 671 for (int i = 0; i < WebGLExtensionNameCount; ++i) |
638 m_extensionEnabled[i] = false; | 672 m_extensionEnabled[i] = false; |
639 | 673 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 // Helper function for V8 bindings to identify what version of WebGL a CanvasRen
deringContext supports. | 705 // Helper function for V8 bindings to identify what version of WebGL a CanvasRen
deringContext supports. |
672 unsigned WebGLRenderingContextBase::getWebGLVersion(const CanvasRenderingContext
* context) | 706 unsigned WebGLRenderingContextBase::getWebGLVersion(const CanvasRenderingContext
* context) |
673 { | 707 { |
674 if (!context->is3d()) | 708 if (!context->is3d()) |
675 return 0; | 709 return 0; |
676 return static_cast<const WebGLRenderingContextBase*>(context)->version(); | 710 return static_cast<const WebGLRenderingContextBase*>(context)->version(); |
677 } | 711 } |
678 | 712 |
679 WebGLRenderingContextBase::~WebGLRenderingContextBase() | 713 WebGLRenderingContextBase::~WebGLRenderingContextBase() |
680 { | 714 { |
| 715 #if !ENABLE(OILPAN) |
681 // Remove all references to WebGLObjects so if they are the last reference | 716 // Remove all references to WebGLObjects so if they are the last reference |
682 // they will be freed before the last context is removed from the context gr
oup. | 717 // they will be freed before the last context is removed from the context gr
oup. |
683 m_boundArrayBuffer = nullptr; | 718 m_boundArrayBuffer = nullptr; |
684 m_defaultVertexArrayObject = nullptr; | 719 m_defaultVertexArrayObject = nullptr; |
685 m_boundVertexArrayObject = nullptr; | 720 m_boundVertexArrayObject = nullptr; |
686 m_vertexAttrib0Buffer = nullptr; | 721 m_vertexAttrib0Buffer = nullptr; |
687 m_currentProgram = nullptr; | 722 m_currentProgram = nullptr; |
688 m_framebufferBinding = nullptr; | 723 m_framebufferBinding = nullptr; |
689 m_renderbufferBinding = nullptr; | 724 m_renderbufferBinding = nullptr; |
690 | 725 |
691 for (size_t i = 0; i < m_textureUnits.size(); ++i) { | 726 for (size_t i = 0; i < m_textureUnits.size(); ++i) { |
692 m_textureUnits[i].m_texture2DBinding = nullptr; | 727 m_textureUnits[i].m_texture2DBinding = nullptr; |
693 m_textureUnits[i].m_textureCubeMapBinding = nullptr; | 728 m_textureUnits[i].m_textureCubeMapBinding = nullptr; |
694 } | 729 } |
695 | 730 |
696 m_blackTexture2D = nullptr; | 731 m_blackTexture2D = nullptr; |
697 m_blackTextureCubeMap = nullptr; | 732 m_blackTextureCubeMap = nullptr; |
698 | 733 |
699 detachAndRemoveAllObjects(); | 734 detachAndRemoveAllObjects(); |
| 735 #endif |
700 | 736 |
701 // release all extensions | 737 // Release all extensions now. |
702 for (size_t i = 0; i < m_extensions.size(); ++i) | 738 m_extensions.clear(); |
703 delete m_extensions[i]; | |
704 | 739 |
705 // Context must be removed from the group prior to the destruction of the | 740 // Context must be removed from the group prior to the destruction of the |
706 // WebGraphicsContext3D, otherwise shared objects may not be properly delete
d. | 741 // WebGraphicsContext3D, otherwise shared objects may not be properly delete
d. |
707 m_contextGroup->removeContext(this); | 742 m_contextGroup->removeContext(this); |
708 | 743 |
709 destroyContext(); | 744 destroyContext(); |
710 | 745 |
711 #if !ENABLE(OILPAN) | 746 #if !ENABLE(OILPAN) |
712 if (m_multisamplingObserverRegistered) { | 747 if (m_multisamplingObserverRegistered) |
713 Page* page = canvas()->document().page(); | 748 if (Page* page = canvas()->document().page()) |
714 if (page) | |
715 page->removeMultisamplingChangedObserver(this); | 749 page->removeMultisamplingChangedObserver(this); |
716 } | |
717 #endif | 750 #endif |
718 | 751 |
719 willDestroyContext(this); | 752 willDestroyContext(this); |
720 } | 753 } |
721 | 754 |
722 void WebGLRenderingContextBase::destroyContext() | 755 void WebGLRenderingContextBase::destroyContext() |
723 { | 756 { |
724 m_contextLost = true; | 757 m_contextLost = true; |
725 | 758 |
726 if (!m_drawingBuffer) | 759 if (!m_drawingBuffer) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 792 |
760 bool WebGLRenderingContextBase::clearIfComposited(GLbitfield mask) | 793 bool WebGLRenderingContextBase::clearIfComposited(GLbitfield mask) |
761 { | 794 { |
762 if (isContextLost()) | 795 if (isContextLost()) |
763 return false; | 796 return false; |
764 | 797 |
765 if (!m_drawingBuffer->layerComposited() || m_layerCleared | 798 if (!m_drawingBuffer->layerComposited() || m_layerCleared |
766 || m_requestedAttributes->preserveDrawingBuffer() || (mask && m_framebuf
ferBinding)) | 799 || m_requestedAttributes->preserveDrawingBuffer() || (mask && m_framebuf
ferBinding)) |
767 return false; | 800 return false; |
768 | 801 |
769 RefPtr<WebGLContextAttributes> contextAttributes = getContextAttributes(); | 802 RefPtrWillBeRawPtr<WebGLContextAttributes> contextAttributes = getContextAtt
ributes(); |
770 | 803 |
771 // Determine if it's possible to combine the clear the user asked for and th
is clear. | 804 // Determine if it's possible to combine the clear the user asked for and th
is clear. |
772 bool combinedClear = mask && !m_scissorEnabled; | 805 bool combinedClear = mask && !m_scissorEnabled; |
773 | 806 |
774 webContext()->disable(GL_SCISSOR_TEST); | 807 webContext()->disable(GL_SCISSOR_TEST); |
775 if (combinedClear && (mask & GL_COLOR_BUFFER_BIT)) { | 808 if (combinedClear && (mask & GL_COLOR_BUFFER_BIT)) { |
776 webContext()->clearColor(m_colorMask[0] ? m_clearColor[0] : 0, | 809 webContext()->clearColor(m_colorMask[0] ? m_clearColor[0] : 0, |
777 m_colorMask[1] ? m_clearColor[1] : 0, | 810 m_colorMask[1] ? m_clearColor[1] : 0, |
778 m_colorMask[2] ? m_clearColor[2] : 0, | 811 m_colorMask[2] ? m_clearColor[2] : 0, |
779 m_colorMask[3] ? m_clearColor[3] : 0); | 812 m_colorMask[3] ? m_clearColor[3] : 0); |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 const char* reason = "framebuffer incomplete"; | 1519 const char* reason = "framebuffer incomplete"; |
1487 if (m_framebufferBinding && !m_framebufferBinding->onAccess(webContext(), &r
eason)) { | 1520 if (m_framebufferBinding && !m_framebufferBinding->onAccess(webContext(), &r
eason)) { |
1488 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D",
reason); | 1521 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D",
reason); |
1489 return; | 1522 return; |
1490 } | 1523 } |
1491 clearIfComposited(); | 1524 clearIfComposited(); |
1492 ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding
.get()); | 1525 ScopedDrawingBufferBinder binder(m_drawingBuffer.get(), m_framebufferBinding
.get()); |
1493 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width
, height); | 1526 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width
, height); |
1494 } | 1527 } |
1495 | 1528 |
1496 PassRefPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer() | 1529 PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer() |
1497 { | 1530 { |
1498 if (isContextLost()) | 1531 if (isContextLost()) |
1499 return nullptr; | 1532 return nullptr; |
1500 RefPtr<WebGLBuffer> o = WebGLBuffer::create(this); | 1533 RefPtrWillBeRawPtr<WebGLBuffer> o = WebGLBuffer::create(this); |
1501 addSharedObject(o.get()); | 1534 addSharedObject(o.get()); |
1502 return o; | 1535 return o.release(); |
1503 } | 1536 } |
1504 | 1537 |
1505 PassRefPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFramebuffer() | 1538 PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFrameb
uffer() |
1506 { | 1539 { |
1507 if (isContextLost()) | 1540 if (isContextLost()) |
1508 return nullptr; | 1541 return nullptr; |
1509 RefPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this); | 1542 RefPtrWillBeRawPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this); |
1510 addContextObject(o.get()); | 1543 addContextObject(o.get()); |
1511 return o; | 1544 return o.release(); |
1512 } | 1545 } |
1513 | 1546 |
1514 PassRefPtr<WebGLTexture> WebGLRenderingContextBase::createTexture() | 1547 PassRefPtrWillBeRawPtr<WebGLTexture> WebGLRenderingContextBase::createTexture() |
1515 { | 1548 { |
1516 if (isContextLost()) | 1549 if (isContextLost()) |
1517 return nullptr; | 1550 return nullptr; |
1518 RefPtr<WebGLTexture> o = WebGLTexture::create(this); | 1551 RefPtrWillBeRawPtr<WebGLTexture> o = WebGLTexture::create(this); |
1519 addSharedObject(o.get()); | 1552 addSharedObject(o.get()); |
1520 return o; | 1553 return o.release(); |
1521 } | 1554 } |
1522 | 1555 |
1523 PassRefPtr<WebGLProgram> WebGLRenderingContextBase::createProgram() | 1556 PassRefPtrWillBeRawPtr<WebGLProgram> WebGLRenderingContextBase::createProgram() |
1524 { | 1557 { |
1525 if (isContextLost()) | 1558 if (isContextLost()) |
1526 return nullptr; | 1559 return nullptr; |
1527 RefPtr<WebGLProgram> o = WebGLProgram::create(this); | 1560 RefPtrWillBeRawPtr<WebGLProgram> o = WebGLProgram::create(this); |
1528 addSharedObject(o.get()); | 1561 addSharedObject(o.get()); |
1529 return o; | 1562 return o.release(); |
1530 } | 1563 } |
1531 | 1564 |
1532 PassRefPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRenderbuffer() | 1565 PassRefPtrWillBeRawPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRende
rbuffer() |
1533 { | 1566 { |
1534 if (isContextLost()) | 1567 if (isContextLost()) |
1535 return nullptr; | 1568 return nullptr; |
1536 RefPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this); | 1569 RefPtrWillBeRawPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this); |
1537 addSharedObject(o.get()); | 1570 addSharedObject(o.get()); |
1538 return o; | 1571 return o.release(); |
1539 } | 1572 } |
1540 | 1573 |
1541 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum
target, WebGLRenderbuffer* renderbuffer) | 1574 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum
target, WebGLRenderbuffer* renderbuffer) |
1542 { | 1575 { |
1543 if (isContextLost()) | 1576 if (isContextLost()) |
1544 return 0; | 1577 return 0; |
1545 if (!renderbuffer->emulatedStencilBuffer()) { | 1578 if (!renderbuffer->emulatedStencilBuffer()) { |
1546 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer()); | 1579 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer()); |
1547 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat
edStencilBuffer())); | 1580 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat
edStencilBuffer())); |
1548 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin
g.get())); | 1581 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin
g.get())); |
1549 } | 1582 } |
1550 return renderbuffer->emulatedStencilBuffer(); | 1583 return renderbuffer->emulatedStencilBuffer(); |
1551 } | 1584 } |
1552 | 1585 |
1553 PassRefPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLenum type) | 1586 PassRefPtrWillBeRawPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLen
um type) |
1554 { | 1587 { |
1555 if (isContextLost()) | 1588 if (isContextLost()) |
1556 return nullptr; | 1589 return nullptr; |
1557 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) { | 1590 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) { |
1558 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type"
); | 1591 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type"
); |
1559 return nullptr; | 1592 return nullptr; |
1560 } | 1593 } |
1561 | 1594 |
1562 RefPtr<WebGLShader> o = WebGLShader::create(this, type); | 1595 RefPtrWillBeRawPtr<WebGLShader> o = WebGLShader::create(this, type); |
1563 addSharedObject(o.get()); | 1596 addSharedObject(o.get()); |
1564 return o; | 1597 return o.release(); |
1565 } | 1598 } |
1566 | 1599 |
1567 void WebGLRenderingContextBase::cullFace(GLenum mode) | 1600 void WebGLRenderingContextBase::cullFace(GLenum mode) |
1568 { | 1601 { |
1569 if (isContextLost()) | 1602 if (isContextLost()) |
1570 return; | 1603 return; |
1571 switch (mode) { | 1604 switch (mode) { |
1572 case GL_FRONT_AND_BACK: | 1605 case GL_FRONT_AND_BACK: |
1573 case GL_FRONT: | 1606 case GL_FRONT: |
1574 case GL_BACK: | 1607 case GL_BACK: |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2000 } | 2033 } |
2001 #endif | 2034 #endif |
2002 webContext()->generateMipmap(target); | 2035 webContext()->generateMipmap(target); |
2003 #if OS(MACOSX) | 2036 #if OS(MACOSX) |
2004 if (needToResetMinFilter) | 2037 if (needToResetMinFilter) |
2005 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi
lter()); | 2038 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi
lter()); |
2006 #endif | 2039 #endif |
2007 tex->generateMipmapLevelInfo(); | 2040 tex->generateMipmapLevelInfo(); |
2008 } | 2041 } |
2009 | 2042 |
2010 PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProg
ram* program, GLuint index) | 2043 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttr
ib(WebGLProgram* program, GLuint index) |
2011 { | 2044 { |
2012 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) | 2045 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) |
2013 return nullptr; | 2046 return nullptr; |
2014 blink::WebGraphicsContext3D::ActiveInfo info; | 2047 blink::WebGraphicsContext3D::ActiveInfo info; |
2015 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) | 2048 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) |
2016 return nullptr; | 2049 return nullptr; |
2017 return WebGLActiveInfo::create(info.name, info.type, info.size); | 2050 return WebGLActiveInfo::create(info.name, info.type, info.size); |
2018 } | 2051 } |
2019 | 2052 |
2020 PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLPro
gram* program, GLuint index) | 2053 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUnif
orm(WebGLProgram* program, GLuint index) |
2021 { | 2054 { |
2022 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) | 2055 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) |
2023 return nullptr; | 2056 return nullptr; |
2024 blink::WebGraphicsContext3D::ActiveInfo info; | 2057 blink::WebGraphicsContext3D::ActiveInfo info; |
2025 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) | 2058 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) |
2026 return nullptr; | 2059 return nullptr; |
2027 return WebGLActiveInfo::create(info.name, info.type, info.size); | 2060 return WebGLActiveInfo::create(info.name, info.type, info.size); |
2028 } | 2061 } |
2029 | 2062 |
2030 bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, Vector
<RefPtr<WebGLShader> >& shaderObjects) | 2063 bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, WillBe
HeapVector<RefPtrWillBeMember<WebGLShader> >& shaderObjects) |
2031 { | 2064 { |
2032 shaderObjects.clear(); | 2065 shaderObjects.clear(); |
2033 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) | 2066 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) |
2034 return false; | 2067 return false; |
2035 | 2068 |
2036 const GLenum shaderType[] = { | 2069 const GLenum shaderType[] = { |
2037 GL_VERTEX_SHADER, | 2070 GL_VERTEX_SHADER, |
2038 GL_FRAGMENT_SHADER | 2071 GL_FRAGMENT_SHADER |
2039 }; | 2072 }; |
2040 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { | 2073 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2076 return WebGLGetInfo(); | 2109 return WebGLGetInfo(); |
2077 } | 2110 } |
2078 | 2111 |
2079 GLint value = 0; | 2112 GLint value = 0; |
2080 webContext()->getBufferParameteriv(target, pname, &value); | 2113 webContext()->getBufferParameteriv(target, pname, &value); |
2081 if (pname == GL_BUFFER_SIZE) | 2114 if (pname == GL_BUFFER_SIZE) |
2082 return WebGLGetInfo(value); | 2115 return WebGLGetInfo(value); |
2083 return WebGLGetInfo(static_cast<unsigned>(value)); | 2116 return WebGLGetInfo(static_cast<unsigned>(value)); |
2084 } | 2117 } |
2085 | 2118 |
2086 PassRefPtr<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttribut
es() | 2119 PassRefPtrWillBeRawPtr<WebGLContextAttributes> WebGLRenderingContextBase::getCon
textAttributes() |
2087 { | 2120 { |
2088 if (isContextLost()) | 2121 if (isContextLost()) |
2089 return nullptr; | 2122 return nullptr; |
2090 // We always need to return a new WebGLContextAttributes object to | 2123 // We always need to return a new WebGLContextAttributes object to |
2091 // prevent the user from mutating any cached version. | 2124 // prevent the user from mutating any cached version. |
2092 blink::WebGraphicsContext3D::Attributes attrs = m_drawingBuffer->getActualAt
tributes(); | 2125 blink::WebGraphicsContext3D::Attributes attrs = m_drawingBuffer->getActualAt
tributes(); |
2093 RefPtr<WebGLContextAttributes> attributes = m_requestedAttributes->clone(); | 2126 RefPtrWillBeRawPtr<WebGLContextAttributes> attributes = m_requestedAttribute
s->clone(); |
2094 // Some requested attributes may not be honored, so we need to query the und
erlying | 2127 // Some requested attributes may not be honored, so we need to query the und
erlying |
2095 // context/drawing buffer and adjust accordingly. | 2128 // context/drawing buffer and adjust accordingly. |
2096 if (m_requestedAttributes->depth() && !attrs.depth) | 2129 if (m_requestedAttributes->depth() && !attrs.depth) |
2097 attributes->setDepth(false); | 2130 attributes->setDepth(false); |
2098 if (m_requestedAttributes->stencil() && !attrs.stencil) | 2131 if (m_requestedAttributes->stencil() && !attrs.stencil) |
2099 attributes->setStencil(false); | 2132 attributes->setStencil(false); |
2100 attributes->setAntialias(m_drawingBuffer->multisample()); | 2133 attributes->setAntialias(m_drawingBuffer->multisample()); |
2101 return attributes.release(); | 2134 return attributes.release(); |
2102 } | 2135 } |
2103 | 2136 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac
ker* tracker) | 2169 bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac
ker* tracker) |
2137 { | 2170 { |
2138 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled
()) | 2171 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled
()) |
2139 return false; | 2172 return false; |
2140 if (!tracker->supported(this)) | 2173 if (!tracker->supported(this)) |
2141 return false; | 2174 return false; |
2142 return true; | 2175 return true; |
2143 } | 2176 } |
2144 | 2177 |
2145 | 2178 |
2146 PassRefPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String&
name) | 2179 PassRefPtrWillBeRawPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(c
onst String& name) |
2147 { | 2180 { |
2148 if (isContextLost()) | 2181 if (isContextLost()) |
2149 return nullptr; | 2182 return nullptr; |
2150 | 2183 |
2151 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2184 for (size_t i = 0; i < m_extensions.size(); ++i) { |
2152 ExtensionTracker* tracker = m_extensions[i]; | 2185 ExtensionTracker* tracker = m_extensions[i].get(); |
2153 if (tracker->matchesNameWithPrefixes(name)) { | 2186 if (tracker->matchesNameWithPrefixes(name)) { |
2154 if (!extensionSupportedAndAllowed(tracker)) | 2187 if (!extensionSupportedAndAllowed(tracker)) |
2155 return nullptr; | 2188 return nullptr; |
2156 | 2189 |
2157 RefPtr<WebGLExtension> extension = tracker->getExtension(this); | 2190 RefPtrWillBeRawPtr<WebGLExtension> extension = tracker->getExtension
(this); |
2158 if (extension) | 2191 if (extension) |
2159 m_extensionEnabled[extension->name()] = true; | 2192 m_extensionEnabled[extension->name()] = true; |
2160 return extension.release(); | 2193 return extension.release(); |
2161 } | 2194 } |
2162 } | 2195 } |
2163 | 2196 |
2164 return nullptr; | 2197 return nullptr; |
2165 } | 2198 } |
2166 | 2199 |
2167 WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GLenum
target, GLenum attachment, GLenum pname) | 2200 WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GLenum
target, GLenum attachment, GLenum pname) |
(...skipping 15 matching lines...) Expand all Loading... |
2183 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter",
"invalid parameter name"); | 2216 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter",
"invalid parameter name"); |
2184 return WebGLGetInfo(); | 2217 return WebGLGetInfo(); |
2185 } | 2218 } |
2186 | 2219 |
2187 ASSERT(object->isTexture() || object->isRenderbuffer()); | 2220 ASSERT(object->isTexture() || object->isRenderbuffer()); |
2188 if (object->isTexture()) { | 2221 if (object->isTexture()) { |
2189 switch (pname) { | 2222 switch (pname) { |
2190 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 2223 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
2191 return WebGLGetInfo(GL_TEXTURE); | 2224 return WebGLGetInfo(GL_TEXTURE); |
2192 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2225 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
2193 return WebGLGetInfo(PassRefPtr<WebGLTexture>(static_cast<WebGLTextur
e*>(object))); | 2226 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(static_cast
<WebGLTexture*>(object))); |
2194 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: | 2227 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
2195 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: | 2228 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
2196 { | 2229 { |
2197 GLint value = 0; | 2230 GLint value = 0; |
2198 webContext()->getFramebufferAttachmentParameteriv(target, attach
ment, pname, &value); | 2231 webContext()->getFramebufferAttachmentParameteriv(target, attach
ment, pname, &value); |
2199 return WebGLGetInfo(value); | 2232 return WebGLGetInfo(value); |
2200 } | 2233 } |
2201 default: | 2234 default: |
2202 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for texture attachment"); | 2235 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for texture attachment"); |
2203 return WebGLGetInfo(); | 2236 return WebGLGetInfo(); |
2204 } | 2237 } |
2205 } else { | 2238 } else { |
2206 switch (pname) { | 2239 switch (pname) { |
2207 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 2240 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
2208 return WebGLGetInfo(GL_RENDERBUFFER); | 2241 return WebGLGetInfo(GL_RENDERBUFFER); |
2209 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: | 2242 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
2210 return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(static_cast<WebGLR
enderbuffer*>(object))); | 2243 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLRenderbuffer>(static
_cast<WebGLRenderbuffer*>(object))); |
2211 default: | 2244 default: |
2212 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for renderbuffer attachment"); | 2245 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete
r", "invalid parameter name for renderbuffer attachment"); |
2213 return WebGLGetInfo(); | 2246 return WebGLGetInfo(); |
2214 } | 2247 } |
2215 } | 2248 } |
2216 } | 2249 } |
2217 | 2250 |
2218 WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname) | 2251 WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname) |
2219 { | 2252 { |
2220 if (isContextLost()) | 2253 if (isContextLost()) |
2221 return WebGLGetInfo(); | 2254 return WebGLGetInfo(); |
2222 const int intZero = 0; | 2255 const int intZero = 0; |
2223 switch (pname) { | 2256 switch (pname) { |
2224 case GL_ACTIVE_TEXTURE: | 2257 case GL_ACTIVE_TEXTURE: |
2225 return getUnsignedIntParameter(pname); | 2258 return getUnsignedIntParameter(pname); |
2226 case GL_ALIASED_LINE_WIDTH_RANGE: | 2259 case GL_ALIASED_LINE_WIDTH_RANGE: |
2227 return getWebGLFloatArrayParameter(pname); | 2260 return getWebGLFloatArrayParameter(pname); |
2228 case GL_ALIASED_POINT_SIZE_RANGE: | 2261 case GL_ALIASED_POINT_SIZE_RANGE: |
2229 return getWebGLFloatArrayParameter(pname); | 2262 return getWebGLFloatArrayParameter(pname); |
2230 case GL_ALPHA_BITS: | 2263 case GL_ALPHA_BITS: |
2231 return getIntParameter(pname); | 2264 return getIntParameter(pname); |
2232 case GL_ARRAY_BUFFER_BINDING: | 2265 case GL_ARRAY_BUFFER_BINDING: |
2233 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundArrayBuffer)); | 2266 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(m_boundArrayBuff
er.get())); |
2234 case GL_BLEND: | 2267 case GL_BLEND: |
2235 return getBooleanParameter(pname); | 2268 return getBooleanParameter(pname); |
2236 case GL_BLEND_COLOR: | 2269 case GL_BLEND_COLOR: |
2237 return getWebGLFloatArrayParameter(pname); | 2270 return getWebGLFloatArrayParameter(pname); |
2238 case GL_BLEND_DST_ALPHA: | 2271 case GL_BLEND_DST_ALPHA: |
2239 return getUnsignedIntParameter(pname); | 2272 return getUnsignedIntParameter(pname); |
2240 case GL_BLEND_DST_RGB: | 2273 case GL_BLEND_DST_RGB: |
2241 return getUnsignedIntParameter(pname); | 2274 return getUnsignedIntParameter(pname); |
2242 case GL_BLEND_EQUATION_ALPHA: | 2275 case GL_BLEND_EQUATION_ALPHA: |
2243 return getUnsignedIntParameter(pname); | 2276 return getUnsignedIntParameter(pname); |
2244 case GL_BLEND_EQUATION_RGB: | 2277 case GL_BLEND_EQUATION_RGB: |
2245 return getUnsignedIntParameter(pname); | 2278 return getUnsignedIntParameter(pname); |
2246 case GL_BLEND_SRC_ALPHA: | 2279 case GL_BLEND_SRC_ALPHA: |
2247 return getUnsignedIntParameter(pname); | 2280 return getUnsignedIntParameter(pname); |
2248 case GL_BLEND_SRC_RGB: | 2281 case GL_BLEND_SRC_RGB: |
2249 return getUnsignedIntParameter(pname); | 2282 return getUnsignedIntParameter(pname); |
2250 case GL_BLUE_BITS: | 2283 case GL_BLUE_BITS: |
2251 return getIntParameter(pname); | 2284 return getIntParameter(pname); |
2252 case GL_COLOR_CLEAR_VALUE: | 2285 case GL_COLOR_CLEAR_VALUE: |
2253 return getWebGLFloatArrayParameter(pname); | 2286 return getWebGLFloatArrayParameter(pname); |
2254 case GL_COLOR_WRITEMASK: | 2287 case GL_COLOR_WRITEMASK: |
2255 return getBooleanArrayParameter(pname); | 2288 return getBooleanArrayParameter(pname); |
2256 case GL_COMPRESSED_TEXTURE_FORMATS: | 2289 case GL_COMPRESSED_TEXTURE_FORMATS: |
2257 return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data(
), m_compressedTextureFormats.size())); | 2290 return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data(
), m_compressedTextureFormats.size())); |
2258 case GL_CULL_FACE: | 2291 case GL_CULL_FACE: |
2259 return getBooleanParameter(pname); | 2292 return getBooleanParameter(pname); |
2260 case GL_CULL_FACE_MODE: | 2293 case GL_CULL_FACE_MODE: |
2261 return getUnsignedIntParameter(pname); | 2294 return getUnsignedIntParameter(pname); |
2262 case GL_CURRENT_PROGRAM: | 2295 case GL_CURRENT_PROGRAM: |
2263 return WebGLGetInfo(PassRefPtr<WebGLProgram>(m_currentProgram)); | 2296 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLProgram>(m_currentProgra
m.get())); |
2264 case GL_DEPTH_BITS: | 2297 case GL_DEPTH_BITS: |
2265 if (!m_framebufferBinding && !m_requestedAttributes->depth()) | 2298 if (!m_framebufferBinding && !m_requestedAttributes->depth()) |
2266 return WebGLGetInfo(intZero); | 2299 return WebGLGetInfo(intZero); |
2267 return getIntParameter(pname); | 2300 return getIntParameter(pname); |
2268 case GL_DEPTH_CLEAR_VALUE: | 2301 case GL_DEPTH_CLEAR_VALUE: |
2269 return getFloatParameter(pname); | 2302 return getFloatParameter(pname); |
2270 case GL_DEPTH_FUNC: | 2303 case GL_DEPTH_FUNC: |
2271 return getUnsignedIntParameter(pname); | 2304 return getUnsignedIntParameter(pname); |
2272 case GL_DEPTH_RANGE: | 2305 case GL_DEPTH_RANGE: |
2273 return getWebGLFloatArrayParameter(pname); | 2306 return getWebGLFloatArrayParameter(pname); |
2274 case GL_DEPTH_TEST: | 2307 case GL_DEPTH_TEST: |
2275 return getBooleanParameter(pname); | 2308 return getBooleanParameter(pname); |
2276 case GL_DEPTH_WRITEMASK: | 2309 case GL_DEPTH_WRITEMASK: |
2277 return getBooleanParameter(pname); | 2310 return getBooleanParameter(pname); |
2278 case GL_DITHER: | 2311 case GL_DITHER: |
2279 return getBooleanParameter(pname); | 2312 return getBooleanParameter(pname); |
2280 case GL_ELEMENT_ARRAY_BUFFER_BINDING: | 2313 case GL_ELEMENT_ARRAY_BUFFER_BINDING: |
2281 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundVertexArrayObject->bo
undElementArrayBuffer())); | 2314 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(m_boundVertexArr
ayObject->boundElementArrayBuffer())); |
2282 case GL_FRAMEBUFFER_BINDING: | 2315 case GL_FRAMEBUFFER_BINDING: |
2283 return WebGLGetInfo(PassRefPtr<WebGLFramebuffer>(m_framebufferBinding)); | 2316 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLFramebuffer>(m_framebuff
erBinding.get())); |
2284 case GL_FRONT_FACE: | 2317 case GL_FRONT_FACE: |
2285 return getUnsignedIntParameter(pname); | 2318 return getUnsignedIntParameter(pname); |
2286 case GL_GENERATE_MIPMAP_HINT: | 2319 case GL_GENERATE_MIPMAP_HINT: |
2287 return getUnsignedIntParameter(pname); | 2320 return getUnsignedIntParameter(pname); |
2288 case GL_GREEN_BITS: | 2321 case GL_GREEN_BITS: |
2289 return getIntParameter(pname); | 2322 return getIntParameter(pname); |
2290 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: | 2323 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: |
2291 return getIntParameter(pname); | 2324 return getIntParameter(pname); |
2292 case GL_IMPLEMENTATION_COLOR_READ_TYPE: | 2325 case GL_IMPLEMENTATION_COLOR_READ_TYPE: |
2293 return getIntParameter(pname); | 2326 return getIntParameter(pname); |
(...skipping 28 matching lines...) Expand all Loading... |
2322 return getIntParameter(pname); | 2355 return getIntParameter(pname); |
2323 case GL_POLYGON_OFFSET_FACTOR: | 2356 case GL_POLYGON_OFFSET_FACTOR: |
2324 return getFloatParameter(pname); | 2357 return getFloatParameter(pname); |
2325 case GL_POLYGON_OFFSET_FILL: | 2358 case GL_POLYGON_OFFSET_FILL: |
2326 return getBooleanParameter(pname); | 2359 return getBooleanParameter(pname); |
2327 case GL_POLYGON_OFFSET_UNITS: | 2360 case GL_POLYGON_OFFSET_UNITS: |
2328 return getFloatParameter(pname); | 2361 return getFloatParameter(pname); |
2329 case GL_RED_BITS: | 2362 case GL_RED_BITS: |
2330 return getIntParameter(pname); | 2363 return getIntParameter(pname); |
2331 case GL_RENDERBUFFER_BINDING: | 2364 case GL_RENDERBUFFER_BINDING: |
2332 return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(m_renderbufferBinding)
); | 2365 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLRenderbuffer>(m_renderbu
fferBinding.get())); |
2333 case GL_RENDERER: | 2366 case GL_RENDERER: |
2334 return WebGLGetInfo(String("WebKit WebGL")); | 2367 return WebGLGetInfo(String("WebKit WebGL")); |
2335 case GL_SAMPLE_BUFFERS: | 2368 case GL_SAMPLE_BUFFERS: |
2336 return getIntParameter(pname); | 2369 return getIntParameter(pname); |
2337 case GL_SAMPLE_COVERAGE_INVERT: | 2370 case GL_SAMPLE_COVERAGE_INVERT: |
2338 return getBooleanParameter(pname); | 2371 return getBooleanParameter(pname); |
2339 case GL_SAMPLE_COVERAGE_VALUE: | 2372 case GL_SAMPLE_COVERAGE_VALUE: |
2340 return getFloatParameter(pname); | 2373 return getFloatParameter(pname); |
2341 case GL_SAMPLES: | 2374 case GL_SAMPLES: |
2342 return getIntParameter(pname); | 2375 return getIntParameter(pname); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 return getIntParameter(pname); | 2411 return getIntParameter(pname); |
2379 case GL_STENCIL_TEST: | 2412 case GL_STENCIL_TEST: |
2380 return getBooleanParameter(pname); | 2413 return getBooleanParameter(pname); |
2381 case GL_STENCIL_VALUE_MASK: | 2414 case GL_STENCIL_VALUE_MASK: |
2382 return getUnsignedIntParameter(pname); | 2415 return getUnsignedIntParameter(pname); |
2383 case GL_STENCIL_WRITEMASK: | 2416 case GL_STENCIL_WRITEMASK: |
2384 return getUnsignedIntParameter(pname); | 2417 return getUnsignedIntParameter(pname); |
2385 case GL_SUBPIXEL_BITS: | 2418 case GL_SUBPIXEL_BITS: |
2386 return getIntParameter(pname); | 2419 return getIntParameter(pname); |
2387 case GL_TEXTURE_BINDING_2D: | 2420 case GL_TEXTURE_BINDING_2D: |
2388 return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeText
ureUnit].m_texture2DBinding)); | 2421 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(m_textureUnits[
m_activeTextureUnit].m_texture2DBinding.get())); |
2389 case GL_TEXTURE_BINDING_CUBE_MAP: | 2422 case GL_TEXTURE_BINDING_CUBE_MAP: |
2390 return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeText
ureUnit].m_textureCubeMapBinding)); | 2423 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(m_textureUnits[
m_activeTextureUnit].m_textureCubeMapBinding.get())); |
2391 case GL_UNPACK_ALIGNMENT: | 2424 case GL_UNPACK_ALIGNMENT: |
2392 return getIntParameter(pname); | 2425 return getIntParameter(pname); |
2393 case GC3D_UNPACK_FLIP_Y_WEBGL: | 2426 case GC3D_UNPACK_FLIP_Y_WEBGL: |
2394 return WebGLGetInfo(m_unpackFlipY); | 2427 return WebGLGetInfo(m_unpackFlipY); |
2395 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL: | 2428 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL: |
2396 return WebGLGetInfo(m_unpackPremultiplyAlpha); | 2429 return WebGLGetInfo(m_unpackPremultiplyAlpha); |
2397 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: | 2430 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: |
2398 return WebGLGetInfo(m_unpackColorspaceConversion); | 2431 return WebGLGetInfo(m_unpackColorspaceConversion); |
2399 case GL_VENDOR: | 2432 case GL_VENDOR: |
2400 return WebGLGetInfo(String("WebKit")); | 2433 return WebGLGetInfo(String("WebKit")); |
(...skipping 12 matching lines...) Expand all Loading... |
2413 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na
me, WEBGL_debug_renderer_info not enabled"); | 2446 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na
me, WEBGL_debug_renderer_info not enabled"); |
2414 return WebGLGetInfo(); | 2447 return WebGLGetInfo(); |
2415 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: | 2448 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: |
2416 if (extensionEnabled(WebGLDebugRendererInfoName)) | 2449 if (extensionEnabled(WebGLDebugRendererInfoName)) |
2417 return WebGLGetInfo(webContext()->getString(GL_VENDOR)); | 2450 return WebGLGetInfo(webContext()->getString(GL_VENDOR)); |
2418 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na
me, WEBGL_debug_renderer_info not enabled"); | 2451 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na
me, WEBGL_debug_renderer_info not enabled"); |
2419 return WebGLGetInfo(); | 2452 return WebGLGetInfo(); |
2420 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object | 2453 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object |
2421 if (extensionEnabled(OESVertexArrayObjectName)) { | 2454 if (extensionEnabled(OESVertexArrayObjectName)) { |
2422 if (!m_boundVertexArrayObject->isDefaultObject()) | 2455 if (!m_boundVertexArrayObject->isDefaultObject()) |
2423 return WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES>(m_boun
dVertexArrayObject)); | 2456 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLVertexArrayObjec
tOES>(m_boundVertexArrayObject.get())); |
2424 return WebGLGetInfo(); | 2457 return WebGLGetInfo(); |
2425 } | 2458 } |
2426 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na
me, OES_vertex_array_object not enabled"); | 2459 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na
me, OES_vertex_array_object not enabled"); |
2427 return WebGLGetInfo(); | 2460 return WebGLGetInfo(); |
2428 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic | 2461 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
2429 if (extensionEnabled(EXTTextureFilterAnisotropicName)) | 2462 if (extensionEnabled(EXTTextureFilterAnisotropicName)) |
2430 return getUnsignedIntParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); | 2463 return getUnsignedIntParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); |
2431 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na
me, EXT_texture_filter_anisotropic not enabled"); | 2464 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na
me, EXT_texture_filter_anisotropic not enabled"); |
2432 return WebGLGetInfo(); | 2465 return WebGLGetInfo(); |
2433 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN | 2466 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2553 | 2586 |
2554 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) | 2587 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) |
2555 { | 2588 { |
2556 if (isContextLost()) | 2589 if (isContextLost()) |
2557 return String(); | 2590 return String(); |
2558 if (!validateWebGLObject("getShaderInfoLog", shader)) | 2591 if (!validateWebGLObject("getShaderInfoLog", shader)) |
2559 return ""; | 2592 return ""; |
2560 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); | 2593 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); |
2561 } | 2594 } |
2562 | 2595 |
2563 PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::getShaderPreci
sionFormat(GLenum shaderType, GLenum precisionType) | 2596 PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::ge
tShaderPrecisionFormat(GLenum shaderType, GLenum precisionType) |
2564 { | 2597 { |
2565 if (isContextLost()) | 2598 if (isContextLost()) |
2566 return nullptr; | 2599 return nullptr; |
2567 switch (shaderType) { | 2600 switch (shaderType) { |
2568 case GL_VERTEX_SHADER: | 2601 case GL_VERTEX_SHADER: |
2569 case GL_FRAGMENT_SHADER: | 2602 case GL_FRAGMENT_SHADER: |
2570 break; | 2603 break; |
2571 default: | 2604 default: |
2572 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid
shader type"); | 2605 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid
shader type"); |
2573 return nullptr; | 2606 return nullptr; |
(...skipping 26 matching lines...) Expand all Loading... |
2600 return ensureNotNull(shader->source()); | 2633 return ensureNotNull(shader->source()); |
2601 } | 2634 } |
2602 | 2635 |
2603 Vector<String> WebGLRenderingContextBase::getSupportedExtensions() | 2636 Vector<String> WebGLRenderingContextBase::getSupportedExtensions() |
2604 { | 2637 { |
2605 Vector<String> result; | 2638 Vector<String> result; |
2606 if (isContextLost()) | 2639 if (isContextLost()) |
2607 return result; | 2640 return result; |
2608 | 2641 |
2609 for (size_t i = 0; i < m_extensions.size(); ++i) { | 2642 for (size_t i = 0; i < m_extensions.size(); ++i) { |
2610 ExtensionTracker* tracker = m_extensions[i]; | 2643 ExtensionTracker* tracker = m_extensions[i].get(); |
2611 if (extensionSupportedAndAllowed(tracker)) { | 2644 if (extensionSupportedAndAllowed(tracker)) { |
2612 const char* const* prefixes = tracker->prefixes(); | 2645 const char* const* prefixes = tracker->prefixes(); |
2613 for (; *prefixes; ++prefixes) { | 2646 for (; *prefixes; ++prefixes) { |
2614 String prefixedName = String(*prefixes) + tracker->extensionName
(); | 2647 String prefixedName = String(*prefixes) + tracker->extensionName
(); |
2615 result.append(prefixedName); | 2648 result.append(prefixedName); |
2616 } | 2649 } |
2617 } | 2650 } |
2618 } | 2651 } |
2619 | 2652 |
2620 return result; | 2653 return result; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 notImplemented(); | 2822 notImplemented(); |
2790 } | 2823 } |
2791 } | 2824 } |
2792 } | 2825 } |
2793 } | 2826 } |
2794 // If we get here, something went wrong in our unfortunately complex logic a
bove | 2827 // If we get here, something went wrong in our unfortunately complex logic a
bove |
2795 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); | 2828 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); |
2796 return WebGLGetInfo(); | 2829 return WebGLGetInfo(); |
2797 } | 2830 } |
2798 | 2831 |
2799 PassRefPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUniformLocation(W
ebGLProgram* program, const String& name) | 2832 PassRefPtrWillBeRawPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUnifo
rmLocation(WebGLProgram* program, const String& name) |
2800 { | 2833 { |
2801 if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) | 2834 if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) |
2802 return nullptr; | 2835 return nullptr; |
2803 if (!validateLocationLength("getUniformLocation", name)) | 2836 if (!validateLocationLength("getUniformLocation", name)) |
2804 return nullptr; | 2837 return nullptr; |
2805 if (!validateString("getUniformLocation", name)) | 2838 if (!validateString("getUniformLocation", name)) |
2806 return nullptr; | 2839 return nullptr; |
2807 if (isPrefixReserved(name)) | 2840 if (isPrefixReserved(name)) |
2808 return nullptr; | 2841 return nullptr; |
2809 if (!program->linkStatus()) { | 2842 if (!program->linkStatus()) { |
(...skipping 16 matching lines...) Expand all Loading... |
2826 } | 2859 } |
2827 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArr
ayObject->getVertexAttribState(index); | 2860 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArr
ayObject->getVertexAttribState(index); |
2828 | 2861 |
2829 if (extensionEnabled(ANGLEInstancedArraysName) && pname == GL_VERTEX_ATTRIB_
ARRAY_DIVISOR_ANGLE) | 2862 if (extensionEnabled(ANGLEInstancedArraysName) && pname == GL_VERTEX_ATTRIB_
ARRAY_DIVISOR_ANGLE) |
2830 return WebGLGetInfo(state.divisor); | 2863 return WebGLGetInfo(state.divisor); |
2831 | 2864 |
2832 switch (pname) { | 2865 switch (pname) { |
2833 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: | 2866 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: |
2834 if (!state.bufferBinding || !state.bufferBinding->object()) | 2867 if (!state.bufferBinding || !state.bufferBinding->object()) |
2835 return WebGLGetInfo(); | 2868 return WebGLGetInfo(); |
2836 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(state.bufferBinding)); | 2869 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(state.bufferBind
ing.get())); |
2837 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: | 2870 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: |
2838 return WebGLGetInfo(state.enabled); | 2871 return WebGLGetInfo(state.enabled); |
2839 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: | 2872 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
2840 return WebGLGetInfo(state.normalized); | 2873 return WebGLGetInfo(state.normalized); |
2841 case GL_VERTEX_ATTRIB_ARRAY_SIZE: | 2874 case GL_VERTEX_ATTRIB_ARRAY_SIZE: |
2842 return WebGLGetInfo(state.size); | 2875 return WebGLGetInfo(state.size); |
2843 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: | 2876 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: |
2844 return WebGLGetInfo(state.originalStride); | 2877 return WebGLGetInfo(state.originalStride); |
2845 case GL_VERTEX_ATTRIB_ARRAY_TYPE: | 2878 case GL_VERTEX_ATTRIB_ARRAY_TYPE: |
2846 return WebGLGetInfo(state.type); | 2879 return WebGLGetInfo(state.type); |
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4203 } | 4236 } |
4204 | 4237 |
4205 // Make absolutely sure we do not refer to an already-deleted texture or fra
mebuffer. | 4238 // Make absolutely sure we do not refer to an already-deleted texture or fra
mebuffer. |
4206 m_drawingBuffer->setTexture2DBinding(0); | 4239 m_drawingBuffer->setTexture2DBinding(0); |
4207 m_drawingBuffer->setFramebufferBinding(0); | 4240 m_drawingBuffer->setFramebufferBinding(0); |
4208 | 4241 |
4209 detachAndRemoveAllObjects(); | 4242 detachAndRemoveAllObjects(); |
4210 | 4243 |
4211 // Lose all the extensions. | 4244 // Lose all the extensions. |
4212 for (size_t i = 0; i < m_extensions.size(); ++i) { | 4245 for (size_t i = 0; i < m_extensions.size(); ++i) { |
4213 ExtensionTracker* tracker = m_extensions[i]; | 4246 ExtensionTracker* tracker = m_extensions[i].get(); |
4214 tracker->loseExtension(); | 4247 tracker->loseExtension(); |
4215 } | 4248 } |
4216 | 4249 |
4217 for (size_t i = 0; i < WebGLExtensionNameCount; ++i) | 4250 for (size_t i = 0; i < WebGLExtensionNameCount; ++i) |
4218 m_extensionEnabled[i] = false; | 4251 m_extensionEnabled[i] = false; |
4219 | 4252 |
4220 removeAllCompressedTextureFormats(); | 4253 removeAllCompressedTextureFormats(); |
4221 | 4254 |
4222 if (mode != RealLostContext) | 4255 if (mode != RealLostContext) |
4223 destroyContext(); | 4256 destroyContext(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4282 | 4315 |
4283 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) | 4316 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) |
4284 { | 4317 { |
4285 ASSERT(!isContextLost()); | 4318 ASSERT(!isContextLost()); |
4286 m_contextObjects.add(object); | 4319 m_contextObjects.add(object); |
4287 } | 4320 } |
4288 | 4321 |
4289 void WebGLRenderingContextBase::detachAndRemoveAllObjects() | 4322 void WebGLRenderingContextBase::detachAndRemoveAllObjects() |
4290 { | 4323 { |
4291 while (m_contextObjects.size() > 0) { | 4324 while (m_contextObjects.size() > 0) { |
4292 HashSet<WebGLContextObject*>::iterator it = m_contextObjects.begin(); | 4325 WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject> >::iterator
it = m_contextObjects.begin(); |
4293 (*it)->detachContext(); | 4326 (*it)->detachContext(); |
4294 } | 4327 } |
4295 } | 4328 } |
4296 | 4329 |
4297 bool WebGLRenderingContextBase::hasPendingActivity() const | 4330 bool WebGLRenderingContextBase::hasPendingActivity() const |
4298 { | 4331 { |
4299 return false; | 4332 return false; |
4300 } | 4333 } |
4301 | 4334 |
4302 void WebGLRenderingContextBase::stop() | 4335 void WebGLRenderingContextBase::stop() |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5599 InspectorInstrumentation::didFireWebGLWarning(canvas()); | 5632 InspectorInstrumentation::didFireWebGLWarning(canvas()); |
5600 } | 5633 } |
5601 | 5634 |
5602 void WebGLRenderingContextBase::applyStencilTest() | 5635 void WebGLRenderingContextBase::applyStencilTest() |
5603 { | 5636 { |
5604 bool haveStencilBuffer = false; | 5637 bool haveStencilBuffer = false; |
5605 | 5638 |
5606 if (m_framebufferBinding) | 5639 if (m_framebufferBinding) |
5607 haveStencilBuffer = m_framebufferBinding->hasStencilBuffer(); | 5640 haveStencilBuffer = m_framebufferBinding->hasStencilBuffer(); |
5608 else { | 5641 else { |
5609 RefPtr<WebGLContextAttributes> attributes = getContextAttributes(); | 5642 RefPtrWillBeRawPtr<WebGLContextAttributes> attributes = getContextAttrib
utes(); |
5610 haveStencilBuffer = attributes->stencil(); | 5643 haveStencilBuffer = attributes->stencil(); |
5611 } | 5644 } |
5612 enableOrDisable(GL_STENCIL_TEST, | 5645 enableOrDisable(GL_STENCIL_TEST, |
5613 m_stencilEnabled && haveStencilBuffer); | 5646 m_stencilEnabled && haveStencilBuffer); |
5614 } | 5647 } |
5615 | 5648 |
5616 void WebGLRenderingContextBase::enableOrDisable(GLenum capability, bool enable) | 5649 void WebGLRenderingContextBase::enableOrDisable(GLenum capability, bool enable) |
5617 { | 5650 { |
5618 if (isContextLost()) | 5651 if (isContextLost()) |
5619 return; | 5652 return; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5693 for (int i = startIndex; i >= 0; --i) { | 5726 for (int i = startIndex; i >= 0; --i) { |
5694 if (m_textureUnits[i].m_texture2DBinding | 5727 if (m_textureUnits[i].m_texture2DBinding |
5695 || m_textureUnits[i].m_textureCubeMapBinding) { | 5728 || m_textureUnits[i].m_textureCubeMapBinding) { |
5696 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5729 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
5697 return; | 5730 return; |
5698 } | 5731 } |
5699 } | 5732 } |
5700 m_onePlusMaxNonDefaultTextureUnit = 0; | 5733 m_onePlusMaxNonDefaultTextureUnit = 0; |
5701 } | 5734 } |
5702 | 5735 |
| 5736 void WebGLRenderingContextBase::TextureUnitState::trace(Visitor* visitor) |
| 5737 { |
| 5738 visitor->trace(m_texture2DBinding); |
| 5739 visitor->trace(m_textureCubeMapBinding); |
| 5740 } |
| 5741 |
| 5742 void WebGLRenderingContextBase::trace(Visitor* visitor) |
| 5743 { |
| 5744 visitor->trace(m_contextObjects); |
| 5745 visitor->trace(m_contextLostCallbackAdapter); |
| 5746 visitor->trace(m_errorMessageCallbackAdapter); |
| 5747 visitor->trace(m_boundArrayBuffer); |
| 5748 visitor->trace(m_defaultVertexArrayObject); |
| 5749 visitor->trace(m_boundVertexArrayObject); |
| 5750 visitor->trace(m_vertexAttrib0Buffer); |
| 5751 visitor->trace(m_currentProgram); |
| 5752 visitor->trace(m_framebufferBinding); |
| 5753 visitor->trace(m_renderbufferBinding); |
| 5754 visitor->trace(m_textureUnits); |
| 5755 visitor->trace(m_blackTexture2D); |
| 5756 visitor->trace(m_blackTextureCubeMap); |
| 5757 visitor->trace(m_requestedAttributes); |
| 5758 visitor->trace(m_extensions); |
| 5759 CanvasRenderingContext::trace(visitor); |
| 5760 } |
| 5761 |
5703 } // namespace WebCore | 5762 } // namespace WebCore |
OLD | NEW |