Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 1783763002: [WebGL 2] primitive restart should be always enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cache max_value and max_value_primitive_restart_enabled for each range Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698