OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 } | 1303 } |
1304 // FIXME: provide alternative code path? This will be unpleasant | 1304 // FIXME: provide alternative code path? This will be unpleasant |
1305 // to implement if glGenerateMipmapEXT is not available -- it will | 1305 // to implement if glGenerateMipmapEXT is not available -- it will |
1306 // require a texture readback and re-upload. | 1306 // require a texture readback and re-upload. |
1307 } | 1307 } |
1308 | 1308 |
1309 bool GraphicsContext3D::getActiveAttrib(CanvasProgram* program, unsigned long index, ActiveInfo& info) | 1309 bool GraphicsContext3D::getActiveAttrib(CanvasProgram* program, unsigned long index, ActiveInfo& info) |
1310 { | 1310 { |
1311 if (!program) | 1311 if (!program) |
1312 return false; | 1312 return false; |
1313 GLint numActiveAttribs = -1; | |
1314 glGetProgramiv(EXTRACT(program), GL_ACTIVE_ATTRIBUTES, &numActiveAttribs); | |
1315 if (numActiveAttribs < 0) | |
1316 return false; | |
1317 if (index >= static_cast<GLuint>(numActiveAttribs)) | |
1318 return false; | |
1319 GLint maxNameLength = -1; | 1313 GLint maxNameLength = -1; |
1320 glGetProgramiv(EXTRACT(program), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNameLength); | 1314 glGetProgramiv(EXTRACT(program), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNameLength); |
1321 if (maxNameLength < 0) | 1315 if (maxNameLength < 0) |
1322 return false; | 1316 return false; |
1323 GLchar* name = NULL; | 1317 GLchar* name = NULL; |
1324 if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) | 1318 if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) |
1325 return false; | 1319 return false; |
1326 GLsizei length = 0; | 1320 GLsizei length = 0; |
1327 GLint size = -1; | 1321 GLint size = -1; |
1328 GLenum type = 0; | 1322 GLenum type = 0; |
1329 glGetActiveAttrib(EXTRACT(program), index, maxNameLength, | 1323 glGetActiveAttrib(EXTRACT(program), index, maxNameLength, |
1330 &length, &size, &type, name); | 1324 &length, &size, &type, name); |
1331 if (size < 0) { | 1325 if (size < 0) { |
1332 fastFree(name); | 1326 fastFree(name); |
1333 return false; | 1327 return false; |
1334 } | 1328 } |
1335 info.name = String(name, length); | 1329 info.name = String(name, length); |
1336 info.type = type; | 1330 info.type = type; |
1337 info.size = size; | 1331 info.size = size; |
1338 fastFree(name); | 1332 fastFree(name); |
1339 return true; | 1333 return true; |
1340 } | 1334 } |
1341 | 1335 |
1342 bool GraphicsContext3D::getActiveUniform(CanvasProgram* program, unsigned long index, ActiveInfo& info) | 1336 bool GraphicsContext3D::getActiveUniform(CanvasProgram* program, unsigned long index, ActiveInfo& info) |
1343 { | 1337 { |
1344 if (!program) | 1338 if (!program) |
1345 return false; | 1339 return false; |
1346 GLint numActiveUniforms = -1; | |
1347 glGetProgramiv(EXTRACT(program), GL_ACTIVE_UNIFORMS, &numActiveUniforms); | |
1348 if (numActiveUniforms < 0) | |
1349 return false; | |
1350 if (index >= static_cast<GLuint>(numActiveUniforms)) | |
1351 return false; | |
1352 GLint maxNameLength = -1; | 1340 GLint maxNameLength = -1; |
1353 glGetProgramiv(EXTRACT(program), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLength); | 1341 glGetProgramiv(EXTRACT(program), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLength); |
1354 if (maxNameLength < 0) | 1342 if (maxNameLength < 0) |
1355 return false; | 1343 return false; |
1356 GLchar* name = NULL; | 1344 GLchar* name = NULL; |
1357 if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) | 1345 if (!tryFastMalloc(maxNameLength * sizeof(GLchar)).getValue(name)) |
1358 return false; | 1346 return false; |
1359 GLsizei length = 0; | 1347 GLsizei length = 0; |
1360 GLint size = -1; | 1348 GLint size = -1; |
1361 GLenum type = 0; | 1349 GLenum type = 0; |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2254 | 2242 |
2255 void GraphicsContext3D::viewport(long x, long y, unsigned long width, unsigned long height) | 2243 void GraphicsContext3D::viewport(long x, long y, unsigned long width, unsigned long height) |
2256 { | 2244 { |
2257 makeContextCurrent(); | 2245 makeContextCurrent(); |
2258 m_internal->viewportImpl(x, y, width, height); | 2246 m_internal->viewportImpl(x, y, width, height); |
2259 } | 2247 } |
2260 | 2248 |
2261 } | 2249 } |
2262 | 2250 |
2263 #endif // ENABLE(3D_CANVAS) | 2251 #endif // ENABLE(3D_CANVAS) |
OLD | NEW |