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 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 | 989 |
990 contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 990 contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
991 contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 991 contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
992 | 992 |
993 m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi
s); | 993 m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi
s); |
994 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
reate(this); | 994 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
reate(this); |
995 | 995 |
996 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); | 996 webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); |
997 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); | 997 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); |
998 | 998 |
| 999 // If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled. |
| 1000 // See the section <Primitive Restart is Always Enabled> in WebGL 2 spec: |
| 1001 // https://www.khronos.org/registry/webgl/specs/latest/2.0/#4.1.4 |
| 1002 if (isWebGL2OrHigher()) |
| 1003 contextGL()->Enable(GL_PRIMITIVE_RESTART_FIXED_INDEX); |
| 1004 |
999 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. | 1005 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. |
1000 contextGL()->Flush(); | 1006 contextGL()->Flush(); |
1001 | 1007 |
1002 for (int i = 0; i < WebGLExtensionNameCount; ++i) | 1008 for (int i = 0; i < WebGLExtensionNameCount; ++i) |
1003 m_extensionEnabled[i] = false; | 1009 m_extensionEnabled[i] = false; |
1004 | 1010 |
1005 m_isWebGL2FormatsTypesAdded = false; | 1011 m_isWebGL2FormatsTypesAdded = false; |
1006 m_isWebGL2InternalFormatsCopyTexImageAdded = false; | 1012 m_isWebGL2InternalFormatsCopyTexImageAdded = false; |
1007 m_isOESTextureFloatFormatsTypesAdded = false; | 1013 m_isOESTextureFloatFormatsTypesAdded = false; |
1008 m_isOESTextureHalfFloatFormatsTypesAdded = false; | 1014 m_isOESTextureHalfFloatFormatsTypesAdded = false; |
(...skipping 5287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6296 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6302 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
6297 } | 6303 } |
6298 | 6304 |
6299 void WebGLRenderingContextBase::restoreUnpackParameters() | 6305 void WebGLRenderingContextBase::restoreUnpackParameters() |
6300 { | 6306 { |
6301 if (m_unpackAlignment != 1) | 6307 if (m_unpackAlignment != 1) |
6302 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6308 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
6303 } | 6309 } |
6304 | 6310 |
6305 } // namespace blink | 6311 } // namespace blink |
OLD | NEW |