| 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 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 | 980 |
| 981 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 981 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
| 982 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 982 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
| 983 | 983 |
| 984 m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi
s); | 984 m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi
s); |
| 985 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
reate(this); | 985 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
reate(this); |
| 986 | 986 |
| 987 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); | 987 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); |
| 988 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); | 988 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); |
| 989 | 989 |
| 990 // If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled. |
| 991 // See the section <Primitive Restart is Always Enabled> in WebGL 2 spec: |
| 992 // https://www.khronos.org/registry/webgl/specs/latest/2.0/#4.1.4 |
| 993 if (isWebGL2OrHigher()) |
| 994 webContext()->enable(GL_PRIMITIVE_RESTART_FIXED_INDEX); |
| 995 |
| 990 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. | 996 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. |
| 991 webContext()->flush(); | 997 webContext()->flush(); |
| 992 | 998 |
| 993 for (int i = 0; i < WebGLExtensionNameCount; ++i) | 999 for (int i = 0; i < WebGLExtensionNameCount; ++i) |
| 994 m_extensionEnabled[i] = false; | 1000 m_extensionEnabled[i] = false; |
| 995 | 1001 |
| 996 m_isWebGL2FormatsTypesAdded = false; | 1002 m_isWebGL2FormatsTypesAdded = false; |
| 997 m_isWebGL2InternalFormatsCopyTexImageAdded = false; | 1003 m_isWebGL2InternalFormatsCopyTexImageAdded = false; |
| 998 m_isOESTextureFloatFormatsTypesAdded = false; | 1004 m_isOESTextureFloatFormatsTypesAdded = false; |
| 999 m_isOESTextureHalfFloatFormatsTypesAdded = false; | 1005 m_isOESTextureHalfFloatFormatsTypesAdded = false; |
| (...skipping 5285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6285 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6291 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6286 } | 6292 } |
| 6287 | 6293 |
| 6288 void WebGLRenderingContextBase::restoreUnpackParameters() | 6294 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6289 { | 6295 { |
| 6290 if (m_unpackAlignment != 1) | 6296 if (m_unpackAlignment != 1) |
| 6291 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6297 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6292 } | 6298 } |
| 6293 | 6299 |
| 6294 } // namespace blink | 6300 } // namespace blink |
| OLD | NEW |