| 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 | 992 |
| 993 contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 993 contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
| 994 contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 994 contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
| 995 | 995 |
| 996 m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi
s); | 996 m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi
s); |
| 997 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
reate(this); | 997 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
reate(this); |
| 998 | 998 |
| 999 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); | 999 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); |
| 1000 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); | 1000 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); |
| 1001 | 1001 |
| 1002 // If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled. |
| 1003 // See the section <Primitive Restart is Always Enabled> in WebGL 2 spec: |
| 1004 // https://www.khronos.org/registry/webgl/specs/latest/2.0/#4.1.4 |
| 1005 if (isWebGL2OrHigher()) |
| 1006 contextGL()->Enable(GL_PRIMITIVE_RESTART_FIXED_INDEX); |
| 1007 |
| 1002 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. | 1008 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. |
| 1003 contextGL()->Flush(); | 1009 contextGL()->Flush(); |
| 1004 | 1010 |
| 1005 for (int i = 0; i < WebGLExtensionNameCount; ++i) | 1011 for (int i = 0; i < WebGLExtensionNameCount; ++i) |
| 1006 m_extensionEnabled[i] = false; | 1012 m_extensionEnabled[i] = false; |
| 1007 | 1013 |
| 1008 m_isWebGL2FormatsTypesAdded = false; | 1014 m_isWebGL2FormatsTypesAdded = false; |
| 1009 m_isWebGL2InternalFormatsCopyTexImageAdded = false; | 1015 m_isWebGL2InternalFormatsCopyTexImageAdded = false; |
| 1010 m_isOESTextureFloatFormatsTypesAdded = false; | 1016 m_isOESTextureFloatFormatsTypesAdded = false; |
| 1011 m_isOESTextureHalfFloatFormatsTypesAdded = false; | 1017 m_isOESTextureHalfFloatFormatsTypesAdded = false; |
| (...skipping 5322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6334 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6340 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6335 } | 6341 } |
| 6336 | 6342 |
| 6337 void WebGLRenderingContextBase::restoreUnpackParameters() | 6343 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6338 { | 6344 { |
| 6339 if (m_unpackAlignment != 1) | 6345 if (m_unpackAlignment != 1) |
| 6340 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6346 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6341 } | 6347 } |
| 6342 | 6348 |
| 6343 } // namespace blink | 6349 } // namespace blink |
| OLD | NEW |