Skip to content

Integrate D3D11 support and enhance rendering capabilities - #160

Open
alfonsmagd wants to merge 36 commits into
aap:masterfrom
alfonsmagd:master
Open

Integrate D3D11 support and enhance rendering capabilities#160
alfonsmagd wants to merge 36 commits into
aap:masterfrom
alfonsmagd:master

Conversation

@alfonsmagd

Copy link
Copy Markdown

No description provided.

alfonsmagd and others added 30 commits August 8, 2025 19:22
Addin resolving dependencies glfw
- Updated CMakeLists.txt to include D3D11 in LIBRW_PLATFORMS.
- Modified platform-specific code to handle D3D11 configurations.
- Introduced new source files:
  - d3d11.cpp
  - d3d11matfx.cpp
  - d3d11render.cpp
  - d3d11skin.cpp
- Updated rwbase.h to define RWDEVICE and RWHALFPIXEL for D3D11, and added PLATFORM_D3D11 enum.
- Created rwd3d11.h for D3D11-specific structures and function prototypes.
- Added TODO comments for further development in shader creation and rendering callbacks.

These changes enhance the library's capabilities with modern D3D11
Introduces a new d3d11device.cpp with basic D3D11 device system stubs, mode management, and placeholder rendering hooks. Updates CMakeLists.txt to include the new file. Adds D3D11 structures and function prototypes to rwd3dimpl.h, and exports the D3D11 renderdevice in rwd3d11.h. Modifies d3ddevice.cpp to use the new D3D11 renderdevice. No actual rendering is implemented yet.
Create and release the Im3D shaders, input layout, dynamic buffers and matrix constant buffer. Add camera view/projection updates, D3D9-style matrix uploads and the initial Im3D transform path. Keep D3D11 HLSL sources separate and embed them through CMake, and ignore generated build artifacts.
Connect primitive draws, fix face winding, and remove the D3D9 half-pixel offset from D3D11.
D3D9 provides fixed-function alpha testing, while D3D11 does not. Emulate alpha testing in the D3D11 pixel shaders so discarded fragments cannot write depth.\n\nMove Im2D shaders into D3D11 shader files generated by CMake.
Rename the engine device field and provide CPU-backed static index buffers for the D3D11 backend.
Move object and light data into dedicated vertex shader constant buffers. Add a pixel shader state buffer for D3D9 fixed-function behavior that D3D11 must reproduce in shaders. Vertex lighting remains pending while the backend stays aligned with the D3D9 pipeline for GTA III and example testing.
Use the D3D9 column-major matrix convention and matrix-vector multiplication order in default and immediate 3D shaders. Align constant names and layout with the D3D9 shader registers, and cache vertex stream bindings using the existing D3D9 naming and behavior.
Explain that im3d_VS_d11.hlsl is bound by the D3D11 Im3D path for textured view planes, camera frusta, debug lines, and other immediate-mode 3D primitives. Document the camera case where opaque texels write depth before a coplanar outline is drawn, allowing the D3D9/D3D11 coverage difference to hide line pixels. Keep the half-pixel correction local to Im3D so Im2D and ImGui remain aligned and text stays sharp.
Use im3dVS, im3dPS, and im3dTexPS directly in the D3D11 immediate-mode path. Remove misleading default shader aliases while preserving the D3D9-style selection point for future Im3D lighting variants.
Add native geometry streaming, GPU skinning, and dual texture stages for MatFX.
Mirror the D3D9 MatFX environment path with dedicated constant buffers, dual texture stages, matching shader variants, and CMake-managed HLSL sources.
Cap packed directional, point, and spot lights to eight entries in total and keep the default, skin, and MatFX shader layouts consistent with the CPU constant buffer.
Build the video mode list from DXGI output modes, keep the windowed mode at index zero, deduplicate fullscreen resolutions by refresh rate, and rebuild the list when changing adapters.
@alfonsmagd

alfonsmagd commented Jul 28, 2026

Copy link
Copy Markdown
Author

#122 I have been adding info about my steps in this issue , is working in GTA III but I have to fix some issues with FOG, right now is setting by one, I need to do more test in gta III . But I think is a versión that can be integrate without problem in librw, and more tweaks can be more easy to follow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant