Open SteveKChiu opened 4 years ago
I can't reproduce this, I added a test to the example (press H to toggle whether the drawn path in the bottom left widget is hidden) and it works for me. Can you provide we with a code snippet that reproduces it?
An issue that could trigger the observed behavior is if you don't upload new data to the device correctly. This could be better documented. So once per frame (when the device is not using any rvg resources for rendering, you e.g. have to make sure the rendering command submission has finished via a fence, you likely already have such a phase in your rendering engine where you update/recreate device resources) you have to call rvg::Context::upload
. I just submitted a change to master regarding that, make sure to pull. You probably don't use vpp (the underlying vulkan utility library) yourself, so you can just pass submit = true
as parameter to upload (that will lead to a command submission when new data is uploaded, if you use vpp you can bundle it with your own submissions and make it more efficient since vkQueueSubmit can be expensive). The function will return a boolean and a semaphore. If the boolean is true, device resources have changed and you have to re-record all rvg rendering. Additionally, if the semaphore is not VK_NULL_HANDLE, you have to wait for it (at stage = allGraphics) in your next rvg rendering submission.
I agree that this is not an easy-to-use api at this point but it's designed like this to make it efficient and possible to integrate into any engine. Suggestions on how this API can be improved to make it easier to use are appreciated.
We are using indirect drawing in shapes (more precisely in the underlying primitive, rvg::Polygon) so disabling/re-enabling should be quite cheap already.
Did this help? Feedback appreciated
I have tried the patch but the result is the same. If re-record is needed or I call renderer.invalidate(), then it works.
The disable method of various shapes don's not work correctly.