Switch to DirectX based render backend#2212
Conversation
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
|
I think you can start a topic on the forum so that more people can test and communicate. Currently, some Chinese users find it difficult to understand this English title and want to ask questions about windowing and Reshade usage. |
I haven't registered on that forum currently, I'd appreciate it if somebody post this message on that. I will sign up for an account later maybe. |
|
About the reshade stuffs, I think we can integrate the reshade features after switching to the new render backend, because we can use the GPU directly instead of adding an extra library. |
This comment was marked as outdated.
This comment was marked as outdated.
The current test template requires filling in some content with subjective information; it would be best for you to create a topic yourself. The topic mentioned in the link above is temporary, and testing for this PR still requires a new topic. |
|
To Chinese users:
|
Done |
ERROR REPORTGame Environment
Device Status
Log File :syringe (without ddraw).log Maybe related parts : these functions are in the specific commit.
Direct Error CauseIn SUB_432750: else
{
v26 = Rect.top;
v27 = v17;
}
*(this + 16) = v26;
*(this + 20) = v22;
*(this + 24) = v27;
*(this + 28) = v25;
*(this + 8) = BinkDDSurfaceType(Primary->VideoSurfacePtr);
result = 1;
}Here Calls |
|
The vanilla YR support requires us to understand the OwnerDraw procedure, which I haven't figured out already. So currently tests based on cncnet spawner is appreciated |
|
CnCNet YR 9.2.0 + c80db5e The game may freeze for a period of time, during which the BGM plays normally and the cursor moves normally. AMD Ryzen 7 PRO 6850H, iGPU Radeon 680M, 64 GB RAM (fixed VRAM for the iGPU is set to 4GB), in-game resolution 1920x1080, monitor resolution 3840x2160. Windows 11 25H2. Video: |
Prioritize hardware adapter selection using `IDXGIFactory6::EnumAdapterByGpuPreference` for optimal performance. Fall back to `IDXGIFactory4::EnumAdapters1` if `IDXGIFactory6` is unavailable. If no hardware device can be created, attempt to create a WARP device as a last resort. This improves robustness and compatibility across various systems.
|
Switched to DX11 implementation. Retesting is welcomed |
This URL redirects to an HTTP 404 page. @DeathFishAtEase |
|
Yeah, that link is outdated. The correct address is provided in another comment below. I've hidden the old one to avoid confusion. |
|
CnCNet YR 9.2.0 + 40df9a3 AMD Ryzen 7 PRO 6850H, iGPU Radeon 680M, 64 GB RAM (fixed VRAM for the iGPU is set to 4GB), in-game resolution 1920x1080, monitor resolution 3840x2160. Windows 11 25H2. Compared to the previous c80db5e commit, the same phenomenon of "the game may freeze for a period of time, during which the BGM plays normally and the cursor moves normally" has not been observed so far with this 40df9a3 commit. On this basis, I immediately switched back to the c80db5e commit and observed the phenomenon of "the game may freeze for a period of time, during which the BGM plays normally and the cursor moves normally" again. Therefore, it can be confirmed that this 40df9a3 commit has a significant improvement regarding this issue, at least on my machine. |
|
haven't tested it rigorously but I noticed an immediate improvement in responsiveness/delay/smoothness compared to cncddraw, simply put, it plays like a dream. |
|
I'm currently working on the whole OwnerDraw control part as it's essential to make things looks completely correctly. But OwnerDraw is so huge and it might take much more time than already done part(I'm quite busy so im not sure whether this part could be done in 1 month or not). If you want to help testing, currently verifying the spawner based game works is enough. Thanks for everyone testing this feature. |


YR originally used DDRAW as its rendering backend. However, DDRAW was introduced more than two decades ago, primarily for the graphics hardware environment of that time, where 2D accelerator cards were still common. Modern computers now almost universally use display hardware based on 3D graphics pipelines, and Windows itself has long since migrated to a modern graphics architecture built around DXGI-based swap chains. Therefore, we would like YR to migrate to a modern rendering backend based on DirectX as well.
At present, the community usually achieves similar functionality through DDRAW wrappers, with CNC-DDRAW being one of the common examples. These solutions intercept and forward DDRAW calls, translating them into corresponding modern rendering backend implementations. While this approach can improve compatibility and display quality, it also introduces a limitation: directly using such modern 3D rendering backends to add rendering effects to the YR game engine becomes extremely difficult. The core rendering process still remains within the traditional 2D software rendering model.
Our current approach is based on the SDL implementation in Vinifera. In essence, it is similar to the earlier CNC-DDRAW approach: 2D software rendering is still performed on the CPU. Currently, D3D is mainly used to present the fully rendered frame as a texture to the screen through a fullscreen triangle. Therefore, in theory, its performance should be close to CNC-DDRAW.
At present, the program reads the following configuration from
RA2MD.ini:In addition, fullscreen and windowed mode can be toggled in-game with Alt+Enter. Please feel free to report any issues you encounter.
Regarding ReShade, this rendering backend may theoretically conflict with the current community ReShade plugin. However, once this backend is functional, the logic currently implemented in ReShade can later be developed directly in Phobos instead of relying on an external DLL, providing more stable and more efficient rendering.
CURRENTLY, BINK MOVIE IS DISABLED, YOU CAN JUST FOCUS ON OTHER PARTS AND SEE IF THEY WORK CORRECTLY
Support for vanilla YR is still WIP, and it seems cannot be easily done in 1 month, I will update as soon as I made any progress.