(fragmentShader: WebGLShader)
| 329 | } |
| 330 | |
| 331 | public createProgram(fragmentShader: WebGLShader): GPGPUContextProgram { |
| 332 | this.throwIfDisposed(); |
| 333 | const gl = this.gl; |
| 334 | if (this.vertexShader == null) { |
| 335 | this.vertexShader = gpgpu_util.createVertexShader(gl); |
| 336 | } |
| 337 | const program: WebGLProgram = webgl_util.createProgram(gl); |
| 338 | webgl_util.callAndCheck( |
| 339 | gl, () => gl.attachShader(program, this.vertexShader)); |
| 340 | webgl_util.callAndCheck(gl, () => gl.attachShader(program, fragmentShader)); |
| 341 | webgl_util.linkProgram(gl, program); |
| 342 | |
| 343 | const program2 = Object.assign(program, {vao: this.createVertexArray()}); |
| 344 | if (this.debug) { |
| 345 | webgl_util.validateProgram(gl, program2); |
| 346 | } |
| 347 | return program2; |
| 348 | } |
| 349 | |
| 350 | public buildVao(program: GPGPUContextProgram) { |
| 351 | this.setProgram(program); |
no test coverage detected