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

Side by Side 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, 9 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"
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 } 1194 }
1195 1195
1196 return true; 1196 return true;
1197 } 1197 }
1198 1198
1199 DEFINE_TRACE(WebGL2RenderingContextBase) 1199 DEFINE_TRACE(WebGL2RenderingContextBase)
1200 { 1200 {
1201 WebGLRenderingContextBase::trace(visitor); 1201 WebGLRenderingContextBase::trace(visitor);
1202 } 1202 }
1203 1203
1204 WebGLTexture* WebGL2RenderingContextBase::validateTextureBinding(const char* fun ctionName, GLenum target, bool useSixEnumsForCubeMap)
1205 {
1206 switch (target) {
1207 case GL_TEXTURE_2D_ARRAY:
1208 // FIXME: add 2D Array texture binding point and 3D texture binding poin t.
1209 ASSERT(false);
1210 // return m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding.ge t();
1211 case GL_TEXTURE_3D:
1212 ASSERT(false);
1213 // return m_textureUnits[m_activeTextureUnit].m_texture3DBinding.get();
1214 default:
1215 return WebGLRenderingContextBase::validateTextureBinding(functionName, t arget, useSixEnumsForCubeMap);
1216 }
1217 }
1218
1219 ScriptValue WebGL2RenderingContextBase::getTexParameter(ScriptState* scriptState , GLenum target, GLenum pname)
1220 {
1221 if (isContextLost() || !validateTextureBinding("getTexParameter", target, fa lse))
1222 return ScriptValue::createNull(scriptState);
1223
1224 switch (pname) {
1225 case GL_TEXTURE_MAG_FILTER:
1226 case GL_TEXTURE_MIN_FILTER:
1227 case GL_TEXTURE_WRAP_S:
1228 case GL_TEXTURE_WRAP_T:
1229 case GL_TEXTURE_WRAP_R:
1230 case GL_TEXTURE_COMPARE_FUNC:
1231 case GL_TEXTURE_COMPARE_MODE:
1232 case GL_TEXTURE_IMMUTABLE_LEVELS:
1233 {
1234 GLint value = 0;
1235 webContext()->getTexParameteriv(target, pname, &value);
1236 return WebGLAny(scriptState, static_cast<unsigned>(value));
1237 }
1238 case GL_TEXTURE_IMMUTABLE_FORMAT:
1239 {
1240 GLint value = 0;
1241 webContext()->getTexParameteriv(target, pname, &value);
1242 return WebGLAny(scriptState, static_cast<bool>(value));
1243 }
1244 case GL_TEXTURE_BASE_LEVEL:
1245 case GL_TEXTURE_MAX_LEVEL:
1246 {
1247 GLfloat value = 0.f;
Zhenyao Mo 2015/03/06 18:39:46 This should be GLint, the function being getTexPar
yunchao 2015/03/09 02:25:25 Thanks for your review, @zmo. Accroding to OpenGL
Zhenyao Mo 2015/03/09 17:18:44 Yes, it seems there are some discrepancies in the
1248 webContext()->getTexParameterfv(target, pname, &value);
1249 return WebGLAny(scriptState, static_cast<int>(value));
1250 }
1251 case GL_TEXTURE_MAX_LOD:
1252 case GL_TEXTURE_MIN_LOD:
1253 {
1254 GLfloat value = 0.f;
1255 webContext()->getTexParameterfv(target, pname, &value);
1256 return WebGLAny(scriptState, value);
1257 }
1258 case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic
1259 if (extensionEnabled(EXTTextureFilterAnisotropicName)) {
1260 GLfloat value = 0.f;
1261 webContext()->getTexParameterfv(target, pname, &value);
1262 return WebGLAny(scriptState, value);
1263 }
1264 synthesizeGLError(GL_INVALID_ENUM, "getTexParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled");
1265 return ScriptValue::createNull(scriptState);
1266 default:
1267 synthesizeGLError(GL_INVALID_ENUM, "getTexParameter", "invalid parameter name");
1268 return ScriptValue::createNull(scriptState);
1269 }
1270 }
1271
1204 } // namespace blink 1272 } // namespace blink
OLDNEW
« 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