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 {
15  enum class device_api
16  {
19  d3d9 = 0x9000,
22  d3d10 = 0xa000,
25  d3d11 = 0xb000,
28  d3d12 = 0xc000,
31  opengl = 0x10000,
34  vulkan = 0x20000
35  };
36 
40  enum class device_caps
41  {
46  compute_shader = 1,
61  logic_op,
126  blit,
171  shared_fence,
186  ray_tracing,
187  };
188 
192  enum class device_properties
193  {
198  api_version = 1,
208  vendor_id,
213  device_id,
218  description,
234  };
235 
240  struct __declspec(novtable) api_object
241  {
251  virtual uint64_t get_native() const = 0;
252 
256  virtual void get_private_data(const uint8_t guid[16], uint64_t *data) const = 0;
263  virtual void set_private_data(const uint8_t guid[16], const uint64_t data) = 0;
264 
268  template <typename T> inline T &get_private_data() const
269  {
270  uint64_t res;
271  get_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), &res);
272  return *reinterpret_cast<T *>(static_cast<uintptr_t>(res));
273  }
277  template <typename T, typename... Args> inline T &create_private_data(Args &&... args)
278  {
279  uint64_t res = reinterpret_cast<uintptr_t>(new T(static_cast<Args &&>(args)...));
280  set_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), res);
281  return *reinterpret_cast<T *>(static_cast<uintptr_t>(res));
282  }
286  template <typename T> inline void destroy_private_data()
287  {
288  uint64_t res;
289  get_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), &res);
290  delete reinterpret_cast<T *>(static_cast<uintptr_t>(res));
291  set_private_data(reinterpret_cast<const uint8_t *>(&__uuidof(T)), 0);
292  }
293  };
294 
302  struct __declspec(novtable) device : public api_object
303  {
307  virtual device_api get_api() const = 0;
308 
312  virtual bool check_capability(device_caps capability) const = 0;
316  virtual bool check_format_support(format format, resource_usage usage) const = 0;
317 
324  virtual bool create_sampler(const sampler_desc &desc, sampler *out_handle) = 0;
328  virtual void destroy_sampler(sampler handle) = 0;
329 
339  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;
344  virtual void destroy_resource(resource handle) = 0;
345 
350 
359  virtual bool create_resource_view(resource resource, resource_usage usage_type, const resource_view_desc &desc, resource_view *out_handle) = 0;
363  virtual void destroy_resource_view(resource_view handle) = 0;
364 
376 
386  virtual bool map_buffer_region(resource resource, uint64_t offset, uint64_t size, map_access access, void **out_data) = 0;
401  virtual bool map_texture_region(resource resource, uint32_t subresource, const subresource_box *box, map_access access, subresource_data *out_data) = 0;
407  virtual void unmap_texture_region(resource resource, uint32_t subresource) = 0;
408 
416  virtual void update_buffer_region(const void *data, resource resource, uint64_t offset, uint64_t size) = 0;
424  virtual void update_texture_region(const subresource_data &data, resource resource, uint32_t subresource, const subresource_box *box = nullptr) = 0;
425 
434  virtual bool create_pipeline(pipeline_layout layout, uint32_t subobject_count, const pipeline_subobject *subobjects, pipeline *out_handle) = 0;
438  virtual void destroy_pipeline(pipeline handle) = 0;
439 
447  virtual bool create_pipeline_layout(uint32_t param_count, const pipeline_layout_param *params, pipeline_layout *out_handle) = 0;
451  virtual void destroy_pipeline_layout(pipeline_layout handle) = 0;
452 
460  inline bool allocate_descriptor_table(pipeline_layout layout, uint32_t param, descriptor_table *out_handle) { return allocate_descriptor_tables(1, layout, param, out_handle); }
469  virtual bool allocate_descriptor_tables(uint32_t count, pipeline_layout layout, uint32_t param, descriptor_table *out_handles) = 0;
473  inline void free_descriptor_table(descriptor_table handle) { free_descriptor_tables(1, &handle); }
477  virtual void free_descriptor_tables(uint32_t count, const descriptor_table *handles) = 0;
478 
487  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;
488 
499  virtual void copy_descriptor_tables(uint32_t count, const descriptor_table_copy *copies) = 0;
510  virtual void update_descriptor_tables(uint32_t count, const descriptor_table_update *updates) = 0;
511 
519  virtual bool create_query_heap(query_type type, uint32_t size, query_heap *out_handle) = 0;
523  virtual void destroy_query_heap(query_heap handle) = 0;
524 
534  virtual bool get_query_heap_results(query_heap heap, uint32_t first, uint32_t count, void *results, uint32_t stride) = 0;
535 
541  virtual void set_resource_name(resource handle, const char *name) = 0;
547  virtual void set_resource_view_name(resource_view handle, const char *name) = 0;
548 
557  virtual bool create_fence(uint64_t initial_value, fence_flags flags, fence *out_handle, void **shared_handle = nullptr) = 0;
561  virtual void destroy_fence(fence handle) = 0;
562 
566  virtual uint64_t get_completed_fence_value(fence fence) const = 0;
567 
575  virtual bool wait(fence fence, uint64_t value, uint64_t timeout = UINT64_MAX) = 0;
582  virtual bool signal(fence fence, uint64_t value) = 0;
583 
590  virtual bool get_property(device_properties property, void *data) const = 0;
591 
597  virtual uint64_t get_resource_view_gpu_address(resource_view handle) const = 0;
598 
610  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;
611 
621  virtual bool get_pipeline_shader_group_handles(pipeline pipeline, uint32_t first, uint32_t count, void *out_handles) = 0;
622  };
623 
627  struct __declspec(novtable) device_object : public api_object
628  {
632  virtual device *get_device() = 0;
633  };
634 
638  enum class indirect_command
639  {
640  unknown,
641  draw,
642  draw_indexed,
643  dispatch,
646  };
647 
655  struct __declspec(novtable) command_list : public device_object
656  {
665  inline void barrier(resource resource, resource_usage old_state, resource_usage new_state) { barrier(1, &resource, &old_state, &new_state); }
673  virtual void barrier(uint32_t count, const resource *resources, const resource_usage *old_states, const resource_usage *new_states) = 0;
674 
681  virtual void begin_render_pass(uint32_t count, const render_pass_render_target_desc *rts, const render_pass_depth_stencil_desc *ds = nullptr) = 0;
687  virtual void end_render_pass() = 0;
696  virtual void bind_render_targets_and_depth_stencil(uint32_t count, const resource_view *rtvs, resource_view dsv = { 0 }) = 0;
697 
703  virtual void bind_pipeline(pipeline_stage stages, pipeline pipeline) = 0;
710  inline void bind_pipeline_state(dynamic_state state, uint32_t value) { bind_pipeline_states(1, &state, &value); }
718  virtual void bind_pipeline_states(uint32_t count, const dynamic_state *states, const uint32_t *values) = 0;
726  virtual void bind_viewports(uint32_t first, uint32_t count, const viewport *viewports) = 0;
734  virtual void bind_scissor_rects(uint32_t first, uint32_t count, const rect *rects) = 0;
735 
747  virtual void push_constants(shader_stage stages, pipeline_layout layout, uint32_t param, uint32_t first, uint32_t count, const void *values) = 0;
756  virtual void push_descriptors(shader_stage stages, pipeline_layout layout, uint32_t param, const descriptor_table_update &update) = 0;
764  inline void bind_descriptor_table(shader_stage stages, pipeline_layout layout, uint32_t param, descriptor_table table) { bind_descriptor_tables(stages, layout, param, 1, &table); }
773  virtual void bind_descriptor_tables(shader_stage stages, pipeline_layout layout, uint32_t first, uint32_t count, const descriptor_table *tables) = 0;
774 
781  virtual void bind_index_buffer(resource buffer, uint64_t offset, uint32_t index_size) = 0;
789  inline void bind_vertex_buffer(uint32_t index, resource buffer, uint64_t offset, uint32_t stride) { bind_vertex_buffers(index, 1, &buffer, &offset, &stride); }
798  virtual void bind_vertex_buffers(uint32_t first, uint32_t count, const resource *buffers, const uint64_t *offsets, const uint32_t *strides) = 0;
799 
810  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;
811 
820  virtual void draw(uint32_t vertex_count, uint32_t instance_count, uint32_t first_vertex, uint32_t first_instance) = 0;
830  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;
838  virtual void dispatch(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z) = 0;
848  virtual void draw_or_dispatch_indirect(indirect_command type, resource buffer, uint64_t offset, uint32_t draw_count, uint32_t stride) = 0;
849 
859  virtual void copy_resource(resource source, resource dest) = 0;
873  virtual void copy_buffer_region(resource source, uint64_t source_offset, resource dest, uint64_t dest_offset, uint64_t size) = 0;
889  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;
905  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;
921  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;
940  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;
941 
953  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;
964  virtual void clear_render_target_view(resource_view rtv, const float color[4], uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
975  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;
986  virtual void clear_unordered_access_view_float(resource_view uav, const float values[4], uint32_t rect_count = 0, const rect *rects = nullptr) = 0;
987 
997  virtual void generate_mipmaps(resource_view srv) = 0;
998 
1005  virtual void begin_query(query_heap heap, query_type type, uint32_t index) = 0;
1012  virtual void end_query(query_heap heap, query_type type, uint32_t index) = 0;
1027  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;
1028 
1034  virtual void begin_debug_event(const char *label, const float color[4] = nullptr) = 0;
1038  virtual void end_debug_event() = 0;
1044  virtual void insert_debug_marker(const char *label, const float color[4] = nullptr) = 0;
1045 
1053  virtual void dispatch_mesh(uint32_t group_count_x, uint32_t group_count_y, uint32_t group_count_z) = 0;
1054 
1069  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;
1070 
1082 
1102  };
1103 
1108  {
1109  graphics = 0x1,
1110  compute = 0x2,
1111  copy = 0x4
1112  };
1114 
1122  struct __declspec(novtable) command_queue : public device_object
1123  {
1127  virtual command_queue_type get_type() const = 0;
1128 
1133  virtual void wait_idle() const = 0;
1134 
1139  virtual void flush_immediate_command_list() const = 0;
1140 
1146 
1152  virtual void begin_debug_event(const char *label, const float color[4] = nullptr) = 0;
1156  virtual void end_debug_event() = 0;
1162  virtual void insert_debug_marker(const char *label, const float color[4] = nullptr) = 0;
1163 
1170  virtual bool wait(fence fence, uint64_t value) = 0;
1177  virtual bool signal(fence fence, uint64_t value) = 0;
1178 
1183  virtual uint64_t get_timestamp_frequency() const = 0;
1184  };
1185 
1190  {
1195 
1199  uint32_t back_buffer_count = 0;
1200 
1205  uint32_t present_mode = 0;
1206 
1211  uint32_t present_flags = 0;
1212  };
1213 
1218  struct __declspec(novtable) swapchain : public device_object
1219  {
1223  virtual void *get_hwnd() const = 0;
1224 
1229  virtual resource get_back_buffer(uint32_t index) = 0;
1230 
1234  virtual uint32_t get_back_buffer_count() const = 0;
1235 
1243  virtual uint32_t get_current_back_buffer_index() const = 0;
1244 
1249 
1253  virtual color_space get_color_space() const = 0;
1254  };
1255 } }
device_api
The underlying render API a device is using, as returned by device::get_api.
Definition: reshade_api_device.hpp:16
acceleration_structure_build_mode
The available acceleration structure build modes.
Definition: reshade_api_resource.hpp:560
query_type
The available query types.
Definition: reshade_api_pipeline.hpp:1130
acceleration_structure_type
The available acceleration structure types.
Definition: reshade_api_resource.hpp:539
dynamic_state
A list of all possible render pipeline states that can be set independent of pipeline state objects.
Definition: reshade_api_pipeline.hpp:1172
pipeline_stage
A list of flags that represent the available pipeline stages in the render pipeline.
Definition: reshade_api_pipeline.hpp:45
indirect_command
The available indirect command types.
Definition: reshade_api_device.hpp:639
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:1108
color_space
The available color space types for presentation.
Definition: reshade_api_format.hpp:157
map_access
The available memory mapping access types.
Definition: reshade_api_resource.hpp:142
acceleration_structure_copy_mode
The available acceleration structure copy modes.
Definition: reshade_api_resource.hpp:549
acceleration_structure_build_flags
The available acceleration structure build flags.
Definition: reshade_api_resource.hpp:569
fence_flags
A list of flags that describe fence creation options.
Definition: reshade_api_pipeline.hpp:1267
device_caps
The available features a device may support.
Definition: reshade_api_device.hpp:41
@ 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
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
device_properties
The available properties a device may report.
Definition: reshade_api_device.hpp:193
@ api_version
Version of the underlying render API the device is using. Data is a 32-bit unsigned integer value.
@ description
Description text of the primary adapter/physical device associated with the logical render device....
@ device_id
PCI device ID of the primary adapter/physical device associated with the logical render device....
@ vendor_id
PCI vendor ID of the primary adapter/physical device associated with the logical render device....
@ 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
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:199
Definition: reshade.hpp:52
#define RESHADE_DEFINE_ENUM_FLAG_OPERATORS(type)
Definition: reshade_api_resource.hpp:16
Describes a build input for an acceleration structure build.
Definition: reshade_api_resource.hpp:618
The base class for objects provided by the ReShade API.
Definition: reshade_api_device.hpp:241
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:286
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:268
T & create_private_data(Args &&... args)
Allocates user-defined data and stores it in the object.
Definition: reshade_api_device.hpp:277
A command list, used to enqueue render commands on the CPU, before later executing them in a command ...
Definition: reshade_api_device.hpp:656
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:665
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:710
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:764
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:789
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:1123
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:1124
All information needed to copy descriptors between descriptor tables.
Definition: reshade_api_pipeline.hpp:1054
All information needed to update descriptors in a descriptor table.
Definition: reshade_api_pipeline.hpp:1089
An opaque handle to a descriptor table in a descriptor heap.
Definition: reshade_api_pipeline.hpp:1048
The base class for objects that are children to a logical render device.
Definition: reshade_api_device.hpp:628
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:303
virtual bool allocate_descriptor_tables(uint32_t count, pipeline_layout layout, uint32_t param, descriptor_table *out_handles)=0
Allocates one or more descriptor tables from an internal heap.
virtual void destroy_fence(fence handle)=0
Instantly destroys a fence that was previously created via create_fence.
virtual resource_view_desc get_resource_view_desc(resource_view view) const =0
Gets the description of the specified resource view.
bool allocate_descriptor_table(pipeline_layout layout, uint32_t param, descriptor_table *out_handle)
Allocates a descriptor table from an internal heap.
Definition: reshade_api_device.hpp:460
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_fence(uint64_t initial_value, fence_flags flags, fence *out_handle, void **shared_handle=nullptr)=0
Creates a new fence synchronization object.
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 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 signal(fence fence, uint64_t value)=0
Updates the specified fence to the specified value.
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 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 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 destroy_query_heap(query_heap handle)=0
Instantly destroys a query heap that was previously created via create_query_heap.
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:493
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 copy_descriptor_tables(uint32_t count, const descriptor_table_copy *copies)=0
Copies the contents between multiple descriptor tables.
virtual void destroy_pipeline_layout(pipeline_layout handle)=0
Instantly destroys a pipeline layout that was previously created via create_pipeline_layout.
void free_descriptor_table(descriptor_table handle)
Frees a descriptor table that was previously allocated via create_descriptor_table.
Definition: reshade_api_device.hpp:473
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 unmap_texture_region(resource resource, uint32_t subresource)=0
Unmaps a previously mapped texture resource.
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 void destroy_sampler(sampler handle)=0
Instantly destroys a sampler that was previously created via create_sampler.
virtual void free_descriptor_tables(uint32_t count, const descriptor_table *handles)=0
Frees one or more descriptor tables that were previously allocated via create_descriptor_tables.
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 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 bool create_query_heap(query_type type, uint32_t size, query_heap *out_handle)=0
Creates a new query heap.
virtual uint64_t get_completed_fence_value(fence fence) const =0
Gets the current value of the specified fence.
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 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...
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 uint64_t get_resource_view_gpu_address(resource_view handle) 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_handle)=0
Creates a new pipeline layout.
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.
void update_descriptors(const descriptor_table_update &update)
Updates the contents of a descriptor table with the specified descriptors.
Definition: reshade_api_device.hpp:504
An opaque handle to a fence synchronization object.
Definition: reshade_api_pipeline.hpp:1279
Describes a single parameter in a pipeline layout.
Definition: reshade_api_pipeline.hpp:198
An opaque handle to a pipeline layout object.
Definition: reshade_api_pipeline.hpp:236
Describes a pipeline sub-object.
Definition: reshade_api_pipeline.hpp:986
An opaque handle to a pipeline state object.
Definition: reshade_api_pipeline.hpp:1007
An opaque handle to a query heap.
Definition: reshade_api_pipeline.hpp:1165
Describes a rectangle.
Definition: reshade_api_pipeline.hpp:1240
Describes a depth-stencil view and how it is treated at the start and end of a render pass.
Definition: reshade_api_resource.hpp:481
Describes a render target view and how it is treated at the start and end of a render pass.
Definition: reshade_api_resource.hpp:516
Describes a resource, such as a buffer or texture.
Definition: reshade_api_resource.hpp:236
Describes a resource view, which specifies how to interpret the data of a resource.
Definition: reshade_api_resource.hpp:345
An opaque handle to a resource view object (depth-stencil, render target, shader resource view,...
Definition: reshade_api_resource.hpp:416
An opaque handle to a resource object (buffer, texture, ...).
Definition: reshade_api_resource.hpp:320
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:422
Describes the data of a subresource.
Definition: reshade_api_resource.hpp:439
Describes a swap chain and its back buffer resources.
Definition: reshade_api_device.hpp:1190
uint32_t back_buffer_count
Number of back buffer resources in the swap chain.
Definition: reshade_api_device.hpp:1199
uint32_t present_mode
Defines how the back buffers should be swapped when a present occurs.
Definition: reshade_api_device.hpp:1205
uint32_t present_flags
Swap chain creation flags.
Definition: reshade_api_device.hpp:1211
resource_desc back_buffer
Description of the back buffer resources.
Definition: reshade_api_device.hpp:1194
A swap chain, used to present images to the screen.
Definition: reshade_api_device.hpp:1219
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:1239
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:1254