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

[Android]: API 'mesh.path:update' index data not update #390

Closed
zhiyangyou opened this issue May 5, 2022 · 17 comments
Closed

[Android]: API 'mesh.path:update' index data not update #390

zhiyangyou opened this issue May 5, 2022 · 17 comments

Comments

@zhiyangyou
Copy link

zhiyangyou commented May 5, 2022

  • Device: Android Simulator On Windows (夜神模拟器 6.6.1.2)
  • OS: Android5 5.1.1
  • solar2D code Version: branch : master commit : e5217ec

Describe the bug
on windows simulator , API 'mesh.path:update' work normally
on android platform , API 'mesh.path:update' does not work, seem to that IBO has not been updated
this bug will show by gif image

test demo
assets2.zip

bug
index_no_update
bug fixed??
index_no_update_maybe_fixed

Since I am not familiar with the source code, I am not sure if this modification is correct,
in Rtt_GlGeometry.cpp line:301,
bind target IBO
bufferSubData IBO
bind GL_ELEMENT_ARRAY_BUFFER to 0

Looking forward to your reply , thanks

@Shchvova
Copy link
Contributor

Shchvova commented May 7, 2022

Hey. May I ask to try in latest build?

@zhiyangyou
Copy link
Author

Hey. May I ask to try in latest build?

Thank you for your reply
Bug still exist
mesh_update_bug3

@zhiyangyou
Copy link
Author

In my application, I intergrate a spine animation system to engine .
In order to update mesh data more quickly, I take part of the business logic to c + + layer, direct access ShapeObject.ClosePath.TesselatorMesh and update it's mesh data

@depilz
Copy link
Contributor

depilz commented May 10, 2022

Hi @zhiyangyou , you are right, I already fixed this in Spine but haven't shared it since it is not the fix we really need.

Which Spine Runtime version are you using?

@zhiyangyou
Copy link
Author

zhiyangyou commented May 11, 2022

Thank you for reply @depilz

The "spine" version I use is:
spine-runtimes
Branch: 4.0
commit:b8da2fa27bd7fbdc09c041c12424a2d8df70e041
I integrated the spine-cpp library into my application and re-implemented the adapter between spine-runtime.lib and corona engine using c++, like spine-solar2d/spine.lua

Because ShapeObject was reused and index data was not pushed to the GPU side during the Verts UVs Indices update.
I am now looking forward to the author's repair

And I suggest that spine with cliperAttachment be added to the "solar2d-spine" test case
Such as "coin"
I used solar2d-spine of the above version for this picture
image

@depilz
Copy link
Contributor

depilz commented May 11, 2022

Woow! For real? Having Spine running in C++ would be an incredible boost in performance!
Did you made it as a plugin?

I'm working with Spine 3.9, but I'm going to update 4.0 too and share the fix in a moment.

@depilz
Copy link
Contributor

depilz commented May 11, 2022

@zhiyangyou This is it:

spine-4-0.txt

@zhiyangyou
Copy link
Author

@zhiyangyou This is it:

spine-4-0.txt

Thanks for sharing
I see the areEqual method, which avoids index updates

@zhiyangyou
Copy link
Author

zhiyangyou commented May 11, 2022

Woow! For real? Having Spine running in C++ would be an incredible boost in performance! Did you made it as a plugin?

I'm working with Spine 3.9, but I'm going to update 4.0 too and share the fix in a moment.

I modified the Rtt_LuaLibDisplay.cpp file and added the display.newspine() method,
There are no plugin yet, also, I don't think it's easy to plug , because of the source code modification

Using spine-cpp did improve performance a lot in my tests

  1. Memory usage is lower
  2. Avoid a lot of Lua gc and memory allocation time
  3. Avoid the time consumption of data transfer in Lua-C interactive stack
  4. Use ShapeObject pool to avoid the time spent constructing many objects (paint Mesh) , but pool cost more memory usage , special in spine with clipper

@depilz
Copy link
Contributor

depilz commented May 11, 2022

That's exactly what I wanted to do! But didn't know C++ enough to do that task alone.

When I made the tests, most of the delay was caused by running the runtime and only a small portion by the drawing itself, so migrating to C++ was my hope.

If you have a public fork of this I would love to collaborate and help making this officially part of the engine.

@zhiyangyou
Copy link
Author

zhiyangyou commented May 11, 2022

That's exactly what I wanted to do! But didn't know C++ enough to do that task alone.

When I made the tests, most of the delay was caused by running the runtime and only a small portion by the drawing itself, so migrating to C++ was my hope.

If you have a public fork of this I would love to collaborate and help making this officially part of the engine.

Currently in development,there are still some issues that have not been dealt with , using Corona's memory management, disk IO, assetsPath , bug fix , .etc
It may take some times, then I will push the code to the repository I forked.And I will notify you here. Very little code that works

@ggcrunchy
Copy link
Contributor

Hi. @depilz brought this up on Discord and there were some comments there: https://discord.com/channels/721785436195782677/721785436195782680/973953535035199498

I'm StarCrunch there and was wondering some things myself. Do you know all the parts where you need to integrate with the engine, versus where it's convenient?

@ggcrunchy
Copy link
Contributor

@zhiyangyou Hi. Something I saw just now:

Vertex array objects are disabled on Android, so you go through this path: https://github.com/coronalabs/corona/blob/master/librtt/Renderer/Rtt_GLGeometry.cpp#L282

But that's missing the index update bits from further up: https://github.com/coronalabs/corona/blob/master/librtt/Renderer/Rtt_GLGeometry.cpp#L268 This seems to be exactly your situation.

@zhiyangyou
Copy link
Author

zhiyangyou commented May 14, 2022

Hi. @depilz brought this up on Discord and there were some comments there: https://discord.com/channels/721785436195782677/721785436195782680/973953535035199498

I'm StarCrunch there and was wondering some things myself. Do you know all the parts where you need to integrate with the engine, versus where it's convenient?

hi @depilz corona_spine_cpp_adapter demo code https://github.com/zhiyangyou/corona/blob/master_spine_cpp_intergration_test/Corona%26SpineCppREADME.md
Frame rate comparison
https://github.com/zhiyangyou/corona/tree/master_spine_cpp_intergration_test/doc_images

I can not access this discord channel , discord user name zhiyangyou#5364

@zhiyangyou
Copy link
Author

My problem is solved, thank you for your kind help

@depilz
Copy link
Contributor

depilz commented May 14, 2022

Wooah!! That's amazing! Thanks for this big contribution @zhiyangyou.

The discussion was about what is the best way to make this officially part of the engine, and that's probably making it a plugin, and I'm gonna work on it.

@Shchvova
Copy link
Contributor

We got set of pull requests to make it possible for this to be a plug-in.
Probably should get back to them.

zhiyangyou added a commit to dianchu/corona that referenced this issue Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants