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