Allow VRAM/GPU Loading for desktop target#5
Allow VRAM/GPU Loading for desktop target#5PurSnake wants to merge 4 commits intoFunkinCrew:mobile/mainfrom
Conversation
|
Why not just use the
Maybe I'm missing something? |
|
Here's the snippet from the branch where I was experimenting with this functionality: trace('Uploading bitmap data to GPU... ${bitmapData?.image?.premultiplied}');
// Retrieve the render context.
var context:Context3D = FlxG.stage.context3D;
// Create a new texture object using the render context.
var texture:Texture = context.createTexture(bitmapData.width, bitmapData.height, Context3DTextureFormat.BGRA, optimizeForRender);
// TODO: Figure out how to use texture.uploadCompressedTextureFromByteArray to save GPU memory?
// Upload the texture to the GPU.
// This is an expensive operation so don't do it in the UI thread if you can help it.
texture.uploadFromBitmapData(bitmapData);
// Now that the texture is uploaded, the `Texture` object is all we need to render it in-game.
// We can dispose of the BitmapData object now.
bitmapData.dispose();
bitmapData.disposeImage();
// Build a new, optimized BitmapData object using the Texture object.
var output:BitmapData = BitmapData.fromTexture(texture);
return output;Note that this takes the bitmap data (which has already been loaded into memory from the disk), then creates a NEW texture, uploads the bitmap data to it, then creates a new BitmapData from that texture. It looks like PurSnake's approach is trying to remove the BitmapData from the existing Bitmap so you don't have to swap to a new BitmapData like I was doing here. |
|
Also, important: It would be prudent to make the same pull request to the upstream |
Co-Authored-By: Mihai Alexandru <77043862+majigsaw77@users.noreply.github.com>
|
It got conflicted, bruh. |
b76d3eb to
257639d
Compare
Adds ability to load bitmapdata via vram :steamhappy:
But only for desktop targets
Also its part of that Funkin PR