Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply child stencils correctly to the clipping node #1957

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

rh101
Copy link
Contributor

@rh101 rh101 commented Jun 3, 2024

Fix incorrect reference count for original program states stored in collection

Describe your changes

When using different child stencils in a ClippingNode, the ProgramState applied to each child was exactly the same, resulting in incorrect output.

With this change, it now allows the developer to set whether the ClippingNode uses the same unique ProgramState per child stencil.

An existing issue is also fixed, due to the _originalStencilProgramState collection not retaining the ProgramState instances saved in it. These instances were being released by the parent node after being added to the _originalStencilProgramState, which meant that they may have been freed if their reference count became 0. The change in this PR ensures that they are correctly retained prior to being added to the collection.

This change will not affect existing usage, as the new functionality is optional.

Issue ticket number and link

#1956

Checklist before requesting a review

For each PR

  • Add Copyright if it missed:
    - "Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md)."

  • I have performed a self-review of my code.

    Optional:

    • I have checked readme and add important infos to this PR.
    • I have added/adapted some tests too.

For core/new feature PR

  • I have checked readme and add important infos to this PR.
  • I have added thorough tests.

Fix incorrect reference count for original program states stored in collection
@rh101 rh101 changed the title Child stencils are now applied correctly to the clipping node Apple child stencils correctly to the clipping node Jun 3, 2024
@rh101 rh101 changed the title Apple child stencils correctly to the clipping node Apply child stencils correctly to the clipping node Jun 3, 2024
@aismann
Copy link
Contributor

aismann commented Jun 3, 2024

Please add a new test to cpp_test too.

@rh101
Copy link
Contributor Author

rh101 commented Jun 3, 2024

Please add a new test to cpp_test too.

Test added. Output should be the following:
image

@halx99 halx99 merged commit 66ca90c into axmolengine:dev Jun 3, 2024
15 checks passed
@halx99 halx99 added this to the 2.1.4 milestone Jun 3, 2024
@halx99 halx99 added the enhancement New feature or request label Jun 3, 2024
@rh101 rh101 deleted the fix-issue1956 branch June 3, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants