| 204 | } |
| 205 | |
| 206 | export function validateTextureSize(width: number, height: number) { |
| 207 | const maxTextureSize = env().getNumber('WEBGL_MAX_TEXTURE_SIZE'); |
| 208 | if ((width <= 0) || (height <= 0)) { |
| 209 | const requested = `[${width}x${height}]`; |
| 210 | throw new Error('Requested texture size ' + requested + ' is invalid.'); |
| 211 | } |
| 212 | if ((width > maxTextureSize) || (height > maxTextureSize)) { |
| 213 | const requested = `[${width}x${height}]`; |
| 214 | const max = `[${maxTextureSize}x${maxTextureSize}]`; |
| 215 | throw new Error( |
| 216 | 'Requested texture size ' + requested + |
| 217 | ' greater than WebGL maximum on this browser / GPU ' + max + '.'); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | export function createFramebuffer(gl: WebGLRenderingContext): WebGLFramebuffer { |
| 222 | return throwIfNull<WebGLFramebuffer>( |