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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // return m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding.ge t(); | |
yunchao
2015/03/04 07:11:31
Will Implement TexParameter and add 2D Array and 3
Zhenyao Mo
2015/03/04 17:55:10
You should add a FIXME and ASSERT(false) for now.
yunchao
2015/03/05 07:40:53
Done.
| |
1209 case GL_TEXTURE_3D: | |
1210 // return m_textureUnits[m_activeTextureUnit].m_texture3DBinding.get(); | |
1211 default: | |
1212 return WebGLRenderingContextBase::validateTextureBinding(functionName, t arget, useSixEnumsForCubeMap); | |
1213 } | |
1214 } | |
1215 | |
1216 ScriptValue WebGL2RenderingContextBase::getTexParameter(ScriptState* scriptState , GLenum target, GLenum pname) | |
1217 { | |
1218 if (isContextLost() || !validateTextureBinding("getTexParameter", target, fa lse)) | |
1219 return ScriptValue::createNull(scriptState); | |
1220 | |
1221 switch (pname) { | |
1222 case GL_TEXTURE_MAG_FILTER: | |
1223 case GL_TEXTURE_MIN_FILTER: | |
1224 case GL_TEXTURE_WRAP_S: | |
1225 case GL_TEXTURE_WRAP_T: | |
1226 case GL_TEXTURE_WRAP_R: | |
1227 case GL_TEXTURE_COMPARE_FUNC: | |
1228 case GL_TEXTURE_COMPARE_MODE: | |
Zhenyao Mo
2015/03/04 17:55:10
The above seven return type is GLenum, which is un
yunchao
2015/03/05 07:40:53
Acknowledged.
| |
1229 case GL_TEXTURE_IMMUTABLE_LEVELS: | |
Zhenyao Mo
2015/03/04 17:55:10
This is defined as GLuint
yunchao
2015/03/05 07:40:53
Acknowledged.
| |
1230 case GL_TEXTURE_SWIZZLE_R: | |
1231 case GL_TEXTURE_SWIZZLE_G: | |
1232 case GL_TEXTURE_SWIZZLE_B: | |
1233 case GL_TEXTURE_SWIZZLE_A: | |
Zhenyao Mo
2015/03/04 17:55:10
These above four are not exposed in WebGL 2
yunchao
2015/03/05 07:40:53
Acknowledged.
| |
1234 { | |
1235 GLint value = 0; | |
1236 webContext()->getTexParameteriv(target, pname, &value); | |
1237 return WebGLAny(scriptState, value); | |
1238 } | |
1239 case GL_TEXTURE_IMMUTABLE_FORMAT: | |
1240 { | |
1241 GLint value = 0; | |
1242 webContext()->getTexParameteriv(target, pname, &value); | |
1243 return WebGLAny(scriptState, static_cast<bool>(value)); | |
1244 } | |
1245 case GL_TEXTURE_BASE_LEVEL: | |
1246 case GL_TEXTURE_MAX_LEVEL: | |
Zhenyao Mo
2015/03/04 17:55:10
The above two return type is GLint.
yunchao
2015/03/05 07:40:53
Acknowledged.
It's my fault. When I implemented t
| |
1247 case GL_TEXTURE_MAX_LOD: | |
1248 case GL_TEXTURE_MIN_LOD: | |
1249 { | |
1250 GLfloat value = 0.f; | |
1251 webContext()->getTexParameterfv(target, pname, &value); | |
1252 return WebGLAny(scriptState, value); | |
1253 } | |
1254 case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic | |
1255 if (extensionEnabled(EXTTextureFilterAnisotropicName)) { | |
1256 GLfloat value = 0.f; | |
1257 webContext()->getTexParameterfv(target, pname, &value); | |
1258 return WebGLAny(scriptState, value); | |
1259 } | |
1260 synthesizeGLError(GL_INVALID_ENUM, "getTexParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled"); | |
1261 return ScriptValue::createNull(scriptState); | |
1262 default: | |
1263 synthesizeGLError(GL_INVALID_ENUM, "getTexParameter", "invalid parameter name"); | |
1264 return ScriptValue::createNull(scriptState); | |
1265 } | |
1266 } | |
1267 | |
1204 } // namespace blink | 1268 } // namespace blink |
OLD | NEW |