ReShade
A generic post-processing injector for games and video software.
Namespaces | Classes | Enumerations | Functions
reshade Namespace Reference

Namespaces

 api
 
 internal
 
 log
 

Classes

struct  addon_event_traits
 
struct  addon_event_traits< addon_event::init_device >
 
struct  addon_event_traits< addon_event::destroy_device >
 
struct  addon_event_traits< addon_event::init_command_list >
 
struct  addon_event_traits< addon_event::destroy_command_list >
 
struct  addon_event_traits< addon_event::init_command_queue >
 
struct  addon_event_traits< addon_event::destroy_command_queue >
 
struct  addon_event_traits< addon_event::init_swapchain >
 
struct  addon_event_traits< addon_event::create_swapchain >
 
struct  addon_event_traits< addon_event::destroy_swapchain >
 
struct  addon_event_traits< addon_event::init_effect_runtime >
 
struct  addon_event_traits< addon_event::destroy_effect_runtime >
 
struct  addon_event_traits< addon_event::init_sampler >
 
struct  addon_event_traits< addon_event::create_sampler >
 
struct  addon_event_traits< addon_event::destroy_sampler >
 
struct  addon_event_traits< addon_event::init_resource >
 
struct  addon_event_traits< addon_event::create_resource >
 
struct  addon_event_traits< addon_event::destroy_resource >
 
struct  addon_event_traits< addon_event::init_resource_view >
 
struct  addon_event_traits< addon_event::create_resource_view >
 
struct  addon_event_traits< addon_event::destroy_resource_view >
 
struct  addon_event_traits< addon_event::map_buffer_region >
 
struct  addon_event_traits< addon_event::unmap_buffer_region >
 
struct  addon_event_traits< addon_event::map_texture_region >
 
struct  addon_event_traits< addon_event::unmap_texture_region >
 
struct  addon_event_traits< addon_event::update_buffer_region >
 
struct  addon_event_traits< addon_event::update_texture_region >
 
struct  addon_event_traits< addon_event::init_pipeline >
 
struct  addon_event_traits< addon_event::create_pipeline >
 
struct  addon_event_traits< addon_event::destroy_pipeline >
 
struct  addon_event_traits< addon_event::init_pipeline_layout >
 
struct  addon_event_traits< addon_event::create_pipeline_layout >
 
struct  addon_event_traits< addon_event::destroy_pipeline_layout >
 
struct  addon_event_traits< addon_event::copy_descriptor_tables >
 
struct  addon_event_traits< addon_event::update_descriptor_tables >
 
struct  addon_event_traits< addon_event::init_query_heap >
 
struct  addon_event_traits< addon_event::create_query_heap >
 
struct  addon_event_traits< addon_event::destroy_query_heap >
 
struct  addon_event_traits< addon_event::get_query_heap_results >
 
struct  addon_event_traits< addon_event::barrier >
 
struct  addon_event_traits< addon_event::begin_render_pass >
 
struct  addon_event_traits< addon_event::end_render_pass >
 
struct  addon_event_traits< addon_event::bind_render_targets_and_depth_stencil >
 
struct  addon_event_traits< addon_event::bind_pipeline >
 
struct  addon_event_traits< addon_event::bind_pipeline_states >
 
struct  addon_event_traits< addon_event::bind_viewports >
 
struct  addon_event_traits< addon_event::bind_scissor_rects >
 
struct  addon_event_traits< addon_event::push_constants >
 
struct  addon_event_traits< addon_event::push_descriptors >
 
struct  addon_event_traits< addon_event::bind_descriptor_tables >
 
struct  addon_event_traits< addon_event::bind_index_buffer >
 
struct  addon_event_traits< addon_event::bind_vertex_buffers >
 
struct  addon_event_traits< addon_event::bind_stream_output_buffers >
 
struct  addon_event_traits< addon_event::draw >
 
struct  addon_event_traits< addon_event::draw_indexed >
 
struct  addon_event_traits< addon_event::dispatch >
 
struct  addon_event_traits< addon_event::dispatch_mesh >
 
struct  addon_event_traits< addon_event::dispatch_rays >
 
struct  addon_event_traits< addon_event::draw_or_dispatch_indirect >
 
struct  addon_event_traits< addon_event::copy_resource >
 
struct  addon_event_traits< addon_event::copy_buffer_region >
 
struct  addon_event_traits< addon_event::copy_buffer_to_texture >
 
struct  addon_event_traits< addon_event::copy_texture_region >
 
struct  addon_event_traits< addon_event::copy_texture_to_buffer >
 
struct  addon_event_traits< addon_event::resolve_texture_region >
 
struct  addon_event_traits< addon_event::clear_depth_stencil_view >
 
struct  addon_event_traits< addon_event::clear_render_target_view >
 
struct  addon_event_traits< addon_event::clear_unordered_access_view_uint >
 
struct  addon_event_traits< addon_event::clear_unordered_access_view_float >
 
struct  addon_event_traits< addon_event::generate_mipmaps >
 
struct  addon_event_traits< addon_event::begin_query >
 
struct  addon_event_traits< addon_event::end_query >
 
struct  addon_event_traits< addon_event::copy_query_heap_results >
 
struct  addon_event_traits< addon_event::copy_acceleration_structure >
 
struct  addon_event_traits< addon_event::build_acceleration_structure >
 
struct  addon_event_traits< addon_event::reset_command_list >
 
struct  addon_event_traits< addon_event::close_command_list >
 
struct  addon_event_traits< addon_event::execute_command_list >
 
struct  addon_event_traits< addon_event::execute_secondary_command_list >
 
struct  addon_event_traits< addon_event::present >
 
struct  addon_event_traits< addon_event::set_fullscreen_state >
 
struct  addon_event_traits< addon_event::reshade_present >
 
struct  addon_event_traits< addon_event::reshade_begin_effects >
 
struct  addon_event_traits< addon_event::reshade_finish_effects >
 
struct  addon_event_traits< addon_event::reshade_reloaded_effects >
 
struct  addon_event_traits< addon_event::reshade_set_uniform_value >
 
struct  addon_event_traits< addon_event::reshade_set_technique_state >
 
struct  addon_event_traits< addon_event::reshade_overlay >
 
struct  addon_event_traits< addon_event::reshade_screenshot >
 
struct  addon_event_traits< addon_event::reshade_render_technique >
 
struct  addon_event_traits< addon_event::reshade_set_effects_state >
 
struct  addon_event_traits< addon_event::reshade_set_current_preset_path >
 
struct  addon_event_traits< addon_event::reshade_reorder_techniques >
 
struct  addon_event_traits< addon_event::reshade_open_overlay >
 
struct  addon_event_traits< addon_event::reshade_overlay_uniform_variable >
 
struct  addon_event_traits< addon_event::reshade_overlay_technique >
 

Enumerations

enum class  addon_event : uint32_t {
  init_device , destroy_device , init_command_list , destroy_command_list ,
  init_command_queue , destroy_command_queue , init_swapchain , create_swapchain ,
  destroy_swapchain , init_effect_runtime , destroy_effect_runtime , init_sampler ,
  create_sampler , destroy_sampler , init_resource , create_resource ,
  destroy_resource , init_resource_view , create_resource_view , destroy_resource_view ,
  map_buffer_region , unmap_buffer_region , map_texture_region , unmap_texture_region ,
  update_buffer_region , update_texture_region , init_pipeline , create_pipeline ,
  destroy_pipeline , init_pipeline_layout , create_pipeline_layout , destroy_pipeline_layout ,
  copy_descriptor_tables , update_descriptor_tables , init_query_heap , create_query_heap ,
  destroy_query_heap , get_query_heap_results , barrier , begin_render_pass ,
  end_render_pass , bind_render_targets_and_depth_stencil , bind_pipeline , bind_pipeline_states ,
  bind_viewports , bind_scissor_rects , push_constants , push_descriptors ,
  bind_descriptor_tables , bind_index_buffer , bind_vertex_buffers , bind_stream_output_buffers ,
  draw , draw_indexed , dispatch , dispatch_mesh ,
  dispatch_rays , draw_or_dispatch_indirect , copy_resource , copy_buffer_region ,
  copy_buffer_to_texture , copy_texture_region , copy_texture_to_buffer , resolve_texture_region ,
  clear_depth_stencil_view , clear_render_target_view , clear_unordered_access_view_uint , clear_unordered_access_view_float ,
  generate_mipmaps , begin_query , end_query , copy_query_heap_results ,
  copy_acceleration_structure , build_acceleration_structure , reset_command_list , close_command_list ,
  execute_command_list , execute_secondary_command_list , present , set_fullscreen_state ,
  reshade_present , reshade_begin_effects , reshade_finish_effects , reshade_reloaded_effects ,
  reshade_set_uniform_value , reshade_set_technique_state , reshade_overlay , reshade_screenshot ,
  reshade_render_technique , reshade_set_effects_state , reshade_set_current_preset_path , reshade_reorder_techniques ,
  reshade_open_overlay , reshade_overlay_uniform_variable , reshade_overlay_technique
}
 

Functions

void get_reshade_base_path (char *path, size_t *path_size)
 Gets the base path ReShade uses to resolve relative paths. More...
 
bool get_config_value (api::effect_runtime *runtime, const char *section, const char *key, char *value, size_t *value_size)
 Gets a value from one of ReShade's config files. This can use either the global config file (ReShade.ini next to the application executable), or one local to an effect runtime (ReShade[index].ini in the base path). More...
 
void set_config_value (api::effect_runtime *runtime, const char *section, const char *key, const char *value)
 Sets and saves a value in one of ReShade's config files. This can use either the global config file (ReShade.ini next to the application executable), or one local to an effect runtime (ReShade[index].ini in the base path). More...
 
void set_config_value (api::effect_runtime *runtime, const char *section, const char *key, const char *value, size_t value_size)
 
bool register_addon (HMODULE addon_module, [[maybe_unused]] HMODULE reshade_module=nullptr)
 Registers this module as an add-on with ReShade. Call this in 'AddonInit' or 'DllMain' during process attach, before any of the other API functions! More...
 
void unregister_addon (HMODULE addon_module, [[maybe_unused]] HMODULE reshade_module=nullptr)
 Unregisters this module as an add-on. Call this in 'AddonUninit' or 'DllMain' during process detach, after any of the other API functions. More...
 
template<addon_event ev>
void register_event (typename addon_event_traits< ev >::decl callback)
 Registers a callback for the specified event with ReShade. More...
 
template<addon_event ev>
void unregister_event (typename addon_event_traits< ev >::decl callback)
 Unregisters a callback from the specified event that was previously registered via register_event. More...
 
void register_overlay (const char *title, void(*callback)(api::effect_runtime *runtime))
 Registers an overlay with ReShade. More...
 
void unregister_overlay (const char *title, void(*callback)(api::effect_runtime *runtime))
 Unregisters an overlay that was previously registered via register_overlay. More...
 
bool create_effect_runtime (reshade::api::device_api api, void *device, void *command_queue, void *swapchain, const char *config_path, reshade::api::effect_runtime **out_runtime)
 Creates a new effect runtime for an existing swapchain, for when it was not already hooked by ReShade (e.g. because the RESHADE_DISABLE_GRAPHICS_HOOK environment variable is set). More...
 
void destroy_effect_runtime (api::effect_runtime *runtime)
 Instantly destroys an effect runtime that was previously created via create_effect_runtime. Do not call this with effect runtimes that were automatically created by ReShade! More...
 
void update_and_present_effect_runtime (api::effect_runtime *runtime)
 Updates and renders an effect runtime onto the current back buffer of the swap chain it was created with. Do not call this with effect runtimes that were automatically created by ReShade! More...
 

Enumeration Type Documentation

◆ addon_event

enum reshade::addon_event : uint32_t
strong
Enumerator
init_device 

Called after successful device creation, from:

  • IDirect3D9::CreateDevice
  • IDirect3D9Ex::CreateDeviceEx
  • IDirect3DDevice9::Reset
  • IDirect3DDevice9Ex::ResetEx
  • D3D10CreateDevice
  • D3D10CreateDevice1
  • D3D10CreateDeviceAndSwapChain
  • D3D10CreateDeviceAndSwapChain1
  • D3D11CreateDevice
  • D3D11CreateDeviceAndSwapChain
  • D3D12CreateDevice
  • glMakeCurrent
  • vkCreateDevice

Callback function signature: void (api::device *device)

destroy_device 

Called on device destruction, before:

  • IDirect3DDevice9::Reset
  • IDirect3DDevice9Ex::ResetEx
  • IDirect3DDevice9::Release
  • ID3D10Device::Release
  • ID3D11Device::Release
  • ID3D12Device::Release
  • wglDeleteContext
  • vkDestroyDevice

Callback function signature: void (api::device *device)

init_command_list 

Called after successful command list creation, from:

  • ID3D11Device::CreateDeferredContext
  • ID3D11Device1::CreateDeferredContext1
  • ID3D11Device2::CreateDeferredContext2
  • ID3D11Device3::CreateDeferredContext3
  • ID3D12Device::CreateCommandList
  • ID3D12Device4::CreateCommandList1
  • vkAllocateCommandBuffers

Callback function signature: void (api::command_list *cmd_list)

In case of D3D9, D3D10, D3D11 and OpenGL this is called during device initialization as well and behaves as if an implicit immediate command list was created.

destroy_command_list 

Called on command list destruction, before:

  • ID3D11CommandList::Release
  • ID3D12CommandList::Release
  • vkFreeCommandBuffers

Callback function signature: void (api::command_list *cmd_list)

init_command_queue 

Called after successful command queue creation, from:

  • ID3D12Device::CreateCommandQueue
  • vkCreateDevice (for every queue associated with the device)

Callback function signature: void (api::command_queue *queue)

In case of D3D9, D3D10, D3D11 and OpenGL this is called during device initialization as well and behaves as if an implicit command queue was created.

destroy_command_queue 

Called on command queue destruction, before:

  • ID3D12CommandQueue::Release
  • vkDestroyDevice (for every queue associated with the device)

Callback function signature: void (api::command_queue *queue)

init_swapchain 

Called after successful swap chain creation, from:

  • IDirect3D9::CreateDevice (for the implicit swap chain)
  • IDirect3D9Ex::CreateDeviceEx (for the implicit swap chain)
  • IDirect3D9Device::CreateAdditionalSwapChain
  • IDXGIFactory::CreateSwapChain
  • IDXGIFactory2::CreateSwapChain(...)
  • wglMakeCurrent
  • wglSwapBuffers (after window was resized)
  • vkCreateSwapchainKHR
  • xrCreateSession

In addition, called when swap chain is resized, after:

  • IDirect3DDevice9::Reset (for the implicit swap chain)
  • IDirect3DDevice9Ex::ResetEx (for the implicit swap chain)
  • IDXGISwapChain::ResizeBuffers
  • IDXGISwapChain3::ResizeBuffers1

Callback function signature: void (api::swapchain *swapchain)

create_swapchain 

Called on swap chain creation, before:

  • IDirect3D9::CreateDevice (for the implicit swap chain)
  • IDirect3D9Ex::CreateDeviceEx (for the implicit swap chain)
  • IDirect3D9Device::CreateAdditionalSwapChain
  • IDirect3D9Device::Reset (for the implicit swap chain)
  • IDirect3D9DeviceEx::ResetEx (for the implicit swap chain)
  • IDXGIFactory::CreateSwapChain
  • IDXGIFactory2::CreateSwapChain(...)
  • IDXGISwapChain::ResizeBuffers
  • IDXGISwapChain3::ResizeBuffers1
  • wglSetPixelFormat
  • vkCreateSwapchainKHR

Callback function signature: bool (api::swapchain_desc &desc, void *hwnd)

To overwrite the swap chain description, modify desc in the callback and return true, otherwise return false.

destroy_swapchain 

Called on swap chain destruction, before:

  • IDirect3DDevice9::Release (for the implicit swap chain)
  • IDirect3DSwapChain9::Release
  • IDXGISwapChain::Release
  • wglDeleteContext
  • wglSwapBuffers (after window was resized)
  • vkDestroySwapchainKHR
  • xrDestroySession

In addition, called when swap chain is resized, before:

  • IDirect3DDevice9::Reset (for the implicit swap chain)
  • IDirect3DDevice9Ex::ResetEx (for the implicit swap chain)
  • IDXGISwapChain::ResizeBuffers
  • IDXGISwapChain1::ResizeBuffers1

Callback function signature: void (api::swapchain *swapchain)

init_effect_runtime 

Called after effect runtime initialization (which happens after swap chain creation or a swap chain buffer resize).

Callback function signature: void (api::effect_runtime *runtime)

destroy_effect_runtime 

Called when an effect runtime is reset or destroyed.

Callback function signature: void (api::effect_runtime *runtime)

init_sampler 

Called after successful sampler creation from:

  • ID3D10Device::CreateSamplerState
  • ID3D11Device::CreateSamplerState
  • ID3D12Device::CreateSampler
  • vkCreateSampler

Callback function signature: void (api::device *device, const api::sampler_desc &desc, api::sampler sampler)

Is not called in D3D9 (since samplers are loose state there) or OpenGL.

create_sampler 

Called on sampler creation, before:

  • ID3D10Device::CreateSamplerState
  • ID3D11Device::CreateSamplerState
  • ID3D12Device::CreateSampler
  • ID3D12Device::CreateRootSignature
  • vkCreateSampler

Callback function signature: bool (api::device *device, api::sampler_desc &desc)

To overwrite the sampler description, modify desc in the callback and return true, otherwise return false. Is not called in D3D9 (since samplers are loose state there) or OpenGL.

destroy_sampler 

Called on sampler destruction, before:

  • ID3D10SamplerState::Release
  • ID3D11SamplerState::Release
  • glDeleteSamplers
  • vkDestroySampler

Callback function signature: void (api::device *device, api::sampler sampler)

Is not called in D3D9 (since samplers are loose state there), D3D12 (since samplers are descriptor handles instead of objects there) or OpenGL.

init_resource 

Called after successful resource creation from:

  • IDirect3DDevice9::CreateVertexBuffer
  • IDirect3DDevice9::CreateIndexBuffer
  • IDirect3DDevice9::CreateTexture
  • IDirect3DDevice9::CreateCubeTexture
  • IDirect3DDevice9::CreateVolumeTexture
  • IDirect3DDevice9::CreateRenderTargetSurface
  • IDirect3DDevice9::CreateDepthStencilSurface
  • IDirect3DDevice9::CreateOffscreenPlainSurface
  • IDirect3DDevice9Ex::CreateRenderTargetSurfaceEx
  • IDirect3DDevice9Ex::CreateDepthStencilSurfaceEx
  • IDirect3DDevice9Ex::CreateOffscreenPlainSurfaceEx
  • ID3D10Device::CreateBuffer
  • ID3D10Device::CreateTexture1D
  • ID3D10Device::CreateTexture2D
  • ID3D10Device::CreateTexture2D
  • ID3D11Device::CreateBuffer
  • ID3D11Device::CreateTexture1D
  • ID3D11Device::CreateTexture2D
  • ID3D11Device::CreateTexture3D
  • ID3D11Device3::CreateTexture2D
  • ID3D11Device3::CreateTexture3D
  • ID3D12Device::CreateCommittedResource
  • ID3D12Device::CreatePlacedResource
  • ID3D12Device::CreateReservedResource
  • ID3D12Device4::CreateCommittedResource1
  • ID3D12Device4::CreateReservedResource1
  • glBufferData
  • glBufferStorage
  • glNamedBufferData
  • glNamedBufferStorage
  • glTexImage1D
  • glTexImage2D
  • glTexImage2DMultisample
  • glTexImage3D
  • glTexImage3DMultisample
  • glCompressedTexImage1D
  • glCompressedTexImage2D
  • glCompressedTexImage3D
  • glTexStorage1D
  • glTexStorage2D
  • glTexStorage2DMultisample
  • glTexStorage3D
  • glTexStorage3DMultisample
  • glTextureStorage1D
  • glTextureStorage2D
  • glTextureStorage2DMultisample
  • glTextureStorage3D
  • glTextureStorage3DMultisample
  • glRenderbufferStorage
  • glRenderbufferStorageMultisample
  • glNamedRenderbufferStorage
  • glNamedRenderbufferStorageMultisample
  • vkBindBufferMemory
  • vkBindBufferMemory2
  • vkBindImageMemory
  • vkBindImageMemory2

Callback function signature: void (api::device *device, const api::resource_desc &desc, const api::subresource_data *initial_data, api::resource_usage initial_state, api::resource resource)

May be called multiple times with the same resource handle (whenever the resource is updated or its reference count is incremented).

create_resource 

Called on resource creation, before:

  • IDirect3DDevice9::CreateVertexBuffer
  • IDirect3DDevice9::CreateIndexBuffer
  • IDirect3DDevice9::CreateTexture
  • IDirect3DDevice9::CreateCubeTexture
  • IDirect3DDevice9::CreateVolumeTexture
  • IDirect3DDevice9::CreateRenderTargetSurface
  • IDirect3DDevice9::CreateDepthStencilSurface
  • IDirect3DDevice9::CreateOffscreenPlainSurface
  • IDirect3DDevice9Ex::CreateRenderTargetSurfaceEx
  • IDirect3DDevice9Ex::CreateDepthStencilSurfaceEx
  • IDirect3DDevice9Ex::CreateOffscreenPlainSurfaceEx
  • ID3D10Device::CreateBuffer
  • ID3D10Device::CreateTexture1D
  • ID3D10Device::CreateTexture2D
  • ID3D10Device::CreateTexture2D
  • ID3D11Device::CreateBuffer
  • ID3D11Device::CreateTexture1D
  • ID3D11Device::CreateTexture2D
  • ID3D11Device::CreateTexture3D
  • ID3D11Device3::CreateTexture2D
  • ID3D11Device3::CreateTexture3D
  • ID3D12Device::CreateCommittedResource
  • ID3D12Device::CreatePlacedResource
  • ID3D12Device::CreateReservedResource
  • ID3D12Device4::CreateCommittedResource1
  • ID3D12Device4::CreateReservedResource1
  • glBufferData
  • glBufferStorage
  • glNamedBufferData
  • glNamedBufferStorage
  • glTexImage1D
  • glTexImage2D
  • glTexImage2DMultisample
  • glTexImage3D
  • glTexImage3DMultisample
  • glCompressedTexImage1D
  • glCompressedTexImage2D
  • glCompressedTexImage3D
  • glTexStorage1D
  • glTexStorage2D
  • glTexStorage2DMultisample
  • glTexStorage3D
  • glTexStorage3DMultisample
  • glTextureStorage1D
  • glTextureStorage2D
  • glTextureStorage2DMultisample
  • glTextureStorage3D
  • glTextureStorage3DMultisample
  • glRenderbufferStorage
  • glRenderbufferStorageMultisample
  • glNamedRenderbufferStorage
  • glNamedRenderbufferStorageMultisample
  • vkCreateBuffer
  • vkCreateImage

Callback function signature: bool (api::device *device, api::resource_desc &desc, api::subresource_data *initial_data, api::resource_usage initial_state)

To overwrite the resource description, modify desc in the callback and return true, otherwise return false.

destroy_resource 

Called on resource destruction, before:

  • IDirect3DResource9::Release
  • ID3D10Resource::Release
  • ID3D11Resource::Release
  • ID3D12Resource::Release
  • glDeleteBuffers
  • glDeleteTextures
  • glDeleteRenderbuffers
  • vkDestroyBuffer
  • vkDestroyImage

Callback function signature: void (api::device *device, api::resource resource)

init_resource_view 

Called after successful resource view creation from:

  • IDirect3DDevice9::CreateTexture
  • IDirect3DDevice9::CreateCubeTexture
  • IDirect3DDevice9::CreateVolumeTexture
  • ID3D10Device::CreateShaderResourceView
  • ID3D10Device::CreateRenderTargetView
  • ID3D10Device::CreateDepthStencilView
  • ID3D10Device1::CreateShaderResourceView1
  • ID3D11Device::CreateShaderResourceView
  • ID3D11Device::CreateUnorderedAccessView
  • ID3D11Device::CreateRenderTargetView
  • ID3D11Device::CreateDepthStencilView
  • ID3D11Device3::CreateShaderResourceView1
  • ID3D11Device3::CreateUnorderedAccessView1
  • ID3D11Device3::CreateRenderTargetView1
  • ID3D12Device::CreateShaderResourceView
  • ID3D12Device::CreateUnorderedAccessView
  • ID3D12Device::CreateRenderTargetView
  • ID3D12Device::CreateDepthStencilView
  • glTexBuffer
  • glTextureBuffer
  • glTextureView
  • vkCreateBufferView
  • vkCreateImageView
  • vkCreateAccelerationStructureKHR

Callback function signature: void (api::device *device, api::resource resource, api::resource_usage usage_type, const api::resource_view_desc &desc, api::resource_view view)

May be called multiple times with the same resource view handle (whenever the resource view is updated).

create_resource_view 

Called on resource view creation, before:

  • ID3D10Device::CreateShaderResourceView
  • ID3D10Device::CreateRenderTargetView
  • ID3D10Device::CreateDepthStencilView
  • ID3D10Device1::CreateShaderResourceView1
  • ID3D11Device::CreateShaderResourceView
  • ID3D11Device::CreateUnorderedAccessView
  • ID3D11Device::CreateRenderTargetView
  • ID3D11Device::CreateDepthStencilView
  • ID3D11Device3::CreateShaderResourceView1
  • ID3D11Device3::CreateUnorderedAccessView1
  • ID3D11Device3::CreateRenderTargetView1
  • ID3D12Device::CreateShaderResourceView
  • ID3D12Device::CreateUnorderedAccessView
  • ID3D12Device::CreateRenderTargetView
  • ID3D12Device::CreateDepthStencilView
  • glTexBuffer
  • glTextureBuffer
  • glTextureView
  • vkCreateBufferView
  • vkCreateImageView
  • vkCreateAccelerationStructureKHR

Callback function signature: bool (api::device *device, api::resource resource, api::resource_usage usage_type, api::resource_view_desc &desc)

To overwrite the resource view description, modify desc in the callback and return true, otherwise return false. Is not called in D3D9 (since resource views are tied to resources there).

destroy_resource_view 

Called on resource view destruction, before:

  • IDirect3DResource9::Release
  • ID3D10View::Release
  • ID3D11View::Release
  • glDeleteTextures
  • vkDestroyBufferView
  • vkDestroyImageView
  • vkDestroyAccelerationStructureKHR

Callback function signature: void (api::device *device, api::resource_view view)

Is not called in D3D12 (since resource views are descriptor handles instead of objects there).

map_buffer_region 

Called after:

  • IDirect3DVertexBuffer9::Lock
  • IDirect3DIndexBuffer9::Lock
  • ID3D10Resource::Map
  • ID3D11DeviceContext::Map
  • ID3D12Resource::Map
  • glMapBuffer
  • glMapBufferRange
  • glMapNamedBuffer
  • glMapNamedBufferRange

Callback function signature: void (api::device *device, api::resource resource, uint64_t offset, uint64_t size, api::map_access access, void **data)

unmap_buffer_region 

Called before:

  • IDirect3DVertexBuffer9::Unlock
  • IDirect3DIndexBuffer9::Unlock
  • ID3D10Resource::Unmap
  • ID3D11DeviceContext::Unmap
  • ID3D12Resource::Unmap
  • glUnmapBuffer
  • glUnmapNamedBuffer

Callback function signature: void (api::device *device, api::resource resource)

map_texture_region 

Called after:

  • IDirect3DSurface9::LockRect
  • IDirect3DVolume9::LockBox
  • IDirect3DTexture9::LockRect
  • IDirect3DVolumeTexture9::LockBox
  • IDirect3DCubeTexture9::LockRect
  • ID3D10Resource::Map
  • ID3D11DeviceContext::Map
  • ID3D12Resource::Map

Callback function signature: void (api::device *device, api::resource resource, uint32_t subresource, const api::subresource_box *box, api::map_access access, api::subresource_data *data)

unmap_texture_region 

Called before:

  • IDirect3DSurface9::UnlockRect
  • IDirect3DVolume9::UnlockBox
  • IDirect3DTexture9::UnlockRect
  • IDirect3DVolumeTexture9::UnlockBox
  • IDirect3DCubeTexture9::UnlockRect
  • ID3D10Resource::Unmap
  • ID3D11DeviceContext::Unmap
  • ID3D12Resource::Unmap

Callback function signature: void (api::device *device, api::resource resource, uint32_t subresource)

update_buffer_region 

Called before:

  • ID3D10Device::UpdateSubresource
  • ID3D11DeviceContext::UpdateSubresource
  • glBufferSubData
  • glNamedBufferSubData

Callback function signature: bool (api::device *device, const void *data, api::resource resource, uint64_t offset, uint64_t size)

To prevent this command from being executed, return true, otherwise return false. Destination resource will be in the api::resource_usage::copy_dest state.

update_texture_region 

Called before:

  • ID3D10Device::UpdateSubresource
  • ID3D11DeviceContext::UpdateSubresource
  • glTexSubData1D
  • glTexSubData2D
  • glTexSubData3D
  • glTextureSubData1D
  • glTextureSubData2D
  • glTextureSubData3D
  • glCompressedTexSubData1D
  • glCompressedTexSubData2D
  • glCompressedTexSubData3D
  • glCompressedTextureSubData1D
  • glCompressedTextureSubData2D
  • glCompressedTextureSubData3D

Callback function signature: bool (api::device *device, const api::subresource_data &data, api::resource resource, uint32_t subresource, const api::subresource_box *box)

To prevent this command from being executed, return true, otherwise return false. Destination resource will be in the api::resource_usage::copy_dest state.

init_pipeline 

Called after successful pipeline creation from:

  • IDirect3DDevice9::CreateVertexShader
  • IDirect3DDevice9::CreatePixelShader
  • IDirect3DDevice9::CreateVertexDeclaration
  • ID3D10Device::CreateVertexShader
  • ID3D10Device::CreateGeometryShader
  • ID3D10Device::CreateGeometryShaderWithStreamOutput
  • ID3D10Device::CreatePixelShader
  • ID3D10Device::CreateInputLayout
  • ID3D10Device::CreateBlendState
  • ID3D10Device::CreateDepthStencilState
  • ID3D10Device::CreateRasterizerState
  • ID3D10Device1::CreateBlendState1
  • ID3D11Device::CreateVertexShader
  • ID3D11Device::CreateHullShader
  • ID3D11Device::CreateDomainShader
  • ID3D11Device::CreateGeometryShader
  • ID3D11Device::CreateGeometryShaderWithStreamOutput
  • ID3D11Device::CreatePixelShader
  • ID3D11Device::CreateComputeShader
  • ID3D11Device::CreateInputLayout
  • ID3D11Device::CreateBlendState
  • ID3D11Device::CreateDepthStencilState
  • ID3D11Device::CreateRasterizerState
  • ID3D11Device1::CreateBlendState1
  • ID3D11Device1::CreateRasterizerState1
  • ID3D11Device3::CreateRasterizerState2
  • ID3D12Device::CreateComputePipelineState
  • ID3D12Device::CreateGraphicsPipelineState
  • ID3D12Device2::CreatePipelineState
  • ID3D12Device5::CreateStateObject
  • ID3D12Device7::AddToStateObject
  • ID3D12PipelineLibrary::LoadComputePipeline
  • ID3D12PipelineLibrary::LoadGraphicsPipeline
  • ID3D12PipelineLibrary1::LoadPipeline
  • glLinkProgram
  • vkCreateComputePipelines
  • vkCreateGraphicsPipelines

Callback function signature: void (api::device *device, api::pipeline_layout layout, uint32_t subobject_count, const api::pipeline_subobject *subobjects, api::pipeline pipeline)

May be called multiple times with the same pipeline handle (whenever the pipeline is updated or its reference count is incremented).

create_pipeline 

Called on pipeline creation, before:

  • IDirect3DDevice9::CreateVertexShader
  • IDirect3DDevice9::CreatePixelShader
  • IDirect3DDevice9::CreateVertexDeclaration
  • ID3D10Device::CreateVertexShader
  • ID3D10Device::CreateGeometryShader
  • ID3D10Device::CreateGeometryShaderWithStreamOutput
  • ID3D10Device::CreatePixelShader
  • ID3D10Device::CreateInputLayout
  • ID3D10Device::CreateBlendState
  • ID3D10Device::CreateDepthStencilState
  • ID3D10Device::CreateRasterizerState
  • ID3D10Device1::CreateBlendState1
  • ID3D11Device::CreateVertexShader
  • ID3D11Device::CreateHullShader
  • ID3D11Device::CreateDomainShader
  • ID3D11Device::CreateGeometryShader
  • ID3D11Device::CreateGeometryShaderWithStreamOutput
  • ID3D11Device::CreatePixelShader
  • ID3D11Device::CreateComputeShader
  • ID3D11Device::CreateInputLayout
  • ID3D11Device::CreateBlendState
  • ID3D11Device::CreateDepthStencilState
  • ID3D11Device::CreateRasterizerState
  • ID3D11Device1::CreateBlendState1
  • ID3D11Device1::CreateRasterizerState1
  • ID3D11Device3::CreateRasterizerState2
  • ID3D12Device::CreateComputePipelineState
  • ID3D12Device::CreateGraphicsPipelineState
  • ID3D12Device2::CreatePipelineState
  • ID3D12Device5::CreateStateObject
  • glShaderSource
  • vkCreateComputePipelines
  • vkCreateGraphicsPipelines

Callback function signature: bool (api::device *device, api::pipeline_layout layout, uint32_t subobject_count, const api::pipeline_subobject *subobjects)

To overwrite the pipeline description, modify desc in the callback and return true, otherwise return false.

destroy_pipeline 

Called on pipeline destruction, before:

  • ID3D10VertexShader::Release
  • ID3D10GeometryShader::Release
  • ID3D10PixelShader::Release
  • ID3D10InputLayout::Release
  • ID3D10BlendState::Release
  • ID3D10DepthStencilState::Release
  • ID3D10RasterizerState::Release
  • ID3D11VertexShader::Release
  • ID3D11HullShader::Release
  • ID3D11DomainShader::Release
  • ID3D11GeometryShader::Release
  • ID3D11PixelShader::Release
  • ID3D11ComputeShader::Release
  • ID3D11InputLayout::Release
  • ID3D11BlendState::Release
  • ID3D11DepthStencilState::Release
  • ID3D11RasterizerState::Release
  • ID3D12PipelineState::Release
  • ID3D12StateObject::Release
  • glDeleteProgram
  • vkDestroyPipeline

Callback function signature: void (api::device *device, api::pipeline pipeline)

Is not called in D3D9.

init_pipeline_layout 

Called after successful pipeline layout creation from:

  • ID3D12Device::CreateRootSignature
  • vkCreatePipelineLayout

Callback function signature: void (api::device *device, uint32_t param_count, const api::pipeline_layout_param *params, api::pipeline_layout layout)

In case of D3D9, D3D10, D3D11 and OpenGL this is called during device initialization as well and behaves as if an implicit global pipeline layout was created.

create_pipeline_layout 

Called on pipeline layout creation, before:

  • ID3D12Device::CreateRootSignature
  • vkCreatePipelineLayout

Callback function signature: bool (api::device *device, uint32_t &param_count, api::pipeline_layout_param *&params)

Is not called in D3D9, D3D10, D3D11 or OpenGL.

destroy_pipeline_layout 

Called on pipeline layout destruction, before:

  • ID3D12RootSignature::Release
  • VkDestroyPipelineLayout

Callback function signature: void (api::device *device, api::pipeline_layout layout)

copy_descriptor_tables 

Called before:

  • ID3D12Device::CopyDescriptors
  • ID3D12Device::CopyDescriptorsSimple
  • vkUpdateDescriptorSets

Callback function signature: bool (api::device *device, uint32_t count, const api::descriptor_table_copy *copies)

To prevent this command from being executed, return true, otherwise return false.

update_descriptor_tables 

Called before:

  • ID3D12Device::CreateConstantBufferView
  • ID3D12Device::CreateShaderResourceView
  • ID3D12Device::CreateUnorderedAccessView
  • ID3D12Device::CreateSampler
  • vkUpdateDescriptorSets

Callback function signature: bool (api::device *device, uint32_t count, const api::descriptor_table_update *updates)

To prevent this command from being executed, return true, otherwise return false.

init_query_heap 

Called after successful query heap creation from:

  • ID3D12Device::CreateQueryHeap
  • vkCreateQueryPool

Callback function signature: void (api::device *device, api::query_type type, uint32_t size, api::query_heap heap)

create_query_heap 

Called on query heap creation, before:

  • ID3D12Device::CreateQueryHeap
  • vkCreateQueryPool

Callback function signature: bool (api::device *device, api::query_type type, uint32_t &size)

destroy_query_heap 

Called on query heap destruction, before:

  • ID3D12QueryHeap::Release
  • vkDestroyQueryPool

Callback function signature: void (api::device *device, api::query_heap heap)

get_query_heap_results 

Called before:

  • vkGetQueryPoolResults

Callback function signature: bool (api::device *device, api::query_heap heap, uint32_t first, uint32_t count, void *results, uint32_t stride)

barrier 

Called after:

  • ID3D12GraphicsCommandList::ResourceBarrier
  • ID3D12GraphicsCommandList7::Barrier
  • vkCmdPipelineBarrier
  • vkCmdPipelineBarrier2

Callback function signature: void (api::command_list *cmd_list, uint32_t count, const api::resource *resources, const api::resource_usage *old_states, const api::resource_usage *new_states)

begin_render_pass 

Called before:

  • ID3D12GraphicsCommandList4::BeginRenderPass
  • vkCmdBeginRenderPass
  • vkCmdBeginRenderPass2
  • vkCmdNextSubpass
  • vkCmdNextSubpass2
  • vkCmdBeginRendering

Callback function signature: void (api::command_list *cmd_list, uint32_t count, const api::render_pass_render_target_desc *rts, const api::render_pass_depth_stencil_desc *ds)

The depth-stencil description argument is optional and may be nullptr (which indicates that no depth-stencil is used).

end_render_pass 

Called before:

  • ID3D12GraphicsCommandList4::EndRenderPass
  • vkCmdEndRenderPass
  • vkCmdEndRenderPass2
  • vkCmdNextSubpass
  • vkCmdNextSubpass2
  • vkCmdEndRendering

Callback function signature: void (api::command_list *cmd_list)

bind_render_targets_and_depth_stencil 

Called after:

  • IDirect3DDevice9::SetRenderTarget
  • IDirect3DDevice9::SetDepthStencilSurface
  • ID3D10Device::OMSetRenderTargets
  • ID3D11DeviceContext::OMSetRenderTargets
  • ID3D11DeviceContext::OMSetRenderTargetsAndUnorderedAccessViews
  • ID3D12GraphicsCommandList::OMSetRenderTargets
  • glBindFramebuffer

Callback function signature: void (api::command_list *cmd_list, uint32_t count, const api::resource_view *rtvs, api::resource_view dsv)

bind_pipeline 

Called after:

  • IDirect3DDevice9::SetVertexShader
  • IDirect3DDevice9::SetPixelShader
  • IDirect3DDevice9::SetVertexDeclaration
  • IDirect3DDevice9::ProcessVertices
  • ID3D10Device::VSSetShader
  • ID3D10Device::GSSetShader
  • ID3D10Device::PSSetShader
  • ID3D10Device::IASetInputLayout
  • ID3D10Device::OMSetBlendState
  • ID3D10Device::OMSetDepthStencilState
  • ID3D10Device::RSSetState
  • ID3D11DeviceContext::VSSetShader
  • ID3D11DeviceContext::HSSetShader
  • ID3D11DeviceContext::DSSetShader
  • ID3D11DeviceContext::GSSetShader
  • ID3D11DeviceContext::PSSetShader
  • ID3D11DeviceContext::CSSetShader
  • ID3D11DeviceContext::IASetInputLayout
  • ID3D11DeviceContext::OMSetBlendState
  • ID3D11DeviceContext::OMSetDepthStencilState
  • ID3D11DeviceContext::RSSetState
  • ID3D12GraphicsCommandList::Reset
  • ID3D12GraphicsCommandList::SetPipelineState
  • ID3D12GraphicsCommandList4::SetPipelineState1
  • glUseProgram
  • glBindVertexArray
  • vkCmdBindPipeline

Callback function signature: void (api::command_list *cmd_list, api::pipeline_stage stages, api::pipeline pipeline)

bind_pipeline_states 

Called after:

  • IDirect3DDevice9::SetRenderState
  • ID3D10Device::IASetPrimitiveTopology
  • ID3D10Device::OMSetBlendState
  • ID3D10Device::OMSetDepthStencilState
  • ID3D11DeviceContext::IASetPrimitiveTopology
  • ID3D11DeviceContext::OMSetBlendState
  • ID3D11DeviceContext::OMSetDepthStencilState
  • ID3D12GraphicsCommandList::IASetPrimitiveTopology
  • ID3D12GraphicsCommandList::OMSetBlendFactor
  • ID3D12GraphicsCommandList::OMSetStencilRef
  • gl(...)
  • vkCmdSetDepthBias
  • vkCmdSetBlendConstants
  • vkCmdSetStencilCompareMask
  • vkCmdSetStencilWriteMask
  • vkCmdSetStencilReference

Callback function signature: void (api::command_list *cmd_list, uint32_t count, const api::dynamic_state *states, const uint32_t *values)

bind_viewports 

Called after:

  • IDirect3DDevice9::SetViewport
  • IDirect3DDevice9::SetRenderTarget (implicitly updates the viewport)
  • ID3D10Device::RSSetViewports
  • ID3D11DeviceContext::RSSetViewports
  • ID3D12GraphicsCommandList::RSSetViewports
  • glViewport
  • glViewportArrayv
  • glViewportIndexedf
  • glViewportIndexedfv
  • vkCmdSetViewport

Callback function signature: void (api::command_list *cmd_list, uint32_t first, uint32_t count, const api::viewport *viewports)

bind_scissor_rects 

Called after:

  • IDirect3DDevice9::SetScissorRect
  • ID3D10Device::RSSetScissorRects
  • ID3D11DeviceContext::RSSetScissorRects
  • ID3D12GraphicsCommandList::RSSetScissorRects
  • glScissor
  • glScissorArrayv
  • glScissorIndexed
  • glScissorIndexedv
  • vkCmdSetScissor

Callback function signature: void (api::command_list *cmd_list, uint32_t first, uint32_t count, const api::rect *rects)

push_constants 

Called after:

  • IDirect3DDevice9::SetVertexShaderConstantF
  • IDirect3DDevice9::SetPixelShaderConstantF
  • ID3D12GraphicsCommandList::SetComputeRoot32BitConstant
  • ID3D12GraphicsCommandList::SetComputeRoot32BitConstants
  • ID3D12GraphicsCommandList::SetGraphicsRoot32BitConstant
  • ID3D12GraphicsCommandList::SetGraphicsRoot32BitConstants
  • glUniform(...)
  • vkCmdPushConstants

Callback function signature: void (api::command_list *cmd_list, api::shader_stage stages, api::pipeline_layout layout, uint32_t layout_param, uint32_t first, uint32_t count, const void *values)

push_descriptors 

Called after:

  • IDirect3DDevice9::SetTexture
  • ID3D10Device::VSSetSamplers
  • ID3D10Device::VSSetShaderResources
  • ID3D10Device::VSSetConstantBuffers
  • ID3D10Device::GSSetSamplers
  • ID3D10Device::GSSetShaderResources
  • ID3D10Device::GSSetConstantBuffers
  • ID3D10Device::PSSetSamplers
  • ID3D10Device::PSSetShaderResources
  • ID3D10Device::PSSetConstantBuffers
  • ID3D11DeviceContext::VSSetSamplers
  • ID3D11DeviceContext::VSSetShaderResources
  • ID3D11DeviceContext::VSSetConstantBuffers
  • ID3D11DeviceContext::HSSetSamplers
  • ID3D11DeviceContext::HSSetShaderResources
  • ID3D11DeviceContext::HSSetConstantBuffers
  • ID3D11DeviceContext::DSSetSamplers
  • ID3D11DeviceContext::DSSetShaderResources
  • ID3D11DeviceContext::DSSetConstantBuffers
  • ID3D11DeviceContext::GSSetSamplers
  • ID3D11DeviceContext::GSSetShaderResources
  • ID3D11DeviceContext::GSSetConstantBuffers
  • ID3D11DeviceContext::PSSetSamplers
  • ID3D11DeviceContext::PSSetShaderResources
  • ID3D11DeviceContext::PSSetConstantBuffers
  • ID3D11DeviceContext::CSSetSamplers
  • ID3D11DeviceContext::CSSetShaderResources
  • ID3D11DeviceContext::CSSetUnorderedAccessViews
  • ID3D11DeviceContext::CSSetConstantBuffers
  • ID3D12GraphicsCommandList::SetComputeRootConstantBufferView
  • ID3D12GraphicsCommandList::SetGraphicsRootConstantBufferView
  • ID3D12GraphicsCommandList::SetComputeRootShaderResourceView
  • ID3D12GraphicsCommandList::SetGraphicsRootShaderResourceView
  • ID3D12GraphicsCommandList::SetComputeRootUnorderedAccessView
  • ID3D12GraphicsCommandList::SetGraphicsRootUnorderedAccessView
  • glBindBufferBase
  • glBindBufferRange
  • glBindBuffersBase
  • glBindBuffersRange
  • glBindTexture
  • glBindImageTexture
  • glBindTextures
  • glBindImageTextures
  • glBindTextureUnit
  • glBindMultiTextureEXT
  • vkCmdPushDescriptorSetKHR

Callback function signature: void (api::command_list *cmd_list, api::shader_stage stages, api::pipeline_layout layout, uint32_t layout_param, const api::descriptor_table_update &update)

bind_descriptor_tables 

Called after:

  • ID3D12GraphicsCommandList::SetComputeRootSignature
  • ID3D12GraphicsCommandList::SetGraphicsRootSignature
  • ID3D12GraphicsCommandList::SetComputeRootDescriptorTable
  • ID3D12GraphicsCommandList::SetGraphicsRootDescriptorTable
  • vkCmdBindDescriptorSets

Callback function signature: void (api::command_list *cmd_list, api::shader_stage stages, api::pipeline_layout layout, uint32_t first, uint32_t count, const api::descriptor_table *tables)

bind_index_buffer 

Called after:

  • IDirect3DDevice9::SetIndices
  • ID3D10Device::IASetIndexBuffer
  • ID3D11DeviceContext::IASetIndexBuffer
  • ID3D12GraphicsCommandList::IASetIndexBuffer
  • glBindBuffer
  • vkCmdBindIndexBuffer

Callback function signature: void (api::command_list *cmd_list, api::resource buffer, uint64_t offset, uint32_t index_size)

bind_vertex_buffers 

Called after:

  • IDirect3DDevice9::SetStreamSource
  • ID3D10Device::IASetVertexBuffers
  • ID3D11DeviceContext::IASetVertexBuffers
  • ID3D12GraphicsCommandList::IASetVertexBuffers
  • glBindBuffer
  • glBindVertexBuffer
  • glBindVertexBuffers
  • vkCmdBindVertexBuffers
  • vkCmdBindVertexBuffers2

Callback function signature: void (api::command_list *cmd_list, uint32_t first, uint32_t count, const api::resource *buffers, const uint64_t *offsets, const uint32_t *strides)

The strides argument is optional and may be nullptr.

bind_stream_output_buffers 

Called after:

  • IDirect3DDevice9::ProcessVertices
  • ID3D10Device::SOSetTargets
  • ID3D11DeviceContext::SOSetTargets
  • ID3D12GraphicsCommandList::SOSetTargets
  • glBindBufferBase
  • glBindBufferRange
  • glBindBuffersBase
  • glBindBuffersRange
  • vkCmdBindTransformFeedbackBuffersEXT

Callback function signature: void (api::command_list *cmd_list, uint32_t first, uint32_t count, const api::resource *buffers, const uint64_t *offsets, const uint64_t *max_sizes, const api::resource *counter_buffers, const uint64_t *counter_offsets)

The counter arguments are optional and may be nullptr.

draw 

Called before:

  • IDirect3DDevice9::DrawPrimitive
  • IDirect3DDevice9::DrawPrimitiveUP
  • IDirect3DDevice9::ProcessVertices
  • ID3D10Device::Draw
  • ID3D10Device::DrawInstanced
  • ID3D11DeviceContext::Draw
  • ID3D11DeviceContext::DrawInstanced
  • ID3D12GraphicsCommandList::DrawInstanced
  • glDrawArrays
  • glDrawArraysInstanced
  • glDrawArraysInstancedBaseInstance
  • glMultiDrawArrays
  • vkCmdDraw

Callback function signature: bool (api::command_list *cmd_list, uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance)

To prevent this command from being executed, return true, otherwise return false.

draw_indexed 

Called before:

  • IDirect3DDevice9::DrawIndexedPrimitive
  • IDirect3DDevice9::DrawIndexedPrimitiveUP
  • ID3D10Device::DrawIndexed
  • ID3D10Device::DrawIndexedInstanced
  • ID3D11DeviceContext::DrawIndexed
  • ID3D11DeviceContext::DrawIndexedInstanced
  • ID3D12GraphicsCommandList::DrawIndexedInstanced
  • glDrawElements
  • glDrawElementsBaseVertex
  • glDrawElementsInstanced
  • glDrawElementsInstancedBaseVertex
  • glDrawElementsInstancedBaseInstance
  • glDrawElementsInstancedBaseVertexBaseInstance
  • glMultiDrawElements
  • glMultiDrawElementsBaseVertex
  • vkCmdDrawIndexed

Callback function signature: bool (api::command_list *cmd_list, uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t vertex_offset, uint32_t first_instance)

To prevent this command from being executed, return true, otherwise return false.

dispatch 

Called before:

  • ID3D11DeviceContext::Dispatch
  • ID3D12GraphicsCommandList::Dispatch
  • glDispatchCompute
  • vkCmdDispatch

Callback function signature: bool (api::command_list *cmd_list, uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z)

To prevent this command from being executed, return true, otherwise return false.

dispatch_mesh 

Called before:

  • ID3D12GraphicsCommandList::DispatchMesh
  • vkCmdDrawMeshTasksEXT

Callback function signature: bool (api::command_list *cmd_list, uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z)

To prevent this command from being executed, return true, otherwise return false.

dispatch_rays 

Called before:

  • ID3D12GraphicsCommandList::DispatchRays
  • vkCmdTraceRaysKHR

Callback function signature: bool (api::command_list *cmd_list, api::resource raygen, uint64_t raygen_offset, uint64_t raygen_size, api::resource miss, uint64_t miss_offset, uint64_t miss_size, uint64_t miss_stride, api::resource hit_group, uint64_t hit_group_offset, uint64_t hit_group_size, uint64_t hit_group_stride, api::resource callable, uint64_t callable_offset, uint64_t callable_size, uint64_t callable_stride, uint32_t width, uint32_t height, uint32_t depth)

To prevent this command from being executed, return true, otherwise return false. In case of D3D12 and Vulkan, the shader handle buffer handles may be zero with the buffers instead referred to via a device address passed in the related offset argument.

draw_or_dispatch_indirect 

Called before:

  • ID3D11DeviceContext::DrawInstancedIndirect
  • ID3D11DeviceContext::DrawIndexedInstancedIndirect
  • ID3D11DeviceContext::DispatchIndirect
  • ID3D12GraphicsCommandList::ExecuteIndirect
  • glDrawArraysIndirect
  • glDrawElementsIndirect
  • glMultiDrawArraysIndirect
  • glMultiDrawElementsIndirect
  • glDispatchComputeIndirect
  • vkCmdDrawIndirect
  • vkCmdDrawIndexedIndirect
  • vkCmdDispatchIndirect
  • vkCmdTraceRaysIndirect2KHR
  • vkCmdDrawMeshTasksIndirectEXT
  • vkCmdDrawMeshTasksIndirectCountEXT

Callback function signature: bool (api::command_list *cmd_list, api::indirect_command type, api::resource buffer, uint64_t offset, uint32_t draw_count, uint32_t stride)

To prevent this command from being executed, return true, otherwise return false.

copy_resource 

Called before:

  • IDirect3DDevice9::UpdateTexture
  • IDirect3DDevice9::GetRenderTargetData
  • ID3D10Device::CopyResource
  • ID3D11DeviceContext::CopyResource
  • ID3D12GraphicsCommandList::CopyResource

Callback function signature: bool (api::command_list *cmd_list, api::resource source, api::resource dest)

To prevent this command from being executed, return true, otherwise return false. Source resource will be in the api::resource_usage::copy_source state. Destination resource will be in the api::resource_usage::copy_dest state.

copy_buffer_region 

Called before:

  • ID3D12GraphicsCommandList::CopyBufferRegion
  • glCopyBufferSubData
  • glCopyNamedBufferSubData
  • vkCmdCopyBuffer
  • vkCmdCopyBuffer2

Callback function signature: bool (api::command_list *cmd_list, api::resource source, uint64_t source_offset, api::resource dest, uint64_t dest_offset, uint64_t size)

To prevent this command from being executed, return true, otherwise return false. Source resource will be in the api::resource_usage::copy_source state. Destination resource will be in the api::resource_usage::copy_dest state.

copy_buffer_to_texture 

Called before:

  • ID3D12GraphicsCommandList::CopyTextureRegion
  • vkCmdCopyBufferToImage
  • vkCmdCopyBufferToImage2

Callback function signature: bool (api::command_list *cmd_list, api::resource source, uint64_t source_offset, uint32_t row_length, uint32_t slice_height, api::resource dest, uint32_t dest_subresource, const api::subresource_box *dest_box)

To prevent this command from being executed, return true, otherwise return false. Source resource will be in the api::resource_usage::copy_source state. Destination resource will be in the api::resource_usage::copy_dest state. The subresource box argument is optional and may be nullptr (which indicates the entire subresource is referenced).

copy_texture_region 

Called before:

  • IDirect3DDevice9::UpdateSurface
  • IDirect3DDevice9::StretchRect
  • ID3D10Device::CopySubresourceRegion
  • ID3D11DeviceContext::CopySubresourceRegion
  • ID3D12GraphicsCommandList::CopyTextureRegion
  • glBlitFramebuffer
  • glBlitNamedFramebuffer
  • glCopyImageSubData
  • glCopyTexSubImage1D
  • glCopyTexSubImage2D
  • glCopyTexSubImage3D
  • glCopyTextureSubImage1D
  • glCopyTextureSubImage2D
  • glCopyTextureSubImage3D
  • vkCmdBlitImage
  • vkCmdBlitImage2
  • vkCmdCopyImage
  • vkCmdCopyImage2

Callback function signature: bool (api::command_list *cmd_list, api::resource source, uint32_t source_subresource, const api::subresource_box *source_box, api::resource dest, uint32_t dest_subresource, const api::subresource_box *dest_box, api::filter_mode filter)

To prevent this command from being executed, return true, otherwise return false. Source resource will be in the api::resource_usage::copy_source state. Destination resource will be in the api::resource_usage::copy_dest state. The subresource box arguments are optional and may be nullptr (which indicates the entire subresource is used).

copy_texture_to_buffer 

Called before:

  • ID3D12GraphicsCommandList::CopyTextureRegion
  • vkCmdCopyImageToBuffer
  • vkCmdCopyImageToBuffer2

Callback function signature: bool (api::command_list *cmd_list, api::resource source, uint32_t source_subresource, const api::subresource_box *source_box, api::resource dest, uint64_t dest_offset, uint32_t row_length, uint32_t slice_height)

To prevent this command from being executed, return true, otherwise return false. Source resource will be in the api::resource_usage::copy_source state. Destination resource will be in the api::resource_usage::copy_dest state. The subresource box argument is optional and may be nullptr (which indicates the entire subresource is used).

resolve_texture_region 

Called before:

  • IDirect3DDevice9::StretchRect
  • ID3D10Device::ResolveSubresource
  • ID3D11DeviceContext::ResolveSubresource
  • ID3D12GraphicsCommandList::ResolveSubresource
  • ID3D12GraphicsCommandList1::ResolveSubresourceRegion
  • glBlitFramebuffer
  • glBlitNamedFramebuffer
  • vkCmdResolveImage
  • vkCmdResolveImage2

Callback function signature: bool (api::command_list *cmd_list, api::resource source, uint32_t source_subresource, const api::subresource_box *source_box, api::resource dest, uint32_t dest_subresource, int32_t dest_x, int32_t dest_y, int32_t dest_z, api::format format)

To prevent this command from being executed, return true, otherwise return false. Source resource will be in the api::resource_usage::resolve_source state. Destination resource will be in the api::resource_usage::resolve_dest state. The subresource box argument is optional and may be nullptr (which indicates the entire subresource is used).

clear_depth_stencil_view 

Called before:

  • IDirect3DDevice9::Clear
  • ID3D10Device::ClearDepthStencilView
  • ID3D11DeviceContext::ClearDepthStencilView
  • ID3D11DeviceContext1::ClearView (for depth-stencil views)
  • ID3D12GraphicsCommandList::ClearDepthStencilView
  • glClear
  • glClearBufferfi
  • glClearBufferfv
  • glClearNamedFramebufferfi
  • glClearNamedFramebufferfv
  • vkCmdClearDepthStencilImage
  • vkCmdClearAttachments

Callback function signature: bool (api::command_list *cmd_list, api::resource_view dsv, const float *depth, const uint8_t *stencil, uint32_t rect_count, const api::rect *rects)

To prevent this command from being executed, return true, otherwise return false. Resource will be in the api::resource_usage::depth_stencil_write state. One of the depth or stencil clear value arguments may be nullptr when the respective component is not cleared.

clear_render_target_view 

Called before:

  • IDirect3DDevice9::Clear
  • IDirect3DDevice9::ColorFill
  • ID3D10Device::ClearRenderTargetView
  • ID3D11DeviceContext::ClearRenderTargetView
  • ID3D11DeviceContext1::ClearView (for render target views)
  • ID3D12GraphicsCommandList::ClearRenderTargetView
  • glClear
  • glClearBufferfv
  • glClearNamedFramebufferfv
  • vkCmdClearColorImage
  • vkCmdClearAttachments

Callback function signature: bool (api::command_list *cmd_list, api::resource_view rtv, const float color[4], uint32_t rect_count, const api::rect *rects)

To prevent this command from being executed, return true, otherwise return false. Resources will be in the api::resource_usage::render_target state.

clear_unordered_access_view_uint 

Called before:

  • ID3D11DeviceContext::ClearUnorderedAccessViewUint
  • ID3D12GraphicsCommandList::ClearUnorderedAccessViewUint

Callback function signature: bool (api::command_list *cmd_list, api::resource_view uav, const uint32_t values[4], uint32_t rect_count, const api::rect *rects)

To prevent this command from being executed, return true, otherwise return false. Resource will be in the api::resource_usage::unordered_access state.

clear_unordered_access_view_float 

Called before:

  • ID3D11DeviceContext::ClearUnorderedAccessViewFloat
  • ID3D11DeviceContext1::ClearView (for unordered access views)
  • ID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat

Callback function signature: bool (api::command_list *cmd_list, api::resource_view uav, const float values[4], uint32_t rect_count, const api::rect *rects)

To prevent this command from being executed, return true, otherwise return false. Resource will be in the api::resource_usage::unordered_access state.

generate_mipmaps 

Called before:

  • ID3D10Device::GenerateMips
  • ID3D11DeviceContext::GenerateMips
  • glGenerateMipmap
  • glGenerateTextureMipmap

Callback function signature: bool (api::command_list *cmd_list, api::resource_view srv)

To prevent this command from being executed, return true, otherwise return false.

begin_query 

Called before:

  • ID3D12GraphicsCommandList::BeginQuery
  • vkCmdBeginQuery
  • vkCmdBeginQueryIndexedEXT

Callback function signature: bool (api::command_list *cmd_list, api::query_heap heap, api::query_type type, uint32_t index)

To prevent this command from being executed, return true, otherwise return false.

end_query 

Called before:

  • ID3D12GraphicsCommandList::EndQuery
  • vkCmdEndQuery
  • vkCmdEndQueryIndexedEXT
  • vkCmdWriteTimestamp
  • vkCmdWriteTimestamp2

Callback function signature: bool (api::command_list *cmd_list, api::query_heap heap, api::query_type type, uint32_t index)

To prevent this command from being executed, return true, otherwise return false.

copy_query_heap_results 

Called before:

  • ID3D12GraphicsCommandList::ResolveQueryData
  • vkCmdCopyQueryPoolResults

Callback function signature: bool (api::command_list *cmd_list, api::query_heap heap, api::query_type type, uint32_t first, uint32_t count, api::resource dest, uint64_t dest_offset, uint32_t stride)

To prevent this command from being executed, return true, otherwise return false.

copy_acceleration_structure 

Called before:

  • ID3D12GraphicsCommandList4::CopyRaytracingAccelerationStructure
  • vkCmdCopyAccelerationStructureKHR

Callback function signature: bool (api::command_list *cmd_list, api::resource_view source, api::resource_view dest, api::acceleration_structure_copy_mode mode)

To prevent this command from being executed, return true, otherwise return false.

build_acceleration_structure 

Called before:

  • ID3D12GraphicsCommandList4::BuildRaytracingAccelerationStructure
  • vkCmdBuildAccelerationStructuresKHR

Callback function signature: bool (api::command_list *cmd_list, api::acceleration_structure_type type, api::acceleration_structure_build_flags flags, uint32_t input_count, const api::acceleration_structure_build_input *inputs, api::resource scratch, uint64_t scratch_offset, api::resource_view source, api::resource_view dest, api::acceleration_structure_build_mode mode)

To prevent this command from being executed, return true, otherwise return false. In case of D3D12 and Vulkan, the scratch buffer handle may be zero with the buffer instead referred to via a device address passed in the related offset argument. Scratch buffer will be in the api::resource_usage::unordered_access resource state.

reset_command_list 

Called before:

  • ID3D12GraphicsCommandList::Reset
  • vkBeginCommandBuffer

Callback function signature: void (api::command_list *cmd_list)

Is not called for immediate command lists (since they cannot be reset).

close_command_list 

Called before:

  • ID3D11DeviceContext::FinishCommandList
  • ID3D12GraphicsCommandList::Close
  • vkEndCommandBuffer

Callback function signature: void (api::command_list *cmd_list)

Is not called for immediate command lists (since they cannot be closed).

execute_command_list 

Called when a command list is submitted to a command queue (or an immediate command list is flushed), before:

  • IDirect3DDevice9::EndScene
  • ID3D10Device::Flush
  • ID3D11DeviceContext::Flush
  • ID3D11DeviceContext3::Flush1
  • ID3D12CommandQueue::ExecuteCommandLists
  • glFlush
  • vkQueueSubmit

Callback function signature: void (api::command_queue *queue, api::command_list *cmd_list)

execute_secondary_command_list 

Called when a secondary command list is executed on a primary command list, before:

  • ID3D11DeviceContext::ExecuteCommandList
  • ID3D12GraphicsCommandList::ExecuteBundle
  • vkCmdExecuteCommands

In addition, called after:

  • ID3D11DeviceContext::FinishCommandList

Callback function signature: void (api::command_list *cmd_list, api::command_list *secondary_cmd_list)

present 

Called before:

  • IDirect3DDevice9::Present
  • IDirect3DDevice9Ex::PresentEx
  • IDirect3DSwapChain9::Present
  • IDXGISwapChain::Present
  • IDXGISwapChain3::Present1
  • ID3D12CommandQueueDownlevel::Present
  • wglSwapBuffers
  • vkQueuePresentKHR
  • IVRCompositor::Submit
  • xrEndFrame

Callback function signature: void (api::command_queue *queue, api::swapchain *swapchain, const api::rect *source_rect, const api::rect *dest_rect, uint32_t dirty_rect_count, const api::rect *dirty_rects)

The source and destination rectangle arguments are optional and may be nullptr (which indicates the swap chain is presented in its entirety).

set_fullscreen_state 

Called before:

  • IDXGISwapChain::SetFullscreenState
  • vkAcquireFullScreenExclusiveModeEXT
  • vkReleaseFullScreenExclusiveModeEXT

Callback function signature: bool (api::swapchain *swapchain, bool fullscreen, void *hmonitor)

To prevent the fullscreen state from being changed, return true, otherwise return false.

reshade_present 

Called after ReShade has rendered its overlay.

Callback function signature: void (api::effect_runtime *runtime)

reshade_begin_effects 

Called right before ReShade effects are rendered.

Callback function signature: void (api::effect_runtime *runtime, api::command_list *cmd_list, api::resource_view rtv, api::resource_view rtv_srgb)

reshade_finish_effects 

Called right after ReShade effects were rendered.

Callback function signature: void (api::effect_runtime *runtime, api::command_list *cmd_list, api::resource_view rtv, api::resource_view rtv_srgb)

reshade_reloaded_effects 

Called right after all ReShade effects were reloaded. This occurs during effect runtime initialization or because the user pressed the "Reload" button in the overlay. Any api::effect_technique, api::effect_texture_variable and api::effect_uniform_variable handles are invalidated when this event occurs and need to be queried again.

Callback function signature: void (api::effect_runtime *runtime)

reshade_set_uniform_value 

Called before a uniform variable is changed, with the new value.

Callback function signature: bool (api::effect_runtime *runtime, api::effect_uniform_variable variable, const void *new_value, size_t new_value_size)

To prevent the variable value from being changed, return true, otherwise return false. The new value has the data type reported by api::effect_runtime::get_uniform_variable_type. The new value size is in bytes.

reshade_set_technique_state 

Called before a technique is enabled or disabled, with the new state.

Callback function signature: bool (api::effect_runtime *runtime, api::effect_technique technique, bool enabled)

To prevent the technique state from being changed, return true, otherwise return false.

reshade_overlay 

Called between the ImGui::NewFrame and ImGui::EndFrame calls for the ReShade overlay. Can be used to perform custom Dear ImGui calls, but it is recommended to instead use register_overlay to register a dedicated overlay.

Callback function signature: void (api::effect_runtime *runtime)

This is not called for effect runtimes in VR.

reshade_screenshot 

Called after a screenshot was taken and saved to disk, with the path to the saved image file.

Callback function signature: void (api::effect_runtime *runtime, const char *path)

reshade_render_technique 

Called for each technique after it was rendered, usually between reshade_begin_effects and reshade_finish_effects.

Callback function signature: void (api::effect_runtime *runtime, api::effect_technique technique, api::command_list *cmd_list, api::resource_view rtv, api::resource_view rtv_srgb)

reshade_set_effects_state 

Called when all effects are about to be enabled or disabled.

Callback function signature: bool (api::effect_runtime *runtime, bool enabled)

To prevent the effects state from being changed, return true, otherwise return false.

reshade_set_current_preset_path 

Called after a preset was loaded and applied. This occurs after effect reloading or when the user chooses a new preset in the overlay.

Callback function signature: void (api::effect_runtime *runtime, const char *path)

reshade_reorder_techniques 

Called when the rendering order of loaded techniques is changed, with a handle array specifying the new order.

Callback function signature: bool (api::effect_runtime *runtime, size_t count, api::effect_technique *techniques)

To prevent the order from being changed, return true, otherwise return false.

reshade_open_overlay 

Called when the ReShade overlay is about to be opened or closed.

Callback function signature: bool (api::effect_runtime *runtime, bool open, api::input_source source)

To prevent the overlay state from being changed, return true, otherwise return false.

reshade_overlay_uniform_variable 

Called when a uniform variable widget is added to the variable list in the overlay. Can be used to replace with custom one or add widgets for specific uniform variables.

Callback function signature: bool (api::effect_runtime *runtime, api::effect_uniform_variable variable)

To prevent the normal widget from being added to the overlay, return true, otherwise return false.

reshade_overlay_technique 

Called when a technique is added to the technique list in the overlay. Can be used to replace with custom one or add widgets for specific techniques.

Callback function signature: bool (api::effect_runtime *runtime, api::effect_technique technique)

To prevent the normal widget from being added to the overlay, return true, otherwise return false.

Function Documentation

◆ create_effect_runtime()

bool reshade::create_effect_runtime ( reshade::api::device_api  api,
void *  device,
void *  command_queue,
void *  swapchain,
const char *  config_path,
reshade::api::effect_runtime **  out_runtime 
)
inline

Creates a new effect runtime for an existing swapchain, for when it was not already hooked by ReShade (e.g. because the RESHADE_DISABLE_GRAPHICS_HOOK environment variable is set).

Parameters
apiUnderlying graphics API used.
device'IDirect3DDevice9', 'ID3D10Device', 'ID3D11Device', 'ID3D12Device', 'HGLRC' or 'VkDevice', depending on the graphics API.
command_queue'ID3D11DeviceContext', 'ID3D12CommandQueue', or 'VkQueue', depending on the graphics API.
swapchain'IDirect3DSwapChain9', 'IDXGISwapChain', 'HDC' or 'VkSwapchainKHR', depending on the graphics API.
config_pathPath to the configuration file the effect runtime should use.
out_runtimePointer to a variable that is set to the pointer of the created effect runtime.
Returns
true if the effect_runtime was successfully created, false otherwise (in this case out_runtime is set to nullptr).

◆ destroy_effect_runtime()

void reshade::destroy_effect_runtime ( api::effect_runtime runtime)
inline

Instantly destroys an effect runtime that was previously created via create_effect_runtime. Do not call this with effect runtimes that were automatically created by ReShade!

◆ get_config_value()

bool reshade::get_config_value ( api::effect_runtime runtime,
const char *  section,
const char *  key,
char *  value,
size_t *  value_size 
)
inline

Gets a value from one of ReShade's config files. This can use either the global config file (ReShade.ini next to the application executable), or one local to an effect runtime (ReShade[index].ini in the base path).

Parameters
runtimeOptional effect runtime to use the config file from, or nullptr to use the global config file.
sectionName of the config section.
keyName of the config value.
valuePointer to a string buffer that is filled with the config value, or nullptr to query the necessary size.
value_sizePointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator.
Returns
true if the specified config value exists, false otherwise.

◆ get_reshade_base_path()

void reshade::get_reshade_base_path ( char *  path,
size_t *  path_size 
)
inline

Gets the base path ReShade uses to resolve relative paths.

Parameters
pathPointer to a string buffer that is filled with the base path, or nullptr to query the necessary size.
path_sizePointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator.

◆ register_addon()

bool reshade::register_addon ( HMODULE  addon_module,
[[maybe_unused] ] HMODULE  reshade_module = nullptr 
)
inline

Registers this module as an add-on with ReShade. Call this in 'AddonInit' or 'DllMain' during process attach, before any of the other API functions!

Parameters
addon_moduleHandle of the current module.
reshade_moduleHandle of the ReShade module in the process, or nullptr to find it automatically.

◆ register_event()

template<addon_event ev>
void reshade::register_event ( typename addon_event_traits< ev >::decl  callback)
inline

Registers a callback for the specified event with ReShade.

The callback function is then called whenever the application performs a task associated with this event (see also the addon_event enumeration).

Parameters
callbackPointer to the callback function.
Template Parameters
evEvent to register the callback for.

◆ register_overlay()

void reshade::register_overlay ( const char *  title,
void(*)(api::effect_runtime *runtime)  callback 
)
inline

Registers an overlay with ReShade.

The callback function is then called when the overlay is visible and allows adding Dear ImGui widgets for user interaction.

Parameters
titleNull-terminated title string, or nullptr to register a settings overlay for this add-on.
callbackPointer to the callback function.

◆ set_config_value() [1/2]

void reshade::set_config_value ( api::effect_runtime runtime,
const char *  section,
const char *  key,
const char *  value 
)
inline

Sets and saves a value in one of ReShade's config files. This can use either the global config file (ReShade.ini next to the application executable), or one local to an effect runtime (ReShade[index].ini in the base path).

Parameters
runtimeOptional effect runtime to use the config file from, or nullptr to use the global config file.
sectionName of the config section.
keyName of the config value.
valueConfig value to set.

◆ set_config_value() [2/2]

void reshade::set_config_value ( api::effect_runtime runtime,
const char *  section,
const char *  key,
const char *  value,
size_t  value_size 
)
inline

◆ unregister_addon()

void reshade::unregister_addon ( HMODULE  addon_module,
[[maybe_unused] ] HMODULE  reshade_module = nullptr 
)
inline

Unregisters this module as an add-on. Call this in 'AddonUninit' or 'DllMain' during process detach, after any of the other API functions.

Parameters
addon_moduleHandle of the current module.
reshade_moduleHandle of the ReShade module in the process, or nullptr to find it automatically.

◆ unregister_event()

template<addon_event ev>
void reshade::unregister_event ( typename addon_event_traits< ev >::decl  callback)
inline

Unregisters a callback from the specified event that was previously registered via register_event.

Parameters
callbackPointer to the callback function.
Template Parameters
evEvent to unregister the callback from.

◆ unregister_overlay()

void reshade::unregister_overlay ( const char *  title,
void(*)(api::effect_runtime *runtime)  callback 
)
inline

Unregisters an overlay that was previously registered via register_overlay.

Parameters
titleNull-terminated title string.
callbackPointer to the callback function.

◆ update_and_present_effect_runtime()

void reshade::update_and_present_effect_runtime ( api::effect_runtime runtime)
inline

Updates and renders an effect runtime onto the current back buffer of the swap chain it was created with. Do not call this with effect runtimes that were automatically created by ReShade!