Changeset 264371 in webkit
- Timestamp:
- Jul 14, 2020 12:59:01 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/unary-minus-operator-in-dynamic-loop-expected.txt
r235913 r264371 2 2 3 3 Test: ../../resources/webgl_test_files/conformance2/glsl3/unary-minus-operator-in-dynamic-loop.html 4 [ 1: PASS ] square should be green 5 [ 2: FAIL ] square should be green at (138, 0) expected: 0,255,0,255 was 255,0,0,255 6 [ 3: PASS ] square should be green 7 [ 4: FAIL ] square should be green at (414, 0) expected: 0,255,0,255 was 255,0,0,255 8 [ 5: PASS ] square should be green 9 [ 6: FAIL ] square should be green at (690, 0) expected: 0,255,0,255 was 255,0,0,255 10 [ 7: PASS ] successfullyParsed is true 11 [ FAIL ] 3 failures reported 4 [ PASS ] All tests passed 12 5 -
trunk/LayoutTests/webgl/2.0.0/conformance2/programs/gl-get-frag-data-location-expected.txt
r236236 r264371 2 2 3 3 Test: ../../resources/webgl_test_files/conformance2/programs/gl-get-frag-data-location.html 4 [ 1: PASS ] WebGL context exists 5 [ 2: PASS ] getError was expected value: NO_ERROR : No GL error from set up 6 [ 3: FAIL ] Fail to query scalar output variable locations, expected: fragColor0->2, fragColor1->0, got: fragColor0->0, fragColor1->0 7 [ 4: FAIL ] Fail to query scalar output variable locations, expected: fragColor->0, fragColor[0]->0, fragColor[1]->1, got: fragColor->0, fragColor[0]->0, fragColor[1]->0 8 [ 5: PASS ] getError was expected value: NO_ERROR : No GL error from testing 9 [ 6: PASS ] successfullyParsed is true 10 [ FAIL ] 2 failures reported 4 [ PASS ] All tests passed 11 5 -
trunk/LayoutTests/webgl/2.0.0/conformance2/state/gl-object-get-calls-expected.txt
r263999 r264371 244 244 [ 240: PASS ] gl.getProgramParameter(uintProgram, gl.LINK_STATUS) is true 245 245 [ 241: PASS ] getError was expected value: NO_ERROR : 246 [ 242: FAIL ] gl.getUniform(uintProgram, uvalLoc) should be 1 (of type number). Was null (of type object).247 [ 243: FAIL ] gl.getUniform(uintProgram, uval2Loc) should be 2,3. Was null.248 [ 244: FAIL ] gl.getUniform(uintProgram, uval3Loc) should be 4,5,6. Was null.249 [ 245: FAIL ] gl.getUniform(uintProgram, uval4Loc) should be 7,8,9,10. Was null.250 [ 246: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE:246 [ 242: PASS ] gl.getUniform(uintProgram, uvalLoc) is 1 247 [ 243: PASS ] gl.getUniform(uintProgram, uval2Loc) is [2, 3] 248 [ 244: PASS ] gl.getUniform(uintProgram, uval3Loc) is [4, 5, 6] 249 [ 245: PASS ] gl.getUniform(uintProgram, uval4Loc) is [7, 8, 9, 10] 250 [ 246: PASS ] getError was expected value: NO_ERROR : 251 251 [ 247: PASS ] getError was expected value: NO_ERROR : 252 252 [ 248: PASS ] gl.getProgramParameter(matForWebGL2Program, gl.LINK_STATUS) is true 253 253 [ 249: PASS ] getError was expected value: NO_ERROR : 254 [ 250: FAIL ] gl.getUniform(matForWebGL2Program, mval2x3Loc) should be 1,2,3,4,5,6. Was null.255 [ 251: FAIL ] gl.getUniform(matForWebGL2Program, mval2x4Loc) should be 7,8,9,10,11,12,13,14. Was null.256 [ 252: FAIL ] gl.getUniform(matForWebGL2Program, mval3x2Loc) should be 15,16,17,18,19,20. Was null.257 [ 253: FAIL ] gl.getUniform(matForWebGL2Program, mval3x4Loc) should be 21,22,23,24,25,26,27,28,29,30,31,32. Was null.258 [ 254: FAIL ] gl.getUniform(matForWebGL2Program, mval4x2Loc) should be 33,34,35,36,37,38,39,40. Was null.259 [ 255: FAIL ] gl.getUniform(matForWebGL2Program, mval4x3Loc) should be 41,42,43,44,45,46,47,48,49,50,51,52. Was null.260 [ 256: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE:254 [ 250: PASS ] gl.getUniform(matForWebGL2Program, mval2x3Loc) is [1, 2, 3, 4, 5, 6] 255 [ 251: PASS ] gl.getUniform(matForWebGL2Program, mval2x4Loc) is [7, 8, 9, 10, 11, 12, 13, 14] 256 [ 252: PASS ] gl.getUniform(matForWebGL2Program, mval3x2Loc) is [15, 16, 17, 18, 19, 20] 257 [ 253: PASS ] gl.getUniform(matForWebGL2Program, mval3x4Loc) is [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32] 258 [ 254: PASS ] gl.getUniform(matForWebGL2Program, mval4x2Loc) is [33, 34, 35, 36, 37, 38, 39, 40] 259 [ 255: PASS ] gl.getUniform(matForWebGL2Program, mval4x3Loc) is [41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52] 260 [ 256: PASS ] getError was expected value: NO_ERROR : 261 261 [ 257: PASS ] gl.getProgramParameter(samplerForWebGL2Program, gl.LINK_STATUS) is true 262 262 [ 258: PASS ] getError was expected value: NO_ERROR : 263 [ 259: FAIL ] gl.getUniform(samplerForWebGL2Program, s3DValLoc) should be 0 (of type number). Was null (of type object).264 [ 260: FAIL ] gl.getUniform(samplerForWebGL2Program, s2DArrayValLoc) should be 1 (of type number). Was null (of type object).265 [ 261: FAIL ] getError expected: NO_ERROR. Was INVALID_VALUE:263 [ 259: PASS ] gl.getUniform(samplerForWebGL2Program, s3DValLoc) is 0 264 [ 260: PASS ] gl.getUniform(samplerForWebGL2Program, s2DArrayValLoc) is 1 265 [ 261: PASS ] getError was expected value: NO_ERROR : 266 266 [ 262: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) is buffer 267 267 [ 263: PASS ] gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_ENABLED) is true … … 312 312 [ 308: FAIL ] gl.getSyncParameter(sync, gl.OBJECT_TYPE) should be 37142. Threw exception TypeError: Argument 1 ('sync') to WebGL2RenderingContext.getSyncParameter must be an instance of WebGLSync 313 313 [ 309: FAIL ] successfullyParsed should be true (of type boolean). Was undefined (of type undefined). 314 [ FAIL ] 54failures reported314 [ FAIL ] 39 failures reported 315 315 -
trunk/Source/WebCore/ChangeLog
r264370 r264371 1 2020-07-14 James Darpinian <jdarpinian@chromium.org> 2 3 Implement uniform* and getUniform for WebGL 2 types 4 https://bugs.webkit.org/show_bug.cgi?id=214116 5 6 Reviewed by Dean Jackson. 7 8 Passes all relevant WebGL conformance tests. 9 10 * html/canvas/WebGL2RenderingContext.cpp: 11 (WebCore::WebGL2RenderingContext::getFragDataLocation): 12 (WebCore::WebGL2RenderingContext::uniform1ui): 13 (WebCore::WebGL2RenderingContext::uniform2ui): 14 (WebCore::WebGL2RenderingContext::uniform3ui): 15 (WebCore::WebGL2RenderingContext::uniform4ui): 16 (WebCore::WebGL2RenderingContext::uniform1uiv): 17 (WebCore::WebGL2RenderingContext::uniform2uiv): 18 (WebCore::WebGL2RenderingContext::uniform3uiv): 19 (WebCore::WebGL2RenderingContext::uniform4uiv): 20 (WebCore::WebGL2RenderingContext::uniformMatrix2x3fv): 21 (WebCore::WebGL2RenderingContext::uniformMatrix3x2fv): 22 (WebCore::WebGL2RenderingContext::uniformMatrix2x4fv): 23 (WebCore::WebGL2RenderingContext::uniformMatrix4x2fv): 24 (WebCore::WebGL2RenderingContext::uniformMatrix3x4fv): 25 (WebCore::WebGL2RenderingContext::uniformMatrix4x3fv): 26 (WebCore::WebGL2RenderingContext::uniform1fv): 27 (WebCore::WebGL2RenderingContext::uniform2fv): 28 (WebCore::WebGL2RenderingContext::uniform3fv): 29 (WebCore::WebGL2RenderingContext::uniform4fv): 30 (WebCore::WebGL2RenderingContext::uniform1iv): 31 (WebCore::WebGL2RenderingContext::uniform2iv): 32 (WebCore::WebGL2RenderingContext::uniform3iv): 33 (WebCore::WebGL2RenderingContext::uniform4iv): 34 (WebCore::WebGL2RenderingContext::uniformMatrix2fv): 35 (WebCore::WebGL2RenderingContext::uniformMatrix3fv): 36 (WebCore::WebGL2RenderingContext::uniformMatrix4fv): 37 * html/canvas/WebGLRenderingContextBase.cpp: 38 (WebCore::WebGLRenderingContextBase::getUniform): 39 (WebCore::WebGLRenderingContextBase::uniform1fv): 40 (WebCore::WebGLRenderingContextBase::uniform2fv): 41 (WebCore::WebGLRenderingContextBase::uniform3fv): 42 (WebCore::WebGLRenderingContextBase::uniform4fv): 43 (WebCore::WebGLRenderingContextBase::uniform1iv): 44 (WebCore::WebGLRenderingContextBase::uniform2iv): 45 (WebCore::WebGLRenderingContextBase::uniform3iv): 46 (WebCore::WebGLRenderingContextBase::uniform4iv): 47 (WebCore::WebGLRenderingContextBase::uniformMatrix2fv): 48 (WebCore::WebGLRenderingContextBase::uniformMatrix3fv): 49 (WebCore::WebGLRenderingContextBase::uniformMatrix4fv): 50 (WebCore::WebGLRenderingContextBase::validateUniformParameters): 51 (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters): 52 * html/canvas/WebGLRenderingContextBase.h: 53 * platform/graphics/GraphicsContextGL.h: 54 * platform/graphics/angle/GraphicsContextGLANGLE.cpp: 55 (WebCore::GraphicsContextGLOpenGL::getUniformuiv): 56 (WebCore::GraphicsContextGLOpenGL::getFragDataLocation): 57 (WebCore::GraphicsContextGLOpenGL::uniform1ui): 58 (WebCore::GraphicsContextGLOpenGL::uniform2ui): 59 (WebCore::GraphicsContextGLOpenGL::uniform3ui): 60 (WebCore::GraphicsContextGLOpenGL::uniform4ui): 61 (WebCore::GraphicsContextGLOpenGL::uniform1uiv): 62 (WebCore::GraphicsContextGLOpenGL::uniform2uiv): 63 (WebCore::GraphicsContextGLOpenGL::uniform3uiv): 64 (WebCore::GraphicsContextGLOpenGL::uniform4uiv): 65 (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x3fv): 66 (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x2fv): 67 (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x4fv): 68 (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x2fv): 69 (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x4fv): 70 (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x3fv): 71 (WebCore::GraphicsContextGLOpenGL::uniform1fv): 72 (WebCore::GraphicsContextGLOpenGL::uniform2fv): 73 (WebCore::GraphicsContextGLOpenGL::uniform3fv): 74 (WebCore::GraphicsContextGLOpenGL::uniform4fv): 75 (WebCore::GraphicsContextGLOpenGL::uniform1iv): 76 (WebCore::GraphicsContextGLOpenGL::uniform2iv): 77 (WebCore::GraphicsContextGLOpenGL::uniform3iv): 78 (WebCore::GraphicsContextGLOpenGL::uniform4iv): 79 (WebCore::GraphicsContextGLOpenGL::uniformMatrix2fv): 80 (WebCore::GraphicsContextGLOpenGL::uniformMatrix3fv): 81 (WebCore::GraphicsContextGLOpenGL::uniformMatrix4fv): 82 * platform/graphics/opengl/GraphicsContextGLOpenGL.h: 83 * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: 84 (WebCore::GraphicsContextGLOpenGL::getUniformuiv): 85 1 86 2020-07-14 Per Arne Vollan <pvollan@apple.com> 2 87 -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
r263999 r264371 1272 1272 } 1273 1273 1274 GCGLint WebGL2RenderingContext::getFragDataLocation(WebGLProgram&, const String&) 1275 { 1276 LOG(WebGL, "[[ NOT IMPLEMENTED ]] getFragDataLocation()"); 1277 return 0; 1278 } 1279 1280 void WebGL2RenderingContext::uniform1ui(WebGLUniformLocation*, GCGLuint) 1281 { 1282 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform1ui()"); 1283 } 1284 1285 void WebGL2RenderingContext::uniform2ui(WebGLUniformLocation*, GCGLuint, GCGLuint) 1286 { 1287 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform2ui()"); 1288 } 1289 1290 void WebGL2RenderingContext::uniform3ui(WebGLUniformLocation*, GCGLuint, GCGLuint, GCGLuint) 1291 { 1292 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform3ui()"); 1293 } 1294 1295 void WebGL2RenderingContext::uniform4ui(WebGLUniformLocation*, GCGLuint, GCGLuint, GCGLuint, GCGLuint) 1296 { 1297 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform4ui()"); 1298 } 1299 1300 void WebGL2RenderingContext::uniform1uiv(WebGLUniformLocation*, Uint32List&&, GCGLuint, GCGLuint) 1301 { 1302 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform1uiv()"); 1303 } 1304 1305 void WebGL2RenderingContext::uniform2uiv(WebGLUniformLocation*, Uint32List&&, GCGLuint, GCGLuint) 1306 { 1307 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform2uiv()"); 1308 } 1309 1310 void WebGL2RenderingContext::uniform3uiv(WebGLUniformLocation*, Uint32List&&, GCGLuint, GCGLuint) 1311 { 1312 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform3uiv()"); 1313 } 1314 1315 void WebGL2RenderingContext::uniform4uiv(WebGLUniformLocation*, Uint32List&&, GCGLuint, GCGLuint) 1316 { 1317 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform4uiv()"); 1318 } 1319 1320 void WebGL2RenderingContext::uniformMatrix2x3fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint) 1321 { 1322 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix2x3fv()"); 1323 } 1324 1325 void WebGL2RenderingContext::uniformMatrix3x2fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint) 1326 { 1327 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix3x2fv()"); 1328 } 1329 1330 void WebGL2RenderingContext::uniformMatrix2x4fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint) 1331 { 1332 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix2x4fv()"); 1333 } 1334 1335 void WebGL2RenderingContext::uniformMatrix4x2fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint) 1336 { 1337 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix4x2fv()"); 1338 } 1339 1340 void WebGL2RenderingContext::uniformMatrix3x4fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint) 1341 { 1342 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix3x4fv()"); 1343 } 1344 1345 void WebGL2RenderingContext::uniformMatrix4x3fv(WebGLUniformLocation*, GCGLboolean, Float32List&&, GCGLuint, GCGLuint) 1346 { 1347 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix4x3fv()"); 1274 GCGLint WebGL2RenderingContext::getFragDataLocation(WebGLProgram& program, const String& name) 1275 { 1276 if (isContextLostOrPending() || !validateWebGLObject("getFragDataLocation", &program)) 1277 return -1; 1278 return m_context->getFragDataLocation(program.object(), name); 1279 } 1280 1281 void WebGL2RenderingContext::uniform1ui(WebGLUniformLocation* location, GCGLuint v0) 1282 { 1283 if (isContextLostOrPending() || !validateUniformLocation("uniform1ui", location)) 1284 return; 1285 m_context->uniform1ui(location->location(), v0); 1286 } 1287 1288 void WebGL2RenderingContext::uniform2ui(WebGLUniformLocation* location, GCGLuint v0, GCGLuint v1) 1289 { 1290 if (isContextLostOrPending() || !validateUniformLocation("uniform2ui", location)) 1291 return; 1292 m_context->uniform2ui(location->location(), v0, v1); 1293 } 1294 1295 void WebGL2RenderingContext::uniform3ui(WebGLUniformLocation* location, GCGLuint v0, GCGLuint v1, GCGLuint v2) 1296 { 1297 if (isContextLostOrPending() || !validateUniformLocation("uniform3ui", location)) 1298 return; 1299 m_context->uniform3ui(location->location(), v0, v1, v2); 1300 } 1301 1302 void WebGL2RenderingContext::uniform4ui(WebGLUniformLocation* location, GCGLuint v0, GCGLuint v1, GCGLuint v2, GCGLuint v3) 1303 { 1304 if (isContextLostOrPending() || !validateUniformLocation("uniform4ui", location)) 1305 return; 1306 m_context->uniform4ui(location->location(), v0, v1, v2, v3); 1307 } 1308 1309 void WebGL2RenderingContext::uniform1uiv(WebGLUniformLocation* location, Uint32List&& value, GCGLuint srcOffset, GCGLuint srcLength) 1310 { 1311 if (isContextLostOrPending() || !validateUniformParameters("uniform1uiv", location, value, 1, srcOffset, srcLength)) 1312 return; 1313 m_context->uniform1uiv(location->location(), value.data(), srcOffset, srcLength ? srcLength : (value.length() - srcOffset)); 1314 } 1315 1316 void WebGL2RenderingContext::uniform2uiv(WebGLUniformLocation* location, Uint32List&& value, GCGLuint srcOffset, GCGLuint srcLength) 1317 { 1318 if (isContextLostOrPending() || !validateUniformParameters("uniform2uiv", location, value, 2, srcOffset, srcLength)) 1319 return; 1320 m_context->uniform2uiv(location->location(), value.data(), srcOffset, srcLength ? srcLength : (value.length() - srcOffset) / 2); 1321 } 1322 1323 void WebGL2RenderingContext::uniform3uiv(WebGLUniformLocation* location, Uint32List&& value, GCGLuint srcOffset, GCGLuint srcLength) 1324 { 1325 if (isContextLostOrPending() || !validateUniformParameters("uniform3uiv", location, value, 3, srcOffset, srcLength)) 1326 return; 1327 m_context->uniform3uiv(location->location(), value.data(), srcOffset, srcLength ? srcLength : (value.length() - srcOffset) / 3); 1328 } 1329 1330 void WebGL2RenderingContext::uniform4uiv(WebGLUniformLocation* location, Uint32List&& value, GCGLuint srcOffset, GCGLuint srcLength) 1331 { 1332 if (isContextLostOrPending() || !validateUniformParameters("uniform4uiv", location, value, 4, srcOffset, srcLength)) 1333 return; 1334 m_context->uniform4uiv(location->location(), value.data(), srcOffset, srcLength ? srcLength : (value.length() - srcOffset) / 4); 1335 } 1336 1337 void WebGL2RenderingContext::uniformMatrix2x3fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength) 1338 { 1339 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2x3fv", location, transpose, v, 6, srcOffset, srcLength)) 1340 return; 1341 m_context->uniformMatrix2x3fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 6); 1342 } 1343 1344 void WebGL2RenderingContext::uniformMatrix3x2fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength) 1345 { 1346 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3x2fv", location, transpose, v, 6, srcOffset, srcLength)) 1347 return; 1348 m_context->uniformMatrix3x2fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 6); 1349 } 1350 1351 void WebGL2RenderingContext::uniformMatrix2x4fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength) 1352 { 1353 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2x4fv", location, transpose, v, 8, srcOffset, srcLength)) 1354 return; 1355 m_context->uniformMatrix2x4fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 8); 1356 } 1357 1358 void WebGL2RenderingContext::uniformMatrix4x2fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength) 1359 { 1360 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4x2fv", location, transpose, v, 8, srcOffset, srcLength)) 1361 return; 1362 m_context->uniformMatrix4x2fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 8); 1363 } 1364 1365 void WebGL2RenderingContext::uniformMatrix3x4fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength) 1366 { 1367 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3x4fv", location, transpose, v, 12, srcOffset, srcLength)) 1368 return; 1369 m_context->uniformMatrix3x4fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 12); 1370 } 1371 1372 void WebGL2RenderingContext::uniformMatrix4x3fv(WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v, GCGLuint srcOffset, GCGLuint srcLength) 1373 { 1374 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4x3fv", location, transpose, v, 12, srcOffset, srcLength)) 1375 return; 1376 m_context->uniformMatrix4x3fv(location->location(), transpose, v.data(), srcOffset, srcLength ? srcLength : (v.length() - srcOffset) / 12); 1348 1377 } 1349 1378 … … 2982 3011 void WebGL2RenderingContext::uniform1fv(WebGLUniformLocation* location, Float32List data, GLuint srcOffset, GLuint srcLength) 2983 3012 { 2984 UNUSED_PARAM(location); 2985 UNUSED_PARAM(data); 2986 UNUSED_PARAM(srcOffset); 2987 UNUSED_PARAM(srcLength); 2988 2989 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform1fv()"); 3013 if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, data, 1, srcOffset, srcLength)) 3014 return; 3015 m_context->uniform1fv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset)); 2990 3016 } 2991 3017 2992 3018 void WebGL2RenderingContext::uniform2fv(WebGLUniformLocation* location, Float32List data, GLuint srcOffset, GLuint srcLength) 2993 3019 { 2994 UNUSED_PARAM(location); 2995 UNUSED_PARAM(data); 2996 UNUSED_PARAM(srcOffset); 2997 UNUSED_PARAM(srcLength); 2998 2999 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform2fv()"); 3020 if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, data, 2, srcOffset, srcLength)) 3021 return; 3022 m_context->uniform2fv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 2); 3000 3023 } 3001 3024 3002 3025 void WebGL2RenderingContext::uniform3fv(WebGLUniformLocation* location, Float32List data, GLuint srcOffset, GLuint srcLength) 3003 3026 { 3004 UNUSED_PARAM(location); 3005 UNUSED_PARAM(data); 3006 UNUSED_PARAM(srcOffset); 3007 UNUSED_PARAM(srcLength); 3008 3009 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform3fv()"); 3027 if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, data, 3, srcOffset, srcLength)) 3028 return; 3029 m_context->uniform3fv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 3); 3010 3030 } 3011 3031 3012 3032 void WebGL2RenderingContext::uniform4fv(WebGLUniformLocation* location, Float32List data, GLuint srcOffset, GLuint srcLength) 3013 3033 { 3014 UNUSED_PARAM(location); 3015 UNUSED_PARAM(data); 3016 UNUSED_PARAM(srcOffset); 3017 UNUSED_PARAM(srcLength); 3018 3019 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform4fv()"); 3034 if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, data, 4, srcOffset, srcLength)) 3035 return; 3036 m_context->uniform4fv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 4); 3020 3037 } 3021 3038 3022 3039 void WebGL2RenderingContext::uniform1iv(WebGLUniformLocation* location, Int32List data, GLuint srcOffset, GLuint srcLength) 3023 3040 { 3024 UNUSED_PARAM(location); 3025 UNUSED_PARAM(data); 3026 UNUSED_PARAM(srcOffset); 3027 UNUSED_PARAM(srcLength); 3028 3029 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform1iv()"); 3041 if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, data, 1, srcOffset, srcLength)) 3042 return; 3043 m_context->uniform1iv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset)); 3030 3044 } 3031 3045 3032 3046 void WebGL2RenderingContext::uniform2iv(WebGLUniformLocation* location, Int32List data, GLuint srcOffset, GLuint srcLength) 3033 3047 { 3034 UNUSED_PARAM(location); 3035 UNUSED_PARAM(data); 3036 UNUSED_PARAM(srcOffset); 3037 UNUSED_PARAM(srcLength); 3038 3039 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform2iv()"); 3048 if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, data, 2, srcOffset, srcLength)) 3049 return; 3050 m_context->uniform2iv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 2); 3040 3051 } 3041 3052 3042 3053 void WebGL2RenderingContext::uniform3iv(WebGLUniformLocation* location, Int32List data, GLuint srcOffset, GLuint srcLength) 3043 3054 { 3044 UNUSED_PARAM(location); 3045 UNUSED_PARAM(data); 3046 UNUSED_PARAM(srcOffset); 3047 UNUSED_PARAM(srcLength); 3048 3049 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform3iv()"); 3055 if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, data, 3, srcOffset, srcLength)) 3056 return; 3057 m_context->uniform3iv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 3); 3050 3058 } 3051 3059 3052 3060 void WebGL2RenderingContext::uniform4iv(WebGLUniformLocation* location, Int32List data, GLuint srcOffset, GLuint srcLength) 3053 3061 { 3054 UNUSED_PARAM(location); 3055 UNUSED_PARAM(data); 3056 UNUSED_PARAM(srcOffset); 3057 UNUSED_PARAM(srcLength); 3058 3059 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniform4iv()"); 3062 if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, data, 4, srcOffset, srcLength)) 3063 return; 3064 m_context->uniform4iv(location->location(), data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / 4); 3060 3065 } 3061 3066 3062 3067 void WebGL2RenderingContext::uniformMatrix2fv(WebGLUniformLocation* location, GLboolean transpose, Float32List data, GLuint srcOffset, GLuint srcLength) 3063 3068 { 3064 UNUSED_PARAM(location); 3065 UNUSED_PARAM(transpose); 3066 UNUSED_PARAM(data); 3067 UNUSED_PARAM(srcOffset); 3068 UNUSED_PARAM(srcLength); 3069 3070 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix2fv()"); 3069 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, data, 2*2, srcOffset, srcLength)) 3070 return; 3071 m_context->uniformMatrix2fv(location->location(), transpose, data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / (2*2)); 3071 3072 } 3072 3073 3073 3074 void WebGL2RenderingContext::uniformMatrix3fv(WebGLUniformLocation* location, GLboolean transpose, Float32List data, GLuint srcOffset, GLuint srcLength) 3074 3075 { 3075 UNUSED_PARAM(location); 3076 UNUSED_PARAM(transpose); 3077 UNUSED_PARAM(data); 3078 UNUSED_PARAM(srcOffset); 3079 UNUSED_PARAM(srcLength); 3080 3081 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix3fv()"); 3076 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, data, 3*3, srcOffset, srcLength)) 3077 return; 3078 m_context->uniformMatrix3fv(location->location(), transpose, data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / (3*3)); 3082 3079 } 3083 3080 3084 3081 void WebGL2RenderingContext::uniformMatrix4fv(WebGLUniformLocation* location, GLboolean transpose, Float32List data, GLuint srcOffset, GLuint srcLength) 3085 3082 { 3086 UNUSED_PARAM(location); 3087 UNUSED_PARAM(transpose); 3088 UNUSED_PARAM(data); 3089 UNUSED_PARAM(srcOffset); 3090 UNUSED_PARAM(srcLength); 3091 3092 LOG(WebGL, "[[ NOT IMPLEMENTED ]] uniformMatrix4fv()"); 3083 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, data, 4*4, srcOffset, srcLength)) 3084 return; 3085 m_context->uniformMatrix4fv(location->location(), transpose, data.data(), srcOffset, srcLength ? srcLength : (data.length() - srcOffset) / (4*4)); 3093 3086 } 3094 3087 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r263281 r264371 3406 3406 break; 3407 3407 default: 3408 // Can't handle this type 3409 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getUniform", "unhandled type"); 3410 return nullptr; 3408 if (!isWebGL2()) { 3409 // Can't handle this type. 3410 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getUniform", "unhandled type"); 3411 return nullptr; 3412 } 3413 switch (uniformLocation->type()) { 3414 case GraphicsContextGL::UNSIGNED_INT: 3415 baseType = GraphicsContextGL::UNSIGNED_INT; 3416 length = 1; 3417 break; 3418 case GraphicsContextGL::UNSIGNED_INT_VEC2: 3419 baseType = GraphicsContextGL::UNSIGNED_INT; 3420 length = 2; 3421 break; 3422 case GraphicsContextGL::UNSIGNED_INT_VEC3: 3423 baseType = GraphicsContextGL::UNSIGNED_INT; 3424 length = 3; 3425 break; 3426 case GraphicsContextGL::UNSIGNED_INT_VEC4: 3427 baseType = GraphicsContextGL::UNSIGNED_INT; 3428 length = 4; 3429 break; 3430 case GraphicsContextGL::FLOAT_MAT2x3: 3431 baseType = GraphicsContextGL::FLOAT; 3432 length = 6; 3433 break; 3434 case GraphicsContextGL::FLOAT_MAT2x4: 3435 baseType = GraphicsContextGL::FLOAT; 3436 length = 8; 3437 break; 3438 case GraphicsContextGL::FLOAT_MAT3x2: 3439 baseType = GraphicsContextGL::FLOAT; 3440 length = 6; 3441 break; 3442 case GraphicsContextGL::FLOAT_MAT3x4: 3443 baseType = GraphicsContextGL::FLOAT; 3444 length = 12; 3445 break; 3446 case GraphicsContextGL::FLOAT_MAT4x2: 3447 baseType = GraphicsContextGL::FLOAT; 3448 length = 8; 3449 break; 3450 case GraphicsContextGL::FLOAT_MAT4x3: 3451 baseType = GraphicsContextGL::FLOAT; 3452 length = 12; 3453 break; 3454 case GraphicsContextGL::SAMPLER_3D: 3455 case GraphicsContextGL::SAMPLER_2D_ARRAY: 3456 case GraphicsContextGL::SAMPLER_2D_SHADOW: 3457 case GraphicsContextGL::SAMPLER_CUBE_SHADOW: 3458 case GraphicsContextGL::SAMPLER_2D_ARRAY_SHADOW: 3459 case GraphicsContextGL::INT_SAMPLER_2D: 3460 case GraphicsContextGL::INT_SAMPLER_CUBE: 3461 case GraphicsContextGL::INT_SAMPLER_3D: 3462 case GraphicsContextGL::INT_SAMPLER_2D_ARRAY: 3463 case GraphicsContextGL::UNSIGNED_INT_SAMPLER_2D: 3464 case GraphicsContextGL::UNSIGNED_INT_SAMPLER_CUBE: 3465 case GraphicsContextGL::UNSIGNED_INT_SAMPLER_3D: 3466 case GraphicsContextGL::UNSIGNED_INT_SAMPLER_2D_ARRAY: 3467 baseType = GraphicsContextGL::INT; 3468 length = 1; 3469 break; 3470 default: 3471 // Can't handle this type. 3472 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, "getUniform", "unhandled type"); 3473 return nullptr; 3474 } 3411 3475 } 3412 3476 switch (baseType) { … … 3430 3494 return value[0]; 3431 3495 return Int32Array::tryCreate(value, length); 3496 } 3497 case GraphicsContextGL::UNSIGNED_INT: { 3498 GCGLuint value[4] = {0}; 3499 m_context->getUniformuiv(objectOrZero(program), location, value); 3500 if (length == 1) 3501 return value[0]; 3502 return Uint32Array::tryCreate(value, length); 3432 3503 } 3433 3504 case GraphicsContextGL::BOOL: { … … 5506 5577 } 5507 5578 5579 bool WebGLRenderingContextBase::validateUniformLocation(const char* functionName, const WebGLUniformLocation* location) 5580 { 5581 if (!location) 5582 return false; 5583 if (location->program() != m_currentProgram) { 5584 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "location not for current program"); 5585 return false; 5586 } 5587 return true; 5588 } 5589 5508 5590 void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location, GCGLfloat x) 5509 5591 { 5510 if (isContextLostOrPending() || !location) 5511 return; 5512 5513 if (location->program() != m_currentProgram) { 5514 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform1f", "location not for current program"); 5515 return; 5516 } 5592 if (isContextLostOrPending() || !validateUniformLocation("uniform1f", location)) 5593 return; 5517 5594 5518 5595 m_context->uniform1f(location->location(), x); … … 5521 5598 void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location, GCGLfloat x, GCGLfloat y) 5522 5599 { 5523 if (isContextLostOrPending() || !location) 5524 return; 5525 5526 if (location->program() != m_currentProgram) { 5527 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform2f", "location not for current program"); 5528 return; 5529 } 5600 if (isContextLostOrPending() || !validateUniformLocation("uniform2f", location)) 5601 return; 5530 5602 5531 5603 m_context->uniform2f(location->location(), x, y); … … 5534 5606 void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location, GCGLfloat x, GCGLfloat y, GCGLfloat z) 5535 5607 { 5536 if (isContextLostOrPending() || !location) 5537 return; 5538 5539 if (location->program() != m_currentProgram) { 5540 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform3f", "location not for current program"); 5541 return; 5542 } 5608 if (isContextLostOrPending() || !validateUniformLocation("uniform3f", location)) 5609 return; 5543 5610 5544 5611 m_context->uniform3f(location->location(), x, y, z); … … 5547 5614 void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, GCGLfloat x, GCGLfloat y, GCGLfloat z, GCGLfloat w) 5548 5615 { 5549 if (isContextLostOrPending() || !location) 5550 return; 5551 5552 if (location->program() != m_currentProgram) { 5553 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform4f", "location not for current program"); 5554 return; 5555 } 5616 if (isContextLostOrPending() || !validateUniformLocation("uniform4f", location)) 5617 return; 5556 5618 5557 5619 m_context->uniform4f(location->location(), x, y, z, w); … … 5560 5622 void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, GCGLint x) 5561 5623 { 5562 if (isContextLostOrPending() || !location) 5563 return; 5564 5565 if (location->program() != m_currentProgram) { 5566 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform1i", "location not for current program"); 5567 return; 5568 } 5624 if (isContextLostOrPending() || !validateUniformLocation("uniform1i", location)) 5625 return; 5569 5626 5570 5627 if ((location->type() == GraphicsContextGL::SAMPLER_2D || location->type() == GraphicsContextGL::SAMPLER_CUBE) && x >= (int)m_textureUnits.size()) { … … 5578 5635 void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location, GCGLint x, GCGLint y) 5579 5636 { 5580 if (isContextLostOrPending() || !location) 5581 return; 5582 5583 if (location->program() != m_currentProgram) { 5584 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform2i", "location not for current program"); 5585 return; 5586 } 5637 if (isContextLostOrPending() || !validateUniformLocation("uniform2i", location)) 5638 return; 5587 5639 5588 5640 m_context->uniform2i(location->location(), x, y); … … 5591 5643 void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location, GCGLint x, GCGLint y, GCGLint z) 5592 5644 { 5593 if (isContextLostOrPending() || !location) 5594 return; 5595 5596 if (location->program() != m_currentProgram) { 5597 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform3i", "location not for current program"); 5598 return; 5599 } 5645 if (isContextLostOrPending() || !validateUniformLocation("uniform3i", location)) 5646 return; 5600 5647 5601 5648 m_context->uniform3i(location->location(), x, y, z); … … 5604 5651 void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location, GCGLint x, GCGLint y, GCGLint z, GCGLint w) 5605 5652 { 5606 if (isContextLostOrPending() || !location) 5607 return; 5608 5609 if (location->program() != m_currentProgram) { 5610 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, "uniform4i", "location not for current program"); 5611 return; 5612 } 5653 if (isContextLostOrPending() || !validateUniformLocation("uniform4i", location)) 5654 return; 5613 5655 5614 5656 m_context->uniform4i(location->location(), x, y, z, w); … … 5617 5659 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, Float32List&& v) 5618 5660 { 5619 if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, v, 1 ))5661 if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, v, 1, 0, v.length())) 5620 5662 return; 5621 5663 … … 5625 5667 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, Float32List&& v) 5626 5668 { 5627 if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, v, 2 ))5669 if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, v, 2, 0, v.length())) 5628 5670 return; 5629 5671 … … 5633 5675 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, Float32List&& v) 5634 5676 { 5635 if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, v, 3 ))5677 if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, v, 3, 0, v.length())) 5636 5678 return; 5637 5679 … … 5641 5683 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, Float32List&& v) 5642 5684 { 5643 if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, v, 4 ))5685 if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, v, 4, 0, v.length())) 5644 5686 return; 5645 5687 … … 5649 5691 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, Int32List&& v) 5650 5692 { 5651 if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, v, 1 ))5693 if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, v, 1, 0, v.length())) 5652 5694 return; 5653 5695 … … 5670 5712 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, Int32List&& v) 5671 5713 { 5672 if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, v, 2 ))5714 if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, v, 2, 0, v.length())) 5673 5715 return; 5674 5716 … … 5678 5720 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, Int32List&& v) 5679 5721 { 5680 if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, v, 3 ))5722 if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, v, 3, 0, v.length())) 5681 5723 return; 5682 5724 … … 5686 5728 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, Int32List&& v) 5687 5729 { 5688 if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, v, 4 ))5730 if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, v, 4, 0, v.length())) 5689 5731 return; 5690 5732 … … 5694 5736 void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v) 5695 5737 { 5696 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4 ))5738 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4, 0, v.length())) 5697 5739 return; 5698 5740 m_context->uniformMatrix2fv(location->location(), v.length() / 4, transpose, v.data()); … … 5701 5743 void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v) 5702 5744 { 5703 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9 ))5745 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9, 0, v.length())) 5704 5746 return; 5705 5747 m_context->uniformMatrix3fv(location->location(), v.length() / 9, transpose, v.data()); … … 5708 5750 void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GCGLboolean transpose, Float32List&& v) 5709 5751 { 5710 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16 ))5752 if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16, 0, v.length())) 5711 5753 return; 5712 5754 m_context->uniformMatrix4fv(location->location(), v.length() / 16, transpose, v.data()); … … 6776 6818 } 6777 6819 6778 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Float32List& v, GCGLsizei requiredMinSize) 6779 { 6780 return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize); 6781 } 6782 6783 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Int32List& v, GCGLsizei requiredMinSize) 6784 { 6785 return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize); 6786 } 6787 6788 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, void* v, GCGLsizei size, GCGLsizei requiredMinSize) 6789 { 6790 return validateUniformMatrixParameters(functionName, location, false, v, size, requiredMinSize); 6791 } 6792 6793 bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GCGLboolean transpose, const Float32List& v, GCGLsizei requiredMinSize) 6794 { 6795 return validateUniformMatrixParameters(functionName, location, transpose, v.data(), v.length(), requiredMinSize); 6796 } 6797 6798 bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GCGLboolean transpose, const void* v, GCGLsizei size, GCGLsizei requiredMinSize) 6799 { 6800 if (!location) 6801 return false; 6802 if (location->program() != m_currentProgram) { 6803 synthesizeGLError(GraphicsContextGL::INVALID_OPERATION, functionName, "location is not from current program"); 6804 return false; 6805 } 6820 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Float32List& v, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength) 6821 { 6822 return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize, srcOffset, srcLength); 6823 } 6824 6825 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Int32List& v, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength) 6826 { 6827 return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize, srcOffset, srcLength); 6828 } 6829 6830 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Uint32List& v, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength) 6831 { 6832 return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize, srcOffset, srcLength); 6833 } 6834 6835 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, void* v, GCGLsizei size, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength) 6836 { 6837 return validateUniformMatrixParameters(functionName, location, false, v, size, requiredMinSize, srcOffset, srcLength); 6838 } 6839 6840 bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GCGLboolean transpose, const Float32List& v, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength) 6841 { 6842 return validateUniformMatrixParameters(functionName, location, transpose, v.data(), v.length(), requiredMinSize, srcOffset, srcLength); 6843 } 6844 6845 bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GCGLboolean transpose, const void* v, GCGLsizei size, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength) 6846 { 6847 if (!validateUniformLocation(functionName, location)) 6848 return false; 6806 6849 if (!v) { 6807 6850 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "no array"); 6808 6851 return false; 6809 6852 } 6810 if (transpose ) {6853 if (transpose && !isWebGL2()) { 6811 6854 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "transpose not FALSE"); 6812 6855 return false; 6813 6856 } 6814 if (size < requiredMinSize || (size % requiredMinSize)) { 6857 if (srcOffset >= static_cast<GCGLuint>(size)) { 6858 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid srcOffset"); 6859 return false; 6860 } 6861 GCGLsizei actualSize = size - srcOffset; 6862 if (srcLength > 0) { 6863 if (srcLength > static_cast<GCGLuint>(actualSize)) { 6864 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid srcOffset + srcLength"); 6865 return false; 6866 } 6867 actualSize = srcLength; 6868 } 6869 if (actualSize < requiredMinSize || (actualSize % requiredMinSize)) { 6815 6870 synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid size"); 6816 6871 return false; -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r263281 r264371 302 302 using Float32List = TypedList<Float32Array, float>; 303 303 using Int32List = TypedList<Int32Array, int>; 304 using Uint32List = TypedList<Uint32Array, uint32_t>; 304 305 305 306 void uniform1f(const WebGLUniformLocation*, GCGLfloat x); … … 950 951 951 952 // Helper function to validate input parameters for uniform functions. 952 bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Float32List&, GCGLsizei mod); 953 bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Int32List&, GCGLsizei mod); 954 bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, void*, GCGLsizei, GCGLsizei mod); 955 bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GCGLboolean transpose, const Float32List&, GCGLsizei mod); 956 bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GCGLboolean transpose, const void*, GCGLsizei, GCGLsizei mod); 953 bool validateUniformLocation(const char* functionName, const WebGLUniformLocation*); 954 bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Float32List&, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength); 955 bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Int32List&, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength); 956 bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Uint32List&, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength); 957 bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, void*, GCGLsizei, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength); 958 bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GCGLboolean transpose, const Float32List&, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength); 959 bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GCGLboolean transpose, const void*, GCGLsizei, GCGLsizei requiredMinSize, GCGLuint srcOffset, GCGLuint srcLength); 957 960 958 961 // Helper function to validate parameters for bufferData. -
trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h
r263281 r264371 1024 1024 virtual void getUniformfv(PlatformGLObject program, GCGLint location, GCGLfloat* value) = 0; 1025 1025 virtual void getUniformiv(PlatformGLObject program, GCGLint location, GCGLint* value) = 0; 1026 virtual void getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value) = 0; 1026 1027 1027 1028 virtual GCGLint getUniformLocation(PlatformGLObject, const String& name) = 0; -
trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
r263999 r264371 1710 1710 } 1711 1711 1712 void GraphicsContextGLOpenGL::getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value) 1713 { 1714 makeContextCurrent(); 1715 gl::GetUniformuiv(program, location, value); 1716 } 1717 1712 1718 GCGLint GraphicsContextGLOpenGL::getUniformLocation(PlatformGLObject program, const String& name) 1713 1719 { … … 2287 2293 GCGLint GraphicsContextGLOpenGL::getFragDataLocation(PlatformGLObject program, const String& name) 2288 2294 { 2289 UNUSED_PARAM(program); 2290 UNUSED_PARAM(name); 2291 2292 return 0; 2295 makeContextCurrent(); 2296 return gl::GetFragDataLocation(program, name.utf8().data()); 2293 2297 } 2294 2298 2295 2299 void GraphicsContextGLOpenGL::uniform1ui(GCGLint location, GCGLuint v0) 2296 2300 { 2297 UNUSED_PARAM(location);2298 UNUSED_PARAM(v0);2301 makeContextCurrent(); 2302 gl::Uniform1ui(location, v0); 2299 2303 } 2300 2304 2301 2305 void GraphicsContextGLOpenGL::uniform2ui(GCGLint location, GCGLuint v0, GCGLuint v1) 2302 2306 { 2303 UNUSED_PARAM(location); 2304 UNUSED_PARAM(v0); 2305 UNUSED_PARAM(v1); 2307 makeContextCurrent(); 2308 gl::Uniform2ui(location, v0, v1); 2306 2309 } 2307 2310 2308 2311 void GraphicsContextGLOpenGL::uniform3ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2) 2309 2312 { 2310 UNUSED_PARAM(location); 2311 UNUSED_PARAM(v0); 2312 UNUSED_PARAM(v1); 2313 UNUSED_PARAM(v2); 2313 makeContextCurrent(); 2314 gl::Uniform3ui(location, v0, v1, v2); 2314 2315 } 2315 2316 2316 2317 void GraphicsContextGLOpenGL::uniform4ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2, GCGLuint v3) 2317 2318 { 2318 UNUSED_PARAM(location); 2319 UNUSED_PARAM(v0); 2320 UNUSED_PARAM(v1); 2321 UNUSED_PARAM(v2); 2322 UNUSED_PARAM(v3); 2319 makeContextCurrent(); 2320 gl::Uniform4ui(location, v0, v1, v2, v3); 2323 2321 } 2324 2322 2325 2323 void GraphicsContextGLOpenGL::uniform1uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength) 2326 2324 { 2327 UNUSED_PARAM(location); 2328 UNUSED_PARAM(data); 2329 UNUSED_PARAM(srcOffset); 2330 UNUSED_PARAM(srcLength); 2325 makeContextCurrent(); 2326 gl::Uniform1uiv(location, srcLength, data + srcOffset); 2331 2327 } 2332 2328 2333 2329 void GraphicsContextGLOpenGL::uniform2uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength) 2334 2330 { 2335 UNUSED_PARAM(location); 2336 UNUSED_PARAM(data); 2337 UNUSED_PARAM(srcOffset); 2338 UNUSED_PARAM(srcLength); 2331 makeContextCurrent(); 2332 gl::Uniform2uiv(location, srcLength, data + srcOffset); 2339 2333 } 2340 2334 2341 2335 void GraphicsContextGLOpenGL::uniform3uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength) 2342 2336 { 2343 UNUSED_PARAM(location); 2344 UNUSED_PARAM(data); 2345 UNUSED_PARAM(srcOffset); 2346 UNUSED_PARAM(srcLength); 2337 makeContextCurrent(); 2338 gl::Uniform3uiv(location, srcLength, data + srcOffset); 2347 2339 } 2348 2340 2349 2341 void GraphicsContextGLOpenGL::uniform4uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength) 2350 2342 { 2351 UNUSED_PARAM(location); 2352 UNUSED_PARAM(data); 2353 UNUSED_PARAM(srcOffset); 2354 UNUSED_PARAM(srcLength); 2343 makeContextCurrent(); 2344 gl::Uniform4uiv(location, srcLength, data + srcOffset); 2355 2345 } 2356 2346 2357 2347 void GraphicsContextGLOpenGL::uniformMatrix2x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2358 2348 { 2359 UNUSED_PARAM(location); 2360 UNUSED_PARAM(transpose); 2361 UNUSED_PARAM(data); 2362 UNUSED_PARAM(srcOffset); 2363 UNUSED_PARAM(srcLength); 2349 makeContextCurrent(); 2350 gl::UniformMatrix2x3fv(location, srcLength, transpose, data + srcOffset); 2364 2351 } 2365 2352 2366 2353 void GraphicsContextGLOpenGL::uniformMatrix3x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2367 2354 { 2368 UNUSED_PARAM(location); 2369 UNUSED_PARAM(transpose); 2370 UNUSED_PARAM(data); 2371 UNUSED_PARAM(srcOffset); 2372 UNUSED_PARAM(srcLength); 2355 makeContextCurrent(); 2356 gl::UniformMatrix3x2fv(location, srcLength, transpose, data + srcOffset); 2373 2357 } 2374 2358 2375 2359 void GraphicsContextGLOpenGL::uniformMatrix2x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2376 2360 { 2377 UNUSED_PARAM(location); 2378 UNUSED_PARAM(transpose); 2379 UNUSED_PARAM(data); 2380 UNUSED_PARAM(srcOffset); 2381 UNUSED_PARAM(srcLength); 2361 makeContextCurrent(); 2362 gl::UniformMatrix2x4fv(location, srcLength, transpose, data + srcOffset); 2382 2363 } 2383 2364 2384 2365 void GraphicsContextGLOpenGL::uniformMatrix4x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2385 2366 { 2386 UNUSED_PARAM(location); 2387 UNUSED_PARAM(transpose); 2388 UNUSED_PARAM(data); 2389 UNUSED_PARAM(srcOffset); 2390 UNUSED_PARAM(srcLength); 2367 makeContextCurrent(); 2368 gl::UniformMatrix4x2fv(location, srcLength, transpose, data + srcOffset); 2391 2369 } 2392 2370 2393 2371 void GraphicsContextGLOpenGL::uniformMatrix3x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2394 2372 { 2395 UNUSED_PARAM(location); 2396 UNUSED_PARAM(transpose); 2397 UNUSED_PARAM(data); 2398 UNUSED_PARAM(srcOffset); 2399 UNUSED_PARAM(srcLength); 2373 makeContextCurrent(); 2374 gl::UniformMatrix3x4fv(location, srcLength, transpose, data + srcOffset); 2400 2375 } 2401 2376 2402 2377 void GraphicsContextGLOpenGL::uniformMatrix4x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2403 2378 { 2404 UNUSED_PARAM(location); 2405 UNUSED_PARAM(transpose); 2406 UNUSED_PARAM(data); 2407 UNUSED_PARAM(srcOffset); 2408 UNUSED_PARAM(srcLength); 2379 makeContextCurrent(); 2380 gl::UniformMatrix4x3fv(location, srcLength, transpose, data + srcOffset); 2409 2381 } 2410 2382 … … 2705 2677 void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2706 2678 { 2707 UNUSED_PARAM(location); 2708 UNUSED_PARAM(data); 2709 UNUSED_PARAM(srcOffset); 2710 UNUSED_PARAM(srcLength); 2679 makeContextCurrent(); 2680 gl::Uniform1fv(location, srcLength, data + srcOffset); 2711 2681 } 2712 2682 2713 2683 void GraphicsContextGLOpenGL::uniform2fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2714 2684 { 2715 UNUSED_PARAM(location); 2716 UNUSED_PARAM(data); 2717 UNUSED_PARAM(srcOffset); 2718 UNUSED_PARAM(srcLength); 2685 makeContextCurrent(); 2686 gl::Uniform2fv(location, srcLength, data + srcOffset); 2719 2687 } 2720 2688 2721 2689 void GraphicsContextGLOpenGL::uniform3fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2722 2690 { 2723 UNUSED_PARAM(location); 2724 UNUSED_PARAM(data); 2725 UNUSED_PARAM(srcOffset); 2726 UNUSED_PARAM(srcLength); 2691 makeContextCurrent(); 2692 gl::Uniform3fv(location, srcLength, data + srcOffset); 2727 2693 } 2728 2694 2729 2695 void GraphicsContextGLOpenGL::uniform4fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2730 2696 { 2731 UNUSED_PARAM(location); 2732 UNUSED_PARAM(data); 2733 UNUSED_PARAM(srcOffset); 2734 UNUSED_PARAM(srcLength); 2697 makeContextCurrent(); 2698 gl::Uniform4fv(location, srcLength, data + srcOffset); 2735 2699 } 2736 2700 2737 2701 void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength) 2738 2702 { 2739 UNUSED_PARAM(location); 2740 UNUSED_PARAM(data); 2741 UNUSED_PARAM(srcOffset); 2742 UNUSED_PARAM(srcLength); 2703 makeContextCurrent(); 2704 gl::Uniform1iv(location, srcLength, data + srcOffset); 2743 2705 } 2744 2706 2745 2707 void GraphicsContextGLOpenGL::uniform2iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength) 2746 2708 { 2747 UNUSED_PARAM(location); 2748 UNUSED_PARAM(data); 2749 UNUSED_PARAM(srcOffset); 2750 UNUSED_PARAM(srcLength); 2709 makeContextCurrent(); 2710 gl::Uniform2iv(location, srcLength, data + srcOffset); 2751 2711 } 2752 2712 2753 2713 void GraphicsContextGLOpenGL::uniform3iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength) 2754 2714 { 2755 UNUSED_PARAM(location); 2756 UNUSED_PARAM(data); 2757 UNUSED_PARAM(srcOffset); 2758 UNUSED_PARAM(srcLength); 2715 makeContextCurrent(); 2716 gl::Uniform3iv(location, srcLength, data + srcOffset); 2759 2717 } 2760 2718 2761 2719 void GraphicsContextGLOpenGL::uniform4iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength) 2762 2720 { 2763 UNUSED_PARAM(location); 2764 UNUSED_PARAM(data); 2765 UNUSED_PARAM(srcOffset); 2766 UNUSED_PARAM(srcLength); 2721 makeContextCurrent(); 2722 gl::Uniform4iv(location, srcLength, data + srcOffset); 2767 2723 } 2768 2724 2769 2725 void GraphicsContextGLOpenGL::uniformMatrix2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2770 2726 { 2771 UNUSED_PARAM(location); 2772 UNUSED_PARAM(transpose); 2773 UNUSED_PARAM(data); 2774 UNUSED_PARAM(srcOffset); 2775 UNUSED_PARAM(srcLength); 2727 makeContextCurrent(); 2728 gl::UniformMatrix2fv(location, srcLength, transpose, data + srcOffset); 2776 2729 } 2777 2730 2778 2731 void GraphicsContextGLOpenGL::uniformMatrix3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2779 2732 { 2780 UNUSED_PARAM(location); 2781 UNUSED_PARAM(transpose); 2782 UNUSED_PARAM(data); 2783 UNUSED_PARAM(srcOffset); 2784 UNUSED_PARAM(srcLength); 2733 makeContextCurrent(); 2734 gl::UniformMatrix3fv(location, srcLength, transpose, data + srcOffset); 2785 2735 } 2786 2736 2787 2737 void GraphicsContextGLOpenGL::uniformMatrix4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2788 2738 { 2789 UNUSED_PARAM(location); 2790 UNUSED_PARAM(transpose); 2791 UNUSED_PARAM(data); 2792 UNUSED_PARAM(srcOffset); 2793 UNUSED_PARAM(srcLength); 2739 makeContextCurrent(); 2740 gl::UniformMatrix4fv(location, srcLength, transpose, data + srcOffset); 2794 2741 } 2795 2742 -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h
r263281 r264371 295 295 void getUniformfv(PlatformGLObject program, GCGLint location, GCGLfloat* value) final; 296 296 void getUniformiv(PlatformGLObject program, GCGLint location, GCGLint* value) final; 297 void getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value) final; 297 298 GCGLint getUniformLocation(PlatformGLObject, const String& name) final; 298 299 void getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLfloat* value) final; -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp
r263281 r264371 1823 1823 } 1824 1824 1825 void GraphicsContextGLOpenGL::getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value) 1826 { 1827 UNUSED_PARAM(program); 1828 UNUSED_PARAM(location); 1829 UNUSED_PARAM(value); 1830 } 1831 1825 1832 GCGLint GraphicsContextGLOpenGL::getUniformLocation(PlatformGLObject program, const String& name) 1826 1833 {
Note: See TracChangeset
for help on using the changeset viewer.