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

Fix spriteDisableBatching tag failure #2261

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

cptbtptpbcptdtptp
Copy link
Collaborator

@cptbtptpbcptdtptp cptbtptpbcptdtptp commented Jul 24, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

Summary by CodeRabbit

  • New Features

    • Enhanced sprite batching logic allowing for more control over rendering based on shader tags.
    • Introduced a mechanism to disable sprite batching through shader properties.
  • Bug Fixes

    • Removed obsolete property that could cause confusion regarding sprite batching management.

Copy link

coderabbitai bot commented Jul 24, 2024

Walkthrough

The recent changes focus on refining the sprite batching functionality within the rendering engine. The removal of the _canSpriteBatch property from the Engine class signals a shift in sprite management, while the introduction of the _disableBatchTag in the BatchUtils class enhances control over whether batching can occur based on specific shader tags. Together, these adjustments improve the flexibility and efficiency of sprite rendering.

Changes

Files Change Summary
.../Engine.ts Removed the _canSpriteBatch boolean property from the Engine class, indicating a potential refactor in sprite batching.
.../BatchUtils.ts Added _disableBatchTag, which checks for a tag in the canBatchSprite method, enhancing sprite batching control via shaders.

Poem

🐰 In the world of sprites, so bright and bold,
We’ve tidied our batching, a story retold.
With a flick of a tag, we’ll dance and we’ll play,
No more unnecessary batches in our way!
Hopping through pixels, our joy now refined,
Let’s render some magic, a feast for the mind! ✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cptbtptpbcptdtptp
Copy link
Collaborator Author

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 69.18%. Comparing base (4cc191e) to head (b883ade).
Report is 44 commits behind head on dev/1.3.

Files Patch % Lines
packages/core/src/RenderPipeline/BatchUtils.ts 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           dev/1.3    #2261      +/-   ##
===========================================
+ Coverage    68.27%   69.18%   +0.91%     
===========================================
  Files          468      523      +55     
  Lines        24353    27381    +3028     
  Branches      3632     4094     +462     
===========================================
+ Hits         16626    18944    +2318     
- Misses        6400     6948     +548     
- Partials      1327     1489     +162     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
packages/core/src/RenderPipeline/BatchUtils.ts (1)

12-13: Test coverage needed for canBatchSprite method

The modification to the canBatchSprite method enhances control over sprite batching. However, it appears that this method is not currently covered by tests.

  • File: packages/core/src/RenderPipeline/BatchUtils.ts
  • Method: canBatchSprite

Please ensure that this method is covered by appropriate tests to validate its functionality.

Analysis chain

LGTM! But ensure test coverage.

The modification in the canBatchSprite method is correct and enhances control over sprite batching.

However, ensure that this change is covered by tests.

# If tests are missing, consider adding the following test case:

def test_can_batch_sprite_disable_batch_tag():
    elementA = SubRenderElement()
    elementB = SubRenderElement()
    elementB.shaderPasses[0].setTagValue(BatchUtils._disableBatchTag, True)
    assert not BatchUtils.canBatchSprite(elementA, elementB)
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the modified `canBatchSprite` method is covered by tests.

# Test: Search for tests related to `canBatchSprite`. Expect: Test files containing `canBatchSprite`.
rg --type python -A 5 'canBatchSprite'

Length of output: 69


Script:

#!/bin/bash
# Description: Verify if the modified `canBatchSprite` method is covered by tests.

# Test: Search for tests related to `canBatchSprite`. Expect: Test files containing `canBatchSprite`.
rg 'canBatchSprite'

Length of output: 607

Tools
GitHub Check: codecov/patch

[warning] 13-13: packages/core/src/RenderPipeline/BatchUtils.ts#L13
Added line #L13 was not covered by tests

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4e3f5a9 and b883ade.

Files selected for processing (2)
  • packages/core/src/Engine.ts (1 hunks)
  • packages/core/src/RenderPipeline/BatchUtils.ts (1 hunks)
Additional context used
GitHub Check: codecov/patch
packages/core/src/RenderPipeline/BatchUtils.ts

[warning] 13-13: packages/core/src/RenderPipeline/BatchUtils.ts#L13
Added line #L13 was not covered by tests

Additional comments not posted (1)
packages/core/src/RenderPipeline/BatchUtils.ts (1)

9-9: LGTM!

The addition of the _disableBatchTag property is correct and improves the flexibility of sprite batching.

@GuoLei1990 GuoLei1990 merged commit 5f9709c into galacean:dev/1.3 Jul 24, 2024
7 of 8 checks passed
@GuoLei1990 GuoLei1990 added the bug Something isn't working label Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2D bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants