/* * Copyright (C) 2021 Patrick Mours * SPDX-License-Identifier: BSD-3-Clause OR MIT */ #pragma once #include "reshade_api_device.hpp" namespace reshade { namespace api { /// /// An opaque handle to a technique in an effect. /// /// /// This handle is only valid until effects are next reloaded again (). /// RESHADE_DEFINE_HANDLE(effect_technique); /// /// An opaque handle to a texture variable in an effect. /// /// /// This handle is only valid until effects are next reloaded again (). /// RESHADE_DEFINE_HANDLE(effect_texture_variable); /// /// An opaque handle to a uniform variable in an effect. /// /// /// This handle is only valid until effects are next reloaded again (). /// RESHADE_DEFINE_HANDLE(effect_uniform_variable); /// /// A ReShade effect runtime, used to control effects. /// A separate runtime is instantiated for every swap chain. /// struct __declspec(novtable) effect_runtime : public swapchain { /// /// Gets the main graphics command queue associated with this effect runtime. /// This may potentially be different from the presentation queue and should be used to execute graphics commands on. /// virtual command_queue *get_command_queue() = 0; /// /// Applies post-processing effects to the specified render targets and prevents the usual rendering of effects before swap chain presentation of the current frame. /// This can be used to force ReShade to render effects at a certain point during the frame to e.g. avoid effects being applied to user interface elements of the application. /// /// /// The resource the render target views point to has to be in the state. /// This call may modify current state on the command list (pipeline, render targets, descriptor tables, ...), so it may be necessary for an add-on to backup and restore state around it if the application does not bind all state again afterwards already. /// Calling this with set to zero will cause nothing to be rendered, but uniform variables to still be updated. /// /// Command list to add effect rendering commands to. /// Render target view to use for passes that write to the back buffer with SRGBWriteEnabled state set to . /// Render target view to use for passes that write to the back buffer with SRGBWriteEnabled state set to , or zero in which case the view from is used. virtual void render_effects(command_list *cmd_list, resource_view rtv, resource_view rtv_srgb = { 0 }) = 0; /// /// Captures a screenshot of the current back buffer resource and returns its image data in 32 bits-per-pixel RGBA format. /// /// Pointer to an array of width * height * 4 bytes the image data is written to. virtual bool capture_screenshot(uint8_t *pixels) = 0; /// /// Gets the current buffer dimensions of the swap chain. /// virtual void get_screenshot_width_and_height(uint32_t *out_width, uint32_t *out_height) const = 0; /// /// Gets the current status of the specified key. /// /// The virtual key code to check. /// if the key is currently pressed down, otherwise. virtual bool is_key_down(uint32_t keycode) const = 0; /// /// Gets whether the specified key was pressed this frame. /// /// The virtual key code to check. /// if the key was pressed this frame, otherwise. virtual bool is_key_pressed(uint32_t keycode) const = 0; /// /// Gets whether the specified key was released this frame. /// /// The virtual key code to check. /// if the key was released this frame, otherwise. virtual bool is_key_released(uint32_t keycode) const = 0; /// /// Gets the current status of the specified mouse button. /// /// The mouse button index to check (0 = left, 1 = middle, 2 = right). /// if the mouse button is currently pressed down, otherwise. virtual bool is_mouse_button_down(uint32_t button) const = 0; /// /// Gets whether the specified mouse button was pressed this frame. /// /// The mouse button index to check (0 = left, 1 = middle, 2 = right). /// if the mouse button was pressed this frame, otherwise. virtual bool is_mouse_button_pressed(uint32_t button) const = 0; /// /// Gets whether the specified mouse button was released this frame. /// /// The mouse button index to check (0 = left, 1 = middle, 2 = right). /// if the mouse button was released this frame, otherwise. virtual bool is_mouse_button_released(uint32_t button) const = 0; /// /// Gets the current absolute position of the mouse cursor in screen coordinates. /// /// Pointer to a variable that is set to the X coordinate of the current cursor position. /// Pointer to a variable that is set to the Y coordinate of the current cursor position. /// Optional pointer to a variable that is set to the mouse wheel delta since the last frame. virtual void get_mouse_cursor_position(uint32_t *out_x, uint32_t *out_y, int16_t *out_wheel_delta = nullptr) const = 0; /// /// Enumerates all uniform variables of loaded effects and calls the specified function with a handle for each one. /// /// File name of the effect file to enumerate uniform variables from, or to enumerate those of all loaded effects. /// Function to call for every uniform variable. /// Optional pointer passed to the callback function. virtual void enumerate_uniform_variables(const char *effect_name, void(*callback)(effect_runtime *runtime, effect_uniform_variable variable, void *user_data), void *user_data) = 0; /// /// Enumerates all uniform variables of loaded effects and calls the specified callback function with a handle for each one. /// /// File name of the effect file to enumerate uniform variables from, or to enumerate those of all loaded effects. /// Function to call for every uniform variable. template inline void enumerate_uniform_variables(const char *effect_name, F lambda) { enumerate_uniform_variables(effect_name, [](effect_runtime *runtime, effect_uniform_variable variable, void *user_data) { static_cast(user_data)->operator()(runtime, variable); }, &lambda); } /// /// Finds a specific uniform variable in the loaded effects and returns a handle to it. /// /// File name of the effect file the variable is declared in, or to search in all loaded effects. /// Name of the uniform variable declaration to find. /// Opaque handle to the uniform variable, or zero in case it was not found. virtual effect_uniform_variable find_uniform_variable(const char *effect_name, const char *variable_name) const = 0; /// /// Gets information about the data type of a uniform . /// /// Opaque handle to the uniform variable. /// Optional pointer to a variable that is set to the base type of the uniform variable (, , or ). /// Optional pointer to a variable that is set to the number of vector rows of the uniform variable type. /// Optional pointer to a variable that is set to the number of matrix column of the uniform variable type. /// Optional pointer to a variable that is set to the number of array elements of the uniform variable type. virtual void get_uniform_variable_type(effect_uniform_variable variable, format *out_base_type, uint32_t *out_rows = nullptr, uint32_t *out_columns = nullptr, uint32_t *out_array_length = nullptr) const = 0; /// /// Gets the name of a uniform . /// /// Opaque handle to the uniform variable. /// Pointer to a string buffer that is filled with the name of the uniform variable, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual void get_uniform_variable_name(effect_uniform_variable variable, char *name, size_t *name_size) const = 0; template inline void get_uniform_variable_name(effect_uniform_variable variable, char(&name)[SIZE]) const { size_t name_size = SIZE; get_uniform_variable_name(variable, name, &name_size); } /// /// Gets the value from an annotation attached to the specified uniform as boolean values. /// /// Opaque handle to the uniform variable. /// Name of the annotation. /// Pointer to an array of booleans that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_bool_from_uniform_variable(effect_uniform_variable variable, const char *name, bool *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from an annotation attached to the specified uniform as floating-point values. /// /// Opaque handle to the uniform variable. /// Name of the annotation. /// Pointer to an array of floating-points that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_float_from_uniform_variable(effect_uniform_variable variable, const char *name, float *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from an annotation attached to the specified uniform as signed integer values. /// /// Opaque handle to the uniform variable. /// Name of the annotation. /// Pointer to an array of signed integers that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_int_from_uniform_variable(effect_uniform_variable variable, const char *name, int32_t *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from an annotation attached to the specified uniform as unsigned integer values. /// /// Opaque handle to the uniform variable. /// Name of the annotation. /// Pointer to an array of unsigned integers that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_uint_from_uniform_variable(effect_uniform_variable variable, const char *name, uint32_t *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from a string annotation attached to the specified uniform . /// /// Opaque handle to the uniform variable. /// Name of the annotation. /// Pointer to a string buffer that is filled with the value of the annotation, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual bool get_annotation_string_from_uniform_variable(effect_uniform_variable variable, const char *name, char *value, size_t *value_size) const = 0; template inline bool get_annotation_string_from_uniform_variable(effect_uniform_variable variable, const char *name, char(&value)[SIZE]) const { size_t value_size = SIZE; return get_annotation_string_from_uniform_variable(variable, name, value, &value_size); } /// /// Gets the value of the specified uniform as boolean values. /// /// Opaque handle to the uniform variable. /// Pointer to an array of booleans that is filled with the values of this uniform variable. /// Number of values to read. /// Array offset to start reading values from when this uniform variable is an array variable. virtual void get_uniform_value_bool(effect_uniform_variable variable, bool *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value of the specified uniform as floating-point values. /// /// Opaque handle to the uniform variable. /// Pointer to an array of floating-points that is filled with the values of this uniform variable. /// Number of values to read. /// Array offset to start reading values from when this uniform variable is an array variable. virtual void get_uniform_value_float(effect_uniform_variable variable, float *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value of the specified uniform as signed integer values. /// /// Opaque handle to the uniform variable. /// Pointer to an array of signed integers that is filled with the values of this uniform variable. /// Number of values to read. /// Array offset to start reading values from when this uniform variable is an array variable. virtual void get_uniform_value_int(effect_uniform_variable variable, int32_t *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value of the specified uniform as unsigned integer values. /// /// Opaque handle to the uniform variable. /// Pointer to an array of unsigned integers that is filled with the values of this uniform variable. /// Number of values to read. /// Array offset to start reading values from when this uniform variable is an array variable. virtual void get_uniform_value_uint(effect_uniform_variable variable, uint32_t *values, size_t count, size_t array_index = 0) const = 0; /// /// Sets the value of the specified uniform as boolean values. /// /// Opaque handle to the uniform variable. /// Pointer to an array of booleans that are used to update this uniform variable. /// Number of values to write. /// Array offset to start writing values to when this uniform variable is an array variable. /// Setting the uniform value won't result in a save of the current preset. To make sure the current preset with the changed value /// is saved to disk, call virtual void set_uniform_value_bool(effect_uniform_variable variable, const bool *values, size_t count, size_t array_index = 0) = 0; /// /// Sets the value of the specified uniform as a vector of boolean values. /// /// Opaque handle to the uniform variable. /// Value of the first component in the vector that is used to update this uniform variable. /// Optional value of the second component in the vector that is used to update this uniform variable. /// Optional value of the third component in the vector that is used to update this uniform variable. /// Optional value of the fourth component in the vector that is used to update this uniform variable. /// Setting the uniform value won't result in a save of the current preset. To make sure the current preset with the changed value /// is saved to disk, call inline void set_uniform_value_bool(effect_uniform_variable variable, bool x, bool y = bool(0), bool z = bool(0), bool w = bool(0)) { const bool values[4] = { x, y, z, w }; set_uniform_value_bool(variable, values, 4); } /// /// Sets the value of the specified uniform as floating-point values. /// /// Opaque handle to the uniform variable. /// Pointer to an array of floating-points that are used to update this uniform variable. /// Number of values to write. /// Array offset to start writing values to when this uniform variable is an array variable. /// Setting the uniform value won't result in a save of the current preset. To make sure the current preset with the changed value /// is saved to disk, call virtual void set_uniform_value_float(effect_uniform_variable variable, const float *values, size_t count, size_t array_index = 0) = 0; /// /// Sets the value of the specified uniform as a vector of floating-point values. /// /// Opaque handle to the uniform variable. /// Value of the first component in the vector that is used to update this uniform variable. /// Optional value of the second component in the vector that is used to update this uniform variable. /// Optional value of the third component in the vector that is used to update this uniform variable. /// Optional value of the fourth component in the vector that is used to update this uniform variable. /// Setting the uniform value won't result in a save of the current preset. To make sure the current preset with the changed value /// is saved to disk, call inline void set_uniform_value_float(effect_uniform_variable variable, float x, float y = float(0), float z = float(0), float w = float(0)) { const float values[4] = { x, y, z, w }; set_uniform_value_float(variable, values, 4); } /// /// Sets the value of the specified uniform as signed integer values. /// /// Opaque handle to the uniform variable. /// Pointer to an array of signed integers that are used to update this uniform variable. /// Number of values to write. /// Array offset to start writing values to when this uniform variable is an array variable. /// Setting the uniform value won't result in a save of the current preset. To make sure the current preset with the changed value /// is saved to disk, call virtual void set_uniform_value_int(effect_uniform_variable variable, const int32_t *values, size_t count, size_t array_index = 0) = 0; /// /// Sets the value of the specified uniform as a vector of signed integer values. /// /// Opaque handle to the uniform variable. /// Value of the first component in the vector that is used to update this uniform variable. /// Optional value of the second component in the vector that is used to update this uniform variable. /// Optional value of the third component in the vector that is used to update this uniform variable. /// Optional value of the fourth component in the vector that is used to update this uniform variable. /// Setting the uniform value won't result in a save of the current preset. To make sure the current preset with the changed value /// is saved to disk, call inline void set_uniform_value_int(effect_uniform_variable variable, int32_t x, int32_t y = int32_t(0), int32_t z = int32_t(0), int32_t w = int32_t(0)) { const int32_t values[4] = { x, y, z, w }; set_uniform_value_int(variable, values, 4); } /// /// Sets the value of the specified uniform as unsigned integer values. /// /// Opaque handle to the uniform variable. /// Pointer to an array of unsigned integers that are used to update this uniform variable. /// Number of values to write. /// Array offset to start writing values to when this uniform variable is an array variable. /// Setting the uniform value won't result in a save of the current preset. To make sure the current preset with the changed value /// is saved to disk, call virtual void set_uniform_value_uint(effect_uniform_variable variable, const uint32_t *values, size_t count, size_t array_index = 0) = 0; /// /// Sets the value of the specified uniform as a vector of unsigned integer values. /// /// Opaque handle to the uniform variable. /// Value of the first component in the vector that is used to update this uniform variable. /// Optional value of the second component in the vector that is used to update this uniform variable. /// Optional value of the third component in the vector that is used to update this uniform variable. /// Optional value of the fourth component in the vector that is used to update this uniform variable. /// Setting the uniform value won't result in a save of the current preset. To make sure the current preset with the changed value /// is saved to disk, call inline void set_uniform_value_uint(effect_uniform_variable variable, uint32_t x, uint32_t y = uint32_t(0), uint32_t z = uint32_t(0), uint32_t w = uint32_t(0)) { const uint32_t values[4] = { x, y, z, w }; set_uniform_value_uint(variable, values, 4); } /// /// Enumerates all texture variables of loaded effects and calls the specified function with a handle for each one. /// /// File name of the effect file to enumerate texture variables from, or to enumerate those of all loaded effects. /// Function to call for every texture variable. /// Optional pointer passed to the callback function. virtual void enumerate_texture_variables(const char *effect_name, void(*callback)(effect_runtime *runtime, effect_texture_variable variable, void *user_data), void *user_data) = 0; /// /// Enumerates all texture variables of loaded effects and calls the specified callback function with a handle for each one. /// /// File name of the effect file to enumerate texture variables from, or to enumerate those of all loaded effects. /// Function to call for every texture variable. template inline void enumerate_texture_variables(const char *effect_name, F lambda) { enumerate_texture_variables(effect_name, [](effect_runtime *runtime, effect_texture_variable variable, void *user_data) { static_cast(user_data)->operator()(runtime, variable); }, &lambda); } /// /// Finds a specific texture variable in the loaded effects and returns a handle to it. /// /// File name of the effect file the variable is declared in, or to search in all loaded effects. /// Name of the texture variable declaration to find. /// Opaque handle to the texture variable, or zero in case it was not found. virtual effect_texture_variable find_texture_variable(const char *effect_name, const char *variable_name) const = 0; /// /// Gets the name of a texture . /// /// Opaque handle to the texture variable. /// Pointer to a string buffer that is filled with the name of the texture variable, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual void get_texture_variable_name(effect_texture_variable variable, char *name, size_t *name_size) const = 0; template inline void get_texture_variable_name(effect_texture_variable variable, char(&name)[SIZE]) const { size_t name_size = SIZE; get_texture_variable_name(variable, name, &name_size); } /// /// Gets the value from an annotation attached to the specified texture as boolean values. /// /// Opaque handle to the texture variable. /// Name of the annotation. /// Pointer to an array of booleans that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_bool_from_texture_variable(effect_texture_variable variable, const char *name, bool *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from an annotation attached to the specified texture as floating-point values. /// /// Opaque handle to the texture variable. /// Name of the annotation. /// Pointer to an array of floating-points that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_float_from_texture_variable(effect_texture_variable variable, const char *name, float *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from an annotation attached to the specified texture as signed integer values. /// /// Opaque handle to the texture variable. /// Name of the annotation. /// Pointer to an array of signed integers that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_int_from_texture_variable(effect_texture_variable variable, const char *name, int32_t *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from an annotation attached to the specified texture as unsigned integer values. /// /// Opaque handle to the texture variable. /// Name of the annotation. /// Pointer to an array of unsigned integers that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_uint_from_texture_variable(effect_texture_variable variable, const char *name, uint32_t *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from a string annotation attached to the specified texture . /// /// Opaque handle to the texture variable. /// Name of the annotation. /// Pointer to a string buffer that is filled with the value of the annotation, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual bool get_annotation_string_from_texture_variable(effect_texture_variable variable, const char *name, char *value, size_t *value_size) const = 0; template inline bool get_annotation_string_from_texture_variable(effect_texture_variable variable, const char *name, char(&value)[SIZE]) const { size_t value_size = SIZE; return get_annotation_string_from_texture_variable(variable, name, value, &value_size); } /// /// Uploads 32 bits-per-pixel RGBA image data to the specified texture . /// /// Opaque handle to the texture variable. /// Width of the image data. /// Height of the image data. /// Pointer to an array of width * height * 4 bytes the image data is read from. virtual void update_texture(effect_texture_variable variable, const uint32_t width, const uint32_t height, const uint8_t *pixels) = 0; /// /// Gets the shader resource view that is bound to the specified texture . /// /// Opaque handle to the texture variable. /// Pointer to a variable that is set to the shader resource view. /// Pointer to a variable that is set to the sRGB shader resource view. virtual void get_texture_binding(effect_texture_variable variable, resource_view *out_srv, resource_view *out_srv_srgb = nullptr) const = 0; /// /// Binds a new shader resource view to all texture variables that use the specified . /// /// /// The resource the shader resource views point to has to be in the state at the time is executed. /// /// ReShade FX semantic to filter textures to update by (texture name : SEMANTIC). /// Shader resource view to use for samplers with SRGBTexture state set to . /// Shader resource view to use for samplers with SRGBTexture state set to , or zero in which case the view from is used. virtual void update_texture_bindings(const char *semantic, resource_view srv, resource_view srv_srgb = { 0 }) = 0; /// /// Enumerates all techniques of loaded effects and calls the specified function with a handle for each one. /// /// File name of the effect file to enumerate techniques from, or to enumerate those of all loaded effects. /// Function to call for every technique. /// Optional pointer passed to the callback function. virtual void enumerate_techniques(const char *effect_name, void(*callback)(effect_runtime *runtime, effect_technique technique, void *user_data), void *user_data) = 0; /// /// Enumerates all techniques of loaded effects and calls the specified callback function with a handle for each one. /// /// File name of the effect file to enumerate techniques from, or to enumerate those of all loaded effects. /// Function to call for every technique. template inline void enumerate_techniques(const char *effect_name, F lambda) { enumerate_techniques(effect_name, [](effect_runtime *runtime, effect_technique technique, void *user_data) { static_cast(user_data)->operator()(runtime, technique); }, &lambda); } /// /// Finds a specific technique in the loaded effects and returns a handle to it. /// /// File name of the effect file the technique is declared in, or to search in all loaded effects. /// Name of the technique to find. /// Opaque handle to the technique, or zero in case it was not found. virtual effect_technique find_technique(const char *effect_name, const char *technique_name) = 0; /// /// Gets the name of a . /// /// Opaque handle to the technique. /// Pointer to a string buffer that is filled with the name of the technique, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual void get_technique_name(effect_technique technique, char *name, size_t *name_size) const = 0; template inline void get_technique_name(effect_technique technique, char(&name)[SIZE]) const { size_t name_size = SIZE; get_technique_name(technique, name, &name_size); } /// /// Gets the value from an annotation attached to the specified as boolean values. /// /// Opaque handle to the technique. /// Name of the annotation. /// Pointer to an array of booleans that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_bool_from_technique(effect_technique technique, const char *name, bool *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from an annotation attached to the specified as floating-point values. /// /// Opaque handle to the technique. /// Name of the annotation. /// Pointer to an array of floating-points that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_float_from_technique(effect_technique technique, const char *name, float *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from an annotation attached to the specified as signed integer values. /// /// Opaque handle to the technique. /// Name of the annotation. /// Pointer to an array of signed integers that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_int_from_technique(effect_technique technique, const char *name, int32_t *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from an annotation attached to the specified as unsigned integer values. /// /// Opaque handle to the technique. /// Name of the annotation. /// Pointer to an array of unsigned integers that is filled with the values of the annotation. /// Number of values to read. /// Array offset to start reading values from when the annotation is an array. virtual bool get_annotation_uint_from_technique(effect_technique technique, const char *name, uint32_t *values, size_t count, size_t array_index = 0) const = 0; /// /// Gets the value from a string annotation attached to the specified . /// /// Opaque handle to the technique. /// Name of the annotation. /// Pointer to a string buffer that is filled with the value of the annotation, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual bool get_annotation_string_from_technique(effect_technique technique, const char *name, char *value, size_t *value_size) const = 0; template inline bool get_annotation_string_from_technique(effect_technique technique, const char *name, char(&value)[SIZE]) const { size_t value_size = SIZE; return get_annotation_string_from_technique(technique, name, value, &value_size); } /// /// Gets the state of a . /// /// Opaque handle to the technique. virtual bool get_technique_state(effect_technique technique) const = 0; /// /// Enables or disables the specified . /// /// Opaque handle to the technique. /// Set to to enable the technique, or to disable it. virtual void set_technique_state(effect_technique technique, bool enabled) = 0; /// /// Gets the value of a preprocessor definition. /// /// Name of the definition. /// Pointer to a string buffer that is filled with the value of the definition, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual bool get_preprocessor_definition(const char *name, char *value, size_t *value_size) const = 0; template inline bool get_preprocessor_definition(const char *name, char(&value)[SIZE]) const { size_t value_size = SIZE; return get_preprocessor_definition(name, value, &value_size); } /// /// Defines a preprocessor definition to the specified . /// /// Name of the definition. /// Value of the definition. virtual void set_preprocessor_definition(const char *name, const char *value) = 0; /// /// Applies a to the specified render targets (regardless of the state of this technique). /// /// /// The width and height of the specified render target should match those used to render all other effects! /// The resource the render target views point to has to be in the state. /// This call may modify current state on the command list (pipeline, render targets, descriptor tables, ...), so it may be necessary for an add-on to backup and restore state around it if the application does not bind all state again afterwards already. /// /// Opaque handle to the technique. /// Command list to add effect rendering commands to. /// Render target view to use for passes that write to the back buffer with SRGBWriteEnabled state set to . /// Render target view to use for passes that write to the back buffer with SRGBWriteEnabled state set to , or zero in which case the view from is used. virtual void render_technique(effect_technique technique, command_list *cmd_list, resource_view rtv, resource_view rtv_srgb = { 0 }) = 0; /// /// Gets whether effects are enabled or disabled. /// virtual bool get_effects_state() const = 0; /// /// Enables or disables all effects. /// /// Set to to enable effects, or to disable them. virtual void set_effects_state(bool enabled) = 0; /// /// Gets the file path to the currently active preset. /// /// Pointer to a string buffer that is filled with the file path to the preset, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual void get_current_preset_path(char *path, size_t *path_size) const = 0; template inline void get_current_preset_path(char(&path)[SIZE]) const { size_t path_size = SIZE; get_current_preset_path(path, &path_size); } /// /// Saves the currently active preset and then switches to the specified new preset. /// /// File path to the preset to switch to. virtual void set_current_preset_path(const char *path) = 0; /// /// Changes the rendering order of loaded techniques to that of the specified technique list. /// /// Number of handles in the technique list. /// Array of techniques in the order they should be rendered in. virtual void reorder_techniques(size_t count, const effect_technique *techniques) = 0; /// /// Makes ReShade block any keyboard and mouse input from reaching the game for the duration of the next frame. /// Call this every frame for as long as input should be blocked. This can be used to ensure input is only applied to overlays created in a callback. /// virtual void block_input_next_frame() = 0; /// /// Gets the virtual key code of the last key that was pressed. /// virtual uint32_t last_key_pressed() const = 0; /// /// Gets the virtual key code of the last key that was released. /// virtual uint32_t last_key_released() const = 0; /// /// Gets the effect file name of a uniform . /// /// Opaque handle to the uniform variable. /// Pointer to a string buffer that is filled with the effect file name of the uniform variable, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual void get_uniform_variable_effect_name(effect_uniform_variable variable, char *effect_name, size_t *effect_name_size) const = 0; template inline void get_uniform_variable_effect_name(effect_uniform_variable variable, char(&effect_name)[SIZE]) const { size_t effect_name_size = SIZE; get_uniform_variable_effect_name(variable, effect_name, &effect_name_size); } /// /// Gets the effect file name of a texture . /// /// Opaque handle to the texture variable. /// Pointer to a string buffer that is filled with the effect file name of the texture variable, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual void get_texture_variable_effect_name(effect_texture_variable variable, char *effect_name, size_t *effect_name_size) const = 0; template inline void get_texture_variable_effect_name(effect_texture_variable variable, char(&effect_name)[SIZE]) const { size_t effect_name_size = SIZE; get_texture_variable_effect_name(variable, effect_name, &effect_name_size); } /// /// Gets the effect file name of a . /// /// Opaque handle to the technique. /// Pointer to a string buffer that is filled with the effect file name of the technique, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and is set to the actual length of the string, including the null-terminator. virtual void get_technique_effect_name(effect_technique technique, char *effect_name, size_t *effect_name_size) const = 0; template inline void get_technique_effect_name(effect_technique technique, char(&effect_name)[SIZE]) const { size_t effect_name_size = SIZE; get_technique_effect_name(technique, effect_name, &effect_name_size); } /// /// Saves the current preset with the current state of the loaded techniques and uniform variables. /// virtual void save_current_preset() const = 0; /// /// Gets the value of a preprocessor definition for the specified effect. /// /// File name of the effect file the preprocessor definition is defined for. /// Name of the definition. /// Pointer to a string buffer that is filled with the value of the definition, or to query the necessary size. /// Pointer to an integer that contains the size of the string buffer and upon completion is set to the actual length of the string, including the null-terminator. virtual bool get_preprocessor_definition_for_effect(const char *effect_name, const char *name, char *value, size_t *value_size) const = 0; template inline bool get_preprocessor_definition_for_effect(const char *effect_name, const char *name, char(&value)[SIZE]) const { size_t value_size = SIZE; return get_preprocessor_definition_for_effect(effect_name, name, value, &value_size); } /// /// Defines a preprocessor definition for the specified effect to the specified . /// /// File name of the effect file the preprocessor definition should be defined for. /// Name of the definition. /// Value of the definition. virtual void set_preprocessor_definition_for_effect(const char *effect_name, const char *name, const char *value) = 0; }; } }