ReShade
A generic post-processing injector for games and video software.
reshade_api_device.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Patrick Mours
3  * SPDX-License-Identifier: BSD-3-Clause OR MIT
4  */
5 
6 #pragma once
7 
8 #define RESHADE_DEFINE_INTERFACE(name) \
9  struct __declspec(novtable) name
10 #define RESHADE_DEFINE_INTERFACE_WITH_BASE(name, base) \
11  struct __declspec(novtable) name : public base
12 
13 #include "reshade_api_pipeline.hpp"
14 
15 namespace reshade::api
16 {
20  enum class device_api
21  {
24  d3d9 = 0x9000,
27  d3d10 = 0xa000,
30  d3d11 = 0xb000,
33  d3d12 = 0xc000,
36  opengl = 0x10000,
39  vulkan = 0x20000
40  };
41 
45  enum class device_caps
46  {
51  compute_shader = 1,
66  logic_op,
131  blit,
167  };
168 
174  {
184  virtual uint64_t get_native() const = 0;
185 
189  virtual void get_private_data(const uint8_t guid[16], uint64_t *data) const = 0;
196  virtual void set_private_data(const uint8_t guid[16], const uint64_t data) = 0;
197 
201  template <typename T> inline T &get_private_data() const
202  {
203  uint64_t res;
204  get_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), &res);
205  return *reinterpret_cast<T *>(static_cast<uintptr_t>(res));
206  }
210  template <typename T> inline T &create_private_data()
211  {
212  uint64_t res = reinterpret_cast<uintptr_t>(new T());
213  set_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), res);
214  return *reinterpret_cast<T *>(static_cast<uintptr_t>(res));
215  }
219  template <typename T> inline void destroy_private_data()
220  {
221  uint64_t res;
222  get_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), &res);
223  delete reinterpret_cast<T *>(static_cast<uintptr_t>(res));
224  set_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), 0);
225  }
226  };
227 
236  {
240  virtual device_api get_api() const = 0;
241 
245  virtual bool check_capability(device_caps capability) const = 0;
249  virtual bool check_format_support(format format, resource_usage usage) const = 0;
250 
257  virtual bool create_sampler(const sampler_desc &desc, sampler *out_handle) = 0;
261  virtual void destroy_sampler(sampler handle) = 0;
262 
272  virtual bool create_resource(const resource_desc &desc, const subresource_data *initial_data, resource_usage initial_state, resource *out_handle, void **shared_handle = nullptr) = 0;
277  virtual void destroy_resource(resource handle) = 0;
278 
283 
292  virtual bool create_resource_view(resource resource, resource_usage usage_type, const resource_view_desc &desc, resource_view *out_handle) = 0;
296  virtual void destroy_resource_view(resource_view handle) = 0;
297 
306 
316  virtual bool map_buffer_region(resource resource, uint64_t offset, uint64_t size, map_access access, void **out_data) = 0;
331  virtual bool map_texture_region(resource resource, uint32_t subresource, const subresource_box *box, map_access access, subresource_data *out_data) = 0;
337  virtual void unmap_texture_region(resource resource, uint32_t subresource) = 0;
338 
346  virtual void update_buffer_region(const void *data, resource resource, uint64_t offset, uint64_t size) = 0;
354  virtual void update_texture_region(const subresource_data &data, resource resource, uint32_t subresource, const subresource_box *box = nullptr) = 0;
355 
364  virtual bool create_pipeline(pipeline_layout layout, uint32_t subobject_count, const pipeline_subobject *subobjects, pipeline *out_handle) = 0;
368  virtual void destroy_pipeline(pipeline handle) = 0;
369 
377  virtual bool create_pipeline_layout(uint32_t param_count, const pipeline_layout_param *params, pipeline_layout *out_handle) = 0;
381  virtual void destroy_pipeline_layout(pipeline_layout handle) = 0;
382 
390  inline bool allocate_descriptor_set(pipeline_layout layout, uint32_t param, descriptor_set *out_handle) { return allocate_descriptor_sets(1, layout, param, out_handle); }
399  virtual bool allocate_descriptor_sets(uint32_t count, pipeline_layout layout, uint32_t param, descriptor_set *out_handles) = 0;
403  inline void free_descriptor_set(descriptor_set handle) { free_descriptor_sets(1, &handle); }
407  virtual void free_descriptor_sets(uint32_t count, const descriptor_set *handles) = 0;
408 
417  virtual void get_descriptor_pool_offset(descriptor_set set, uint32_t binding, uint32_t array_offset, descriptor_pool *out_pool, uint32_t *out_offset) const = 0;
418 
429  virtual void copy_descriptor_sets(uint32_t count, const descriptor_set_copy *copies) = 0;
434  inline void update_descriptors(const descriptor_set_update &update) { update_descriptor_sets(1, &update); }
440  virtual void update_descriptor_sets(uint32_t count, const descriptor_set_update *updates) = 0;
441 
449  virtual bool create_query_pool(query_type type, uint32_t size, query_pool *out_handle) = 0;
453  virtual void destroy_query_pool(query_pool handle) = 0;
454 
464  virtual bool get_query_pool_results(query_pool pool, uint32_t first, uint32_t count, void *results, uint32_t stride) = 0;
465 
471  virtual void set_resource_name(resource handle, const char *name) = 0;
477  virtual void set_resource_view_name(resource_view handle, const char *name) = 0;
478  };
479 
484  {
488  virtual device *get_device() = 0;
489  };
490 
494  enum class indirect_command
495  {
496  unknown,
497  draw,
498  draw_indexed,
499  dispatch
500  };
501 
510  {
518  inline void barrier(resource resource, resource_usage old_state, resource_usage new_state) { barrier(1, &resource, &old_state, &new_state); }
526  virtual void barrier(uint32_t count, const resource *resources, const resource_usage *old_states, const resource_usage *new_states) = 0;
527 
534  virtual void begin_render_pass(uint32_t count, const render_pass_render_target_desc *rts, const render_pass_depth_stencil_desc *ds = nullptr) = 0;
540  virtual void end_render_pass() = 0;
551  virtual void bind_render_targets_and_depth_stencil(uint32_t count, const resource_view *rtvs, resource_view dsv = { 0 }) = 0;
552 
558  virtual void bind_pipeline(pipeline_stage stages, pipeline pipeline) = 0;
565  inline void bind_pipeline_state(dynamic_state state, uint32_t value) { bind_pipeline_states(1, &state, &value); }
573  virtual void bind_pipeline_states(uint32_t count, const dynamic_state *states, const uint32_t *values) = 0;
580  virtual void bind_viewports(uint32_t first, uint32_t count, const viewport *viewports) = 0;
587  virtual void bind_scissor_rects(uint32_t first, uint32_t count, const rect *rects) = 0;
588 
599  virtual void push_constants(shader_stage stages, pipeline_layout layout, uint32_t param, uint32_t first, uint32_t count, const void *values) = 0;
607  virtual void push_descriptors(shader_stage stages, pipeline_layout layout, uint32_t param, const descriptor_set_update &update) = 0;
615  inline void bind_descriptor_set(shader_stage stages, pipeline_layout layout, uint32_t param, descriptor_set set) { bind_descriptor_sets(stages, layout, param, 1, &set); }
624  virtual void bind_descriptor_sets(shader_stage stages, pipeline_layout layout, uint32_t first, uint32_t count, const descriptor_set *sets) = 0;
625 
632  virtual void bind_index_buffer(resource buffer, uint64_t offset, uint32_t index_size) = 0;
640  inline void bind_vertex_buffer(uint32_t index, resource buffer, uint64_t offset, uint32_t stride) { bind_vertex_buffers(index, 1, &buffer, &offset, &stride); }
649  virtual void bind_vertex_buffers(uint32_t first, uint32_t count, const resource *buffers, const uint64_t *offsets, const uint32_t *strides) = 0;
650 
659  virtual void bind_stream_output_buffers(uint32_t first, uint32_t count, const api::resource *buffers, const uint64_t *offsets, const uint64_t *max_sizes) = 0;
660 
668  virtual void draw(uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance) = 0;
677  virtual void draw_indexed(uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t vertex_offset, uint32_t first_instance) = 0;
687  virtual void dispatch(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z) = 0;
699  virtual void draw_or_dispatch_indirect(indirect_command type, resource buffer, uint64_t offset, uint32_t draw_count, uint32_t stride) = 0;
700 
710  virtual void copy_resource(resource source, resource dest) = 0;
724  virtual void copy_buffer_region(resource source, uint64_t source_offset, resource dest, uint64_t dest_offset, uint64_t size) = 0;
739  virtual void copy_buffer_to_texture(resource source, uint64_t source_offset, uint32_t row_length, uint32_t slice_height, resource dest, uint32_t dest_subresource, const subresource_box *dest_box = nullptr) = 0;
754  virtual void copy_texture_region(resource source, uint32_t source_subresource, const subresource_box *source_box, resource dest, uint32_t dest_subresource, const subresource_box *dest_box, filter_mode filter = filter_mode::min_mag_mip_point) = 0;
769  virtual void copy_texture_to_buffer(resource source, uint32_t source_subresource, const subresource_box *source_box, resource dest, uint64_t dest_offset, uint32_t row_length = 0, uint32_t slice_height = 0) = 0;
786  virtual void resolve_texture_region(resource source, uint32_t source_subresource, const subresource_box *source_box, resource dest, uint32_t dest_subresource, int32_t dest_x, int32_t dest_y, int32_t dest_z, format format) = 0;
787 
799  virtual void clear_depth_stencil_view(resource_view dsv, const float *depth, const uint8_t *stencil, uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
810  virtual void clear_render_target_view(resource_view rtv, const float color[4], uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
821  virtual void clear_unordered_access_view_uint(resource_view uav, const uint32_t values[4], uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
832  virtual void clear_unordered_access_view_float(resource_view uav, const float values[4], uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
833 
843  virtual void generate_mipmaps(resource_view srv) = 0;
844 
851  virtual void begin_query(query_pool pool, query_type type, uint32_t index) = 0;
858  virtual void end_query(query_pool pool, query_type type, uint32_t index) = 0;
872  virtual void copy_query_pool_results(query_pool pool, query_type type, uint32_t first, uint32_t count, resource dest, uint64_t dest_offset, uint32_t stride) = 0;
873 
879  virtual void begin_debug_event(const char *label, const float color[4] = nullptr) = 0;
883  virtual void end_debug_event() = 0;
889  virtual void insert_debug_marker(const char *label, const float color[4] = nullptr) = 0;
890  };
891 
896  {
897  graphics = 0x1,
898  compute = 0x2,
899  copy = 0x4
900  };
902 
911  {
915  virtual command_queue_type get_type() const = 0;
916 
921  virtual void wait_idle() const = 0;
922 
927  virtual void flush_immediate_command_list() const = 0;
928 
934 
940  virtual void begin_debug_event(const char *label, const float color[4] = nullptr) = 0;
944  virtual void end_debug_event() = 0;
950  virtual void insert_debug_marker(const char *label, const float color[4] = nullptr) = 0;
951  };
952 
957  {
961  uint32_t buffer_count = 0;
962 
966  uint32_t present_mode = 0;
967 
971  uint32_t present_flags = 0;
972  };
973 
979  {
983  virtual void * get_hwnd() const = 0;
984 
989  virtual resource get_back_buffer(uint32_t index) = 0;
990 
994  virtual uint32_t get_back_buffer_count() const = 0;
995 
999  inline resource get_current_back_buffer() { return get_back_buffer(get_current_back_buffer_index()); }
1003  virtual uint32_t get_current_back_buffer_index() const = 0;
1004  };
1005 }
Definition: reshade_api.hpp:11
device_api
The underlying render API a device is using, as returned by device::get_api.
Definition: reshade_api_device.hpp:21
query_type
The available query types.
Definition: reshade_api_pipeline.hpp:867
dynamic_state
A list of all possible render pipeline states that can be set independent of pipeline state objects.
Definition: reshade_api_pipeline.hpp:889
pipeline_stage
A list of flags that represent the available pipeline stages in the render pipeline.
Definition: reshade_api_pipeline.hpp:34
indirect_command
The available indirect command types.
Definition: reshade_api_device.hpp:495
command_queue_type
A list of flags that represent the available command queue types, as returned by command_queue::get_t...
Definition: reshade_api_device.hpp:896
map_access
The available memory mapping access types.
Definition: reshade_api_resource.hpp:140
device_caps
The available features a device may support.
Definition: reshade_api_device.hpp:46
@ conservative_rasterization
Specifies whether conservative rasterization is supported. If this feature is not present,...
@ partial_push_constant_updates
Specifies whether partial push constant updates are supported. If this feature is not present,...
@ partial_push_descriptor_updates
Specifies whether partial push descriptor updates are supported. If this feature is not present,...
@ draw_or_dispatch_indirect
Specifies whether indirect draw or dispatch calls are supported. If this feature is not present,...
@ shared_resource_nt_handle
Specifies whether resource sharing with NT handles is supported. If this feature is not present,...
@ hull_and_domain_shader
Specifies whether hull and domain (tessellation) shaders are supported. If this feature is not presen...
@ compute_shader
Specifies whether compute shaders are supported. If this feature is not present, the pipeline_stage::...
@ multi_viewport
Specifies whther more than one viewport is supported. If this feature is not present,...
@ independent_blend
Specifies whether blend state is controlled independently per render target. If this feature is not p...
@ sampler_anisotropic
Specifies whether anisotropic filtering is supported. If this feature is not present,...
@ resolve_region
Specifies whether resolving a region of a resource rather than its entirety is supported....
@ sampler_compare
Specifies whether comparison sampling is supported. If this feature is not present,...
@ copy_buffer_region
Specifies whether copying between buffers is supported. If this feature is not present,...
@ bind_render_targets_and_depth_stencil
Specifies whether binding individual render target and depth-stencil resource views is supported....
@ copy_query_pool_results
Specifies whether copying query results to a buffer is supported. If this feature is not present,...
@ geometry_shader
Specifies whether geometry shaders are supported. If this feature is not present, the pipeline_stage:...
@ fill_mode_non_solid
Specifies whether point and wireframe fill modes are supported. If this feature is not present,...
@ copy_buffer_to_texture
Specifies whether copying between buffers and textures is supported. If this feature is not present,...
@ dual_source_blend
Specifies whether blend operations which take two sources are supported. If this feature is not prese...
@ logic_op
Specifies whether logic operations are available in the blend state. If this feature is not present,...
@ sampler_with_resource_view
Specifies whether combined sampler and resource view descriptors are supported. If this feature is no...
@ blit
Specifies whether blitting between resources is supported. If this feature is not present,...
@ shared_resource
Specifies whether resource sharing is supported. If this feature is not present, resource_flags::shar...
@ draw_instanced
Specifies whether instancing is supported. If this feature is not present, the "instance_count" and "...
format
The available data and texture formats. This is mostly compatible with 'DXGI_FORMAT'.
Definition: reshade_api_format.hpp:18
filter_mode
The available filtering modes used for texture sampling operations.
Definition: reshade_api_resource.hpp:50
shader_stage
A list of flags that represent the available shader stages in the render pipeline.
Definition: reshade_api_pipeline.hpp:16
resource_usage
A list of flags that specify how a resource is to be used. This needs to be specified during creation...
Definition: reshade_api_resource.hpp:197
@ update_descriptor_sets
Called before: ID3D12Device::CreateConstantBufferView ID3D12Device::CreateShaderResourceView ID3D12De...
@ bind_pipeline_states
Called after: IDirect3DDevice9::SetRenderState ID3D10Device::IASetPrimitiveTopology ID3D10Device::OMS...
@ copy_descriptor_sets
Called before: ID3D12Device::CopyDescriptors ID3D12Device::CopyDescriptorsSimple vkUpdateDescriptorSe...
@ bind_vertex_buffers
Called after: IDirect3DDevice9::SetStreamSource ID3D10Device::IASetVertexBuffers ID3D11DeviceContext:...
@ bind_descriptor_sets
Called after: ID3D12GraphicsCommandList::SetComputeRootDescriptorTable ID3D12GraphicsCommandList::Set...
#define RESHADE_DEFINE_INTERFACE(name)
Definition: reshade_api_device.hpp:8
#define RESHADE_DEFINE_INTERFACE_WITH_BASE(name, base)
Definition: reshade_api_device.hpp:10
#define RESHADE_DEFINE_ENUM_FLAG_OPERATORS(type)
Definition: reshade_api_resource.hpp:16
The base class for objects provided by the ReShade API.
Definition: reshade_api_device.hpp:174
virtual void get_private_data(const uint8_t guid[16], uint64_t *data) const =0
Gets a user-defined 64-bit value from the object that was previously set via set_private_data,...
virtual uint64_t get_native() const =0
Gets the underlying native object for this API object.
virtual void set_private_data(const uint8_t guid[16], const uint64_t data)=0
Stores a user-defined 64-bit value in the object and associates it with the specified guid .
void destroy_private_data()
Frees user-defined data that was previously allocated via create_private_data.
Definition: reshade_api_device.hpp:219
T & create_private_data()
Allocates user-defined data and stores it in the object.
Definition: reshade_api_device.hpp:210
T & get_private_data() const
Gets a reference to user-defined data from the object that was previously allocated via create_privat...
Definition: reshade_api_device.hpp:201
A command list, used to enqueue render commands on the CPU, before later executing them in a command ...
Definition: reshade_api_device.hpp:510
virtual void clear_unordered_access_view_uint(resource_view uav, const uint32_t values[4], uint32_t rect_count=0, const rect *rects=nullptr)=0
Clears the resource referenced by the unordered access view.
virtual void draw(uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance)=0
Draws non-indexed primitives.
virtual void bind_vertex_buffers(uint32_t first, uint32_t count, const resource *buffers, const uint64_t *offsets, const uint32_t *strides)=0
Binds an array of vertex buffers to the input-assembler stage.
virtual void begin_query(query_pool pool, query_type type, uint32_t index)=0
Begins a query.
virtual void clear_unordered_access_view_float(resource_view uav, const float values[4], uint32_t rect_count=0, const rect *rects=nullptr)=0
Clears the resource referenced by the unordered access view.
virtual void copy_query_pool_results(query_pool pool, query_type type, uint32_t first, uint32_t count, resource dest, uint64_t dest_offset, uint32_t stride)=0
Copy the results of queries in a query pool to a buffer resource.
virtual void dispatch(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z)=0
Performs a compute shader dispatch.
virtual void copy_resource(resource source, resource dest)=0
Copies the entire contents of the source resource to the dest ination resource. Dimensions of the tw...
virtual void bind_stream_output_buffers(uint32_t first, uint32_t count, const api::resource *buffers, const uint64_t *offsets, const uint64_t *max_sizes)=0
Binds an array of buffers to the stream-output stage.
virtual void clear_render_target_view(resource_view rtv, const float color[4], uint32_t rect_count=0, const rect *rects=nullptr)=0
Clears the resource referenced by the render target view.
virtual void barrier(uint32_t count, const resource *resources, const resource_usage *old_states, const resource_usage *new_states)=0
Adds a barrier for the specified resources to the command stream.
virtual void copy_texture_to_buffer(resource source, uint32_t source_subresource, const subresource_box *source_box, resource dest, uint64_t dest_offset, uint32_t row_length=0, uint32_t slice_height=0)=0
Copies a texture region from the source texture to the dest ination buffer.
virtual void end_render_pass()=0
Ends a render pass. This must be preceeded by a call to begin_render_pass. Render passes cannot be ne...
virtual void end_debug_event()=0
Closes the current debug event region (the last one opened with begin_debug_event).
virtual void bind_viewports(uint32_t first, uint32_t count, const viewport *viewports)=0
Binds an array of viewports to the rasterizer stage.
void bind_descriptor_set(shader_stage stages, pipeline_layout layout, uint32_t param, descriptor_set set)
Binds a single descriptor set.
Definition: reshade_api_device.hpp:615
virtual void insert_debug_marker(const char *label, const float color[4]=nullptr)=0
Inserts a debug marker into the command list.
virtual void begin_debug_event(const char *label, const float color[4]=nullptr)=0
Opens a debug event region in the command list.
virtual void push_constants(shader_stage stages, pipeline_layout layout, uint32_t param, uint32_t first, uint32_t count, const void *values)=0
Directly updates constant values in the specified shader pipeline stages.
virtual void end_query(query_pool pool, query_type type, uint32_t index)=0
Ends a query.
virtual void bind_render_targets_and_depth_stencil(uint32_t count, const resource_view *rtvs, resource_view dsv={ 0 })=0
Binds individual render target and depth-stencil resource views. This must not be called between begi...
void barrier(resource resource, resource_usage old_state, resource_usage new_state)
Adds a barrier for the specified resource to the command stream. When both old_state and new_state ...
Definition: reshade_api_device.hpp:518
virtual void begin_render_pass(uint32_t count, const render_pass_render_target_desc *rts, const render_pass_depth_stencil_desc *ds=nullptr)=0
Begins a render pass and binds render target and depth-stencil resource views.
virtual void copy_buffer_region(resource source, uint64_t source_offset, resource dest, uint64_t dest_offset, uint64_t size)=0
Copies a linear memory region from the source buffer to the dest ination buffer.
void bind_pipeline_state(dynamic_state state, uint32_t value)
Updates the specfified pipeline state to the specified value . This is only valid for states that ha...
Definition: reshade_api_device.hpp:565
virtual void bind_scissor_rects(uint32_t first, uint32_t count, const rect *rects)=0
Binds an array of scissor rectangles to the rasterizer stage.
virtual void draw_or_dispatch_indirect(indirect_command type, resource buffer, uint64_t offset, uint32_t draw_count, uint32_t stride)=0
Executes indirect draw or dispatch commands.
void bind_vertex_buffer(uint32_t index, resource buffer, uint64_t offset, uint32_t stride)
Binds a single vertex buffer to the input-assembler stage.
Definition: reshade_api_device.hpp:640
virtual void bind_index_buffer(resource buffer, uint64_t offset, uint32_t index_size)=0
Binds an index buffer to the input-assembler stage.
virtual void copy_buffer_to_texture(resource source, uint64_t source_offset, uint32_t row_length, uint32_t slice_height, resource dest, uint32_t dest_subresource, const subresource_box *dest_box=nullptr)=0
Copies a texture region from the source buffer to the dest ination texture.
virtual void generate_mipmaps(resource_view srv)=0
Generates the lower mipmap levels for the specified shader resource view. Uses the largest mipmap lev...
virtual void push_descriptors(shader_stage stages, pipeline_layout layout, uint32_t param, const descriptor_set_update &update)=0
Directly binds a temporary descriptor set for the specfified shader pipeline stage and updates with a...
virtual void bind_descriptor_sets(shader_stage stages, pipeline_layout layout, uint32_t first, uint32_t count, const descriptor_set *sets)=0
Binds an array of descriptor sets.
virtual void copy_texture_region(resource source, uint32_t source_subresource, const subresource_box *source_box, resource dest, uint32_t dest_subresource, const subresource_box *dest_box, filter_mode filter=filter_mode::min_mag_mip_point)=0
Copies or blits a texture region from the source texture to the dest ination texture.
virtual void bind_pipeline(pipeline_stage stages, pipeline pipeline)=0
Binds a pipeline state object.
virtual void draw_indexed(uint32_t index_count, uint32_t instance_count, uint32_t first_index, int32_t vertex_offset, uint32_t first_instance)=0
Draws indexed primitives.
virtual void clear_depth_stencil_view(resource_view dsv, const float *depth, const uint8_t *stencil, uint32_t rect_count=0, const rect *rects=nullptr)=0
Clears the resource referenced by the depth-stencil view.
virtual void resolve_texture_region(resource source, uint32_t source_subresource, const subresource_box *source_box, resource dest, uint32_t dest_subresource, int32_t dest_x, int32_t dest_y, int32_t dest_z, format format)=0
Copies a region from the multisampled source texture to the non-multisampled dest ination texture.
virtual void bind_pipeline_states(uint32_t count, const dynamic_state *states, const uint32_t *values)=0
Updates the specfified pipeline states to the specified values . This is only valid for states that ...
A command queue, used to execute command lists on the GPU.
Definition: reshade_api_device.hpp:911
virtual command_list * get_immediate_command_list()=0
Gets a special command list, on which all issued commands are executed as soon as possible (or right ...
virtual void insert_debug_marker(const char *label, const float color[4]=nullptr)=0
Inserts a debug marker into the command queue.
virtual void flush_immediate_command_list() const =0
Flushes and executes the special immediate command list returned by get_immediate_command_list immedi...
virtual void begin_debug_event(const char *label, const float color[4]=nullptr)=0
Opens a debug event region in the command queue.
virtual command_queue_type get_type() const =0
Gets the type of the command queue, which specifies what commands can be executed on it.
virtual void end_debug_event()=0
Closes the current debug event region (the last one opened with begin_debug_event).
virtual void wait_idle() const =0
Waits for all issued GPU operations on this queue to finish before returning. This can be used to ens...
An opaque handle to a descriptor pool.
Definition: reshade_api_pipeline.hpp:861
All information needed to copy descriptors between descriptor sets.
Definition: reshade_api_pipeline.hpp:791
All information needed to update descriptors in a descriptor set.
Definition: reshade_api_pipeline.hpp:826
An opaque handle to a descriptor set.
Definition: reshade_api_pipeline.hpp:785
The base class for objects that are children to a logical render device.
Definition: reshade_api_device.hpp:484
virtual device * get_device()=0
Gets the parent device for this object.
A logical render device, used for resource creation and global operations.
Definition: reshade_api_device.hpp:236
virtual resource_view_desc get_resource_view_desc(resource_view view) const =0
Gets the description of the specified resource view.
virtual bool create_sampler(const sampler_desc &desc, sampler *out_handle)=0
Creates a new sampler state object.
virtual void update_buffer_region(const void *data, resource resource, uint64_t offset, uint64_t size)=0
Uploads data to a buffer resource.
virtual bool create_query_pool(query_type type, uint32_t size, query_pool *out_handle)=0
Creates a new query pool.
virtual void destroy_query_pool(query_pool handle)=0
Instantly destroys a query pool that was previously created via create_query_pool.
void free_descriptor_set(descriptor_set handle)
Frees adescriptor set that was previously allocated via create_descriptor_set.
Definition: reshade_api_device.hpp:403
void copy_descriptors(const descriptor_set_copy &copy)
Copies the contents of a descriptor set to another descriptor set.
Definition: reshade_api_device.hpp:423
virtual void destroy_pipeline(pipeline handle)=0
Instantly destroys a pipeline state object that was previously created via create_pipeline.
virtual void unmap_buffer_region(resource resource)=0
Unmaps a previously mapped buffer resource.
virtual device_api get_api() const =0
Gets the underlying render API used by this device.
virtual void update_texture_region(const subresource_data &data, resource resource, uint32_t subresource, const subresource_box *box=nullptr)=0
Uploads data to a texture resource.
virtual void set_resource_name(resource handle, const char *name)=0
Associates a name with a resource, for easier debugging in external tools.
virtual void destroy_resource(resource handle)=0
Instantly destroys a resource that was previously created via create_resource and frees its memory....
virtual void free_descriptor_sets(uint32_t count, const descriptor_set *handles)=0
Frees one or more descriptor sets that were previously allocated via create_descriptor_sets.
virtual bool get_query_pool_results(query_pool pool, uint32_t first, uint32_t count, void *results, uint32_t stride)=0
Gets the results of queries in a query pool.
virtual resource get_resource_from_view(resource_view view) const =0
Gets the handle to the underlying resource the specified resource view was created for.
virtual void set_resource_view_name(resource_view handle, const char *name)=0
Associates a name with a resource view, for easier debugging in external tools.
virtual void destroy_pipeline_layout(pipeline_layout handle)=0
Instantly destroys a pipeline layout that was previously created via create_pipeline_layout.
virtual bool map_buffer_region(resource resource, uint64_t offset, uint64_t size, map_access access, void **out_data)=0
Maps the memory of a buffer resource into application address space.
virtual bool allocate_descriptor_sets(uint32_t count, pipeline_layout layout, uint32_t param, descriptor_set *out_handles)=0
Allocates one or more descriptor sets from an internal pool.
virtual void unmap_texture_region(resource resource, uint32_t subresource)=0
Unmaps a previously mapped texture resource.
virtual void destroy_sampler(sampler handle)=0
Instantly destroys a sampler that was previously created via create_sampler.
virtual void copy_descriptor_sets(uint32_t count, const descriptor_set_copy *copies)=0
Copies the contents between multiple descriptor sets.
virtual void get_descriptor_pool_offset(descriptor_set set, uint32_t binding, uint32_t array_offset, descriptor_pool *out_pool, uint32_t *out_offset) const =0
Gets the offset (in descriptors) of the specified binding in the underlying descriptor pool.
virtual bool create_resource(const resource_desc &desc, const subresource_data *initial_data, resource_usage initial_state, resource *out_handle, void **shared_handle=nullptr)=0
Allocates and creates a new resource.
virtual bool map_texture_region(resource resource, uint32_t subresource, const subresource_box *box, map_access access, subresource_data *out_data)=0
Maps the memory of a texture resource into application address space.
virtual void update_descriptor_sets(uint32_t count, const descriptor_set_update *updates)=0
Updates the contents of multiple descriptor sets with the specified descriptors.
bool allocate_descriptor_set(pipeline_layout layout, uint32_t param, descriptor_set *out_handle)
Allocates a descriptor set from an internal pool.
Definition: reshade_api_device.hpp:390
virtual void destroy_resource_view(resource_view handle)=0
Instantly destroys a resource view that was previously created via create_resource_view.
virtual bool check_format_support(format format, resource_usage usage) const =0
Checks whether the specified texture format supports the specified usage .
virtual bool create_resource_view(resource resource, resource_usage usage_type, const resource_view_desc &desc, resource_view *out_handle)=0
Creates a new resource view for the specified resource .
virtual resource_desc get_resource_desc(resource resource) const =0
Gets the description of the specified resource.
virtual bool create_pipeline_layout(uint32_t param_count, const pipeline_layout_param *params, pipeline_layout *out_handle)=0
Creates a new pipeline layout.
void update_descriptors(const descriptor_set_update &update)
Updates the contents of a descriptor set with the specified descriptors.
Definition: reshade_api_device.hpp:434
virtual bool check_capability(device_caps capability) const =0
Checks whether the device supports the specified capability .
virtual bool create_pipeline(pipeline_layout layout, uint32_t subobject_count, const pipeline_subobject *subobjects, pipeline *out_handle)=0
Creates a new pipeline state object.
Describes a single parameter in a pipeline layout.
Definition: reshade_api_pipeline.hpp:147
An opaque handle to a pipeline layout object.
Definition: reshade_api_pipeline.hpp:185
Describes a pipeline sub-object.
Definition: reshade_api_pipeline.hpp:723
An opaque handle to a pipeline state object.
Definition: reshade_api_pipeline.hpp:744
An opaque handle to a query pool.
Definition: reshade_api_pipeline.hpp:882
Describes a rectangle.
Definition: reshade_api_pipeline.hpp:950
Describes a depth-stencil view and how it is treated at the start and end of a render pass.
Definition: reshade_api_resource.hpp:473
Describes a render target view and how it is treated at the start and end of a render pass.
Definition: reshade_api_resource.hpp:508
Describes a resource, such as a buffer or texture.
Definition: reshade_api_resource.hpp:232
Describes a resource view, which specifies how to interpret the data of a resource.
Definition: reshade_api_resource.hpp:339
An opaque handle to a resource view object (depth-stencil, render target, shader resource view,...
Definition: reshade_api_resource.hpp:408
An opaque handle to a resource object (buffer, texture, ...).
Definition: reshade_api_resource.hpp:315
Describes a sampler state.
Definition: reshade_api_resource.hpp:87
An opaque handle to a sampler state object.
Definition: reshade_api_resource.hpp:134
Describes a region inside a subresource.
Definition: reshade_api_resource.hpp:414
Describes the data of a subresource.
Definition: reshade_api_resource.hpp:431
Describes a swap chain and its back buffer resources.
Definition: reshade_api_device.hpp:957
uint32_t buffer_count
Number of back buffer resources in the swap chain.
Definition: reshade_api_device.hpp:961
uint32_t present_mode
Defines how the back buffers should be swapped when a present occurs.
Definition: reshade_api_device.hpp:966
uint32_t present_flags
Swap chain creation flags.
Definition: reshade_api_device.hpp:971
A swap chain, used to present images to the screen.
Definition: reshade_api_device.hpp:979
virtual resource get_back_buffer(uint32_t index)=0
Gets the back buffer resource at the specified index in this swap chain.
virtual uint32_t get_current_back_buffer_index() const =0
Gets the index of the back buffer resource that can currently be rendered into.
virtual void * get_hwnd() const =0
Gets the window handle of the window this swap chain was created with, or nullptr if this is an offsc...
resource get_current_back_buffer()
Gets the current back buffer resource.
Definition: reshade_api_device.hpp:999
virtual uint32_t get_back_buffer_count() const =0
Gets the number of back buffer resources in this swap chain.
Describes a render viewport.
Definition: reshade_api_pipeline.hpp:964