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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 // JavaScript wrappers to it.) | 1032 // JavaScript wrappers to it.) |
1033 m_preservedDefaultVAOObjectWrapper = false; | 1033 m_preservedDefaultVAOObjectWrapper = false; |
1034 m_boundVertexArrayObject = m_defaultVertexArrayObject; | 1034 m_boundVertexArrayObject = m_defaultVertexArrayObject; |
1035 | 1035 |
1036 m_vertexAttribType.resize(m_maxVertexAttribs); | 1036 m_vertexAttribType.resize(m_maxVertexAttribs); |
1037 | 1037 |
1038 contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 1038 contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
1039 contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 1039 contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
1040 | 1040 |
1041 drawingBuffer()->contextProvider()->setLostContextCallback( | 1041 drawingBuffer()->contextProvider()->setLostContextCallback( |
1042 WebClosure(bind( | 1042 WebClosure(WTF::bind( |
1043 &WebGLRenderingContextBase::forceLostContext, | 1043 &WebGLRenderingContextBase::forceLostContext, |
1044 wrapWeakPersistent(this), | 1044 wrapWeakPersistent(this), |
1045 WebGLRenderingContextBase::RealLostContext, | 1045 WebGLRenderingContextBase::RealLostContext, |
1046 WebGLRenderingContextBase::Auto))); | 1046 WebGLRenderingContextBase::Auto))); |
1047 drawingBuffer()->contextProvider()->setErrorMessageCallback( | 1047 drawingBuffer()->contextProvider()->setErrorMessageCallback( |
1048 WebFunction<void(const char*, int32_t)>(bind( | 1048 WebFunction<void(const char*, int32_t)>(WTF::bind( |
1049 &WebGLRenderingContextBase::onErrorMessage, | 1049 &WebGLRenderingContextBase::onErrorMessage, |
1050 wrapWeakPersistent(this)))); | 1050 wrapWeakPersistent(this)))); |
1051 | 1051 |
1052 // If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled. | 1052 // If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled. |
1053 // See the section <Primitive Restart is Always Enabled> in WebGL 2 spec: | 1053 // See the section <Primitive Restart is Always Enabled> in WebGL 2 spec: |
1054 // https://www.khronos.org/registry/webgl/specs/latest/2.0/#4.1.4 | 1054 // https://www.khronos.org/registry/webgl/specs/latest/2.0/#4.1.4 |
1055 if (isWebGL2OrHigher()) | 1055 if (isWebGL2OrHigher()) |
1056 contextGL()->Enable(GL_PRIMITIVE_RESTART_FIXED_INDEX); | 1056 contextGL()->Enable(GL_PRIMITIVE_RESTART_FIXED_INDEX); |
1057 | 1057 |
1058 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. | 1058 // This ensures that the context has a valid "lastFlushID" and won't be mist
akenly identified as the "least recently used" context. |
(...skipping 5385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6444 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6444 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
6445 } | 6445 } |
6446 | 6446 |
6447 void WebGLRenderingContextBase::restoreUnpackParameters() | 6447 void WebGLRenderingContextBase::restoreUnpackParameters() |
6448 { | 6448 { |
6449 if (m_unpackAlignment != 1) | 6449 if (m_unpackAlignment != 1) |
6450 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6450 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
6451 } | 6451 } |
6452 | 6452 |
6453 } // namespace blink | 6453 } // namespace blink |
OLD | NEW |