Changeset 127452 in webkit
- Timestamp:
- Sep 4, 2012 2:37:41 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127449 r127452 1 2012-09-04 Andrey Adaikin <aandrey@chromium.org> 2 3 Web Inspector: [WebGL] Save gl.getError() status before taking a WebGL state snapshot and restore it afterwards 4 https://bugs.webkit.org/show_bug.cgi?id=95443 5 6 Reviewed by Vsevolod Vlasov. 7 8 Adds a test to check that we properly save the WebGL getError() status while doing the instrumentation. 9 10 * inspector/profiler/webgl/webgl-profiler-get-error-expected.txt: Added. 11 * inspector/profiler/webgl/webgl-profiler-get-error.html: Added. 12 * inspector/profiler/webgl/webgl-profiler-test.js: Added. 13 (initialize_WebGLProfilerTest.InspectorTest.enableWebGLAgent): 14 (initialize_WebGLProfilerTest): 15 (createWebGLContext): 16 1 17 2012-09-04 Alexander Pavlov <apavlov@chromium.org> 2 18 -
trunk/Source/WebCore/ChangeLog
r127449 r127452 1 2012-09-04 Andrey Adaikin <aandrey@chromium.org> 2 3 Web Inspector: [WebGL] Save gl.getError() status before taking a WebGL state snapshot and restore it afterwards 4 https://bugs.webkit.org/show_bug.cgi?id=95443 5 6 Reviewed by Vsevolod Vlasov. 7 8 Save gl.getError() status before taking the GL snapshot and restore it afterwards. 9 10 * inspector/InjectedScriptWebGLModuleSource.js: 11 (.): 12 1 13 2012-09-04 Alexander Pavlov <apavlov@chromium.org> 2 14 -
trunk/Source/WebCore/inspector/InjectedScriptWebGLModuleSource.js
r127426 r127452 340 340 }, 341 341 342 /** 343 * @param {*} result 344 */ 345 setResult: function(result) 346 { 347 this._result = result; 348 }, 349 342 350 freeze: function() 343 351 { … … 895 903 var gl = glResource.wrappedObject(); 896 904 var program = this.wrappedObject(); 905 906 var originalErrors = glResource.getAllErrors(); 897 907 898 908 var uniforms = []; … … 913 923 } 914 924 data.uniforms = uniforms; 925 926 glResource.restoreErrors(originalErrors); 915 927 }, 916 928 … … 1216 1228 1217 1229 /** 1230 * @return {Array.<number>} 1231 */ 1232 getAllErrors: function() 1233 { 1234 var errors = []; 1235 var gl = this.wrappedObject(); 1236 if (gl) { 1237 while (true) { 1238 var error = gl.getError(); 1239 if (error === gl.NO_ERROR) 1240 break; 1241 this.clearError(error); 1242 errors.push(error); 1243 } 1244 } 1245 if (this._customErrors) { 1246 for (var key in this._customErrors) { 1247 var error = Number(key); 1248 errors.push(error); 1249 } 1250 delete this._customErrors; 1251 } 1252 return errors; 1253 }, 1254 1255 /** 1256 * @param {Array.<number>} errors 1257 */ 1258 restoreErrors: function(errors) 1259 { 1260 var gl = this.wrappedObject(); 1261 if (gl) { 1262 var wasError = false; 1263 while (gl.getError() !== gl.NO_ERROR) 1264 wasError = true; 1265 console.assert(!wasError, "Error(s) while capturing current WebGL state."); 1266 } 1267 if (!errors.length) 1268 delete this._customErrors; 1269 else { 1270 this._customErrors = {}; 1271 for (var i = 0, n = errors.length; i < n; ++i) 1272 this._customErrors[errors[i]] = true; 1273 } 1274 }, 1275 1276 /** 1277 * @param {number} error 1278 */ 1279 clearError: function(error) 1280 { 1281 if (this._customErrors) 1282 delete this._customErrors[error]; 1283 }, 1284 1285 /** 1286 * @return {number} 1287 */ 1288 nextError: function() 1289 { 1290 if (this._customErrors) { 1291 for (var key in this._customErrors) { 1292 var error = Number(key); 1293 delete this._customErrors[error]; 1294 return error; 1295 } 1296 } 1297 delete this._customErrors; 1298 var gl = this.wrappedObject(); 1299 return gl ? gl.NO_ERROR : 0; 1300 }, 1301 1302 /** 1218 1303 * @override 1219 1304 * @param {Object} data … … 1225 1310 data.replayContextCallback = this._replayContextCallback; 1226 1311 1227 // FIXME: Save the getError() status and restore it after taking the GL state snapshot.1312 var originalErrors = this.getAllErrors(); 1228 1313 1229 1314 // Take a full GL state snapshot. … … 1234 1319 WebGLRenderingContextResource.StateParameters.forEach(function(parameter) { 1235 1320 glState[parameter] = Resource.toReplayable(gl.getParameter(gl[parameter]), cache); 1236 // FIXME: Call while(gl.getError() != gl.NO_ERROR) {...} to check if a particular parameter is supported.1237 1321 }); 1238 1322 … … 1267 1351 1268 1352 data.glState = glState; 1353 1354 this.restoreErrors(originalErrors); 1269 1355 }, 1270 1356 … … 1547 1633 this._call = new Call(this._glResource, this._functionName, this._args, this.result()); 1548 1634 return this._call; 1635 }, 1636 1637 /** 1638 * @param {*} result 1639 */ 1640 _overrideResult: function(result) 1641 { 1642 var call = this.call(); 1643 call.setResult(result); 1644 this._result = result; 1549 1645 } 1550 1646 } … … 1627 1723 customWrapFunction("framebufferTexture2D"); 1628 1724 customWrapFunction("renderbufferStorage"); 1725 1726 /** @this WebGLRenderingContextResource.WrapFunction */ 1727 wrapFunctions["getError"] = function() 1728 { 1729 var gl = this._originalObject; 1730 var error = this.result(); 1731 if (error !== gl.NO_ERROR) 1732 this._glResource.clearError(error); 1733 else { 1734 error = this._glResource.nextError(); 1735 if (error !== gl.NO_ERROR) 1736 this._overrideResult(error); 1737 } 1738 } 1629 1739 1630 1740 WebGLRenderingContextResource._wrapFunctions = wrapFunctions;
Note: See TracChangeset
for help on using the changeset viewer.