Overview
Add support for DirectX as an alternative rendering backend alongside the existing OpenGL implementation.
The rendering API should be selectable through config.ini, allowing the application to choose which graphics backend to initialize and use at runtime without requiring code changes or recompilation.
Requirements
-
Add a DirectX rendering backend alongside the existing OpenGL backend.
-
Preserve the existing OpenGL implementation and behavior.
-
Introduce a configuration option in config.ini to select the rendering backend.
-
The application should read the configured backend during initialization.
-
Supported values should include at least:
-
Define a sensible default backend for backwards compatibility, preferably opengl.
-
Invalid or unsupported backend values should produce a clear configuration error and/or fall back to the default backend.
-
Keep backend-specific code isolated so that rendering logic is not unnecessarily coupled to either OpenGL or DirectX.
Example Configuration
[graphics]
renderer=opengl
[graphics.opengl]
CoreProfile=1
or:
[graphics]
renderer=directx
[graphics.directx]
...
Implementation Considerations
- Introduce a common renderer abstraction/interface where appropriate.
- Move renderer-specific initialization, resource management, drawing, and shutdown logic behind the abstraction.
- Avoid scattering checks such as
if renderer == ... throughout the game/application code.
- Ensure both backends expose the functionality required by the existing rendering pipeline.
- Consider how textures, shaders, buffers, render targets, synchronization, and window/context/device initialization map between OpenGL and DirectX.
- Ensure the selected backend is initialized before any renderer-dependent resources are created.
- Maintain existing OpenGL behavior when no renderer is explicitly configured.
Acceptance Criteria
Overview
Add support for DirectX as an alternative rendering backend alongside the existing OpenGL implementation.
The rendering API should be selectable through
config.ini, allowing the application to choose which graphics backend to initialize and use at runtime without requiring code changes or recompilation.Requirements
Add a DirectX rendering backend alongside the existing OpenGL backend.
Preserve the existing OpenGL implementation and behavior.
Introduce a configuration option in
config.inito select the rendering backend.The application should read the configured backend during initialization.
Supported values should include at least:
opengldirectxDefine a sensible default backend for backwards compatibility, preferably
opengl.Invalid or unsupported backend values should produce a clear configuration error and/or fall back to the default backend.
Keep backend-specific code isolated so that rendering logic is not unnecessarily coupled to either OpenGL or DirectX.
Example Configuration
or:
Implementation Considerations
if renderer == ...throughout the game/application code.Acceptance Criteria
config.ini.config.ini.