/// Offset applied to the calculated mipmap level when sampling a texture.
/// </summary>
floatmip_lod_bias=0.0f;
/// <summary>
/// Clamping value to use when filtering mode is <see cref="filter_mode::anisotropic"/>.
/// </summary>
floatmax_anisotropy=1.0f;
/// <summary>
/// Comparison function to use to compare sampled data against existing sampled data.
/// </summary>
compare_opcompare_op=compare_op::never;
/// <summary>
/// RGBA value to return for texture coordinates outside 0 to 1 range when addressing mode is <see cref="texture_address_mode::border"/>.
/// </summary>
floatborder_color[4]={1.0f,1.0f,1.0f,1.0f};
/// <summary>
/// Lower end of the mipmap range to clamp access to.
/// </summary>
floatmin_lod=-FLT_MAX;
/// <summary>
/// Upper end of the mipmap range to clamp access to.
/// </summary>
floatmax_lod=+FLT_MAX;
};
/// <summary>
/// An opaque handle to a sampler state object.
/// <para>
/// Depending on the graphics API this can be:
/// <list type="bullet">
/// <item>Direct3D 9: An opaque value.</item>
/// <item>Direct3D 10: A pointer to a 'ID3D10SamplerState' object.</item>
/// <item>Direct3D 11: A pointer to a 'ID3D11SamplerState' object.</item>
/// <item>Direct3D 12: A 'D3D12_CPU_DESCRIPTOR_HANDLE' (to a sampler descriptor).</item>
/// <item>OpenGL: An OpenGL sampler object name.</item>
/// <item>Vulkan: A 'VkSampler' handle.</item>
/// </list>
/// </para>
/// </summary>
RESHADE_DEFINE_HANDLE(sampler);
/// <summary>
/// Memory mapping access types.
/// </summary>
enumclassmap_access
{
read_only=1,
write_only,
read_write,
write_discard
};
/// <summary>
/// Memory heap types, which give a hint as to where to place the allocation for a resource.
/// </summary>
enumclassmemory_heap:uint32_t
{
unknown,// Usually indicates a resource that is reserved, but not yet bound to any memory.
gpu_only,
// Upload heap
cpu_to_gpu,
// Readback heap
gpu_to_cpu,
cpu_only,
custom
};
/// <summary>
/// Type of a resource. This is specified during creation and is immutable.
/// Various operations may have special requirements on the type of resources they operate on (e.g. copies can only happen between resources of the same type, ...).
/// </summary>
enumclassresource_type:uint32_t
{
unknown,
buffer,
texture_1d,
texture_2d,
texture_3d,
surface// Special type for resources that are implicitly both resource and render target view.
};
/// <summary>
/// Flags that specify additional parameters of a resource.
/// </summary>
enumclassresource_flags:uint32_t
{
none=0,
/// <summary>
/// Dynamic resources can be frequently updated during a frame, with previous contents automatically being shadowed so to no affect already executing operations on the GPU.
/// Required for <see cref="map_access::write_discard"/>. The flag is not supported in D3D12 or Vulkan.
/// Structure stride for structured buffers (in bytes), otherwise zero.
/// </summary>
uint32_tstride=0;
}buffer;
/// <summary>
/// Used when resource type is a texture or surface.
/// </summary>
struct
{
/// <summary>
/// Width of the texture (in texels).
/// </summary>
uint32_twidth=1;
/// <summary>
/// If this is a 2D or 3D texture, height of the texture (in texels), otherwise 1.
/// </summary>
uint32_theight=1;
/// <summary>
/// If this is a 3D texture, depth of the texture (in texels), otherwise number of array layers.
/// </summary>
uint16_tdepth_or_layers=1;
/// <summary>
/// Maximum number of mipmap levels in the texture, including the base level, so at least 1.
/// Can also be zero in case the exact number of mipmap levels is unknown.
/// </summary>
uint16_tlevels=1;
/// <summary>
/// Data format of each texel in the texture.
/// </summary>
formatformat=format::unknown;
/// <summary>
/// The number of samples per texel. Set to a value higher than 1 for multisampling.
/// </summary>
uint16_tsamples=1;
}texture;
};
/// <summary>
/// Memory heap the resource allocation is placed in.
/// </summary>
memory_heapheap=memory_heap::unknown;
/// <summary>
/// Flags that specify how this resource is used.
/// This should contain all resource states the resource will ever be transitioned to (including the initial state specified for resource creation).
/// </summary>
resource_usageusage=resource_usage::undefined;
/// <summary>
/// Flags that specify additional parameters.
/// </summary>
resource_flagsflags=resource_flags::none;
};
/// <summary>
/// An opaque handle to a resource object (buffer, texture, ...).
/// <para>Resources created by the application are only guaranteed to be valid during event callbacks.</para>
/// <para>
/// Depending on the graphics API this can be:
/// <list type="bullet">
/// <item>Direct3D 9: A pointer to a 'IDirect3DResource9' object.</item>
/// <item>Direct3D 10: A pointer to a 'ID3D10Resource' object.</item>
/// <item>Direct3D 11: A pointer to a 'ID3D11Resource' object.</item>
/// <item>Direct3D 12: A pointer to a 'ID3D12Resource' object.</item>
/// <item>OpenGL: The upper 24-bit contain the OpenGL object type (like GL_BUFFER, GL_TEXTURE_2D, GL_RENDERBUFFER, ...), the lower 32-bit contain the OpenGL object name. So the object type can be extracted with <c>(handle >> 40)</c>, the object with <c>(handle & 0xFFFFFFFF)</c>.</item>
/// <item>Vulkan: A 'VkImage' handle.</item>
/// </list>
/// </para>
/// </summary>
RESHADE_DEFINE_HANDLE(resource);
/// <summary>
/// Type of a resource view. This identifies how a resource view interprets the data of its resource.
/// </summary>
enumclassresource_view_type:uint32_t
{
unknown,
buffer,
texture_1d,
texture_1d_array,
texture_2d,
texture_2d_array,
texture_2d_multisample,
texture_2d_multisample_array,
texture_3d,
texture_cube,
texture_cube_array,
acceleration_structure
};
/// <summary>
/// Describes a resource view, which specifies how to interpret the data of a resource.
/// Format the view should reinterpret the resource data to (can be different than the format of the resource as long as they are compatible).
/// </summary>
formatformat=format::unknown;
union
{
/// <summary>
/// Used when view type is a buffer or acceleration structure.
/// </summary>
struct
{
/// <summary>
/// Offset from the start of the buffer resource (in bytes).
/// </summary>
uint64_toffset=0;
/// <summary>
/// Number of elements this view covers in the buffer resource (in bytes).
/// Set to -1 (UINT64_MAX) to indicate that the entire buffer resource should be used.
/// </summary>
uint64_tsize=UINT64_MAX;
}buffer;
/// <summary>
/// Used when view type is a texture.
/// </summary>
struct
{
/// <summary>
/// Index of the most detailed mipmap level to use. This number has to be between zero and the maximum number of mipmap levels in the texture minus 1.
/// </summary>
uint32_tfirst_level=0;
/// <summary>
/// Maximum number of mipmap levels for the view of the texture.
/// Set to -1 (UINT32_MAX) to indicate that all mipmap levels down to the least detailed should be used.
/// </summary>
uint32_tlevel_count=UINT32_MAX;
/// <summary>
/// Index of the first array layer of the texture array to use. This value is ignored if the texture is not layered.
/// </summary>
uint32_tfirst_layer=0;
/// <summary>
/// Maximum number of array layers for the view of the texture array. This value is ignored if the texture is not layered.
/// Set to -1 (UINT32_MAX) to indicate that all array layers should be used.
/// </summary>
uint32_tlayer_count=UINT32_MAX;
}texture;
};
};
/// <summary>
/// An opaque handle to a resource view object (depth-stencil, render target, shader resource view, ...).
/// <para>Resource views created by the application are only guaranteed to be valid during event callbacks.</para>
/// <para>
/// Depending on the graphics API this can be:
/// <list type="bullet">
/// <item>Direct3D 9: A pointer to a 'IDirect3DResource9' object.</item>
/// <item>Direct3D 10: A pointer to a 'ID3D10View' object.</item>
/// <item>Direct3D 11: A pointer to a 'ID3D11View' object.</item>
/// <item>Direct3D 12: A 'D3D12_CPU_DESCRIPTOR_HANDLE' (to a view descriptor) or 'D3D12_GPU_VIRTUAL_ADDRESS' (to an acceleration structrue).</item>
/// <item>OpenGL: The upper 24-bit contain the OpenGL object type (like GL_TEXTURE_BUFFER, GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, ...), the lower 32-bit contain the OpenGL object ID. So the object type can be extracted with <c>(handle >> 40)</c>, the object with <c>(handle & 0xFFFFFFFF)</c>.</item>
/// <item>Vulkan: A 'VkImageView' or 'VkAccelerationStructureKHR' handle.</item>
/// </list>
/// </para>
/// </summary>
RESHADE_DEFINE_HANDLE(resource_view);
/// <summary>
/// Describes a region inside a subresource.
/// </summary>
structsubresource_box
{
uint32_tleft=0;
uint32_ttop=0;
uint32_tfront=0;
uint32_tright=0;
uint32_tbottom=0;
uint32_tback=0;
constexpruint32_twidth()const{returnright-left;}
constexpruint32_theight()const{returnbottom-top;}
constexpruint32_tdepth()const{returnback-front;}
};
/// <summary>
/// Describes the data of a subresource.
/// </summary>
structsubresource_data
{
/// <summary>
/// Pointer to the data.
/// </summary>
void*data=nullptr;
/// <summary>
/// Row pitch of the data (added to the data pointer to move between texture rows, unused for buffers and 1D textures).
/// </summary>
/// <seealso cref="format_row_pitch"/>
uint32_trow_pitch=0;
/// <summary>
/// Depth pitch of the data (added to the data pointer to move between texture depth/array slices, unused for buffers and 1D/2D textures).
/// </summary>
/// <seealso cref="format_slice_pitch"/>
uint32_tslice_pitch=0;
};
/// <summary>
/// Specifies how the contents of a render target or depth-stencil view are treated at the start of a render pass.
/// </summary>
enumclassrender_pass_load_op:uint32_t
{
load,
clear,
discard,
no_access
};
/// <summary>
/// Specifies how the contents of a render target or depth-stencil view are treated at the end of a render pass.
/// </summary>
enumclassrender_pass_store_op:uint32_t
{
store,
discard,
no_access
};
/// <summary>
/// Describes a depth-stencil view and how it is treated at the start and end of a render pass.
/// </summary>
structrender_pass_depth_stencil_desc
{
/// <summary>
/// Depth-stencil resource view.
/// </summary>
resource_viewview={0};
/// <summary>
/// Specifies how the depth contents of the depth-stencil view are treated at the start of the render pass.
/// Value the depth contents of the depth-stencil resource is cleared to when <see cref="depth_load_op"/> is <see cref="render_pass_load_op::clear"/>.
/// </summary>
floatclear_depth=0.0f;
/// <summary>
/// Value the stencil contents of the depth-stencil resource is cleared to when <see cref="stencil_load_op"/> is <see cref="render_pass_load_op::clear"/>.
/// </summary>
uint8_tclear_stencil=0;
};
/// <summary>
/// Describes a render target view and how it is treated at the start and end of a render pass.
/// </summary>
structrender_pass_render_target_desc
{
/// <summary>
/// Render target resource view.
/// </summary>
resource_viewview={0};
/// <summary>
/// Specifies how the contents of the render target view are treated at the start of the render pass.