LeiaSR SDK 720218b2 v1.32.7.6322 2025-02-13T14:55:38Z
Stable
|
#include <dx12weaver.h>
Public Member Functions | |
PredictingDX12Weaver (SR::SRContext &context, ID3D12Device *device, ID3D12CommandAllocator *commandAllocator, ID3D12CommandQueue *commandQueue, ID3D12Resource *inputFramebuffer, ID3D12Resource *outputFramebuffer) | |
Constructs a class to be used for weaving an input image of a certain size. More... | |
PredictingDX12Weaver (SR::SRContext &context, ID3D12Device *device, ID3D12CommandAllocator *commandAllocator, ID3D12CommandQueue *commandQueue, ID3D12Resource *inputFramebuffer, ID3D12Resource *outputFramebuffer, HWND window) | |
Constructs a class to be used for weaving an input image of a certain size. More... | |
PredictingDX12Weaver (SR::SRContext &context, ID3D12Device *device, ID3D12CommandAllocator *commandAllocator, ID3D12CommandQueue *commandQueue, ID3D12Resource *inputFramebuffer, ID3D12Resource *outputFramebuffer, HWND window, DXGI_FORMAT inputBufferViewFormat) | |
Constructs a class to be used for weaving an input image of a certain size This constructor should be used to specify the fully qualified format via inputBufferViewFormat when the inputFramebuffer is a texture created with a typeless format. More... | |
PredictingDX12Weaver (SR::SRContext &context, ID3D12Device *device, ID3D12CommandAllocator *commandAllocator, ID3D12CommandQueue *commandQueue, ID3D12Resource *inputFramebuffer, ID3D12Resource *outputFramebuffer, HWND window, DXGI_FORMAT inputBufferViewFormat, DXGI_FORMAT outputFramebufferViewFormat) | |
Constructs a class to be used for weaving an input image of a certain size This constructor should be used to specify the fully qualified format via inputBufferViewFormat when the inputFramebuffer is a texture created with a typeless format. More... | |
~PredictingDX12Weaver () | |
Handles proper destruction of all weaver related classes, buffers and references. More... | |
void | setLatency (uint64_t latency) |
Set the latency to match the expected duration of the full rendering pipeline. More... | |
uint64_t | getLatency () |
Get the latency that is used by the weaver. If setLatency has been called, the value set by that function will be returned. If setLatencyInFrames has been called, the latency will be calculated based on the refresh rate of the monitor and the application. By default setLatencyInFrames is used when no latency is explicitly set. More... | |
void | setLatencyInFrames (uint64_t latencyInFrames) |
Set the latency to match the expected duration of the full rendering pipeline in number of frames. The latency in time is calculated using these number of frames based on the refresh rate of the monitor that the application is running on, this will be dynamically updated when the window changes monitor. For this it requires the weaver to be given a valid window handle of the running application. More... | |
![]() | |
DX12WeaverBase () | |
~DX12WeaverBase () | |
ID3D12Resource * | getFrameBuffer () |
Returns the input buffer of the weaver. When weave(...) is called on this object, this buffer should contain a side-by-side view that will be used as input for the weaver. More... | |
void | setInputFrameBuffer (ID3D12Resource *frameBuffer) |
Sets the input buffer of the weaver. When weave(...) is called on this object, this buffer should contain a side-by-side view that will be used as input for the weaver. More... | |
void | setInputFrameBuffer (ID3D12Resource *frameBuffer, DXGI_FORMAT bufferViewFormat) |
Sets the input buffer of the weaver. This overload of the function should be used to specify the fully qualified format via bufferViewFormat when the framebuffer is a texture created with a typeless format When weave(...) is called on this object, this buffer should contain a side-by-side view that will be used as input for the weaver. More... | |
void | setOutputFrameBuffer (ID3D12Resource *frameBuffer) |
Sets the output buffer of the weaver. After weave(...) has been called on this object, the weaved image will be written to this buffer. More... | |
void | setCommandList (ID3D12GraphicsCommandList *commandList) |
Sets the command list for the weaver to use. Must be set before the weave() function can be called. More... | |
void | setWindowHandle (HWND handle) |
Sets the window handle of the application window. If the weaver was created using a deprecated constructor, setting window handle has no effect. More... | |
void | setContrast (float contrast) |
Sets the weaving contrast. More... | |
float | getContrast () const |
Gets the current weaving contrast. More... | |
void | setShaderSRGBConversion (bool read, bool write) |
Sets whether to apply shader sRGB<->Linear color space conversions to the input framebuffer during weaving. More... | |
void | setACTMode (WeaverACTMode mode) |
Sets the anti-crosstalk mode. More... | |
WeaverACTMode | getACTMode () const |
Gets the anti-crosstalk mode. More... | |
void | setCrosstalkStaticFactor (float factor) |
Sets the anti-crosstalk factor. More... | |
float | getCrosstalkStaticFactor () const |
Gets the anti-crosstalk factor. More... | |
void | setCrosstalkDynamicFactor (float factor) |
Sets the anti-crosstalk dynamic factor. More... | |
float | getCrosstalkDynamicFactor () const |
Gets the anti-crosstalk dynamic factor. More... | |
bool | canWeave () |
Used to determine if software weaving is possible on this device. Always returns false if the input or output buffer is not set. More... | |
bool | canWeave (unsigned int width, unsigned int height) |
Used to determine if software weaving is possible for certain size and visibility to the currently bound framebuffer. Always returns false if the input or output buffer is not set. More... | |
bool | canWeave (unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset) |
Used to determine if software weaving is possible for certain size and visibility to the currently bound framebuffer. Always returns false if the input or output buffer is not set. More... | |
void | weave (unsigned int width, unsigned int height) |
Can be called to render a weaved image of inputFramebuffer provided to DX12Weaver::DX12Weaver(...) (Must be D3D12_RESOURCE_STATE_UNORDERED_ACCESS) to the currently bound rendertarget (Must be D3D12_RESOURCE_STATE_RENDER_TARGET) A commandlist must be set before calling this function or weaving will not be executed. More... | |
void | weave (unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset) |
Can be called to render a weaved image of inputFramebuffer provided to DX12Weaver::DX12Weaver(...) (Must be D3D12_RESOURCE_STATE_UNORDERED_ACCESS) to the currently bound rendertarget (Must be D3D12_RESOURCE_STATE_RENDER_TARGET) A commandlist must be set before calling this function or weaving will not be executed. More... | |
void | weave (ID3D12GraphicsCommandList *commandList, unsigned int width, unsigned int height) |
Can be called to render a weaved image of inputFramebuffer provided to DX12Weaver::DX12Weaver(...) (Must be D3D12_RESOURCE_STATE_UNORDERED_ACCESS) to the currently bound rendertarget (Must be D3D12_RESOURCE_STATE_RENDER_TARGET) More... | |
void | weave (ID3D12GraphicsCommandList *commandList, unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset) |
Can be called to render a weaved image of inputFramebuffer provided to DX12Weaver::DX12Weaver(...) (Must be D3D12_RESOURCE_STATE_UNORDERED_ACCESS) to the currently bound rendertarget (Must be D3D12_RESOURCE_STATE_RENDER_TARGET) More... | |
Additional Inherited Members | |
![]() | |
std::unique_ptr< Impl > | pimpl |
SR::PredictingDX12Weaver::PredictingDX12Weaver | ( | SR::SRContext & | context, |
ID3D12Device * | device, | ||
ID3D12CommandAllocator * | commandAllocator, | ||
ID3D12CommandQueue * | commandQueue, | ||
ID3D12Resource * | inputFramebuffer, | ||
ID3D12Resource * | outputFramebuffer | ||
) |
Constructs a class to be used for weaving an input image of a certain size.
context | to connect to, needs to be valid for the lifetime of the weaver object. |
device | interface used to create resources |
commandAllocator | used for command list generation during setup |
commandQueue | used for command list execution during setup |
inputFramebuffer | A pointer to a frame buffer resource containing the side-by-side image to be weaved together. A reference to this resource will be maintained by the object until a different input buffer is set by calling setInputFrameBuffer or until the object is destroyed. |
outputFramebuffer | A pointer to a frame buffer resource where the output of the weaver will be written to (usually the backbuffer). No reference to the output framebuffer is kept by the weaver object. |
std::exception | if inputFramebuffer is a texture resource created with a typeless format |
SR::PredictingDX12Weaver::PredictingDX12Weaver | ( | SR::SRContext & | context, |
ID3D12Device * | device, | ||
ID3D12CommandAllocator * | commandAllocator, | ||
ID3D12CommandQueue * | commandQueue, | ||
ID3D12Resource * | inputFramebuffer, | ||
ID3D12Resource * | outputFramebuffer, | ||
HWND | window | ||
) |
Constructs a class to be used for weaving an input image of a certain size.
context | to connect to, needs to be valid for the lifetime of the weaver object. |
device | interface used to create resources |
commandAllocator | used for command list generation during setup |
commandQueue | used for command list execution during setup |
inputFramebuffer | A pointer to a frame buffer resource containing the side-by-side image to be weaved together. A reference to this resource will be maintained by the object until a different input buffer is set by calling setInputFrameBuffer or until the object is destroyed. |
outputFramebuffer | A pointer to a frame buffer resource where the output of the weaver will be written to (usually the backbuffer). No reference to the output framebuffer is kept by the weaver object. |
window | Handle of the application window |
std::exception | if inputFramebuffer is a texture resource created with a typeless format |
SR::PredictingDX12Weaver::PredictingDX12Weaver | ( | SR::SRContext & | context, |
ID3D12Device * | device, | ||
ID3D12CommandAllocator * | commandAllocator, | ||
ID3D12CommandQueue * | commandQueue, | ||
ID3D12Resource * | inputFramebuffer, | ||
ID3D12Resource * | outputFramebuffer, | ||
HWND | window, | ||
DXGI_FORMAT | inputBufferViewFormat | ||
) |
Constructs a class to be used for weaving an input image of a certain size This constructor should be used to specify the fully qualified format via inputBufferViewFormat
when the inputFramebuffer
is a texture created with a typeless format.
context | to connect to, needs to be valid for the lifetime of the weaver object. |
device | interface used to create resources |
commandAllocator | used for command list generation during setup |
commandQueue | used for command list execution during setup |
inputFramebuffer | A pointer to a frame buffer resource containing the side-by-side image to be weaved together. A reference to this resource will be maintained by the object until a different input buffer is set by calling setInputFrameBuffer or until the object is destroyed. |
outputFramebuffer | A pointer to a frame buffer resource where the output of the weaver will be written to (usually the backbuffer). No reference to the output framebuffer is kept by the weaver object. |
window | Handle of the application window |
inputBufferViewFormat | The fully qualified shader resource view format for the input frame buffer. This specification is required for textures created with typeless format. It can also be used to cast an already specified fully qualified format to another. |
std::exception | if inputFramebuffer is a texture resource created with a typeless format and inputBufferViewFormat 's value is DXGI_FORMAT_UNKNOWN |
SR::PredictingDX12Weaver::PredictingDX12Weaver | ( | SR::SRContext & | context, |
ID3D12Device * | device, | ||
ID3D12CommandAllocator * | commandAllocator, | ||
ID3D12CommandQueue * | commandQueue, | ||
ID3D12Resource * | inputFramebuffer, | ||
ID3D12Resource * | outputFramebuffer, | ||
HWND | window, | ||
DXGI_FORMAT | inputBufferViewFormat, | ||
DXGI_FORMAT | outputFramebufferViewFormat | ||
) |
Constructs a class to be used for weaving an input image of a certain size This constructor should be used to specify the fully qualified format via inputBufferViewFormat
when the inputFramebuffer
is a texture created with a typeless format.
context | to connect to, needs to be valid for the lifetime of the weaver object. |
device | interface used to create resources |
commandAllocator | used for command list generation during setup |
commandQueue | used for command list execution during setup |
inputFramebuffer | A pointer to a frame buffer resource containing the side-by-side image to be weaved together. A reference to this resource will be maintained by the object until a different input buffer is set by calling setInputFrameBuffer or until the object is destroyed. |
outputFramebuffer | A pointer to a frame buffer resource where the output of the weaver will be written to (usually the backbuffer). No reference to the output framebuffer is kept by the weaver object. |
window | Handle of the application window |
inputBufferViewFormat | The fully qualified shader resource view format for the input frame buffer. This specification is required for textures created with typeless format. It can also be used to cast an already specified fully qualified format to another. |
outputFramebufferViewFormat | The fully qualified shader resource view format for the output frame buffer view. |
std::exception | if inputFramebuffer is a texture resource created with a typeless format and inputBufferViewFormat 's value is DXGI_FORMAT_UNKNOWN |
SR::PredictingDX12Weaver::~PredictingDX12Weaver | ( | ) |
Handles proper destruction of all weaver related classes, buffers and references.
uint64_t SR::PredictingDX12Weaver::getLatency | ( | ) |
Get the latency that is used by the weaver. If setLatency has been called, the value set by that function will be returned. If setLatencyInFrames has been called, the latency will be calculated based on the refresh rate of the monitor and the application. By default setLatencyInFrames is used when no latency is explicitly set.
void SR::PredictingDX12Weaver::setLatency | ( | uint64_t | latency | ) |
Set the latency to match the expected duration of the full rendering pipeline.
The eye positions should be predicted to the timepoint at which the frame is visible to the user Internally the prediction is already taking care of all other latency, only the rendering pipeline latency is application dependent A low latency app would have 1 framebuffer latency, so 16666 microseconds (the generated frame will be presented at next v-sync) When using v-sync, the driver adds at least 1 buffer latency, and maybe the windows display manager also adds a buffer latency. Typically, the latency is n * 1000*1000/framerate microseconds
latency | The latency from the moment when weave() is called until presenting the current frame to the user, in microseconds |
void SR::PredictingDX12Weaver::setLatencyInFrames | ( | uint64_t | latencyInFrames | ) |
Set the latency to match the expected duration of the full rendering pipeline in number of frames. The latency in time is calculated using these number of frames based on the refresh rate of the monitor that the application is running on, this will be dynamically updated when the window changes monitor. For this it requires the weaver to be given a valid window handle of the running application.
The eye positions should be predicted to the timepoint at which the frame is visible to the user Internally the prediction is already taking care of all other latency, only the rendering pipeline latency is application dependent A low latency app would have 1 framebuffer latency, the generated frame will be presented at next v-sync) When using v-sync, the driver adds at least 1 buffer latency, and maybe the windows display manager also adds a buffer latency.
latencyInFrames | The expected number of frames before presenting the current generated frame to the user. |