Update texture data from a different thread is missing
After speaking with Mathias on PR #901. It was said to fix/add in Engine classes (Texture, TextureManager) the functionality of modifying the texture data on the cpu side by using the dirty parameter and making sure to update on the gpu side before rendering a frame with the renderer thread.
I'm not able to add assignee, I don't know why.
The PR #976 corrects this issue. If you use BaseApplication in your application, you have to use TextureManager::updateTextureContent function to update the texture. The texture data is sent to the gpu by the base application during the rendering process with the render thread. Take care if your texture data in cpu side is updating during the rendering (pending textures : cpu -> gpu). There is example added by the PR #976 : see TextureQuadDynamic examples.
PR is not merged yet. Reopening.
After discussing with @MathiasPaulin, an alternative solution to #976 could be:
- Add a
dirtybitattribute to the texture class. - In
texture::bind(), thedirtybitis checked. If yes, the texture updates the data from the CPU to the GPU.
With this approach, any system modifying the texture just has to set the dirtybit to true, as it is done for other objects in Radium. Also, this does not require any other change.
@hiergaut could you come up with a proposal implementing this approach ?
There is a question on which class own the data (even if the current proposal, but since the raw ptr is just kept until update, that seems quite good).
Yes, I can try, not today but probably tomorrow. I'll create another PR to do that.
Great thanks
I think now everything is merged.