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

Namespaces

 api
 
 internal
 

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_sets >
 
struct  addon_event_traits< addon_event::update_descriptor_sets >
 
struct  addon_event_traits< addon_event::init_query_pool >
 
struct  addon_event_traits< addon_event::create_query_pool >
 
struct  addon_event_traits< addon_event::destroy_query_pool >
 
struct  addon_event_traits< addon_event::get_query_pool_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_sets >
 
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::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_pool_results >
 
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::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 >
 

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_sets , update_descriptor_sets , init_query_pool , create_query_pool ,
  destroy_query_pool , get_query_pool_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_sets , bind_index_buffer , bind_vertex_buffers , bind_stream_output_buffers ,
  draw , draw_indexed , dispatch , 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_pool_results , reset_command_list , close_command_list ,
  execute_command_list , execute_secondary_command_list , present , reshade_present ,
  reshade_begin_effects , reshade_finish_effects , reshade_reloaded_effects , reshade_set_uniform_value ,
  reshade_set_technique_state , reshade_overlay , reshade_screenshot
}
 

Functions

void log_message (int level, const char *message)
 Writes a message to ReShade's log. More...
 
bool config_get_value (api::effect_runtime *runtime, const char *section, const char *key, char *value, size_t *length)
 Gets a value from one of ReShade's config files. More...
 
template<typename T >
bool config_get_value (api::effect_runtime *runtime, const char *section, const char *key, T &value)
 
template<>
bool config_get_value< bool > (api::effect_runtime *runtime, const char *section, const char *key, bool &value)
 
void config_set_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. More...
 
template<typename T >
void config_set_value (api::effect_runtime *runtime, const char *section, const char *key, const T &value)
 
template<>
void config_set_value< bool > (api::effect_runtime *runtime, const char *section, const char *key, const bool &value)
 
bool register_addon (HMODULE module)
 Registers this module as an add-on with ReShade. Call this in 'DllMain' during process attach, before any of the other API functions! More...
 
void unregister_addon (HMODULE module)
 Unregisters this module. Call this in 'DllMain' during process detach, after any of the other API functions. More...
 
template<reshade::addon_event ev>
void register_event (typename reshade::addon_event_traits< ev >::decl callback)
 Registers a callback for the specified event (via template) with ReShade. More...
 
template<reshade::addon_event ev>
void unregister_event (typename reshade::addon_event_traits< ev >::decl callback)
 Unregisters a callback for the specified event (via template) that was previously registered via register_event. More...
 
void register_overlay (const char *title, void(*callback)(reshade::api::effect_runtime *runtime))
 Registers an overlay with ReShade. More...
 
void unregister_overlay (const char *title, void(*callback)(reshade::api::effect_runtime *runtime))
 Unregisters an overlay that was previously registered via register_overlay. More...
 

Enumeration Type Documentation

◆ addon_event

enum reshade::addon_event : uint32_t
strong
Enumerator
init_device 

Called after successfull 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 successfull 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 successfull 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 successfull swap chain creation, from:

  • IDirect3D9::CreateDevice (for the implicit swap chain)
  • IDirect3D9Ex::CreateDeviceEx (for the implicit swap chain)
  • IDirect3D9Device::CreateAdditionalSwapChain
  • IDirect3DDevice9::Reset (for the implicit swap chain)
  • IDirect3DDevice9Ex::ResetEx (for the implicit swap chain)
  • IDXGIFactory::CreateSwapChain
  • IDXGIFactory2::CreateSwapChain(...)
  • IDXGISwapChain::ResizeBuffers
  • IDXGISwapChain3::ResizeBuffers1
  • wglMakeCurrent
  • wglSwapBuffers (after window was resized)
  • vkCreateSwapchainKHR

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
  • 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. Is not called in OpenGL (since it is not possible to influence swap chain creation there).

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

In addition, called when swap chain is reset, 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 successfull 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
  • 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 successfull 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)

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 successfull 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

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)

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

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

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 successfull 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
  • 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
  • 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
  • glDeleteProgram
  • vkDestroyPipeline

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

Is not called in D3D9.

init_pipeline_layout 

Called after successfull 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)

create_pipeline_layout 

Called on pipeline layout creation.

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

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_sets 

Called before:

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

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

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

update_descriptor_sets 

Called before:

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

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

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

init_query_pool 

Called after successfull query pool creation from:

  • ID3D12Device::CreateQueryHeap
  • vkCreateQueryPool

Callback function signature: void (api::device *device, api::query_type type, uint32_t size, api::query_pool pool)

create_query_pool 

Called on query pool creation, before:

  • ID3D12Device::CreateQueryHeap
  • vkCreateQueryPool

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

destroy_query_pool 

Called on query pool destruction, before:

  • ID3D12QueryHeap::Release
  • vkDestroyQueryPool

Callback function signature: void (api::device *device, api::query_pool pool)

get_query_pool_results 

Called before:

  • vkGetQueryPoolResults

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

barrier 

Called after:

  • ID3D12GraphicsCommandList::ResourceBarrier
  • vkCmdPipelineBarrier

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
  • vkCmdNextSubpass

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)

end_render_pass 

Called before:

  • ID3D12GraphicsCommandList4::EndRenderPass
  • vkCmdEndRenderPass
  • vkCmdNextSubpass

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
  • glUseProgram
  • 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 uint32_t *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
  • 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_set_update &update)

bind_descriptor_sets 

Called after:

  • 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_set *sets)

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

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)

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)

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.

draw_or_dispatch_indirect 

Called before:

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

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

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

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.

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
  • vkCmdCopyImage

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.

copy_texture_to_buffer 

Called before:

  • ID3D12GraphicsCommandList::CopyTextureRegion
  • vkCmdCopyImageToBuffer

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.

resolve_texture_region 

Called before:

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

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.

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.

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

Callback function signature: bool (api::command_list *cmd_list, api::query_pool pool, 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
  • vkCmdWriteTimestamp

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

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

copy_query_pool_results 

Called before:

  • ID3D12GraphicsCommandList::ResolveQueryData
  • vkCmdCopyQueryPoolResults

Callback function signature: bool (api::command_list *cmd_list, api::query_pool pool, 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.

reset_command_list 

Called before:

  • ID3D12GraphicsCommandList::Reset
  • vkBeginCommandBuffer

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

close_command_list 

Called before:

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

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

execute_command_list 

Called when a command list is submitted to a command queue, before:

  • ID3D11DeviceContext::ExecuteCommandList
  • ID3D12CommandQueue::ExecuteCommandLists
  • 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:

  • 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

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)

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.

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

reshade_set_uniform_value 

Called before a uniform variable is changed.

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

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

reshade_set_technique_state 

Called before a technique is enabled or disabled.

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

To prevent the technique 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.

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

Function Documentation

◆ config_get_value() [1/2]

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

Gets a value from one of ReShade's config files.

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.
lengthPointer to an integer that contains the size of the string buffer and upon completion is set to the actual length of the string.
Returns
true if the specified config value exists, false otherwise.

◆ config_get_value() [2/2]

template<typename T >
bool reshade::config_get_value ( api::effect_runtime runtime,
const char *  section,
const char *  key,
T &  value 
)
inline

◆ config_get_value< bool >()

template<>
bool reshade::config_get_value< bool > ( api::effect_runtime runtime,
const char *  section,
const char *  key,
bool &  value 
)
inline

◆ config_set_value() [1/2]

void reshade::config_set_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.

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.

◆ config_set_value() [2/2]

template<typename T >
void reshade::config_set_value ( api::effect_runtime runtime,
const char *  section,
const char *  key,
const T &  value 
)
inline

◆ config_set_value< bool >()

template<>
void reshade::config_set_value< bool > ( api::effect_runtime runtime,
const char *  section,
const char *  key,
const bool &  value 
)
inline

◆ log_message()

void reshade::log_message ( int  level,
const char *  message 
)
inline

Writes a message to ReShade's log.

Parameters
levelSeverity level (1 = error, 2 = warning, 3 = info, 4 = debug).
messageA null-terminated message string.

◆ register_addon()

bool reshade::register_addon ( HMODULE  module)
inline

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

Parameters
moduleHandle of the current add-on module.

◆ register_event()

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

Registers a callback for the specified event (via template) 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.

◆ register_overlay()

void reshade::register_overlay ( const char *  title,
void(*)(reshade::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.

◆ unregister_addon()

void reshade::unregister_addon ( HMODULE  module)
inline

Unregisters this module. Call this in 'DllMain' during process detach, after any of the other API functions.

Parameters
moduleHandle of the current add-on module.

◆ unregister_event()

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

Unregisters a callback for the specified event (via template) that was previously registered via register_event.

Parameters
callbackPointer to the callback function.

◆ unregister_overlay()

void reshade::unregister_overlay ( const char *  title,
void(*)(reshade::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.