(framebuffer)
| 1328 | } |
| 1329 | |
| 1330 | validateFramebufferFormats(framebuffer) { |
| 1331 | const gl = this.GL; |
| 1332 | |
| 1333 | if ( |
| 1334 | framebuffer.useDepth && |
| 1335 | this.webglVersion === constants.WEBGL && |
| 1336 | !gl.getExtension('WEBGL_depth_texture') |
| 1337 | ) { |
| 1338 | console.warn( |
| 1339 | 'Unable to create depth textures in this environment. Falling back ' + |
| 1340 | 'to a framebuffer without depth.' |
| 1341 | ); |
| 1342 | framebuffer.useDepth = false; |
| 1343 | } |
| 1344 | |
| 1345 | if ( |
| 1346 | framebuffer.useDepth && |
| 1347 | this.webglVersion === constants.WEBGL && |
| 1348 | framebuffer.depthFormat === constants.FLOAT |
| 1349 | ) { |
| 1350 | console.warn( |
| 1351 | 'FLOAT depth format is unavailable in WebGL 1. ' + |
| 1352 | 'Defaulting to UNSIGNED_INT.' |
| 1353 | ); |
| 1354 | framebuffer.depthFormat = constants.UNSIGNED_INT; |
| 1355 | } |
| 1356 | |
| 1357 | if (![ |
| 1358 | constants.UNSIGNED_BYTE, |
| 1359 | constants.FLOAT, |
| 1360 | constants.HALF_FLOAT |
| 1361 | ].includes(framebuffer.format)) { |
| 1362 | console.warn( |
| 1363 | 'Unknown Framebuffer format. ' + |
| 1364 | 'Please use UNSIGNED_BYTE, FLOAT, or HALF_FLOAT. ' + |
| 1365 | 'Defaulting to UNSIGNED_BYTE.' |
| 1366 | ); |
| 1367 | framebuffer.format = constants.UNSIGNED_BYTE; |
| 1368 | } |
| 1369 | if (framebuffer.useDepth && ![ |
| 1370 | constants.UNSIGNED_INT, |
| 1371 | constants.FLOAT |
| 1372 | ].includes(framebuffer.depthFormat)) { |
| 1373 | console.warn( |
| 1374 | 'Unknown Framebuffer depth format. ' + |
| 1375 | 'Please use UNSIGNED_INT or FLOAT. Defaulting to FLOAT.' |
| 1376 | ); |
| 1377 | framebuffer.depthFormat = constants.FLOAT; |
| 1378 | } |
| 1379 | |
| 1380 | const support = checkWebGLCapabilities(this); |
| 1381 | if (!support.float && framebuffer.format === constants.FLOAT) { |
| 1382 | console.warn( |
| 1383 | 'This environment does not support FLOAT textures. ' + |
| 1384 | 'Falling back to UNSIGNED_BYTE.' |
| 1385 | ); |
| 1386 | framebuffer.format = constants.UNSIGNED_BYTE; |
| 1387 | } |
no test coverage detected