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  {
201  api_version = 1,
211  vendor_id,
216  device_id,
221  description,
237  };
238 
243  struct __declspec(novtable) api_object
244  {
254  virtual uint64_t get_native() const = 0;
255 
259  virtual void get_private_data(const uint8_t guid[16], uint64_t *data) const = 0;
266  virtual void set_private_data(const uint8_t guid[16], const uint64_t data) = 0;
267 
271  template <typename T>
272  T &get_private_data() const
273  {
274  uint64_t res;
275  get_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), &res);
276  return *reinterpret_cast<T *>(static_cast<uintptr_t>(res));
277  }
281  template <typename T, typename... Args>
282  T &create_private_data(Args &&... args)
283  {
284  uint64_t res = reinterpret_cast<uintptr_t>(new T(static_cast<Args &&>(args)...));
285  set_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), res);
286  return *reinterpret_cast<T *>(static_cast<uintptr_t>(res));
287  }
291  template <typename T>
293  {
294  uint64_t res;
295  get_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), &res);
296  delete reinterpret_cast<T *>(static_cast<uintptr_t>(res));
297  set_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), 0);
298  }
299  };
300 
308  struct __declspec(novtable) device : public api_object
309  {
313  virtual device_api get_api() const = 0;
314 
318  virtual bool check_capability(device_caps capability) const = 0;
322  virtual bool check_format_support(format format, resource_usage usage) const = 0;
323 
330  virtual bool create_sampler(const sampler_desc &desc, sampler *out_sampler) = 0;
334  virtual void destroy_sampler(sampler sampler) = 0;
335 
345  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;
350  virtual void destroy_resource(resource resource) = 0;
351 
356 
365  virtual bool create_resource_view(resource resource, resource_usage usage_type, const resource_view_desc &desc, resource_view *out_view) = 0;
369  virtual void destroy_resource_view(resource_view view) = 0;
370 
382 
392  virtual bool map_buffer_region(resource resource, uint64_t offset, uint64_t size, map_access access, void **out_data) = 0;
407  virtual bool map_texture_region(resource resource, uint32_t subresource, const subresource_box *box, map_access access, subresource_data *out_data) = 0;
413  virtual void unmap_texture_region(resource resource, uint32_t subresource) = 0;
414 
422  virtual void update_buffer_region(const void *data, resource resource, uint64_t offset, uint64_t size) = 0;
430  virtual void update_texture_region(const subresource_data &data, resource resource, uint32_t subresource, const subresource_box *box = nullptr) = 0;
431 
440  virtual bool create_pipeline(pipeline_layout layout, uint32_t subobject_count, const pipeline_subobject *subobjects, pipeline *out_pipeline) = 0;
444  virtual void destroy_pipeline(pipeline pipeline) = 0;
445 
453  virtual bool create_pipeline_layout(uint32_t param_count, const pipeline_layout_param *params, pipeline_layout *out_layout) = 0;
457  virtual void destroy_pipeline_layout(pipeline_layout layout) = 0;
458 
466  bool allocate_descriptor_table(pipeline_layout layout, uint32_t param, descriptor_table *out_table) { return allocate_descriptor_tables(1, layout, param, out_table); }
475  virtual bool allocate_descriptor_tables(uint32_t count, pipeline_layout layout, uint32_t param, descriptor_table *out_tables) = 0;
483  virtual void free_descriptor_tables(uint32_t count, const descriptor_table *tables) = 0;
484 
493  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;
494 
505  virtual void copy_descriptor_tables(uint32_t count, const descriptor_table_copy *copies) = 0;
516  virtual void update_descriptor_tables(uint32_t count, const descriptor_table_update *updates) = 0;
517 
525  virtual bool create_query_heap(query_type type, uint32_t size, query_heap *out_heap) = 0;
529  virtual void destroy_query_heap(query_heap heap) = 0;
530 
540  virtual bool get_query_heap_results(query_heap heap, uint32_t first, uint32_t count, void *results, uint32_t stride) = 0;
541 
547  virtual void set_resource_name(resource resource, const char *name) = 0;
553  virtual void set_resource_view_name(resource_view view, const char *name) = 0;
554 
563  virtual bool create_fence(uint64_t initial_value, fence_flags flags, fence *out_fence, void **shared_handle = nullptr) = 0;
567  virtual void destroy_fence(fence fence) = 0;
568 
572  virtual uint64_t get_completed_fence_value(fence fence) const = 0;
573 
581  virtual bool wait(fence fence, uint64_t value, uint64_t timeout = UINT64_MAX) = 0;
588  virtual bool signal(fence fence, uint64_t value) = 0;
589 
596  virtual bool get_property(device_properties property, void *data) const = 0;
597 
603  virtual uint64_t get_resource_view_gpu_address(resource_view view) const = 0;
604 
616  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;
617 
627  virtual bool get_pipeline_shader_group_handles(pipeline pipeline, uint32_t first, uint32_t count, void *out_handles) = 0;
628  };
629 
633  struct __declspec(novtable) device_object : public api_object
634  {
638  virtual device *get_device() = 0;
639  };
640 
645  enum class indirect_command
646  {
647  unknown,
648  draw,
649  draw_indexed,
650  dispatch,
653  };
654 
662  struct __declspec(novtable) command_list : public device_object
663  {
672  void barrier(resource resource, resource_usage old_state, resource_usage new_state) { barrier(1, &resource, &old_state, &new_state); }
680  virtual void barrier(uint32_t count, const resource *resources, const resource_usage *old_states, const resource_usage *new_states) = 0;
681 
688  virtual void begin_render_pass(uint32_t count, const render_pass_render_target_desc *rts, const render_pass_depth_stencil_desc *ds = nullptr) = 0;
694  virtual void end_render_pass() = 0;
703  virtual void bind_render_targets_and_depth_stencil(uint32_t count, const resource_view *rtvs, resource_view dsv = { 0 }) = 0;
704 
710  virtual void bind_pipeline(pipeline_stage stages, pipeline pipeline) = 0;
717  void bind_pipeline_state(dynamic_state state, uint32_t value) { bind_pipeline_states(1, &state, &value); }
725  virtual void bind_pipeline_states(uint32_t count, const dynamic_state *states, const uint32_t *values) = 0;
733  virtual void bind_viewports(uint32_t first, uint32_t count, const viewport *viewports) = 0;
741  virtual void bind_scissor_rects(uint32_t first, uint32_t count, const rect *rects) = 0;
742 
754  virtual void push_constants(shader_stage stages, pipeline_layout layout, uint32_t param, uint32_t first, uint32_t count, const void *values) = 0;
763  virtual void push_descriptors(shader_stage stages, pipeline_layout layout, uint32_t param, const descriptor_table_update &update) = 0;
771  void bind_descriptor_table(shader_stage stages, pipeline_layout layout, uint32_t param, descriptor_table table) { bind_descriptor_tables(stages, layout, param, 1, &table); }
780  virtual void bind_descriptor_tables(shader_stage stages, pipeline_layout layout, uint32_t first, uint32_t count, const descriptor_table *tables) = 0;
781 
788  virtual void bind_index_buffer(resource buffer, uint64_t offset, uint32_t index_size) = 0;
796  void bind_vertex_buffer(uint32_t index, resource buffer, uint64_t offset, uint32_t stride) { bind_vertex_buffers(index, 1, &buffer, &offset, &stride); }
805  virtual void bind_vertex_buffers(uint32_t first, uint32_t count, const resource *buffers, const uint64_t *offsets, const uint32_t *strides) = 0;
806 
817  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;
818 
827  virtual void draw(uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance) = 0;
837  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;
845  virtual void dispatch(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z) = 0;
855  virtual void draw_or_dispatch_indirect(indirect_command type, resource buffer, uint64_t offset, uint32_t draw_count, uint32_t stride) = 0;
856 
866  virtual void copy_resource(resource source, resource dest) = 0;
880  virtual void copy_buffer_region(resource source, uint64_t source_offset, resource dest, uint64_t dest_offset, uint64_t size) = 0;
896  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;
912  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;
928  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;
947  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;
948 
960  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;
971  virtual void clear_render_target_view(resource_view rtv, const float color[4], uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
982  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;
993  virtual void clear_unordered_access_view_float(resource_view uav, const float values[4], uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
994 
1004  virtual void generate_mipmaps(resource_view srv) = 0;
1005 
1012  virtual void begin_query(query_heap heap, query_type type, uint32_t index) = 0;
1019  virtual void end_query(query_heap heap, query_type type, uint32_t index) = 0;
1034  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;
1035 
1041  virtual void begin_debug_event(const char *label, const float color[4] = nullptr) = 0;
1045  virtual void end_debug_event() = 0;
1051  virtual void insert_debug_marker(const char *label, const float color[4] = nullptr) = 0;
1052 
1060  virtual void dispatch_mesh(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z) = 0;
1061 
1076  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;
1077 
1089 
1109  };
1110 
1116  {
1117  graphics = 0x1,
1118  compute = 0x2,
1119  copy = 0x4
1120  };
1122 
1130  struct __declspec(novtable) command_queue : public device_object
1131  {
1135  virtual command_queue_type get_type() const = 0;
1136 
1141  virtual void wait_idle() const = 0;
1142 
1147  virtual void flush_immediate_command_list() const = 0;
1148 
1154 
1160  virtual void begin_debug_event(const char *label, const float color[4] = nullptr) = 0;
1164  virtual void end_debug_event() = 0;
1170  virtual void insert_debug_marker(const char *label, const float color[4] = nullptr) = 0;
1171 
1178  virtual bool wait(fence fence, uint64_t value) = 0;
1185  virtual bool signal(fence fence, uint64_t value) = 0;
1186 
1191  virtual uint64_t get_timestamp_frequency() const = 0;
1192  };
1193 
1198  {
1203 
1207  uint32_t back_buffer_count = 0;
1208 
1213  uint32_t present_mode = 0;
1214 
1219  uint32_t present_flags = 0;
1220 
1224  bool fullscreen_state = false;
1225 
1231  };
1232 
1237  struct __declspec(novtable) swapchain : public device_object
1238  {
1242  virtual void *get_hwnd() const = 0;
1243 
1248  virtual resource get_back_buffer(uint32_t index) = 0;
1249 
1253  virtual uint32_t get_back_buffer_count() const = 0;
1254 
1262  virtual uint32_t get_current_back_buffer_index() const = 0;
1263 
1268 
1272  virtual color_space get_color_space() const = 0;
1273  };
1274 } }
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:576
query_type
Type of a query.
Definition: reshade_api_pipeline.hpp:1150
acceleration_structure_type
Type of an acceleration structure.
Definition: reshade_api_resource.hpp:555
dynamic_state
A list of all possible render pipeline states that can be set independent of pipeline state objects.
Definition: reshade_api_pipeline.hpp:1192
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:646
command_queue_type
Command queue type flags, which can be combined to describe the capabilities of a command queue.
Definition: reshade_api_device.hpp:1116
color_space
The available color space types for presentation.
Definition: reshade_api_format.hpp:157
map_access
Memory mapping access types.
Definition: reshade_api_resource.hpp:142
acceleration_structure_copy_mode
Type of an acceleration structure copy operation.
Definition: reshade_api_resource.hpp:565
acceleration_structure_build_flags
Flags that specify additional parameters to an acceleration structure build operation.
Definition: reshade_api_resource.hpp:585
fence_flags
Flags that specify additional parameters of a fence.
Definition: reshade_api_pipeline.hpp:1287
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:215
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:634
The base class for objects provided by the ReShade API.
Definition: reshade_api_device.hpp:244
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:292
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:272
T & create_private_data(Args &&... args)
Allocates user-defined data and stores it in the object.
Definition: reshade_api_device.hpp:282
A command list, used to enqueue render commands on the CPU, before later executing them in a command ...
Definition: reshade_api_device.hpp:663
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:672
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:717
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:771
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:796
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, 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 ...
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:1131
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:1144
All information needed to copy descriptors between descriptor tables.
Definition: reshade_api_pipeline.hpp:1074
All information needed to update descriptors in a descriptor table.
Definition: reshade_api_pipeline.hpp:1109
An opaque handle to a descriptor table in a descriptor heap.
Definition: reshade_api_pipeline.hpp:1068
The base class for objects that are children to a logical render device.
Definition: reshade_api_device.hpp:634
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:309
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 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:499
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 create_query_heap(query_type type, uint32_t size, query_heap *out_heap)=0
Creates a new query heap.
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:466
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:479
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:510
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:1299
Describes a single parameter in a pipeline layout.
Definition: reshade_api_pipeline.hpp:207
An opaque handle to a pipeline layout object.
Definition: reshade_api_pipeline.hpp:256
Describes a pipeline sub-object.
Definition: reshade_api_pipeline.hpp:1006
An opaque handle to a pipeline state object.
Definition: reshade_api_pipeline.hpp:1027
An opaque handle to a query heap.
Definition: reshade_api_pipeline.hpp:1185
Describes a rectangle.
Definition: reshade_api_pipeline.hpp:1260
Describes a depth-stencil view and how it is treated at the start and end of a render pass.
Definition: reshade_api_resource.hpp:497
Describes a render target view and how it is treated at the start and end of a render pass.
Definition: reshade_api_resource.hpp:532
Describes a resource, such as a buffer or texture.
Definition: reshade_api_resource.hpp:252
Describes a resource view, which specifies how to interpret the data of a resource.
Definition: reshade_api_resource.hpp:361
An opaque handle to a resource view object (depth-stencil, render target, shader resource view,...
Definition: reshade_api_resource.hpp:432
An opaque handle to a resource object (buffer, texture, ...).
Definition: reshade_api_resource.hpp:336
Describes a sampler state.
Definition: reshade_api_resource.hpp:89
An opaque handle to a sampler state object.
Definition: reshade_api_resource.hpp:136
Describes a region inside a subresource.
Definition: reshade_api_resource.hpp:438
Describes the data of a subresource.
Definition: reshade_api_resource.hpp:455
Describes a swap chain and its back buffer resources.
Definition: reshade_api_device.hpp:1198
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:1230
uint32_t back_buffer_count
Number of back buffer resources in the swap chain.
Definition: reshade_api_device.hpp:1207
bool fullscreen_state
Initial fullscreen state.
Definition: reshade_api_device.hpp:1224
uint32_t present_mode
Defines how the back buffers should be swapped when a present occurs.
Definition: reshade_api_device.hpp:1213
uint32_t present_flags
Swap chain creation flags.
Definition: reshade_api_device.hpp:1219
resource_desc back_buffer
Description of the back buffer resources.
Definition: reshade_api_device.hpp:1202
A swap chain, used to present images to the screen.
Definition: reshade_api_device.hpp:1238
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:1258
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:1274