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 
9 
10 namespace reshade { namespace api
11 {
16  enum class device_api
17  {
20  d3d9 = 0x9000,
23  d3d10 = 0xa000,
26  d3d11 = 0xb000,
29  d3d12 = 0xc000,
32  opengl = 0x10000,
35  vulkan = 0x20000
36  };
37 
42  enum class device_caps
43  {
48  compute_shader = 1,
63  logic_op,
128  blit,
173  shared_fence,
188  ray_tracing,
189  };
190 
195  enum class device_properties
196  {
202  api_version = 1,
212  vendor_id,
217  device_id,
222  description,
238  };
239 
244  struct __declspec(novtable) api_object
245  {
255  virtual uint64_t get_native() const = 0;
256 
260  virtual void get_private_data(const uint8_t guid[16], uint64_t *data) const = 0;
267  virtual void set_private_data(const uint8_t guid[16], const uint64_t data) = 0;
268 
272  template <typename T>
273  T *get_private_data() const
274  {
275  uint64_t res;
276  get_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), &res);
277  return reinterpret_cast<T *>(static_cast<uintptr_t>(res));
278  }
282  template <typename T, typename... Args>
283  T *create_private_data(Args &&... args)
284  {
285  uint64_t res = reinterpret_cast<uintptr_t>(new T(static_cast<Args &&>(args)...));
286  set_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), res);
287  return reinterpret_cast<T *>(static_cast<uintptr_t>(res));
288  }
292  template <typename T>
294  {
295  delete get_private_data<T>();
296  set_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), 0);
297  }
298  };
299 
307  struct __declspec(novtable) device : public api_object
308  {
312  virtual device_api get_api() const = 0;
313 
317  virtual bool check_capability(device_caps capability) const = 0;
321  virtual bool check_format_support(format format, resource_usage usage) const = 0;
322 
329  virtual bool create_sampler(const sampler_desc &desc, sampler *out_sampler) = 0;
333  virtual void destroy_sampler(sampler sampler) = 0;
334 
344  virtual bool create_resource(const resource_desc &desc, const subresource_data *initial_data, resource_usage initial_state, resource *out_resource, void **shared_handle = nullptr) = 0;
349  virtual void destroy_resource(resource resource) = 0;
350 
355 
364  virtual bool create_resource_view(resource resource, resource_usage usage_type, const resource_view_desc &desc, resource_view *out_view) = 0;
368  virtual void destroy_resource_view(resource_view view) = 0;
369 
381 
391  virtual bool map_buffer_region(resource resource, uint64_t offset, uint64_t size, map_access access, void **out_data) = 0;
406  virtual bool map_texture_region(resource resource, uint32_t subresource, const subresource_box *box, map_access access, subresource_data *out_data) = 0;
412  virtual void unmap_texture_region(resource resource, uint32_t subresource) = 0;
413 
421  virtual void update_buffer_region(const void *data, resource resource, uint64_t offset, uint64_t size) = 0;
429  virtual void update_texture_region(const subresource_data &data, resource resource, uint32_t subresource, const subresource_box *box = nullptr) = 0;
430 
439  virtual bool create_pipeline(pipeline_layout layout, uint32_t subobject_count, const pipeline_subobject *subobjects, pipeline *out_pipeline) = 0;
443  virtual void destroy_pipeline(pipeline pipeline) = 0;
444 
452  virtual bool create_pipeline_layout(uint32_t param_count, const pipeline_layout_param *params, pipeline_layout *out_layout) = 0;
456  virtual void destroy_pipeline_layout(pipeline_layout layout) = 0;
457 
465  bool allocate_descriptor_table(pipeline_layout layout, uint32_t param, descriptor_table *out_table) { return allocate_descriptor_tables(1, layout, param, out_table); }
474  virtual bool allocate_descriptor_tables(uint32_t count, pipeline_layout layout, uint32_t param, descriptor_table *out_tables) = 0;
482  virtual void free_descriptor_tables(uint32_t count, const descriptor_table *tables) = 0;
483 
492  virtual void get_descriptor_heap_offset(descriptor_table table, uint32_t binding, uint32_t array_offset, descriptor_heap *out_heap, uint32_t *out_offset) const = 0;
493 
504  virtual void copy_descriptor_tables(uint32_t count, const descriptor_table_copy *copies) = 0;
515  virtual void update_descriptor_tables(uint32_t count, const descriptor_table_update *updates) = 0;
516 
524  virtual bool create_query_heap(query_type type, uint32_t count, query_heap *out_heap) = 0;
528  virtual void destroy_query_heap(query_heap heap) = 0;
529 
539  virtual bool get_query_heap_results(query_heap heap, uint32_t first, uint32_t count, void *results, uint32_t stride) = 0;
540 
546  virtual void set_resource_name(resource resource, const char *name) = 0;
552  virtual void set_resource_view_name(resource_view view, const char *name) = 0;
553 
562  virtual bool create_fence(uint64_t initial_value, fence_flags flags, fence *out_fence, void **shared_handle = nullptr) = 0;
566  virtual void destroy_fence(fence fence) = 0;
567 
571  virtual uint64_t get_completed_fence_value(fence fence) const = 0;
572 
580  virtual bool wait(fence fence, uint64_t value, uint64_t timeout = UINT64_MAX) = 0;
587  virtual bool signal(fence fence, uint64_t value) = 0;
588 
595  virtual bool get_property(device_properties property, void *data) const = 0;
596 
602  virtual uint64_t get_resource_view_gpu_address(resource_view view) const = 0;
603 
615  virtual void get_acceleration_structure_size(acceleration_structure_type type, acceleration_structure_build_flags flags, uint32_t input_count, const acceleration_structure_build_input *inputs, uint64_t *out_size, uint64_t *out_build_scratch_size, uint64_t *out_update_scratch_size) const = 0;
616 
626  virtual bool get_pipeline_shader_group_handles(pipeline pipeline, uint32_t first, uint32_t count, void *out_handles) = 0;
627  };
628 
632  struct __declspec(novtable) device_object : public api_object
633  {
637  virtual device *get_device() = 0;
638  };
639 
644  enum class indirect_command
645  {
646  unknown,
647  draw,
648  draw_indexed,
649  dispatch,
652  };
653 
661  struct __declspec(novtable) command_list : public device_object
662  {
671  void barrier(resource resource, resource_usage old_state, resource_usage new_state) { barrier(1, &resource, &old_state, &new_state); }
679  virtual void barrier(uint32_t count, const resource *resources, const resource_usage *old_states, const resource_usage *new_states) = 0;
680 
687  virtual void begin_render_pass(uint32_t count, const render_pass_render_target_desc *rts, const render_pass_depth_stencil_desc *ds = nullptr) = 0;
693  virtual void end_render_pass() = 0;
702  virtual void bind_render_targets_and_depth_stencil(uint32_t count, const resource_view *rtvs, resource_view dsv = { 0 }) = 0;
703 
709  virtual void bind_pipeline(pipeline_stage stages, pipeline pipeline) = 0;
716  void bind_pipeline_state(dynamic_state state, uint32_t value) { bind_pipeline_states(1, &state, &value); }
724  virtual void bind_pipeline_states(uint32_t count, const dynamic_state *states, const uint32_t *values) = 0;
732  virtual void bind_viewports(uint32_t first, uint32_t count, const viewport *viewports) = 0;
740  virtual void bind_scissor_rects(uint32_t first, uint32_t count, const rect *rects) = 0;
741 
753  virtual void push_constants(shader_stage stages, pipeline_layout layout, uint32_t param, uint32_t first, uint32_t count, const void *values) = 0;
762  virtual void push_descriptors(shader_stage stages, pipeline_layout layout, uint32_t param, const descriptor_table_update &update) = 0;
770  void bind_descriptor_table(shader_stage stages, pipeline_layout layout, uint32_t param, descriptor_table table) { bind_descriptor_tables(stages, layout, param, 1, &table); }
779  virtual void bind_descriptor_tables(shader_stage stages, pipeline_layout layout, uint32_t first, uint32_t count, const descriptor_table *tables) = 0;
780 
787  virtual void bind_index_buffer(resource buffer, uint64_t offset, uint32_t index_size) = 0;
795  void bind_vertex_buffer(uint32_t index, resource buffer, uint64_t offset, uint32_t stride) { bind_vertex_buffers(index, 1, &buffer, &offset, &stride); }
804  virtual void bind_vertex_buffers(uint32_t first, uint32_t count, const resource *buffers, const uint64_t *offsets, const uint32_t *strides) = 0;
805 
816  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, const api::resource *counter_buffers, const uint64_t *counter_offsets) = 0;
817 
826  virtual void draw(uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance) = 0;
836  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;
844  virtual void dispatch(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z) = 0;
854  virtual void draw_or_dispatch_indirect(indirect_command type, resource buffer, uint64_t offset, uint32_t draw_count, uint32_t stride) = 0;
855 
865  virtual void copy_resource(resource source, resource dest) = 0;
879  virtual void copy_buffer_region(resource source, uint64_t source_offset, resource dest, uint64_t dest_offset, uint64_t size) = 0;
895  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;
911  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;
927  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;
946  virtual void resolve_texture_region(resource source, uint32_t source_subresource, const subresource_box *source_box, resource dest, uint32_t dest_subresource, uint32_t dest_x, uint32_t dest_y, uint32_t dest_z, format format) = 0;
947 
959  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;
970  virtual void clear_render_target_view(resource_view rtv, const float color[4], uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
981  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;
992  virtual void clear_unordered_access_view_float(resource_view uav, const float values[4], uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
993 
1003  virtual void generate_mipmaps(resource_view srv) = 0;
1004 
1011  virtual void begin_query(query_heap heap, query_type type, uint32_t index) = 0;
1018  virtual void end_query(query_heap heap, query_type type, uint32_t index) = 0;
1033  virtual void copy_query_heap_results(query_heap heap, query_type type, uint32_t first, uint32_t count, resource dest, uint64_t dest_offset, uint32_t stride) = 0;
1034 
1040  virtual void begin_debug_event(const char *label, const float color[4] = nullptr) = 0;
1044  virtual void end_debug_event() = 0;
1050  virtual void insert_debug_marker(const char *label, const float color[4] = nullptr) = 0;
1051 
1059  virtual void dispatch_mesh(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z) = 0;
1060 
1075  virtual void dispatch_rays(resource raygen, uint64_t raygen_offset, uint64_t raygen_size, resource miss, uint64_t miss_offset, uint64_t miss_size, uint64_t miss_stride, resource hit_group, uint64_t hit_group_offset, uint64_t hit_group_size, uint64_t hit_group_stride, resource callable, uint64_t callable_offset, uint64_t callable_size, uint64_t callable_stride, uint32_t width, uint32_t height, uint32_t depth) = 0;
1076 
1088 
1108 
1118  virtual void query_acceleration_structures(uint32_t count, const resource_view *acceleration_structures, query_heap heap, query_type type, uint32_t first) = 0;
1119  };
1120 
1126  {
1127  graphics = 0x1,
1128  compute = 0x2,
1129  copy = 0x4
1130  };
1132 
1140  struct __declspec(novtable) command_queue : public device_object
1141  {
1145  virtual command_queue_type get_type() const = 0;
1146 
1151  virtual void wait_idle() const = 0;
1152 
1157  virtual void flush_immediate_command_list() const = 0;
1158 
1164 
1170  virtual void begin_debug_event(const char *label, const float color[4] = nullptr) = 0;
1174  virtual void end_debug_event() = 0;
1180  virtual void insert_debug_marker(const char *label, const float color[4] = nullptr) = 0;
1181 
1188  virtual bool wait(fence fence, uint64_t value) = 0;
1195  virtual bool signal(fence fence, uint64_t value) = 0;
1196 
1201  virtual uint64_t get_timestamp_frequency() const = 0;
1202  };
1203 
1208  {
1213 
1217  uint32_t back_buffer_count = 0;
1218 
1223  uint32_t present_mode = 0;
1224 
1229  uint32_t present_flags = 0;
1230 
1234  bool fullscreen_state = false;
1235 
1241 
1250  uint32_t sync_interval = UINT32_MAX;
1251  };
1252 
1257  struct __declspec(novtable) swapchain : public device_object
1258  {
1262  virtual void *get_hwnd() const = 0;
1263 
1268  virtual resource get_back_buffer(uint32_t index) = 0;
1269 
1273  virtual uint32_t get_back_buffer_count() const = 0;
1274 
1282  virtual uint32_t get_current_back_buffer_index() const = 0;
1283 
1288 
1292  virtual color_space get_color_space() const = 0;
1293  };
1294 } }
device_api
Underlying graphics API a device is using.
Definition: reshade_api_device.hpp:17
acceleration_structure_build_mode
Type of an acceleration structure build operation.
Definition: reshade_api_resource.hpp:606
query_type
Type of a query.
Definition: reshade_api_pipeline.hpp:1196
acceleration_structure_type
Type of an acceleration structure.
Definition: reshade_api_resource.hpp:585
dynamic_state
A list of all possible render pipeline states that can be set independent of pipeline state objects.
Definition: reshade_api_pipeline.hpp:1272
pipeline_stage
Flags that specify the pipeline stages in the render pipeline.
Definition: reshade_api_pipeline.hpp:45
indirect_command
Type of an indirect draw/dispatch command.
Definition: reshade_api_device.hpp:645
command_queue_type
Command queue type flags, which can be combined to describe the capabilities of a command queue.
Definition: reshade_api_device.hpp:1126
color_space
The available color space types for presentation.
Definition: reshade_api_format.hpp:186
map_access
Memory mapping access types.
Definition: reshade_api_resource.hpp:152
acceleration_structure_copy_mode
Type of an acceleration structure copy operation.
Definition: reshade_api_resource.hpp:595
acceleration_structure_build_flags
Flags that specify additional parameters to an acceleration structure build operation.
Definition: reshade_api_resource.hpp:615
fence_flags
Flags that specify additional parameters of a fence.
Definition: reshade_api_pipeline.hpp:1367
device_caps
Optional capabilities a device may support, depending on the underlying graphics API and hardware.
Definition: reshade_api_device.hpp:43
@ shared_fence_nt_handle
Specifies whether fence sharing with NT handles is supported. If this feature is not present,...
@ 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...
@ resolve_depth_stencil
Specifies whether resolving depth-stencil resources is supported. If this feature is not present,...
@ 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,...
@ shared_fence
Specifies whether fence sharing is supported. If this feature is not present, fence_flags::shared mus...
@ bind_render_targets_and_depth_stencil
Specifies whether binding individual render target and depth-stencil resource views is supported....
@ 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,...
@ ray_tracing
Specifies whether ray tracing is supported. If this feature is not present, resource_view_type::accel...
@ 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,...
@ copy_query_heap_results
Specifies whether copying query results to a buffer 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 "...
@ amplification_and_mesh_shader
Specifies whether amplification and mesh shaders are supported. If this feature is not present,...
format
Available data and texture formats. This is mostly compatible with 'DXGI_FORMAT'.
Definition: reshade_api_format.hpp:18
filter_mode
Texture filtering modes available for texture sampling operations.
Definition: reshade_api_resource.hpp:50
shader_stage
Flags that specify the shader stages in the render pipeline.
Definition: reshade_api_pipeline.hpp:16
device_properties
Properties that may be queried from a device.
Definition: reshade_api_device.hpp:196
@ api_version
Version of the underlying graphics API the device is using. Data is a 32-bit unsigned integer value....
@ description
Description text of the hardware associated with the logical render device. Data is an array of 256 b...
@ device_id
PCI device ID of the hardware associated with the logical render device. Data is a 32-bit unsigned in...
@ vendor_id
PCI vendor ID of the hardware associated with the logical render device. Data is a 32-bit unsigned in...
@ shader_group_handle_alignment
Required alignment of each shader_group handle in the buffers passed to command_list::dispatch_rays....
@ driver_version
Version of the graphics driver that is being used. Data is a 32-bit unsigned integer value.
@ shader_group_alignment
Required alignment of the base shader_group handle in the buffers passed to command_list::dispatch_ra...
@ shader_group_handle_size
Size of a shader_group handle as written by device::get_pipeline_shader_group_handles....
resource_usage
Flags that specify how a resource is used. This needs to be specified during creation and is also use...
Definition: reshade_api_resource.hpp:225
Definition: reshade.hpp:56
#define RESHADE_DEFINE_ENUM_FLAG_OPERATORS(type)
Definition: reshade_api_resource.hpp:16
Describes a build input for an acceleration structure build operation.
Definition: reshade_api_resource.hpp:664
The base class for objects provided by the ReShade API.
Definition: reshade_api_device.hpp:245
T * create_private_data(Args &&... args)
Allocates user-defined data and stores it in the object.
Definition: reshade_api_device.hpp:283
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:293
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:273
A command list, used to enqueue render commands on the CPU, before later executing them in a command ...
Definition: reshade_api_device.hpp:662
virtual void query_acceleration_structures(uint32_t count, const resource_view *acceleration_structures, query_heap heap, query_type type, uint32_t first)=0
Queries acceleration structure size parameters. This can be used to figure out destination resource r...
virtual void push_descriptors(shader_stage stages, pipeline_layout layout, uint32_t param, const descriptor_table_update &update)=0
Directly binds a temporary descriptor table for the specfified shader pipeline stage and updates with...
virtual void build_acceleration_structure(acceleration_structure_type type, acceleration_structure_build_flags flags, uint32_t input_count, const acceleration_structure_build_input *inputs, api::resource scratch, uint64_t scratch_offset, resource_view source, resource_view dest, acceleration_structure_build_mode mode)=0
Builds or updates an acceleration structure for ray tracing.
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 bind_stream_output_buffers(uint32_t first, uint32_t count, const api::resource *buffers, const uint64_t *offsets, const uint64_t *max_sizes, const api::resource *counter_buffers, const uint64_t *counter_offsets)=0
Binds an array of buffers to the stream-output stage.
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 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 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 dispatch_rays(resource raygen, uint64_t raygen_offset, uint64_t raygen_size, resource miss, uint64_t miss_offset, uint64_t miss_size, uint64_t miss_stride, resource hit_group, uint64_t hit_group_offset, uint64_t hit_group_size, uint64_t hit_group_stride, resource callable, uint64_t callable_offset, uint64_t callable_size, uint64_t callable_stride, uint32_t width, uint32_t height, uint32_t depth)=0
Performs a ray tracing dispatch.
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.
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 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. Multiple barriers are more efficien...
Definition: reshade_api_device.hpp:671
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.
virtual void copy_acceleration_structure(resource_view source, resource_view dest, acceleration_structure_copy_mode mode)=0
Copies or transforms data from the source acceleration structure to the dest ination acceleration st...
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:716
void bind_descriptor_table(shader_stage stages, pipeline_layout layout, uint32_t param, descriptor_table table)
Binds a single descriptor table.
Definition: reshade_api_device.hpp:770
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:795
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_query_heap_results(query_heap heap, query_type type, uint32_t first, uint32_t count, resource dest, uint64_t dest_offset, uint32_t stride)=0
Copies the results of queries in a query heap to a buffer resource.
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 dispatch_mesh(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z)=0
Performs a mesh shader dispatch.
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 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 bind_descriptor_tables(shader_stage stages, pipeline_layout layout, uint32_t first, uint32_t count, const descriptor_table *tables)=0
Binds an array of descriptor tables.
virtual void begin_query(query_heap heap, query_type type, uint32_t index)=0
Begins a query.
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, uint32_t dest_x, uint32_t dest_y, uint32_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 ...
virtual void end_query(query_heap heap, query_type type, uint32_t index)=0
Ends a query.
A command queue, used to execute command lists on the GPU.
Definition: reshade_api_device.hpp:1141
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 bool wait(fence fence, uint64_t value)=0
Queues a GPU-side wait until the specified fence reaches the specified value and returns immediately.
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 bool signal(fence fence, uint64_t value)=0
Queues a GPU-side update of the specified fence to the specified value after previous operations fini...
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 uint64_t get_timestamp_frequency() const =0
Queries the GPU timestamp frequency in ticks per second.
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 heap.
Definition: reshade_api_pipeline.hpp:1190
All information needed to copy descriptors between descriptor tables.
Definition: reshade_api_pipeline.hpp:1110
All information needed to update descriptors in a descriptor table.
Definition: reshade_api_pipeline.hpp:1145
An opaque handle to a descriptor table in a descriptor heap.
Definition: reshade_api_pipeline.hpp:1104
The base class for objects that are children to a logical render device.
Definition: reshade_api_device.hpp:633
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:308
virtual resource_view_desc get_resource_view_desc(resource_view view) const =0
Gets the description of the specified resource view.
virtual void update_descriptor_tables(uint32_t count, const descriptor_table_update *updates)=0
Updates the contents of multiple descriptor tables with the specified descriptors.
virtual bool create_query_heap(query_type type, uint32_t count, query_heap *out_heap)=0
Creates a new query heap.
virtual void destroy_pipeline_layout(pipeline_layout layout)=0
Instantly destroys a pipeline layout that was previously created via create_pipeline_layout.
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 get_query_heap_results(query_heap heap, uint32_t first, uint32_t count, void *results, uint32_t stride)=0
Gets the results of queries in a query heap.
virtual bool create_fence(uint64_t initial_value, fence_flags flags, fence *out_fence, void **shared_handle=nullptr)=0
Creates a new fence synchronization object.
virtual bool signal(fence fence, uint64_t value)=0
Updates the specified fence to the specified value.
virtual bool create_resource_view(resource resource, resource_usage usage_type, const resource_view_desc &desc, resource_view *out_view)=0
Creates a new resource view for the specified resource .
virtual void destroy_sampler(sampler sampler)=0
Instantly destroys a sampler that was previously created via create_sampler.
virtual void unmap_buffer_region(resource resource)=0
Unmaps a previously mapped buffer resource.
virtual device_api get_api() const =0
Gets the underlying graphics 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 bool get_property(device_properties property, void *data) const =0
Gets data for a property of this device.
virtual void destroy_resource_view(resource_view view)=0
Instantly destroys a resource view that was previously created via create_resource_view.
virtual void get_acceleration_structure_size(acceleration_structure_type type, acceleration_structure_build_flags flags, uint32_t input_count, const acceleration_structure_build_input *inputs, uint64_t *out_size, uint64_t *out_build_scratch_size, uint64_t *out_update_scratch_size) const =0
Gets the required acceleration structure size needed to build the specified data.
void copy_descriptors(const descriptor_table_copy &copy)
Copies the contents of a descriptor table to another descriptor table.
Definition: reshade_api_device.hpp:498
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 copy_descriptor_tables(uint32_t count, const descriptor_table_copy *copies)=0
Copies the contents between multiple descriptor tables.
virtual void set_resource_view_name(resource_view view, const char *name)=0
Associates a name with a resource view, for easier debugging in external tools.
virtual void free_descriptor_tables(uint32_t count, const descriptor_table *tables)=0
Frees one or more descriptor tables that were previously allocated via allocate_descriptor_tables.
virtual uint64_t get_resource_view_gpu_address(resource_view view) const =0
Gets the GPU address for a resource view.
virtual bool create_pipeline_layout(uint32_t param_count, const pipeline_layout_param *params, pipeline_layout *out_layout)=0
Creates a new 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 void destroy_fence(fence fence)=0
Instantly destroys a fence that was previously created via create_fence.
virtual void unmap_texture_region(resource resource, uint32_t subresource)=0
Unmaps a previously mapped texture resource.
virtual bool create_sampler(const sampler_desc &desc, sampler *out_sampler)=0
Creates a new sampler state object.
virtual bool get_pipeline_shader_group_handles(pipeline pipeline, uint32_t first, uint32_t count, void *out_handles)=0
Gets the shader group handles for a ray tracing pipeline, to be put into a shader binding table.
virtual bool wait(fence fence, uint64_t value, uint64_t timeout=UINT64_MAX)=0
Wait until the specified fence reached the specified value.
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 destroy_resource(resource resource)=0
Instantly destroys a resource that was previously created via create_resource and frees its memory....
virtual uint64_t get_completed_fence_value(fence fence) const =0
Gets the current value of the specified fence.
virtual bool allocate_descriptor_tables(uint32_t count, pipeline_layout layout, uint32_t param, descriptor_table *out_tables)=0
Allocates one or more descriptor tables from an internal descriptor heap.
virtual bool check_format_support(format format, resource_usage usage) const =0
Checks whether the specified texture format supports the specified usage .
virtual void get_descriptor_heap_offset(descriptor_table table, uint32_t binding, uint32_t array_offset, descriptor_heap *out_heap, uint32_t *out_offset) const =0
Gets the offset (in descriptors) of the specified binding in the underlying descriptor heap of a desc...
bool allocate_descriptor_table(pipeline_layout layout, uint32_t param, descriptor_table *out_table)
Allocates a descriptor table from an internal descriptor heap.
Definition: reshade_api_device.hpp:465
virtual void destroy_pipeline(pipeline pipeline)=0
Instantly destroys a pipeline state object that was previously created via create_pipeline.
void free_descriptor_table(descriptor_table table)
Frees a descriptor table that was previously allocated via allocate_descriptor_table.
Definition: reshade_api_device.hpp:478
virtual void set_resource_name(resource resource, const char *name)=0
Associates a name with a resource, for easier debugging in external tools.
virtual resource_desc get_resource_desc(resource resource) const =0
Gets the description of the specified resource.
virtual bool create_resource(const resource_desc &desc, const subresource_data *initial_data, resource_usage initial_state, resource *out_resource, void **shared_handle=nullptr)=0
Allocates and creates a new resource.
virtual bool create_pipeline(pipeline_layout layout, uint32_t subobject_count, const pipeline_subobject *subobjects, pipeline *out_pipeline)=0
Creates a new pipeline state object.
virtual bool check_capability(device_caps capability) const =0
Checks whether the device supports the specified capability .
void update_descriptors(const descriptor_table_update &update)
Updates the contents of a descriptor table with the specified descriptors.
Definition: reshade_api_device.hpp:509
virtual void destroy_query_heap(query_heap heap)=0
Instantly destroys a query heap that was previously created via create_query_heap.
An opaque handle to a fence synchronization object.
Definition: reshade_api_pipeline.hpp:1389
Describes a single parameter in a pipeline layout.
Definition: reshade_api_pipeline.hpp:213
An opaque handle to a pipeline layout object.
Definition: reshade_api_pipeline.hpp:272
Describes a pipeline sub-object.
Definition: reshade_api_pipeline.hpp:1022
An opaque handle to a pipeline state object.
Definition: reshade_api_pipeline.hpp:1053
An opaque handle to a query heap.
Definition: reshade_api_pipeline.hpp:1265
Describes a rectangle.
Definition: reshade_api_pipeline.hpp:1340
Describes a depth-stencil view and how it is treated at the start and end of a render pass.
Definition: reshade_api_resource.hpp:527
Describes a render target view and how it is treated at the start and end of a render pass.
Definition: reshade_api_resource.hpp:562
Describes a resource, such as a buffer or texture.
Definition: reshade_api_resource.hpp:262
Describes a resource view, which specifies how to interpret the data of a resource.
Definition: reshade_api_resource.hpp:381
An opaque handle to a resource view object (depth-stencil, render target, shader resource view,...
Definition: reshade_api_resource.hpp:462
An opaque handle to a resource object (buffer, texture, ...).
Definition: reshade_api_resource.hpp:356
Describes a sampler state.
Definition: reshade_api_resource.hpp:89
An opaque handle to a sampler state object.
Definition: reshade_api_resource.hpp:146
Describes a region inside a subresource.
Definition: reshade_api_resource.hpp:468
Describes the data of a subresource.
Definition: reshade_api_resource.hpp:485
Describes a swap chain and its back buffer resources.
Definition: reshade_api_device.hpp:1208
float fullscreen_refresh_rate
Refresh rate of the display in fullscreen mode, in Hertz. Set to zero to use the default.
Definition: reshade_api_device.hpp:1240
uint32_t back_buffer_count
Number of back buffer resources in the swap chain.
Definition: reshade_api_device.hpp:1217
uint32_t sync_interval
Defines how to synchronize presentation of a frame with the vertical blank. 0: Disable synchronizatio...
Definition: reshade_api_device.hpp:1250
bool fullscreen_state
Initial fullscreen state.
Definition: reshade_api_device.hpp:1234
uint32_t present_mode
Defines how the back buffers should be swapped when a present occurs.
Definition: reshade_api_device.hpp:1223
uint32_t present_flags
Swap chain creation flags.
Definition: reshade_api_device.hpp:1229
resource_desc back_buffer
Description of the back buffer resources.
Definition: reshade_api_device.hpp:1212
A swap chain, used to present images to the screen.
Definition: reshade_api_device.hpp:1258
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 handle of the window this swap chain was created with, or nullptr if this is an offscreen sw...
resource get_current_back_buffer()
Gets the current back buffer resource.
Definition: reshade_api_device.hpp:1278
virtual color_space get_color_space() const =0
Gets the color space used for presentation.
virtual uint32_t get_back_buffer_count() const =0
Gets the number of back buffer resources in this swap chain.
virtual bool check_color_space_support(color_space color_space) const =0
Checks whether the specified color space is supported for presentation.
Describes a render viewport.
Definition: reshade_api_pipeline.hpp:1354