Creates a WebGL context without a window for headless rendering and server-side graphics
Overall
score
96%
Build a system that performs GPU-accelerated rendering operations and provides accurate progress tracking by synchronizing between GPU and CPU.
Create a module that executes multiple rendering passes and accurately tracks when each pass completes. The system must wait for the GPU to finish processing before reporting progress to the CPU.
Implement a function runComputationWithProgress(gl, passes, onProgress) that:
Each pass should:
The progress callback receives: { passIndex, totalPasses, completed } where:
passIndex is the zero-based index of the completed passtotalPasses is the total number of passescompleted is a boolean indicating if all passes are done@generates
/**
* Executes GPU computation passes with accurate progress tracking
* @param {WebGL2RenderingContext} gl - WebGL 2 context
* @param {Array<{color: [number, number, number, number]}>} passes - Array of pass configurations
* @param {Function} onProgress - Callback for progress updates
* @returns {Promise<void>} Resolves when all passes complete
*/
async function runComputationWithProgress(gl, passes, onProgress) {
// IMPLEMENTATION HERE
}
module.exports = { runComputationWithProgress };Provides WebGL 2 rendering context for headless GPU operations.
Install with Tessl CLI
npx tessl i tessl/npm-gldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10