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" |
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 | 1460 |
1461 return true; | 1461 return true; |
1462 } | 1462 } |
1463 | 1463 |
1464 DEFINE_TRACE(WebGL2RenderingContextBase) | 1464 DEFINE_TRACE(WebGL2RenderingContextBase) |
1465 { | 1465 { |
1466 visitor->trace(m_readFramebufferBinding); | 1466 visitor->trace(m_readFramebufferBinding); |
1467 WebGLRenderingContextBase::trace(visitor); | 1467 WebGLRenderingContextBase::trace(visitor); |
1468 } | 1468 } |
1469 | 1469 |
| 1470 WebGLTexture* WebGL2RenderingContextBase::validateTextureBinding(const char* fun
ctionName, GLenum target, bool useSixEnumsForCubeMap) |
| 1471 { |
| 1472 switch (target) { |
| 1473 // FIXME: add 2D Array texture binding point and 3D texture binding point. |
| 1474 case GL_TEXTURE_2D_ARRAY: |
| 1475 // return m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding.ge
t(); |
| 1476 return nullptr; |
| 1477 case GL_TEXTURE_3D: |
| 1478 // return m_textureUnits[m_activeTextureUnit].m_texture3DBinding.get(); |
| 1479 return nullptr; |
| 1480 default: |
| 1481 return WebGLRenderingContextBase::validateTextureBinding(functionName, t
arget, useSixEnumsForCubeMap); |
| 1482 } |
| 1483 } |
| 1484 |
| 1485 ScriptValue WebGL2RenderingContextBase::getTexParameter(ScriptState* scriptState
, GLenum target, GLenum pname) |
| 1486 { |
| 1487 if (isContextLost() || !validateTextureBinding("getTexParameter", target, fa
lse)) |
| 1488 return ScriptValue::createNull(scriptState); |
| 1489 |
| 1490 switch (pname) { |
| 1491 case GL_TEXTURE_WRAP_R: |
| 1492 case GL_TEXTURE_COMPARE_FUNC: |
| 1493 case GL_TEXTURE_COMPARE_MODE: |
| 1494 case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 1495 { |
| 1496 GLint value = 0; |
| 1497 webContext()->getTexParameteriv(target, pname, &value); |
| 1498 return WebGLAny(scriptState, static_cast<unsigned>(value)); |
| 1499 } |
| 1500 case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 1501 { |
| 1502 GLint value = 0; |
| 1503 webContext()->getTexParameteriv(target, pname, &value); |
| 1504 return WebGLAny(scriptState, static_cast<bool>(value)); |
| 1505 } |
| 1506 case GL_TEXTURE_BASE_LEVEL: |
| 1507 case GL_TEXTURE_MAX_LEVEL: |
| 1508 { |
| 1509 GLint value = 0; |
| 1510 webContext()->getTexParameteriv(target, pname, &value); |
| 1511 return WebGLAny(scriptState, value); |
| 1512 } |
| 1513 case GL_TEXTURE_MAX_LOD: |
| 1514 case GL_TEXTURE_MIN_LOD: |
| 1515 { |
| 1516 GLfloat value = 0.f; |
| 1517 webContext()->getTexParameterfv(target, pname, &value); |
| 1518 return WebGLAny(scriptState, value); |
| 1519 } |
| 1520 default: |
| 1521 return WebGLRenderingContextBase::getTexParameter(scriptState, target, p
name); |
| 1522 } |
| 1523 } |
| 1524 |
1470 } // namespace blink | 1525 } // namespace blink |
OLD | NEW |