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

Unified Diff: Source/core/html/canvas/WebGL2RenderingContextBase.cpp

Issue 974203002: update getTexParameter for WebGL 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed zmo@'s feedback Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/canvas/WebGL2RenderingContextBase.cpp
diff --git a/Source/core/html/canvas/WebGL2RenderingContextBase.cpp b/Source/core/html/canvas/WebGL2RenderingContextBase.cpp
index 6c8c1a0e95a365cb61977b682b9f55015ac96cea..69707fb246fe37280a178e29f955d4af52f87d7a 100644
--- a/Source/core/html/canvas/WebGL2RenderingContextBase.cpp
+++ b/Source/core/html/canvas/WebGL2RenderingContextBase.cpp
@@ -1467,4 +1467,59 @@ DEFINE_TRACE(WebGL2RenderingContextBase)
WebGLRenderingContextBase::trace(visitor);
}
+WebGLTexture* WebGL2RenderingContextBase::validateTextureBinding(const char* functionName, GLenum target, bool useSixEnumsForCubeMap)
+{
+ switch (target) {
+ // FIXME: add 2D Array texture binding point and 3D texture binding point.
+ case GL_TEXTURE_2D_ARRAY:
+ // return m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding.get();
+ return nullptr;
+ case GL_TEXTURE_3D:
+ // return m_textureUnits[m_activeTextureUnit].m_texture3DBinding.get();
+ return nullptr;
+ default:
+ return WebGLRenderingContextBase::validateTextureBinding(functionName, target, useSixEnumsForCubeMap);
+ }
+}
+
+ScriptValue WebGL2RenderingContextBase::getTexParameter(ScriptState* scriptState, GLenum target, GLenum pname)
+{
+ if (isContextLost() || !validateTextureBinding("getTexParameter", target, false))
+ return ScriptValue::createNull(scriptState);
+
+ switch (pname) {
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_COMPARE_FUNC:
+ case GL_TEXTURE_COMPARE_MODE:
+ case GL_TEXTURE_IMMUTABLE_LEVELS:
+ {
+ GLint value = 0;
+ webContext()->getTexParameteriv(target, pname, &value);
+ return WebGLAny(scriptState, static_cast<unsigned>(value));
+ }
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ {
+ GLint value = 0;
+ webContext()->getTexParameteriv(target, pname, &value);
+ return WebGLAny(scriptState, static_cast<bool>(value));
+ }
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ {
+ GLint value = 0;
+ webContext()->getTexParameteriv(target, pname, &value);
+ return WebGLAny(scriptState, value);
+ }
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_MIN_LOD:
+ {
+ GLfloat value = 0.f;
+ webContext()->getTexParameterfv(target, pname, &value);
+ return WebGLAny(scriptState, value);
+ }
+ default:
+ return WebGLRenderingContextBase::getTexParameter(scriptState, target, pname);
+ }
+}
+
} // namespace blink
« no previous file with comments | « Source/core/html/canvas/WebGL2RenderingContextBase.h ('k') | Source/core/html/canvas/WebGLRenderingContextBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698