protonscr

NtDelayExecution() might being called with wrong signature

dxvkclosed
doitsujin/dxvk#5471 · opened 2026-01-25 by kvoqkki · updated 2026-01-26 · 2 comments · github
Kkvoqkki 2026-01-25 github

I'm working on a FPS limiter by copy-pasta DXVK's implementation. However, I notice that https://github.com/doitsujin/dxvk/blob/c27ef1c43a93741ec1e8d1dc55b6bcf2444a471f/src/util/util_sleep.h#L56 is using BOOL as NtDelayExecution() parameter which is a 4 bytes data type. Some document say it should be a BOOLEAN which is a 1 byte data type. Gemini agrees on 1 byte.

Although I tried call it with the 4 bytes type and it does seem to be working.

Ddoitsujin maintainer 2026-01-25 github

Amazing. Good thing that we have 10 different incompatible types that all serve the purpose of storing one bit of information in memory.

Looking at wine code, you're right. Feel free to PR a fix.

At least this shouldn't have any real consequences because we're using the larger type, and 32-bit stdcall will pad this to 4 bytes anyway. The other way around would have been a lot worse.

Out of curiosity though, why use the DXVK limtier as a base? It's not exactly the best or most sophisticated thing out there when it comes to limiters.

Kkvoqkki 2026-01-26 github

PR as https://github.com/doitsujin/dxvk/pull/5472

Thank you for this marvelous DXVK project.

My FPS limiter at https://codeberg.org/konaka/UnitXP_SP3/src/branch/main/FPScap.cpp It's a bit more compelx than the DXVK one as it has tail spinning. ( firstly use NtDelayExecution() but busy-spinning at the tail to be more precise on timing )

I don't know a better limiter. If you could recommend something that would be great.

Upstream links