Background Thread Texture Stiching

So as the Title Suggestions i am trying to do some Texture Stitching in a second thread for Asynchronous loading of assets, This only needs to be done when the game starts. At first i was thinking of using RenderTarget2Ds but of course you can not render with those on any other thread then the Main ui. So i decided to try and just set a Textures Data in stead of rendering, this causes OpenTK to throw an Access Violate is this a matter accessing the textures data on a second thread. I just want to be sure before i make some changes it is possible to work around this, i just want to be sure if this is the cause.

Sorry for the rambles and thanks for taking the time to read this.

Regards Scott Jensen

I think it is. Why not only offload the texture loading to another thread and handle rendering afterwards in the main thread? Rendering will be faster than SetData and since you have to stitch the textures on the GPU anyway multithreading won’t increase performance for that part.

following @Jjagg 's suggestion, my TaskManagerComponent might be practical for this: https://gist.github.com/raizam/df2f62801ab989dbb55226d911dd917f

Yeah that is about what i figured. the use of SetData was mostly because i could not do rendering on the second thread.
In hind sight it makes alot of sense as to why i was getting memory access violations in the long run.

As for rendering the Textures on the Main Thread i will most likely do that it should not really lock up the Main thread enough to even be noticeable. As a side note Textures are already being loaded in the background.

Thanks for affirming what i believed was the issue.

Regards Scott Jensen