{"record":{"id":"352bbc38888da74b","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-352bbc","errorCode":null,"errorMessage":"Failed to create WebGL texture","messagePattern":"Failed to create WebGL texture","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/shrinkwrap.ts","lineNumber":496,"sourceCode":"\t\tif (!vbo) {\n\t\t\tthrow new Error('Failed to create WebGL buffer');\n\t\t}\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n\t\tgl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);\n\n\t\tconst aPos = gl.getAttribLocation(program, 'aPos');\n\t\tconst aUv = gl.getAttribLocation(program, 'aUv');\n\t\tgl.enableVertexAttribArray(aPos);\n\t\tgl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);\n\t\tgl.enableVertexAttribArray(aUv);\n\t\tgl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);\n\n\t\tgl.bindVertexArray(null);\n\n\t\tconst texture = gl.createTexture();\n\t\tif (!texture) {\n\t\t\tthrow new Error('Failed to create WebGL texture');\n\t\t}\n\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.bindTexture(gl.TEXTURE_2D, null);\n\n\t\treturn {\n\t\t\tgl,\n\t\t\tprogram,\n\t\t\tvao,\n\t\t\tvbo,\n\t\t\ttexture,\n\t\t\tuSource: gl.getUniformLocation(program, 'uSource'),\n\t\t\tuResolution: gl.getUniformLocation(program, 'uResolution'),\n\t\t\tuAmount: gl.getUniformLocation(program, 'uAmount'),","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/shrinkwrap.ts#L478-L514","documentation":"The shrinkwrap() effect's setup function calls gl.createTexture() to allocate the source texture for the input frame. If the WebGL2 driver returns null, the effect throws this Error. Texture allocation failure typically indicates VRAM exhaustion, especially likely given the shrinkwrap shader's memory-intensive operations.","triggerScenarios":"Calling shrinkwrap() when the GPU cannot allocate a texture — VRAM exhaustion from large frame sizes, many concurrent effects each holding textures, or a software renderer with hard texture memory limits. The shrinkwrap effect's complex shader compounds memory pressure.","commonSituations":"High-resolution renders (4K+) that exceed software renderer texture caps; many concurrent effect instances each with their own texture; SwiftShader/llvmpipe backends with limited texture memory; context-loss invalidating previously allocated resources.","solutions":["Reduce output resolution to lower per-frame texture memory requirements.","Lower concurrency so fewer effect textures are live simultaneously.","Ensure GPU hardware acceleration is active.","Use a host with adequate VRAM for the target resolution."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// Probe texture allocation capability\nfunction canCreateTexture(canvas: HTMLCanvasElement): boolean {\n  const gl = canvas.getContext('webgl2');\n  if (!gl) return false;\n  const tex = gl.createTexture();\n  const ok = tex !== null;\n  if (tex) gl.deleteTexture(tex);\n  return ok;\n}","typeGuard":"null","tryCatchPattern":"try {\n  shrinkwrap({ amount: 1 });\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create WebGL texture') {\n    console.warn('WebGL2 texture allocation failed — try reducing resolution or concurrency');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Reduce output resolution to lower per-frame texture memory.","Lower concurrency so fewer effect textures are live simultaneously.","Ensure GPU hardware acceleration is active.","Use a host with adequate VRAM for the target resolution."],"tags":["webgl2","gpu","resource-allocation","texture","memory"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}