WebGLRenderingContext: validateProgram() method
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
TOK1_
Phương thức WebGLRenderingContext.validateProgram() của WebGL API xác nhận WebGLProgram. Nó kiểm tra xem nó có được liên kết thành công hay không và liệu nó có thể được sử dụng ở trạng thái WebGL hiện tại hay không.
Cú pháp
js
validateProgram(program)
Thông số
program-
Một
WebGLProgramđể xác thực.
Giá trị trả về
Không có (undefined).
Ví dụ
js
const program = gl.createProgram();
// Attach pre-existing shaders
gl.attachShader(program, vertexShader);
gl.attachShader(program, fragmentShader);
gl.linkProgram(program);
gl.validateProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
const info = gl.getProgramInfoLog(program);
throw new Error(`Could not compile WebGL program. \n\n${info}`);
}
gl.useProgram(program);
Thông số kỹ thuật
| Specification |
|---|
| WebGL Specification> # 5.14.9> |