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

Side by Side Diff: Source/core/html/canvas/WebGL2RenderingContextBase.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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/html/canvas/WebGL2RenderingContextBase.h" 6 #include "core/html/canvas/WebGL2RenderingContextBase.h"
7 7
8 #include "bindings/core/v8/WebGLAny.h" 8 #include "bindings/core/v8/WebGLAny.h"
9 #include "core/html/HTMLCanvasElement.h" 9 #include "core/html/HTMLCanvasElement.h"
10 #include "core/html/HTMLImageElement.h" 10 #include "core/html/HTMLImageElement.h"
11 #include "core/html/HTMLVideoElement.h" 11 #include "core/html/HTMLVideoElement.h"
12 #include "core/html/ImageData.h" 12 #include "core/html/ImageData.h"
13 #include "core/html/canvas/WebGLActiveInfo.h" 13 #include "core/html/canvas/WebGLActiveInfo.h"
14 #include "core/html/canvas/WebGLBuffer.h" 14 #include "core/html/canvas/WebGLBuffer.h"
15 #include "core/html/canvas/WebGLFenceSync.h" 15 #include "core/html/canvas/WebGLFenceSync.h"
16 #include "core/html/canvas/WebGLFramebuffer.h" 16 #include "core/html/canvas/WebGLFramebuffer.h"
17 #include "core/html/canvas/WebGLProgram.h" 17 #include "core/html/canvas/WebGLProgram.h"
18 #include "core/html/canvas/WebGLQuery.h" 18 #include "core/html/canvas/WebGLQuery.h"
19 #include "core/html/canvas/WebGLSampler.h" 19 #include "core/html/canvas/WebGLSampler.h"
20 #include "core/html/canvas/WebGLSync.h" 20 #include "core/html/canvas/WebGLSync.h"
21 #include "core/html/canvas/WebGLTexture.h" 21 #include "core/html/canvas/WebGLTexture.h"
22 #include "core/html/canvas/WebGLTransformFeedback.h" 22 #include "core/html/canvas/WebGLTransformFeedback.h"
23 #include "core/html/canvas/WebGLUniformLocation.h" 23 #include "core/html/canvas/WebGLUniformLocation.h"
24 #include "core/html/canvas/WebGLVertexArrayObjectOES.h" 24 #include "core/html/canvas/WebGLVertexArrayObject.h"
25 25
26 #include "platform/NotImplemented.h" 26 #include "platform/NotImplemented.h"
27 27
28 namespace blink { 28 namespace blink {
29 29
30 namespace { 30 namespace {
31 31
32 const GLuint webGLTimeoutIgnored = 0xFFFFFFFF; 32 const GLuint webGLTimeoutIgnored = 0xFFFFFFFF;
33 33
34 WGC3Dsync syncObjectOrZero(const WebGLSync* object) 34 WGC3Dsync syncObjectOrZero(const WebGLSync* object)
(...skipping 20 matching lines...) Expand all
55 { 55 {
56 ASSERT(!isContextLost()); 56 ASSERT(!isContextLost());
57 57
58 m_readFramebufferBinding = nullptr; 58 m_readFramebufferBinding = nullptr;
59 59
60 m_max3DTextureSize = 0; 60 m_max3DTextureSize = 0;
61 webContext()->getIntegerv(GL_MAX_3D_TEXTURE_SIZE, &m_max3DTextureSize); 61 webContext()->getIntegerv(GL_MAX_3D_TEXTURE_SIZE, &m_max3DTextureSize);
62 m_max3DTextureLevel = WebGLTexture::computeLevelCount(m_max3DTextureSize, m_ max3DTextureSize, m_max3DTextureSize); 62 m_max3DTextureLevel = WebGLTexture::computeLevelCount(m_max3DTextureSize, m_ max3DTextureSize, m_max3DTextureSize);
63 63
64 WebGLRenderingContextBase::initializeNewContext(); 64 WebGLRenderingContextBase::initializeNewContext();
65
66 // Release WebGLVertexArrayObjectOES which is initialized at WebGLRenderingC ontextBase.
bajones 2015/05/26 16:45:50 Rather than allocate/release/allocate again could
legend 2015/05/27 02:05:46 Done. Since m_defaultVertexArrayObject constructor
67 // Then change to use WebGLVertexArrayObject for WebGL2RenderingContextBase only.
68 removeContextObject(m_defaultVertexArrayObject.get());
69 m_defaultVertexArrayObject = nullptr;
70 m_boundVertexArrayObject = nullptr;
71 m_defaultVertexArrayObject = WebGLVertexArrayObject::create(this, WebGLVerte xArrayObjectImpl::VaoTypeDefault);
72 addContextObject(m_defaultVertexArrayObject.get());
73 m_boundVertexArrayObject = m_defaultVertexArrayObject;
65 } 74 }
66 75
67 void WebGL2RenderingContextBase::copyBufferSubData(GLenum readTarget, GLenum wri teTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) 76 void WebGL2RenderingContextBase::copyBufferSubData(GLenum readTarget, GLenum wri teTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
68 { 77 {
69 if (isContextLost()) 78 if (isContextLost())
70 return; 79 return;
71 80
72 webContext()->copyBufferSubData(readTarget, writeTarget, readOffset, writeOf fset, size); 81 webContext()->copyBufferSubData(readTarget, writeTarget, readOffset, writeOf fset, size);
73 } 82 }
74 83
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 } 1376 }
1368 1377
1369 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui nt uniformBlockIndex, GLuint uniformBlockBinding) 1378 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui nt uniformBlockIndex, GLuint uniformBlockBinding)
1370 { 1379 {
1371 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) 1380 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program))
1372 return; 1381 return;
1373 1382
1374 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex, uniformBlockBinding); 1383 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex, uniformBlockBinding);
1375 } 1384 }
1376 1385
1377 PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> WebGL2RenderingContextBase::cr eateVertexArray() 1386 PassRefPtrWillBeRawPtr<WebGLVertexArrayObject> WebGL2RenderingContextBase::creat eVertexArray()
1378 { 1387 {
1379 if (isContextLost()) 1388 if (isContextLost())
1380 return nullptr; 1389 return nullptr;
1381 1390
1382 RefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES: :create(this, WebGLVertexArrayObjectOES::VaoTypeUser); 1391 RefPtrWillBeRawPtr<WebGLVertexArrayObject> o = WebGLVertexArrayObject::creat e(this, WebGLVertexArrayObjectImpl::VaoTypeUser);
1383 addContextObject(o.get()); 1392 addContextObject(o.get());
1384 return o.release(); 1393 return o.release();
1385 } 1394 }
1386 1395
1387 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObjectOES* ve rtexArray) 1396 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObject* verte xArray)
1388 { 1397 {
1389 if (isContextLost() || !vertexArray) 1398 if (isContextLost() || !vertexArray)
1390 return; 1399 return;
1391 1400
1392 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje ct) 1401 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje ct)
1393 setBoundVertexArrayObject(nullptr); 1402 setBoundVertexArrayObject(nullptr);
1394 1403
1395 vertexArray->deleteObject(webContext()); 1404 vertexArray->deleteObject(webContext());
1396 } 1405 }
1397 1406
1398 GLboolean WebGL2RenderingContextBase::isVertexArray(WebGLVertexArrayObjectOES* v ertexArray) 1407 GLboolean WebGL2RenderingContextBase::isVertexArray(WebGLVertexArrayObject* vert exArray)
1399 { 1408 {
1400 if (isContextLost() || !vertexArray) 1409 if (isContextLost() || !vertexArray)
1401 return 0; 1410 return 0;
1402 1411
1403 if (!vertexArray->hasEverBeenBound()) 1412 if (!vertexArray->hasEverBeenBound())
1404 return 0; 1413 return 0;
1405 1414
1406 return webContext()->isVertexArrayOES(vertexArray->object()); 1415 return webContext()->isVertexArrayOES(vertexArray->object());
1407 } 1416 }
1408 1417
1409 void WebGL2RenderingContextBase::bindVertexArray(WebGLVertexArrayObjectOES* vert exArray) 1418 void WebGL2RenderingContextBase::bindVertexArray(WebGLVertexArrayObject* vertexA rray)
1410 { 1419 {
1411 if (isContextLost()) 1420 if (isContextLost())
1412 return; 1421 return;
1413 1422
1414 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th is))) { 1423 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th is))) {
1415 webContext()->synthesizeGLError(GL_INVALID_OPERATION); 1424 webContext()->synthesizeGLError(GL_INVALID_OPERATION);
1416 return; 1425 return;
1417 } 1426 }
1418 1427
1419 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object()) { 1428 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object()) {
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 GLfloat value = 0.f; 1841 GLfloat value = 0.f;
1833 webContext()->getTexParameterfv(target, pname, &value); 1842 webContext()->getTexParameterfv(target, pname, &value);
1834 return WebGLAny(scriptState, value); 1843 return WebGLAny(scriptState, value);
1835 } 1844 }
1836 default: 1845 default:
1837 return WebGLRenderingContextBase::getTexParameter(scriptState, target, p name); 1846 return WebGLRenderingContextBase::getTexParameter(scriptState, target, p name);
1838 } 1847 }
1839 } 1848 }
1840 1849
1841 } // namespace blink 1850 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698