Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 1856933002: WebGL GL_RGB emulation to support IOSurfaces on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "public/platform/Platform.h" 93 #include "public/platform/Platform.h"
94 #include "public/platform/WebGraphicsContext3D.h" 94 #include "public/platform/WebGraphicsContext3D.h"
95 #include "public/platform/WebGraphicsContext3DProvider.h" 95 #include "public/platform/WebGraphicsContext3DProvider.h"
96 #include "public/platform/functional/WebFunction.h" 96 #include "public/platform/functional/WebFunction.h"
97 #include "wtf/Functional.h" 97 #include "wtf/Functional.h"
98 #include "wtf/PassOwnPtr.h" 98 #include "wtf/PassOwnPtr.h"
99 #include "wtf/text/StringBuilder.h" 99 #include "wtf/text/StringBuilder.h"
100 #include "wtf/text/StringUTF8Adaptor.h" 100 #include "wtf/text/StringUTF8Adaptor.h"
101 #include "wtf/typed_arrays/ArrayBufferContents.h" 101 #include "wtf/typed_arrays/ArrayBufferContents.h"
102 102
103 #include <memory>
104
103 namespace blink { 105 namespace blink {
104 106
105 namespace { 107 namespace {
106 108
107 const double secondsBetweenRestoreAttempts = 1.0; 109 const double secondsBetweenRestoreAttempts = 1.0;
108 const int maxGLErrorsAllowedToConsole = 256; 110 const int maxGLErrorsAllowedToConsole = 256;
109 const unsigned maxGLActiveContexts = 16; 111 const unsigned maxGLActiveContexts = 16;
110 112
111 using WebGLRenderingContextBaseSet = PersistentHeapHashSet<WeakMember<WebGLRende ringContextBase>>; 113 using WebGLRenderingContextBaseSet = PersistentHeapHashSet<WeakMember<WebGLRende ringContextBase>>;
112 WebGLRenderingContextBaseSet& activeContexts() 114 WebGLRenderingContextBaseSet& activeContexts()
113 { 115 {
114 DEFINE_STATIC_LOCAL(WebGLRenderingContextBaseSet, activeContexts, ()); 116 DEFINE_STATIC_LOCAL(WebGLRenderingContextBaseSet, activeContexts, ());
115 return activeContexts; 117 return activeContexts;
116 } 118 }
117 119
118 using WebGLRenderingContextBaseMap = PersistentHeapHashMap<WeakMember<WebGLRende ringContextBase>, int>; 120 using WebGLRenderingContextBaseMap = PersistentHeapHashMap<WeakMember<WebGLRende ringContextBase>, int>;
119 WebGLRenderingContextBaseMap& forciblyEvictedContexts() 121 WebGLRenderingContextBaseMap& forciblyEvictedContexts()
120 { 122 {
121 DEFINE_STATIC_LOCAL(WebGLRenderingContextBaseMap, forciblyEvictedContexts, ( )); 123 DEFINE_STATIC_LOCAL(WebGLRenderingContextBaseMap, forciblyEvictedContexts, ( ));
122 return forciblyEvictedContexts; 124 return forciblyEvictedContexts;
123 } 125 }
124 126
127 class ScopedRGBEmulationColorMask {
Zhenyao Mo 2016/04/29 22:54:15 Does this bug also exist in core profile? If yes,
erikchen 2016/05/03 22:58:07 It does. I've done as you suggested.
128 public:
129 ScopedRGBEmulationColorMask(gpu::gles2::GLES2Interface* contextGL, GLboolean * colorMask)
130 : m_contextGL(contextGL)
131 {
132 memcpy(m_colorMask, colorMask, 4 * sizeof(GLboolean));
133 m_contextGL->ColorMask(m_colorMask[0], m_colorMask[1], m_colorMask[2], f alse);
134 }
135 ~ScopedRGBEmulationColorMask()
136 {
137 m_contextGL->ColorMask(m_colorMask[0], m_colorMask[1], m_colorMask[2], m _colorMask[3]);
138 }
139
140 private:
141 gpu::gles2::GLES2Interface* m_contextGL;
142 GLboolean m_colorMask[4];
143 };
144
125 } // namespace 145 } // namespace
126 146
127 void WebGLRenderingContextBase::forciblyLoseOldestContext(const String& reason) 147 void WebGLRenderingContextBase::forciblyLoseOldestContext(const String& reason)
128 { 148 {
129 WebGLRenderingContextBase* candidate = oldestContext(); 149 WebGLRenderingContextBase* candidate = oldestContext();
130 if (!candidate) 150 if (!candidate)
131 return; 151 return;
132 152
133 candidate->printWarningToConsole(reason); 153 candidate->printWarningToConsole(reason);
134 InspectorInstrumentation::didFireWebGLWarning(candidate->canvas()); 154 InspectorInstrumentation::didFireWebGLWarning(candidate->canvas());
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1130
1111 contextGL()->Disable(GL_SCISSOR_TEST); 1131 contextGL()->Disable(GL_SCISSOR_TEST);
1112 if (combinedClear && (mask & GL_COLOR_BUFFER_BIT)) { 1132 if (combinedClear && (mask & GL_COLOR_BUFFER_BIT)) {
1113 contextGL()->ClearColor(m_colorMask[0] ? m_clearColor[0] : 0, 1133 contextGL()->ClearColor(m_colorMask[0] ? m_clearColor[0] : 0,
1114 m_colorMask[1] ? m_clearColor[1] : 0, 1134 m_colorMask[1] ? m_clearColor[1] : 0,
1115 m_colorMask[2] ? m_clearColor[2] : 0, 1135 m_colorMask[2] ? m_clearColor[2] : 0,
1116 m_colorMask[3] ? m_clearColor[3] : 0); 1136 m_colorMask[3] ? m_clearColor[3] : 0);
1117 } else { 1137 } else {
1118 contextGL()->ClearColor(0, 0, 0, 0); 1138 contextGL()->ClearColor(0, 0, 0, 0);
1119 } 1139 }
1120 contextGL()->ColorMask(true, true, true, true); 1140 contextGL()->ColorMask(true, true, true, !drawingBuffer()->requiresRGBEmulat ion());
1121 GLbitfield clearMask = GL_COLOR_BUFFER_BIT; 1141 GLbitfield clearMask = GL_COLOR_BUFFER_BIT;
1122 if (contextAttributes.get().depth()) { 1142 if (contextAttributes.get().depth()) {
1123 if (!combinedClear || !m_depthMask || !(mask & GL_DEPTH_BUFFER_BIT)) 1143 if (!combinedClear || !m_depthMask || !(mask & GL_DEPTH_BUFFER_BIT))
1124 contextGL()->ClearDepthf(1.0f); 1144 contextGL()->ClearDepthf(1.0f);
1125 clearMask |= GL_DEPTH_BUFFER_BIT; 1145 clearMask |= GL_DEPTH_BUFFER_BIT;
1126 contextGL()->DepthMask(true); 1146 contextGL()->DepthMask(true);
1127 } 1147 }
1128 if (contextAttributes.get().stencil() || drawingBuffer()->hasImplicitStencil Buffer()) { 1148 if (contextAttributes.get().stencil() || drawingBuffer()->hasImplicitStencil Buffer()) {
1129 if (combinedClear && (mask & GL_STENCIL_BUFFER_BIT)) 1149 if (combinedClear && (mask & GL_STENCIL_BUFFER_BIT))
1130 contextGL()->ClearStencil(m_clearStencil & m_stencilMask); 1150 contextGL()->ClearStencil(m_clearStencil & m_stencilMask);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 return; 1422 return;
1403 if (deleted) 1423 if (deleted)
1404 renderBuffer = 0; 1424 renderBuffer = 0;
1405 if (target != GL_RENDERBUFFER) { 1425 if (target != GL_RENDERBUFFER) {
1406 synthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target") ; 1426 synthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target") ;
1407 return; 1427 return;
1408 } 1428 }
1409 m_renderbufferBinding = renderBuffer; 1429 m_renderbufferBinding = renderBuffer;
1410 contextGL()->BindRenderbuffer(target, objectOrZero(renderBuffer)); 1430 contextGL()->BindRenderbuffer(target, objectOrZero(renderBuffer));
1411 preserveObjectWrapper(scriptState, this, "renderbuffer", 0, renderBuffer); 1431 preserveObjectWrapper(scriptState, this, "renderbuffer", 0, renderBuffer);
1432
1433 drawingBuffer()->setRenderbufferBinding(objectOrZero(renderBuffer));
1434
1412 if (renderBuffer) 1435 if (renderBuffer)
1413 renderBuffer->setHasEverBeenBound(); 1436 renderBuffer->setHasEverBeenBound();
1414 } 1437 }
1415 1438
1416 void WebGLRenderingContextBase::bindTexture(ScriptState* scriptState, GLenum tar get, WebGLTexture* texture) 1439 void WebGLRenderingContextBase::bindTexture(ScriptState* scriptState, GLenum tar get, WebGLTexture* texture)
1417 { 1440 {
1418 bool deleted; 1441 bool deleted;
1419 if (!checkObjectToBeBound("bindTexture", texture, deleted)) 1442 if (!checkObjectToBeBound("bindTexture", texture, deleted))
1420 return; 1443 return;
1421 if (deleted) 1444 if (deleted)
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 return; 1663 return;
1641 if (mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_B IT)) { 1664 if (mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_B IT)) {
1642 synthesizeGLError(GL_INVALID_VALUE, "clear", "invalid mask"); 1665 synthesizeGLError(GL_INVALID_VALUE, "clear", "invalid mask");
1643 return; 1666 return;
1644 } 1667 }
1645 const char* reason = "framebuffer incomplete"; 1668 const char* reason = "framebuffer incomplete";
1646 if (m_framebufferBinding && m_framebufferBinding->checkDepthStencilStatus(&r eason) != GL_FRAMEBUFFER_COMPLETE) { 1669 if (m_framebufferBinding && m_framebufferBinding->checkDepthStencilStatus(&r eason) != GL_FRAMEBUFFER_COMPLETE) {
1647 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "clear", reason); 1670 synthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, "clear", reason);
1648 return; 1671 return;
1649 } 1672 }
1673
1674 std::unique_ptr<ScopedRGBEmulationColorMask> scopedColorMask;
Ken Russell (switch to Gerrit) 2016/04/29 09:33:09 I'd suggest changing ScopedRGBEmulationColorMask's
erikchen 2016/05/03 22:58:07 Done.
1675 if (m_drawingBuffer->requiresRGBEmulation())
1676 scopedColorMask.reset(new ScopedRGBEmulationColorMask(contextGL(), m_col orMask));
1677
1650 if (clearIfComposited(mask) != CombinedClear) { 1678 if (clearIfComposited(mask) != CombinedClear) {
1651 // If clearing the default back buffer's depth buffer, also clear the st encil buffer, if one 1679 // If clearing the default back buffer's depth buffer, also clear the st encil buffer, if one
1652 // was allocated implicitly. This avoids performance problems on some GP Us. 1680 // was allocated implicitly. This avoids performance problems on some GP Us.
1653 if (!m_framebufferBinding && drawingBuffer()->hasImplicitStencilBuffer() && (mask & GL_DEPTH_BUFFER_BIT)) { 1681 if (!m_framebufferBinding && drawingBuffer()->hasImplicitStencilBuffer() && (mask & GL_DEPTH_BUFFER_BIT)) {
1654 // It shouldn't matter what value it's cleared to, since in other qu eries in the API, we 1682 // It shouldn't matter what value it's cleared to, since in other qu eries in the API, we
1655 // claim that the stencil buffer doesn't exist. 1683 // claim that the stencil buffer doesn't exist.
1656 mask |= GL_STENCIL_BUFFER_BIT; 1684 mask |= GL_STENCIL_BUFFER_BIT;
1657 } 1685 }
1658 contextGL()->Clear(mask); 1686 contextGL()->Clear(mask);
1659 } 1687 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 { 1939 {
1912 deleteObject(program); 1940 deleteObject(program);
1913 // We don't reset m_currentProgram to 0 here because the deletion of the 1941 // We don't reset m_currentProgram to 0 here because the deletion of the
1914 // current program is delayed. 1942 // current program is delayed.
1915 } 1943 }
1916 1944
1917 void WebGLRenderingContextBase::deleteRenderbuffer(WebGLRenderbuffer* renderbuff er) 1945 void WebGLRenderingContextBase::deleteRenderbuffer(WebGLRenderbuffer* renderbuff er)
1918 { 1946 {
1919 if (!deleteObject(renderbuffer)) 1947 if (!deleteObject(renderbuffer))
1920 return; 1948 return;
1921 if (renderbuffer == m_renderbufferBinding) 1949 if (renderbuffer == m_renderbufferBinding) {
1922 m_renderbufferBinding = nullptr; 1950 m_renderbufferBinding = nullptr;
1951 drawingBuffer()->setRenderbufferBinding(0);
1952 }
1923 if (m_framebufferBinding) 1953 if (m_framebufferBinding)
1924 m_framebufferBinding->removeAttachmentFromBoundFramebuffer(GL_FRAMEBUFFE R, renderbuffer); 1954 m_framebufferBinding->removeAttachmentFromBoundFramebuffer(GL_FRAMEBUFFE R, renderbuffer);
1925 if (getFramebufferBinding(GL_READ_FRAMEBUFFER)) 1955 if (getFramebufferBinding(GL_READ_FRAMEBUFFER))
1926 getFramebufferBinding(GL_READ_FRAMEBUFFER)->removeAttachmentFromBoundFra mebuffer(GL_READ_FRAMEBUFFER, renderbuffer); 1956 getFramebufferBinding(GL_READ_FRAMEBUFFER)->removeAttachmentFromBoundFra mebuffer(GL_READ_FRAMEBUFFER, renderbuffer);
1927 } 1957 }
1928 1958
1929 void WebGLRenderingContextBase::deleteShader(WebGLShader* shader) 1959 void WebGLRenderingContextBase::deleteShader(WebGLShader* shader)
1930 { 1960 {
1931 deleteObject(shader); 1961 deleteObject(shader);
1932 } 1962 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 return false; 2090 return false;
2061 } 2091 }
2062 return true; 2092 return true;
2063 } 2093 }
2064 2094
2065 void WebGLRenderingContextBase::drawArrays(GLenum mode, GLint first, GLsizei cou nt) 2095 void WebGLRenderingContextBase::drawArrays(GLenum mode, GLint first, GLsizei cou nt)
2066 { 2096 {
2067 if (!validateDrawArrays("drawArrays")) 2097 if (!validateDrawArrays("drawArrays"))
2068 return; 2098 return;
2069 2099
2100 std::unique_ptr<ScopedRGBEmulationColorMask> scopedColorMask;
2101 if (m_drawingBuffer->requiresRGBEmulation())
2102 scopedColorMask.reset(new ScopedRGBEmulationColorMask(contextGL(), m_col orMask));
2070 clearIfComposited(); 2103 clearIfComposited();
2071 contextGL()->DrawArrays(mode, first, count); 2104 contextGL()->DrawArrays(mode, first, count);
2072 markContextChanged(CanvasChanged); 2105 markContextChanged(CanvasChanged);
2073 } 2106 }
2074 2107
2075 void WebGLRenderingContextBase::drawElements(GLenum mode, GLsizei count, GLenum type, long long offset) 2108 void WebGLRenderingContextBase::drawElements(GLenum mode, GLsizei count, GLenum type, long long offset)
2076 { 2109 {
2077 if (!validateDrawElements("drawElements", type, offset)) 2110 if (!validateDrawElements("drawElements", type, offset))
2078 return; 2111 return;
2079 2112
2080 if (transformFeedbackActive() && !transformFeedbackPaused()) { 2113 if (transformFeedbackActive() && !transformFeedbackPaused()) {
2081 synthesizeGLError(GL_INVALID_OPERATION, "drawElements", "transform feedb ack is active and not paused"); 2114 synthesizeGLError(GL_INVALID_OPERATION, "drawElements", "transform feedb ack is active and not paused");
2082 return; 2115 return;
2083 } 2116 }
2084 2117
2118 std::unique_ptr<ScopedRGBEmulationColorMask> scopedColorMask;
2119 if (m_drawingBuffer->requiresRGBEmulation())
2120 scopedColorMask.reset(new ScopedRGBEmulationColorMask(contextGL(), m_col orMask));
2085 clearIfComposited(); 2121 clearIfComposited();
2086 contextGL()->DrawElements(mode, count, type, reinterpret_cast<void*>(static_ cast<intptr_t>(offset))); 2122 contextGL()->DrawElements(mode, count, type, reinterpret_cast<void*>(static_ cast<intptr_t>(offset)));
2087 markContextChanged(CanvasChanged); 2123 markContextChanged(CanvasChanged);
2088 } 2124 }
2089 2125
2090 void WebGLRenderingContextBase::drawArraysInstancedANGLE(GLenum mode, GLint firs t, GLsizei count, GLsizei primcount) 2126 void WebGLRenderingContextBase::drawArraysInstancedANGLE(GLenum mode, GLint firs t, GLsizei count, GLsizei primcount)
2091 { 2127 {
2092 if (!validateDrawArrays("drawArraysInstancedANGLE")) 2128 if (!validateDrawArrays("drawArraysInstancedANGLE"))
2093 return; 2129 return;
2094 2130
2131 std::unique_ptr<ScopedRGBEmulationColorMask> scopedColorMask;
2132 if (m_drawingBuffer->requiresRGBEmulation())
2133 scopedColorMask.reset(new ScopedRGBEmulationColorMask(contextGL(), m_col orMask));
2095 clearIfComposited(); 2134 clearIfComposited();
2096 contextGL()->DrawArraysInstancedANGLE(mode, first, count, primcount); 2135 contextGL()->DrawArraysInstancedANGLE(mode, first, count, primcount);
2097 markContextChanged(CanvasChanged); 2136 markContextChanged(CanvasChanged);
2098 } 2137 }
2099 2138
2100 void WebGLRenderingContextBase::drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, long long offset, GLsizei primcount) 2139 void WebGLRenderingContextBase::drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, long long offset, GLsizei primcount)
2101 { 2140 {
2102 if (!validateDrawElements("drawElementsInstancedANGLE", type, offset)) 2141 if (!validateDrawElements("drawElementsInstancedANGLE", type, offset))
2103 return; 2142 return;
2104 2143
2144 std::unique_ptr<ScopedRGBEmulationColorMask> scopedColorMask;
2145 if (m_drawingBuffer->requiresRGBEmulation())
2146 scopedColorMask.reset(new ScopedRGBEmulationColorMask(contextGL(), m_col orMask));
2105 clearIfComposited(); 2147 clearIfComposited();
2106 contextGL()->DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast< void*>(static_cast<intptr_t>(offset)), primcount); 2148 contextGL()->DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast< void*>(static_cast<intptr_t>(offset)), primcount);
2107 markContextChanged(CanvasChanged); 2149 markContextChanged(CanvasChanged);
2108 } 2150 }
2109 2151
2110 void WebGLRenderingContextBase::enable(GLenum cap) 2152 void WebGLRenderingContextBase::enable(GLenum cap)
2111 { 2153 {
2112 if (isContextLost() || !validateCapability("enable", cap)) 2154 if (isContextLost() || !validateCapability("enable", cap))
2113 return; 2155 return;
2114 if (cap == GL_STENCIL_TEST) { 2156 if (cap == GL_STENCIL_TEST) {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 return ScriptValue::createNull(scriptState); 2568 return ScriptValue::createNull(scriptState);
2527 const int intZero = 0; 2569 const int intZero = 0;
2528 switch (pname) { 2570 switch (pname) {
2529 case GL_ACTIVE_TEXTURE: 2571 case GL_ACTIVE_TEXTURE:
2530 return getUnsignedIntParameter(scriptState, pname); 2572 return getUnsignedIntParameter(scriptState, pname);
2531 case GL_ALIASED_LINE_WIDTH_RANGE: 2573 case GL_ALIASED_LINE_WIDTH_RANGE:
2532 return getWebGLFloatArrayParameter(scriptState, pname); 2574 return getWebGLFloatArrayParameter(scriptState, pname);
2533 case GL_ALIASED_POINT_SIZE_RANGE: 2575 case GL_ALIASED_POINT_SIZE_RANGE:
2534 return getWebGLFloatArrayParameter(scriptState, pname); 2576 return getWebGLFloatArrayParameter(scriptState, pname);
2535 case GL_ALPHA_BITS: 2577 case GL_ALPHA_BITS:
2578 if (m_drawingBuffer->requiresRGBEmulation())
2579 return WebGLAny(scriptState, 0);
2536 return getIntParameter(scriptState, pname); 2580 return getIntParameter(scriptState, pname);
2537 case GL_ARRAY_BUFFER_BINDING: 2581 case GL_ARRAY_BUFFER_BINDING:
2538 return WebGLAny(scriptState, m_boundArrayBuffer.get()); 2582 return WebGLAny(scriptState, m_boundArrayBuffer.get());
2539 case GL_BLEND: 2583 case GL_BLEND:
2540 return getBooleanParameter(scriptState, pname); 2584 return getBooleanParameter(scriptState, pname);
2541 case GL_BLEND_COLOR: 2585 case GL_BLEND_COLOR:
2542 return getWebGLFloatArrayParameter(scriptState, pname); 2586 return getWebGLFloatArrayParameter(scriptState, pname);
2543 case GL_BLEND_DST_ALPHA: 2587 case GL_BLEND_DST_ALPHA:
2544 return getUnsignedIntParameter(scriptState, pname); 2588 return getUnsignedIntParameter(scriptState, pname);
2545 case GL_BLEND_DST_RGB: 2589 case GL_BLEND_DST_RGB:
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after
4947 if (isContextLost()) 4991 if (isContextLost())
4948 return; 4992 return;
4949 4993
4950 m_contextLostMode = mode; 4994 m_contextLostMode = mode;
4951 ASSERT(m_contextLostMode != NotLostContext); 4995 ASSERT(m_contextLostMode != NotLostContext);
4952 m_autoRecoveryMethod = autoRecoveryMethod; 4996 m_autoRecoveryMethod = autoRecoveryMethod;
4953 4997
4954 // Make absolutely sure we do not refer to an already-deleted texture or fra mebuffer. 4998 // Make absolutely sure we do not refer to an already-deleted texture or fra mebuffer.
4955 drawingBuffer()->setTexture2DBinding(0); 4999 drawingBuffer()->setTexture2DBinding(0);
4956 drawingBuffer()->setFramebufferBinding(GL_FRAMEBUFFER, 0); 5000 drawingBuffer()->setFramebufferBinding(GL_FRAMEBUFFER, 0);
5001 drawingBuffer()->setRenderbufferBinding(0);
4957 5002
4958 detachAndRemoveAllObjects(); 5003 detachAndRemoveAllObjects();
4959 5004
4960 // Lose all the extensions. 5005 // Lose all the extensions.
4961 for (size_t i = 0; i < m_extensions.size(); ++i) { 5006 for (size_t i = 0; i < m_extensions.size(); ++i) {
4962 ExtensionTracker* tracker = m_extensions[i]; 5007 ExtensionTracker* tracker = m_extensions[i];
4963 tracker->loseExtension(false); 5008 tracker->loseExtension(false);
4964 } 5009 }
4965 5010
4966 for (size_t i = 0; i < WebGLExtensionNameCount; ++i) 5011 for (size_t i = 0; i < WebGLExtensionNameCount; ++i)
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
6222 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6267 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6223 } 6268 }
6224 6269
6225 void WebGLRenderingContextBase::restoreUnpackParameters() 6270 void WebGLRenderingContextBase::restoreUnpackParameters()
6226 { 6271 {
6227 if (m_unpackAlignment != 1) 6272 if (m_unpackAlignment != 1)
6228 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6273 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6229 } 6274 }
6230 6275
6231 } // namespace blink 6276 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698