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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 m_vertexAttribType.resize(m_maxVertexAttribs); | 971 m_vertexAttribType.resize(m_maxVertexAttribs); |
972 | 972 |
973 contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 973 contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
974 contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 974 contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
975 | 975 |
976 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
reate(this); | 976 m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
reate(this); |
977 | 977 |
978 drawingBuffer()->contextProvider()->setLostContextCallback(WebClosure(WTF::b
ind(&WebGLRenderingContextBase::forceLostContext, createWeakThisPointer(), WebGL
RenderingContextBase::RealLostContext, WebGLRenderingContextBase::Auto))); | 978 drawingBuffer()->contextProvider()->setLostContextCallback(WebClosure(WTF::b
ind(&WebGLRenderingContextBase::forceLostContext, createWeakThisPointer(), WebGL
RenderingContextBase::RealLostContext, WebGLRenderingContextBase::Auto))); |
979 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); | 979 webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); |
980 | 980 |
| 981 // If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled. |
| 982 // See the section <Primitive Restart is Always Enabled> in WebGL 2 spec: |
| 983 // https://www.khronos.org/registry/webgl/specs/latest/2.0/#4.1.4 |
| 984 if (isWebGL2OrHigher()) |
| 985 contextGL()->Enable(GL_PRIMITIVE_RESTART_FIXED_INDEX); |
| 986 |
981 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. | 987 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. |
982 contextGL()->Flush(); | 988 contextGL()->Flush(); |
983 | 989 |
984 for (int i = 0; i < WebGLExtensionNameCount; ++i) | 990 for (int i = 0; i < WebGLExtensionNameCount; ++i) |
985 m_extensionEnabled[i] = false; | 991 m_extensionEnabled[i] = false; |
986 | 992 |
987 m_isWebGL2FormatsTypesAdded = false; | 993 m_isWebGL2FormatsTypesAdded = false; |
988 m_isWebGL2InternalFormatsCopyTexImageAdded = false; | 994 m_isWebGL2InternalFormatsCopyTexImageAdded = false; |
989 m_isOESTextureFloatFormatsTypesAdded = false; | 995 m_isOESTextureFloatFormatsTypesAdded = false; |
990 m_isOESTextureHalfFloatFormatsTypesAdded = false; | 996 m_isOESTextureHalfFloatFormatsTypesAdded = false; |
(...skipping 5348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6339 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6345 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
6340 } | 6346 } |
6341 | 6347 |
6342 void WebGLRenderingContextBase::restoreUnpackParameters() | 6348 void WebGLRenderingContextBase::restoreUnpackParameters() |
6343 { | 6349 { |
6344 if (m_unpackAlignment != 1) | 6350 if (m_unpackAlignment != 1) |
6345 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6351 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
6346 } | 6352 } |
6347 | 6353 |
6348 } // namespace blink | 6354 } // namespace blink |
OLD | NEW |