GPURenderPassEncoder: phương thức setStencilReference()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
Phương thức setStencilReference() của giao diện GPURenderPassEncoder đặt giá trị tham chiếu stencil được sử dụng trong các bài kiểm tra stencil với thao tác stencil "replace" (như được đặt trong descriptor của phương thức GPUDevice.createRenderPipeline(), trong các thuộc tính định nghĩa các thao tác stencil khác nhau).
Cú pháp
setStencilReference(reference)
Tham số
reference-
Một số biểu diễn giá trị tham chiếu stencil mới để đặt cho lần thực thi kết xuất.
Note:
Nếu không có lệnh gọi setStencilReference() nào được thực hiện, giá trị tham chiếu stencil mặc định là 0 cho mỗi lần thực thi kết xuất.
Giá trị trả về
Không có (Undefined).
Ví dụ
// …
const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);
passEncoder.setPipeline(renderPipeline);
passEncoder.setVertexBuffer(0, vertexBuffer);
passEncoder.setStencilReference(1);
passEncoder.draw(3);
passEncoder.end();
// …
Thông số kỹ thuật
| Specification |
|---|
| WebGPU> # dom-gpurenderpassencoder-setstencilreference> |