veeenu / hudhook

A videogame overlay framework written in Rust, supporting DirectX and OpenGL
MIT License
209 stars 30 forks source link

Replace texture image data #147

Closed veeenu closed 8 months ago

veeenu commented 10 months ago

Currently, a texture can only be loaded once via RenderEngine::load_image and its contents cannot be changed.

A public RenderEngine::replace_image method should be created to make this happen.

misdake commented 8 months ago

For dx11 and dx12, uploadbuffer RowPitch must be aligned to 256 bytes (64 pixels). Might also fix this to support images with arbitrary width.

veeenu commented 8 months ago

That's an unrelated issue -- could you please open a new one so we can track that separately?

misdake commented 8 months ago

I did some experiments early today, but on an old version 799032ba from Jan, when there was only DX12 renderer.

I split create_texture_inner into create_texture_inner+ upload_texture_inner, then added replace_image to RenderEngine.

Here is the quick (and dirty) patch file for future reference. I haven't written any raw DX12 before, so there might be some bugs. split_create_texture_and_upload_texture.patch on 799032ba

When I have some more spare time, I will take a look at renderers of other APIs.

veeenu commented 8 months ago

That's a good starting point, thank you!