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

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 1157983002: Update WebGLVertexArrayObjectOES to WebGLVertexArrayObject for WebGL2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "core/html/canvas/WebGLDrawBuffers.h" 69 #include "core/html/canvas/WebGLDrawBuffers.h"
70 #include "core/html/canvas/WebGLFramebuffer.h" 70 #include "core/html/canvas/WebGLFramebuffer.h"
71 #include "core/html/canvas/WebGLLoseContext.h" 71 #include "core/html/canvas/WebGLLoseContext.h"
72 #include "core/html/canvas/WebGLProgram.h" 72 #include "core/html/canvas/WebGLProgram.h"
73 #include "core/html/canvas/WebGLRenderbuffer.h" 73 #include "core/html/canvas/WebGLRenderbuffer.h"
74 #include "core/html/canvas/WebGLShader.h" 74 #include "core/html/canvas/WebGLShader.h"
75 #include "core/html/canvas/WebGLShaderPrecisionFormat.h" 75 #include "core/html/canvas/WebGLShaderPrecisionFormat.h"
76 #include "core/html/canvas/WebGLSharedWebGraphicsContext3D.h" 76 #include "core/html/canvas/WebGLSharedWebGraphicsContext3D.h"
77 #include "core/html/canvas/WebGLTexture.h" 77 #include "core/html/canvas/WebGLTexture.h"
78 #include "core/html/canvas/WebGLUniformLocation.h" 78 #include "core/html/canvas/WebGLUniformLocation.h"
79 #include "core/html/canvas/WebGLVertexArrayObjectOES.h"
79 #include "core/inspector/ConsoleMessage.h" 80 #include "core/inspector/ConsoleMessage.h"
80 #include "core/inspector/InspectorInstrumentation.h" 81 #include "core/inspector/InspectorInstrumentation.h"
81 #include "core/layout/LayoutBox.h" 82 #include "core/layout/LayoutBox.h"
82 #include "core/loader/FrameLoader.h" 83 #include "core/loader/FrameLoader.h"
83 #include "core/loader/FrameLoaderClient.h" 84 #include "core/loader/FrameLoaderClient.h"
84 #include "platform/CheckedInt.h" 85 #include "platform/CheckedInt.h"
85 #include "platform/NotImplemented.h" 86 #include "platform/NotImplemented.h"
86 #include "platform/RuntimeEnabledFeatures.h" 87 #include "platform/RuntimeEnabledFeatures.h"
87 #include "platform/geometry/IntSize.h" 88 #include "platform/geometry/IntSize.h"
88 #include "platform/graphics/GraphicsContext.h" 89 #include "platform/graphics/GraphicsContext.h"
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 m_maxCubeMapTextureLevel = WebGLTexture::computeLevelCount(m_maxCubeMapTextu reSize, m_maxCubeMapTextureSize, 1); 717 m_maxCubeMapTextureLevel = WebGLTexture::computeLevelCount(m_maxCubeMapTextu reSize, m_maxCubeMapTextureSize, 1);
717 m_maxRenderbufferSize = 0; 718 m_maxRenderbufferSize = 0;
718 webContext()->getIntegerv(GL_MAX_RENDERBUFFER_SIZE, &m_maxRenderbufferSize); 719 webContext()->getIntegerv(GL_MAX_RENDERBUFFER_SIZE, &m_maxRenderbufferSize);
719 720
720 // These two values from EXT_draw_buffers are lazily queried. 721 // These two values from EXT_draw_buffers are lazily queried.
721 m_maxDrawBuffers = 0; 722 m_maxDrawBuffers = 0;
722 m_maxColorAttachments = 0; 723 m_maxColorAttachments = 0;
723 724
724 m_backDrawBuffer = GL_BACK; 725 m_backDrawBuffer = GL_BACK;
725 726
726 m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVe rtexArrayObjectOES::VaoTypeDefault); 727 m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVe rtexArrayObjectImpl::VaoTypeDefault);
727 addContextObject(m_defaultVertexArrayObject.get()); 728 addContextObject(m_defaultVertexArrayObject.get());
728 m_boundVertexArrayObject = m_defaultVertexArrayObject; 729 m_boundVertexArrayObject = m_defaultVertexArrayObject;
729 730
730 m_vertexAttribValue.resize(m_maxVertexAttribs); 731 m_vertexAttribValue.resize(m_maxVertexAttribs);
731 732
732 createFallbackBlackTextures1x1(); 733 createFallbackBlackTextures1x1();
733 734
734 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); 735 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight());
735 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); 736 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight());
736 737
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 1863
1863 void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index) 1864 void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index)
1864 { 1865 {
1865 if (isContextLost()) 1866 if (isContextLost())
1866 return; 1867 return;
1867 if (index >= m_maxVertexAttribs) { 1868 if (index >= m_maxVertexAttribs) {
1868 synthesizeGLError(GL_INVALID_VALUE, "disableVertexAttribArray", "index o ut of range"); 1869 synthesizeGLError(GL_INVALID_VALUE, "disableVertexAttribArray", "index o ut of range");
1869 return; 1870 return;
1870 } 1871 }
1871 1872
1872 WebGLVertexArrayObjectOES::VertexAttribState* state = m_boundVertexArrayObje ct->getVertexAttribState(index); 1873 WebGLVertexArrayObjectImpl::VertexAttribState* state = m_boundVertexArrayObj ect->getVertexAttribState(index);
1873 state->enabled = false; 1874 state->enabled = false;
1874 1875
1875 webContext()->disableVertexAttribArray(index); 1876 webContext()->disableVertexAttribArray(index);
1876 } 1877 }
1877 1878
1878 bool WebGLRenderingContextBase::validateRenderingState(const char* functionName) 1879 bool WebGLRenderingContextBase::validateRenderingState(const char* functionName)
1879 { 1880 {
1880 if (!m_currentProgram) { 1881 if (!m_currentProgram) {
1881 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no valid shader p rogram in use"); 1882 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no valid shader p rogram in use");
1882 return false; 1883 return false;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 1975
1975 void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index) 1976 void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index)
1976 { 1977 {
1977 if (isContextLost()) 1978 if (isContextLost())
1978 return; 1979 return;
1979 if (index >= m_maxVertexAttribs) { 1980 if (index >= m_maxVertexAttribs) {
1980 synthesizeGLError(GL_INVALID_VALUE, "enableVertexAttribArray", "index ou t of range"); 1981 synthesizeGLError(GL_INVALID_VALUE, "enableVertexAttribArray", "index ou t of range");
1981 return; 1982 return;
1982 } 1983 }
1983 1984
1984 WebGLVertexArrayObjectOES::VertexAttribState* state = m_boundVertexArrayObje ct->getVertexAttribState(index); 1985 WebGLVertexArrayObjectImpl::VertexAttribState* state = m_boundVertexArrayObj ect->getVertexAttribState(index);
1985 state->enabled = true; 1986 state->enabled = true;
1986 1987
1987 webContext()->enableVertexAttribArray(index); 1988 webContext()->enableVertexAttribArray(index);
1988 } 1989 }
1989 1990
1990 void WebGLRenderingContextBase::finish() 1991 void WebGLRenderingContextBase::finish()
1991 { 1992 {
1992 if (isContextLost()) 1993 if (isContextLost())
1993 return; 1994 return;
1994 webContext()->flush(); // Intentionally a flush, not a finish. 1995 webContext()->flush(); // Intentionally a flush, not a finish.
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 } 3046 }
3046 3047
3047 ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, GLuint index, GLenum pname) 3048 ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, GLuint index, GLenum pname)
3048 { 3049 {
3049 if (isContextLost()) 3050 if (isContextLost())
3050 return ScriptValue::createNull(scriptState); 3051 return ScriptValue::createNull(scriptState);
3051 if (index >= m_maxVertexAttribs) { 3052 if (index >= m_maxVertexAttribs) {
3052 synthesizeGLError(GL_INVALID_VALUE, "getVertexAttrib", "index out of ran ge"); 3053 synthesizeGLError(GL_INVALID_VALUE, "getVertexAttrib", "index out of ran ge");
3053 return ScriptValue::createNull(scriptState); 3054 return ScriptValue::createNull(scriptState);
3054 } 3055 }
3055 const WebGLVertexArrayObjectOES::VertexAttribState* state = m_boundVertexArr ayObject->getVertexAttribState(index); 3056 const WebGLVertexArrayObjectImpl::VertexAttribState* state = m_boundVertexAr rayObject->getVertexAttribState(index);
3056 3057
3057 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher()) 3058 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher())
3058 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) 3059 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)
3059 return WebGLAny(scriptState, state->divisor); 3060 return WebGLAny(scriptState, state->divisor);
3060 3061
3061 switch (pname) { 3062 switch (pname) {
3062 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 3063 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
3063 if (!state->bufferBinding || !state->bufferBinding->object()) 3064 if (!state->bufferBinding || !state->bufferBinding->object())
3064 return ScriptValue::createNull(scriptState); 3065 return ScriptValue::createNull(scriptState);
3065 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state-> bufferBinding.get())); 3066 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state-> bufferBinding.get()));
(...skipping 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after
6224 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 6225 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
6225 } 6226 }
6226 #else 6227 #else
6227 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6228 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6228 { 6229 {
6229 return m_drawingBuffer.get(); 6230 return m_drawingBuffer.get();
6230 } 6231 }
6231 #endif 6232 #endif
6232 6233
6233 } // namespace blink 6234 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698