The ReShade API provides a cross-API abstraction for graphics operations.
Device Abstraction
Everything is built from a reshade::api::device. You can retrieve the native graphics API object (e.g., ID3D11Device for D3D11) using device->get_native().
Resource Creation
Resources like textures and buffers are created via reshade::api::device::create_resource().
Resource Handles
ReShade uses handles for most objects to maintain abstraction:
reshade::api::resource: Buffers and textures.reshade::api::resource_view: Views for resources (e.g., depth-stencil, render target, shader resource, or unordered access views).reshade::api::sampler: Sampler state objects.reshade::api::pipeline: (Partial) pipeline state objects.
// Example: Creating a new 800x600 texture via the ReShade API
static void on_init_device(reshade::api::device *device)
{
reshade::api::resource texture = {};
const reshade::api::resource_desc desc(
800, 600, 1, 1,
reshade::api::format::r8g8b8a8_unorm,
1,
reshade::api::memory_heap::gpu_only,
reshade::api::resource_usage::shader_resource | reshade::api::resource_usage::render_target);
if (!device->create_resource(desc, nullptr, reshade::api::resource_usage::undefined, &texture))
{
// Error handling ...
}
}