playcanvas / playcanvas/engine

Refactoring of StencilParameters

Open
#5,244 0 comments 0 reactions 1 assignee View on GitHub

@mvaligursky is already working on this.

Since Apr 14, 2023.

area: graphics
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.