veeenu / hudhook

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

Support uploading images of any width #173

Closed misdake closed 6 months ago

misdake commented 6 months ago

DX12 requires the upload RowPitch to be 256 bytes aligned, which is equivalent to 64 pixels of RGBA8. For more details, please refer to Uploading texture data through buffers.

To reproduce, use this small white image in hook.rs instead of thingken.webp and run dx12 test.

let image = RgbaImage::from_raw(32, 32, vec![0xff; 32 * 32 * 4]).unwrap();
ERROR ThreadId(03) hudhook::hooks::dx12: src\hooks\dx12.rs:119: Render error: Error { code: HRESULT(0x80070057), message: "(aka E_INVALIDARG)" }

Only DX12 is affected.

veeenu commented 6 months ago

Thank you for the repro as well! Will add that to the test harness too, though I'll prob add also one with a size that's bigger than one row pitch just for the sake of completeness.