| OLD | NEW |
| 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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui
nt uniformBlockIndex, GLuint uniformBlockBinding) | 1369 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui
nt uniformBlockIndex, GLuint uniformBlockBinding) |
| 1370 { | 1370 { |
| 1371 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) | 1371 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) |
| 1372 return; | 1372 return; |
| 1373 | 1373 |
| 1374 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex,
uniformBlockBinding); | 1374 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex,
uniformBlockBinding); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> WebGL2RenderingContextBase::cr
eateVertexArray() | 1377 PassRefPtrWillBeRawPtr<WebGLVertexArrayObject> WebGL2RenderingContextBase::creat
eVertexArray() |
| 1378 { | 1378 { |
| 1379 if (isContextLost()) | 1379 if (isContextLost()) |
| 1380 return nullptr; | 1380 return nullptr; |
| 1381 | 1381 |
| 1382 RefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES:
:create(this, WebGLVertexArrayObjectOES::VaoTypeUser); | 1382 RefPtrWillBeRawPtr<WebGLVertexArrayObject> o = WebGLVertexArrayObject::creat
e(this, WebGLVertexArrayObjectBase::VaoTypeUser); |
| 1383 addContextObject(o.get()); | 1383 addContextObject(o.get()); |
| 1384 return o.release(); | 1384 return o.release(); |
| 1385 } | 1385 } |
| 1386 | 1386 |
| 1387 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObjectOES* ve
rtexArray) | 1387 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObject* verte
xArray) |
| 1388 { | 1388 { |
| 1389 if (isContextLost() || !vertexArray) | 1389 if (isContextLost() || !vertexArray) |
| 1390 return; | 1390 return; |
| 1391 | 1391 |
| 1392 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) | 1392 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) |
| 1393 setBoundVertexArrayObject(nullptr); | 1393 setBoundVertexArrayObject(nullptr); |
| 1394 | 1394 |
| 1395 vertexArray->deleteObject(webContext()); | 1395 vertexArray->deleteObject(webContext()); |
| 1396 } | 1396 } |
| 1397 | 1397 |
| 1398 GLboolean WebGL2RenderingContextBase::isVertexArray(WebGLVertexArrayObjectOES* v
ertexArray) | 1398 GLboolean WebGL2RenderingContextBase::isVertexArray(WebGLVertexArrayObject* vert
exArray) |
| 1399 { | 1399 { |
| 1400 if (isContextLost() || !vertexArray) | 1400 if (isContextLost() || !vertexArray) |
| 1401 return 0; | 1401 return 0; |
| 1402 | 1402 |
| 1403 if (!vertexArray->hasEverBeenBound()) | 1403 if (!vertexArray->hasEverBeenBound()) |
| 1404 return 0; | 1404 return 0; |
| 1405 | 1405 |
| 1406 return webContext()->isVertexArrayOES(vertexArray->object()); | 1406 return webContext()->isVertexArrayOES(vertexArray->object()); |
| 1407 } | 1407 } |
| 1408 | 1408 |
| 1409 void WebGL2RenderingContextBase::bindVertexArray(WebGLVertexArrayObjectOES* vert
exArray) | 1409 void WebGL2RenderingContextBase::bindVertexArray(WebGLVertexArrayObject* vertexA
rray) |
| 1410 { | 1410 { |
| 1411 if (isContextLost()) | 1411 if (isContextLost()) |
| 1412 return; | 1412 return; |
| 1413 | 1413 |
| 1414 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th
is))) { | 1414 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th
is))) { |
| 1415 webContext()->synthesizeGLError(GL_INVALID_OPERATION); | 1415 webContext()->synthesizeGLError(GL_INVALID_OPERATION); |
| 1416 return; | 1416 return; |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object())
{ | 1419 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object())
{ |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 GLfloat value = 0.f; | 1832 GLfloat value = 0.f; |
| 1833 webContext()->getTexParameterfv(target, pname, &value); | 1833 webContext()->getTexParameterfv(target, pname, &value); |
| 1834 return WebGLAny(scriptState, value); | 1834 return WebGLAny(scriptState, value); |
| 1835 } | 1835 } |
| 1836 default: | 1836 default: |
| 1837 return WebGLRenderingContextBase::getTexParameter(scriptState, target, p
name); | 1837 return WebGLRenderingContextBase::getTexParameter(scriptState, target, p
name); |
| 1838 } | 1838 } |
| 1839 } | 1839 } |
| 1840 | 1840 |
| 1841 } // namespace blink | 1841 } // namespace blink |
| OLD | NEW |