playcanvas / playcanvas/engine
Refactoring of StencilParameters
@mvaligursky is already working on this.
Since Apr 14, 2023.
- Dominant language
- JavaScript
- Stars
- 16.8k
- Forks
- 2k
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 222
Description
We have existing StencilParameters class, which is implemented to support all WebGL stencil related functionality. This class is used for WebGPU stencil functionality as well, but as the API is different (simpler), we should consider refactoring.
Currently to set up a stencil buffer use, we need front and back instances of Stencil parameters. WebGPU uses shared ref, readMask and writeMask parameters, and so only their values from frontStencil are used, and values in backStencil are ignored.
We should instead model the API based on the WebGPU, that's how it's internally used by elements system as well.
We should create StencilState, which would contain a single copy of ref, readMask and WriteMask values. Internally, it would also have front and back versions of the remained of the parameters.
We could also use BitMask to store those values in a smaller number of numbers, allowing faster implementation of .key, .copy and .compare.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.