You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using, await AsyncImageLoader.LoadImageAsync(tex, byteArray); and it loads the correct texture and is greatly increasing performance but the main issue is sometimes the texture loads as completely black for 1 frame and it happens multiple times every second causing the texture to blink. I'm not simply loading a static texture but instead loading a series of textures that play a video. Any thoughts on what might be causing this?
The texture is black initially because the texture data is being uploaded from the CPU to the GPU and the transfer is not finished yet. You can check the troubleshooting guide here.
In your case, you can implement something like double-buffering. Make an additional texture which acts as a buffer and is displayed on the screen. When you finished loading texture from file, transfer the texture data on the GPU to this buffer texture using shader or compute shader. This will only present a black screen at first when the buffer texture is not initialized. There will be no black screen when the buffer texture is updated with new frame.
I'm not sure exactly what you mean or how to do this part: " When you finished loading texture from file, transfer the texture data on the GPU to this buffer texture using shader or compute shader."
varbufferTexture=newRenderTexture(...);varframe0=awaitAsyncImageLoader.LoadImageAsync(...);// This loads image from disk -> CPU side -> GPU sideGraphics.Blit(frame0,bufferTexture);// Transfer texture data to the buffer only on the GPU side.varframe1=awaitAsyncImageLoader.LoadImageAsync(...);Graphics.Blit(frame1,bufferTexture);varframe2=awaitAsyncImageLoader.LoadImageAsync(...);Graphics.Blit(frame2,bufferTexture);// And so on...
What you want to put on the screen is the bufferTexture.
that worked using Graphics.CopyTexture :) Although I'm now trying to build to android to test and I'm getting these 2 errors. I assume the first error is causing the second error. Any thoughts?
Activity
Looooong commentedon Nov 29, 2022
The texture is black initially because the texture data is being uploaded from the CPU to the GPU and the transfer is not finished yet. You can check the troubleshooting guide here.
In your case, you can implement something like double-buffering. Make an additional texture which acts as a buffer and is displayed on the screen. When you finished loading texture from file, transfer the texture data on the GPU to this buffer texture using shader or compute shader. This will only present a black screen at first when the buffer texture is not initialized. There will be no black screen when the buffer texture is updated with new frame.
MurkesM commentedon Nov 29, 2022
I'm not sure exactly what you mean or how to do this part: " When you finished loading texture from file, transfer the texture data on the GPU to this buffer texture using shader or compute shader."
Looooong commentedon Nov 30, 2022
Something like this:
What you want to put on the screen is the
bufferTexture.MurkesM commentedon Dec 2, 2022
that worked using Graphics.CopyTexture :) Although I'm now trying to build to android to test and I'm getting these 2 errors. I assume the first error is causing the second error. Any thoughts?

