ReShade
A generic post-processing injector for games and video software.
|
A logical render device, used for resource creation and global operations. More...
#include <reshade_api_device.hpp>
Public Member Functions | |
virtual device_api | get_api () const =0 |
Gets the underlying graphics API used by this device. More... | |
virtual bool | check_capability (device_caps capability) const =0 |
Checks whether the device supports the specified capability . More... | |
virtual bool | check_format_support (format format, resource_usage usage) const =0 |
Checks whether the specified texture format supports the specified usage . More... | |
virtual bool | create_sampler (const sampler_desc &desc, sampler *out_sampler)=0 |
Creates a new sampler state object. More... | |
virtual void | destroy_sampler (sampler sampler)=0 |
Instantly destroys a sampler that was previously created via create_sampler. More... | |
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. More... | |
virtual void | destroy_resource (resource resource)=0 |
Instantly destroys a resource that was previously created via create_resource and frees its memory. Make sure the resource is no longer in use on the GPU (via any command list that may reference it and is still being executed) before doing this (e.g. with command_queue::wait_idle) and never try to destroy resources created by the application! More... | |
virtual resource_desc | get_resource_desc (resource resource) const =0 |
Gets the description of the specified resource. More... | |
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 . More... | |
virtual void | destroy_resource_view (resource_view view)=0 |
Instantly destroys a resource view that was previously created via create_resource_view. More... | |
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. More... | |
virtual resource_view_desc | get_resource_view_desc (resource_view view) const =0 |
Gets the description of the specified resource view. More... | |
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. More... | |
virtual void | unmap_buffer_region (resource resource)=0 |
Unmaps a previously mapped buffer resource. More... | |
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. More... | |
virtual void | unmap_texture_region (resource resource, uint32_t subresource)=0 |
Unmaps a previously mapped texture resource. More... | |
virtual void | update_buffer_region (const void *data, resource resource, uint64_t offset, uint64_t size)=0 |
Uploads data to a buffer resource. More... | |
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. More... | |
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. More... | |
virtual void | destroy_pipeline (pipeline pipeline)=0 |
Instantly destroys a pipeline state object that was previously created via create_pipeline. More... | |
virtual bool | create_pipeline_layout (uint32_t param_count, const pipeline_layout_param *params, pipeline_layout *out_layout)=0 |
Creates a new pipeline layout. More... | |
virtual void | destroy_pipeline_layout (pipeline_layout layout)=0 |
Instantly destroys a pipeline layout that was previously created via create_pipeline_layout. More... | |
bool | allocate_descriptor_table (pipeline_layout layout, uint32_t param, descriptor_table *out_table) |
Allocates a descriptor table from an internal descriptor heap. More... | |
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. More... | |
void | free_descriptor_table (descriptor_table table) |
Frees a descriptor table that was previously allocated via allocate_descriptor_table. More... | |
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. More... | |
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 descriptor table. More... | |
void | copy_descriptors (const descriptor_table_copy ©) |
Copies the contents of a descriptor table to another descriptor table. More... | |
virtual void | copy_descriptor_tables (uint32_t count, const descriptor_table_copy *copies)=0 |
Copies the contents between multiple descriptor tables. More... | |
void | update_descriptors (const descriptor_table_update &update) |
Updates the contents of a descriptor table with the specified descriptors. More... | |
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. More... | |
virtual bool | create_query_heap (query_type type, uint32_t size, query_heap *out_heap)=0 |
Creates a new query heap. More... | |
virtual void | destroy_query_heap (query_heap heap)=0 |
Instantly destroys a query heap that was previously created via create_query_heap. More... | |
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. More... | |
virtual void | set_resource_name (resource resource, const char *name)=0 |
Associates a name with a resource, for easier debugging in external tools. More... | |
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. More... | |
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. More... | |
virtual void | destroy_fence (fence fence)=0 |
Instantly destroys a fence that was previously created via create_fence. More... | |
virtual uint64_t | get_completed_fence_value (fence fence) const =0 |
Gets the current value of the specified fence. More... | |
virtual bool | wait (fence fence, uint64_t value, uint64_t timeout=UINT64_MAX)=0 |
Wait until the specified fence reached the specified value. More... | |
virtual bool | signal (fence fence, uint64_t value)=0 |
Updates the specified fence to the specified value. More... | |
virtual bool | get_property (device_properties property, void *data) const =0 |
Gets data for a property of this device. More... | |
virtual uint64_t | get_resource_view_gpu_address (resource_view view) const =0 |
Gets the GPU address for a resource view. More... | |
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. More... | |
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. More... | |
Public Member Functions inherited from reshade::api::api_object | |
virtual uint64_t | get_native () const =0 |
Gets the underlying native object for this API object. More... | |
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, or zero if none associated with the specified guid exists. More... | |
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 . More... | |
template<typename T > | |
T & | get_private_data () const |
Gets a reference to user-defined data from the object that was previously allocated via create_private_data. More... | |
template<typename T , typename... Args> | |
T & | create_private_data (Args &&... args) |
Allocates user-defined data and stores it in the object. More... | |
template<typename T > | |
void | destroy_private_data () |
Frees user-defined data that was previously allocated via create_private_data. More... | |
A logical render device, used for resource creation and global operations.
Functionally equivalent to a 'IDirect3DDevice9', 'ID3D10Device', 'ID3D11Device', 'ID3D12Device', 'HGLRC' or 'VkDevice'.
This class is safe to use concurrently from multiple threads in D3D10+ and Vulkan.
|
inline |
Allocates a descriptor table from an internal descriptor heap.
layout | Pipeline layout that contains a parameter that describes the descriptor table. |
param | Index of the pipeline layout parameter that describes the descriptor table. |
out_table | Pointer to a a variable that is set to the handles of the created descriptor table. |
true
if the descriptor table was successfully allocated, false
otherwise (in this case out_table is set to zeroe).
|
pure virtual |
Allocates one or more descriptor tables from an internal descriptor heap.
count | Number of descriptor tables to allocate. |
layout | Pipeline layout that contains a parameter that describes the descriptor tables. |
param | Index of the pipeline layout parameter that describes the descriptor tables. |
out_tables | Pointer to the first element of an array of handles with at least count elements that is filled with the handles of the created descriptor tables. |
true
if the descriptor tables were successfully allocated, false
otherwise (in this case out_tables is filled with zeroes).
|
pure virtual |
Checks whether the device supports the specified capability .
|
pure virtual |
Checks whether the specified texture format supports the specified usage .
|
pure virtual |
Copies the contents between multiple descriptor tables.
count | Number of copies to process. |
copies | Pointer to the first element of an array of descriptor table copies to process. |
|
inline |
Copies the contents of a descriptor table to another descriptor table.
copy | Descriptor table copy to process. |
|
pure virtual |
Creates a new fence synchronization object.
initial_value | The initial value for the fence. |
flags | Fence creation options. |
out_fence | Pointer to a variable that is set to the handle of the created fence. |
shared_handle | Optional pointer to a variable of type HANDLE used when flags contains fence_flags::shared. When that variable is a nullptr , it is set to the exported shared handle of the created fence. When that variable is a valid handle, the fence is imported from that shared handle. |
true
if the fence was successfully created, false
otherwise (in this case out_fence is set to zero).
|
pure virtual |
Creates a new pipeline state object.
layout | Pipeline layout to use. |
subobject_count | Number of sub-objects. |
subobjects | Pointer to the first element of an array of sub-objects that describe this pipeline. |
out_pipeline | Pointer to a variable that is set to the handle of the created pipeline state object. |
true
if the pipeline state object was successfully created, false
otherwise (in this case out_pipeline is set to zero).
|
pure virtual |
Creates a new pipeline layout.
param_count | Number of layout parameters. |
params | Pointer to the first element of an array of layout parameters that describe this pipeline layout. |
out_layout | Pointer to a variable that is set to the handle of the created pipeline layout. |
true
if the pipeline layout was successfully created, false
otherwise (in this case out_layout is set to zero).
|
pure virtual |
Creates a new query heap.
type | Type of queries that will be used with this query heap. |
size | Number of queries to allocate in the query heap. |
out_heap | Pointer to a variable that is set to the handle of the created query heap. |
true
if the query heap was successfully created, false
otherwise (in this case out_heap is set to zero).
|
pure virtual |
Allocates and creates a new resource.
desc | Description of the resource to create. |
initial_data | Optional data to upload to the resource after creation. This should point to an array of mapped_subresource, one for each subresource (mipmap levels and array layers). Can be nullptr to indicate no initial data to upload. |
initial_state | Initial state of the resource after creation. This can later be changed via command_list::barrier. It should also be part of the resource_desc::usage flags of the description. |
out_resource | Pointer to a variable that is set to the handle of the created resource. |
shared_handle | Optional pointer to a variable of type HANDLE used when resource_desc::flags contains resource_flags::shared. When that variable is a nullptr , it is set to the exported shared handle of the created resource. When that variable is a valid handle, the resource is imported from that shared handle. |
true
if the resource was successfully created, false
otherwise (in this case out_resource is set to zero).
|
pure virtual |
Creates a new resource view for the specified resource .
resource | Resource to create the view to. |
usage_type | Usage type of the resource view to create. Set to resource_usage::shader_resource to create a shader resource view, resource_usage::depth_stencil for a depth-stencil view, resource_usage::render_target for a render target etc. |
desc | Description of the resource view to create. |
out_view | Pointer to a variable that is set to the handle of the created resource view. |
true
if the resource view was successfully created, false
otherwise (in this case out_view is set to zero).
|
pure virtual |
Creates a new sampler state object.
desc | Description of the sampler to create. |
out_sampler | Pointer to a variable that is set to the handle of the created sampler. |
true
if the sampler was successfully created, false
otherwise (in this case out_sampler is set to zero).
|
pure virtual |
Instantly destroys a fence that was previously created via create_fence.
|
pure virtual |
Instantly destroys a pipeline state object that was previously created via create_pipeline.
|
pure virtual |
Instantly destroys a pipeline layout that was previously created via create_pipeline_layout.
|
pure virtual |
Instantly destroys a query heap that was previously created via create_query_heap.
|
pure virtual |
Instantly destroys a resource that was previously created via create_resource and frees its memory. Make sure the resource is no longer in use on the GPU (via any command list that may reference it and is still being executed) before doing this (e.g. with command_queue::wait_idle) and never try to destroy resources created by the application!
|
pure virtual |
Instantly destroys a resource view that was previously created via create_resource_view.
|
pure virtual |
Instantly destroys a sampler that was previously created via create_sampler.
|
inline |
Frees a descriptor table that was previously allocated via allocate_descriptor_table.
|
pure virtual |
Frees one or more descriptor tables that were previously allocated via allocate_descriptor_tables.
|
pure virtual |
Gets the required acceleration structure size needed to build the specified data.
type | Type of the acceleration structure. |
flags | Acceleration structure build options. |
input_count | Number of build inputs. |
inputs | Pointer to the first element of an array of build inputs describing the geometry of the acceleration structure. |
out_size | Pointer to a variable that is set to the required buffer size for the acceleration structure. |
out_build_scratch_size | Pointer to a variable that is set to the required scratch buffer size for building the acceleration structure. |
out_update_scratch_size | Pointer to a variable that is set to the required scratch buffer size for updating the acceleration structure. |
|
pure virtual |
Gets the underlying graphics API used by this device.
|
pure virtual |
Gets the current value of the specified fence.
|
pure virtual |
Gets the offset (in descriptors) of the specified binding in the underlying descriptor heap of a descriptor table.
table | Descriptor table to get the offset from. |
binding | Binding in the descriptor table to get the offset from. |
array_offset | Array index in the specified binding . |
out_heap | Pointer to a variable that is set to the handle of the underlying descriptor heap the table was allocated from. |
out_offset | Pointer to a variable that is set to the offset of the binding in the underlying descriptor heap. |
|
pure virtual |
Gets the shader group handles for a ray tracing pipeline, to be put into a shader binding table.
pipeline | Ray tracing pipeline to query. |
first | Index of the first shader group in the pipeline_subobject_type::shader_groups array that was used to create the pipeline. |
count | Number of shader groups to get handles for. |
out_handles | Pointer to the first element of an array (with elements of the size reported by device_properties::shader_group_handle_size) that is filled with the handles. |
true
if the shader group handles were successfully retrieved, false
otherwise.
|
pure virtual |
Gets data for a property of this device.
property | Property to query. |
data | Pointer to a variable that is set to the value of the property. The necessary data type is documented at the device_properties enumeration. |
true
if the property exists and was retrieved, false
otherwise.
|
pure virtual |
Gets the results of queries in a query heap.
heap | Query heap that contains the queries. |
first | Index of the first query in the query heap to copy the results from. |
count | Number of query results to copy. |
results | Pointer to the first element of an array that is filled with the results. The necessary data type is documented at the query_type enumeration. |
stride | Size (in bytes) of each element in the results array. |
true
if the query results were successfully downloaded from the GPU, false
otherwise.
|
pure virtual |
Gets the description of the specified resource.
|
pure virtual |
Gets the handle to the underlying resource the specified resource view was created for.
Resource views may be created without a resource in D3D12, which is used to initialize a null descriptor (reading zeroes, writes are discarded). This may therefore return zero for such views.
|
pure virtual |
Gets the description of the specified resource view.
|
pure virtual |
Gets the GPU address for a resource view.
view | Resource view to query. |
|
pure virtual |
Maps the memory of a buffer resource into application address space.
resource | Buffer resource to map to host memory. |
offset | Offset (in bytes) into the buffer resource to start mapping. |
size | Number of bytes to map. Set to -1 (UINT64_MAX) to indicate that the entire buffer should be mapped. |
access | Hint on how the returned data pointer will be accessed. |
out_data | Pointer to a variable that is set to a pointer to the memory of the buffer resource. |
true
if the memory of the buffer resource was successfully mapped, false
otherwise (in this case out_data is set to nullptr
).
|
pure virtual |
Maps the memory of a texture resource into application address space.
resource | Texture resource to map to host memory. |
subresource | Index of the subresource to map (level + (layer * levels) ). |
box | Optional 3D box (or nullptr to reference the entire subresource) that defines the region in the resource to map. |
access | Hint on how the returned data pointer will be accessed. |
out_data | Pointer to a variable that is set to a pointer to the memory of the texture resource and optionally the row and slice pitch of that data (depending on the resource type). |
true
if the memory of the texture resource was successfully mapped, false
otherwise (in this case out_data is set to nullptr
).
|
pure virtual |
Associates a name with a resource, for easier debugging in external tools.
resource | Resource to associate a name with. |
name | Null-terminated name string. |
|
pure virtual |
Associates a name with a resource view, for easier debugging in external tools.
view | Resource view to associate a name with. |
name | Null-terminated name string. |
|
pure virtual |
Updates the specified fence to the specified value.
fence | Fence to update. |
value | Value the fence should be set to. |
true
if the signal operation was successful, false
otherwise.
|
pure virtual |
Unmaps a previously mapped buffer resource.
resource | Buffer resource to unmap from host memory. |
|
pure virtual |
Unmaps a previously mapped texture resource.
resource | Texture resource to unmap from host memory. |
subresource | Index of the subresource to unmap (level + (layer * levels) ). |
|
pure virtual |
Uploads data to a buffer resource.
data | Pointer to the data to upload. |
resource | Buffer resource to upload to. |
offset | Offset (in bytes) into the buffer resource to start uploading to. |
size | Number of bytes to upload. |
|
pure virtual |
Updates the contents of multiple descriptor tables with the specified descriptors.
count | Number of updates to process. |
updates | Pointer to the first element of an array of descriptor table updates to process. |
|
inline |
Updates the contents of a descriptor table with the specified descriptors.
update | Descriptor table update to process. |
|
pure virtual |
Uploads data to a texture resource.
data | Pointer to the data to upload. |
resource | Texture resource to upload to. |
subresource | Index of the subresource to upload to (level + (layer * levels) ). |
box | Optional 3D box (or nullptr to reference the entire subresource) that defines the region in the resource to upload to. |
|
pure virtual |
Wait until the specified fence reached the specified value.
fence | Fence to wait on. |
value | Value the fence has to each or exceed. |
timeout | Return early after the specified time in nanoseconds, or set to UINT64_MAX to never time out. |
true
if the wait operation was successful, false
otherwise.