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

UI batching is broken for SoftMaskable elements #76

Closed
Arkarit opened this issue Apr 11, 2020 · 3 comments
Closed

UI batching is broken for SoftMaskable elements #76

Arkarit opened this issue Apr 11, 2020 · 3 comments
Assignees
Labels

Comments

@Arkarit
Copy link

Arkarit commented Apr 11, 2020

Describe the bug
SoftMaskable applies a cloned, modified unique material to each Graphic it belongs to. This breaks UI batching for all SoftMaskable elements completely.

To Reproduce
Steps to reproduce the behavior:

  1. Create a parent container with a SoftMask
  2. Add ~20 of TextMeshPro child elements with SoftMaskable
  3. Play
  4. Open and enable the Frame Debugger
  5. In the frame debugger, examine the draw calls: Each SoftMaskable child element issues an own draw call!

Also, the issue can be examined in the Profiler (UI/Render, "Batch breaking reason: Different material instance")

Environment (please complete the following information):

  • Platform: Windows 8.1
  • Unity: 2019.3.3f1 personal
  • SoftMaskForUGUI: v0.9.1

Additional context
The reason seems to be in SoftMaskable.GetModifiedMaterial().
For testing purposes, I simply added a dict to store already modified materials, which seems to fix the issue at first glance (but as I am not too deep into it, some additional checks might be necessary).
See attached patch.
SoftMaskForUGUI-test-fix-batching.txt

@Arkarit
Copy link
Author

Arkarit commented Apr 13, 2020

As more or less expected, the preliminary fix was not sufficient; an additional hash by SoftMask is necessary (see pull request)

@mob-sakai mob-sakai self-assigned this May 1, 2020
@mob-sakai mob-sakai added the enhancement New feature or request label May 1, 2020
@mob-sakai
Copy link
Owner

@Arkarit
Thank you for reporting!
I'm planning to introduce the material cache used by UIEffect.

mob-sakai added a commit that referenced this issue May 11, 2020
The rendering material is automatically generated. You don't need to pre-generate the material.
The generated materials are cached and properly batched.

Close #75, #76, #80

BREAKING CHANGE: The name of the custom SoftMaskable shader should be `<ShaderName> (SoftMaskable)`. For more information, see the "Support soft masks with your custom shaders" section of the README.
github-actions bot pushed a commit that referenced this issue May 11, 2020
# [1.0.0-preview.1](v0.10.0-preview.3...v1.0.0-preview.1) (2020-05-11)

### Bug Fixes

* Unintentional material destruction ([bc28cc3](bc28cc3))

### change

* change namespace ([7b740a7](7b740a7))

### Features

* support graphic connector ([b603646](b603646)), closes [#75](#75) [#76](#76) [#80](#80)

### BREAKING CHANGES

* If your code contained the SoftMask API, it would fail to compile. Please change the namespace from `Coffee.UIExtensions` to `Coffee.UISoftMask`.
* The name of the custom SoftMaskable shader should be `<ShaderName> (SoftMaskable)`. For more information, see the "Support soft masks with your custom shaders" section of the README.
mob-sakai added a commit that referenced this issue May 11, 2020
The rendering material is automatically generated. You don't need to pre-generate the material.
The generated materials are cached and properly batched.

Close #75, #76, #80

BREAKING CHANGE: The name of the custom SoftMaskable shader should be `<ShaderName> (SoftMaskable)`. For more information, see the ‘Support soft masks with your custom shaders’ section of the README.
github-actions bot pushed a commit that referenced this issue May 11, 2020
# [1.0.0-preview.1](v0.10.0-preview.3...v1.0.0-preview.1) (2020-05-11)

### Bug Fixes

* Unintentional material destruction ([0733243](0733243))

### change

* change namespace ([6a1a928](6a1a928))

### Features

* support graphic connector ([760f715](760f715)), closes [#75](#75) [#76](#76) [#80](#80)

### BREAKING CHANGES

* If your code contained the SoftMask API, it would fail to compile. Please change the namespace from `Coffee.UIExtensions` to `Coffee.UISoftMask`.
* The name of the custom SoftMaskable shader should be `<ShaderName> (SoftMaskable)`. For more information, see the ‘Support soft masks with your custom shaders’ section of the README.
mob-sakai added a commit that referenced this issue May 11, 2020
The rendering material is automatically generated. You don't need to pre-generate the material.
The generated materials are cached and properly batched.

Close #75, #76, #80

BREAKING CHANGE: The name of the custom SoftMaskable shader must be changed. For more information, see the ‘Support soft masks with your custom shaders’ section of the README.
github-actions bot pushed a commit that referenced this issue May 11, 2020
# [1.0.0-preview.1](v0.10.0-preview.3...v1.0.0-preview.1) (2020-05-11)

### Bug Fixes

* Unintentional material destruction ([ab71747](ab71747))

### change

* change namespace ([ad59523](ad59523))

### Features

* support graphic connector ([bd1ac08](bd1ac08)), closes [#75](#75) [#76](#76) [#80](#80)

### BREAKING CHANGES

* If your code contained the SoftMask API, it would fail to compile. Please change the namespace from `Coffee.UIExtensions` to `Coffee.UISoftMask`.
* The name of the custom SoftMaskable shader must be changed. For more information, see the ‘Support soft masks with your custom shaders’ section of the README.
github-actions bot pushed a commit that referenced this issue May 11, 2020
# [1.0.0-preview.1](v0.10.0-preview.3...v1.0.0-preview.1) (2020-05-11)

### Bug Fixes

* Unintentional material destruction ([ab71747](ab71747))

### change

* change namespace ([ad59523](ad59523))

### Features

* support graphic connector ([bd1ac08](bd1ac08)), closes [#75](#75) [#76](#76) [#80](#80)

### BREAKING CHANGES

* If your code contained the SoftMask API, it would fail to compile. Please change the namespace from `Coffee.UIExtensions` to `Coffee.UISoftMask`.
* The name of the custom SoftMaskable shader must be changed. For more information, see the ‘Support soft masks with your custom shaders’ section of the README.
github-actions bot pushed a commit that referenced this issue May 11, 2020
# [1.0.0-preview.1](v0.10.0-preview.3...v1.0.0-preview.1) (2020-05-11)

### Bug Fixes

* Unintentional material destruction ([ab71747](ab71747))

### change

* change namespace ([ad59523](ad59523))

### Features

* support graphic connector ([bd1ac08](bd1ac08)), closes [#75](#75) [#76](#76) [#80](#80)

### BREAKING CHANGES

* If your code contained the SoftMask API, it would fail to compile. Please change the namespace from  to .
* The name of the custom SoftMaskable shader must be changed. For more information, see the ‘Support soft masks with your custom shaders’ section of the README.
mob-sakai added a commit that referenced this issue May 11, 2020
The rendering material is automatically generated. You don't need to pre-generate the material.
The generated materials are cached and properly batched.

Close #75, close #76, close #80

BREAKING CHANGE: The name of the custom SoftMaskable shader must be changed. For more information, see the ‘Support soft masks with your custom shaders’ section of the README.
github-actions bot pushed a commit that referenced this issue May 11, 2020
# [1.0.0-preview.1](v0.10.0-preview.3...v1.0.0-preview.1) (2020-05-11)

### Bug Fixes

* Unintentional material destruction ([bf17b19](bf17b19))

### change

* change namespace ([0347b04](0347b04))

### Features

* support graphic connector ([3451521](3451521)), closes [#75](#75) [#76](#76) [#80](#80)

### BREAKING CHANGES

* If your code contained the SoftMask API, it would fail to compile. Please change the namespace from `Coffee.UIExtensions` to `Coffee.UISoftMask`.
* The name of the custom SoftMaskable shader must be changed. For more information, see the ‘Support soft masks with your custom shaders’ section of the README.
github-actions bot pushed a commit that referenced this issue May 11, 2020
# [1.0.0-preview.1](v0.10.0-preview.3...v1.0.0-preview.1) (2020-05-11)

### Bug Fixes

* Unintentional material destruction ([bf17b19](bf17b19))

### change

* change namespace ([0347b04](0347b04))

### Features

* support graphic connector ([3451521](3451521)), closes [#75](#75) [#76](#76) [#80](#80)

### BREAKING CHANGES

* If your code contained the SoftMask API, it would fail to compile. Please change the namespace from  to .
* The name of the custom SoftMaskable shader must be changed. For more information, see the ‘Support soft masks with your custom shaders’ section of the README.
@github-actions
Copy link

🎉 This issue has been resolved in version 1.0.0-preview.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants