LeiaSR SDK 720218b2 v1.32.7.6322 2025-02-13T14:55:38Z
Stable
dx12weaver.h
Go to the documentation of this file.
1
5#pragma once
6#include <memory>
7#include <d3d12.h>
9#include "sr/weaver/Weaver.h"
10
11#ifdef WIN32
12# ifdef COMPILING_DLL_SimulatedRealityDirectX
13# define DIMENCOSR_API __declspec(dllexport)
14# else
15# define DIMENCOSR_API __declspec(dllimport)
16# endif
17#else
18# define DIMENCOSR_API
19#endif
20
26namespace SR
27{
29 protected:
30 class Impl;
36#pragma warning(suppress: 4251)
37 std::unique_ptr<Impl> pimpl;
38 public:
41
50 ID3D12Resource* getFrameBuffer();
51
59 void setInputFrameBuffer(ID3D12Resource* frameBuffer);
60
70 void setInputFrameBuffer(ID3D12Resource* frameBuffer, DXGI_FORMAT bufferViewFormat);
71
78 void setOutputFrameBuffer(ID3D12Resource* frameBuffer);
79
84 void setCommandList(ID3D12GraphicsCommandList* commandList);
85
90 void setWindowHandle(HWND handle);
91
95 void setContrast(float contrast);
96
100 float getContrast() const;
101
107 void setShaderSRGBConversion(bool read, bool write);
108
113
118
122 void setCrosstalkStaticFactor(float factor);
123
128
132 void setCrosstalkDynamicFactor(float factor);
133
138
145 [[deprecated("Use the canWeave(...) functions that accept parameters")]]
146 bool canWeave();
147
156 bool canWeave(unsigned int width, unsigned int height);
157
168 bool canWeave(unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset);
169
176 void weave(unsigned int width, unsigned int height);
177
186 void weave(unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset);
187
195 [[deprecated("Please set the commandlist with setCommandList() and use non-deprecated weave function")]]
196 void weave(ID3D12GraphicsCommandList* commandList, unsigned int width, unsigned int height);
197
207 [[deprecated("Please set the commandlist with setCommandList() and use non-deprecated weave function")]]
208 void weave(ID3D12GraphicsCommandList* commandList, unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset);
209 };
210
212 public:
224 [[deprecated("For best performance use the PredictingDX12Weaver interface")]]
225 DX12Weaver(SR::SRContext& context, ID3D12Device* device, ID3D12CommandAllocator* commandAllocator, ID3D12CommandQueue* commandQueue, ID3D12Resource* inputFramebuffer, ID3D12Resource* outputFramebuffer);
226
238 [[deprecated("For best performance use the PredictingDX12Weaver interface")]]
239 DX12Weaver(SR::SRContext& context, ID3D12Device* device, ID3D12CommandAllocator* commandAllocator, ID3D12CommandQueue* commandQueue, ID3D12Resource* inputFramebuffer, ID3D12Resource* outputFramebuffer, HWND window);
240
254 [[deprecated("For best performance use the PredictingDX12Weaver interface")]]
255 DX12Weaver(SR::SRContext& context, ID3D12Device* device, ID3D12CommandAllocator* commandAllocator, ID3D12CommandQueue* commandQueue, ID3D12Resource* inputFramebuffer, ID3D12Resource* outputFramebuffer, HWND window, DXGI_FORMAT inputBufferViewFormat);
256
261 };
262
264 public:
276 [[deprecated("Use non-deprecated constructors")]]
277 PredictingDX12Weaver(SR::SRContext& context, ID3D12Device* device, ID3D12CommandAllocator* commandAllocator, ID3D12CommandQueue* commandQueue, ID3D12Resource* inputFramebuffer, ID3D12Resource* outputFramebuffer);
278
290 PredictingDX12Weaver(SR::SRContext& context, ID3D12Device* device, ID3D12CommandAllocator* commandAllocator, ID3D12CommandQueue* commandQueue, ID3D12Resource* inputFramebuffer, ID3D12Resource* outputFramebuffer, HWND window);
291
305 PredictingDX12Weaver(SR::SRContext& context, ID3D12Device* device, ID3D12CommandAllocator* commandAllocator, ID3D12CommandQueue* commandQueue, ID3D12Resource* inputFramebuffer, ID3D12Resource* outputFramebuffer, HWND window, DXGI_FORMAT inputBufferViewFormat);
306
321 PredictingDX12Weaver(SR::SRContext& context, ID3D12Device* device, ID3D12CommandAllocator* commandAllocator, ID3D12CommandQueue* commandQueue, ID3D12Resource* inputFramebuffer, ID3D12Resource* outputFramebuffer, HWND window, DXGI_FORMAT inputBufferViewFormat, DXGI_FORMAT outputFramebufferViewFormat);
322
327
339 void setLatency(uint64_t latency);
340
349 uint64_t getLatency();
350
363 void setLatencyInFrames(uint64_t latencyInFrames);
364 };
365}
366
367#undef DIMENCOSR_API
enum DIMENCOSR_API WeaverACTMode
Definition: WeaverTypes.h:29
Definition: dx12weaver.h:28
float getContrast() const
Gets the current weaving contrast.
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 full...
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 bo...
bool canWeave(unsigned int width, unsigned int height)
Used to determine if software weaving is possible for certain size and visibility to the currently bo...
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(....
ID3D12Resource * getFrameBuffer()
Returns the input buffer of the weaver. When weave(...) is called on this object, this buffer should ...
WeaverACTMode getACTMode() const
Gets the anti-crosstalk mode.
bool canWeave()
Used to determine if software weaving is possible on this device. Always returns false if the input o...
std::unique_ptr< Impl > pimpl
Definition: dx12weaver.h:30
void setInputFrameBuffer(ID3D12Resource *frameBuffer)
Sets the input buffer of the weaver. When weave(...) is called on this object, this buffer should con...
void setCommandList(ID3D12GraphicsCommandList *commandList)
Sets the command list for the weaver to use. Must be set before the weave() function can be called.
void setShaderSRGBConversion(bool read, bool write)
Sets whether to apply shader sRGB<->Linear color space conversions to the input framebuffer during we...
void setOutputFrameBuffer(ID3D12Resource *frameBuffer)
Sets the output buffer of the weaver. After weave(...) has been called on this object,...
void setCrosstalkStaticFactor(float factor)
Sets the anti-crosstalk factor.
void setWindowHandle(HWND handle)
Sets the window handle of the application window. If the weaver was created using a deprecated constr...
void setContrast(float contrast)
Sets the weaving contrast.
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(....
float getCrosstalkDynamicFactor() const
Gets the anti-crosstalk dynamic factor.
void weave(ID3D12GraphicsCommandList *commandList, unsigned int width, unsigned int height)
Can be called to render a weaved image of inputFramebuffer provided to DX12Weaver::DX12Weaver(....
void weave(unsigned int width, unsigned int height)
Can be called to render a weaved image of inputFramebuffer provided to DX12Weaver::DX12Weaver(....
void setCrosstalkDynamicFactor(float factor)
Sets the anti-crosstalk dynamic factor.
float getCrosstalkStaticFactor() const
Gets the anti-crosstalk factor.
void setACTMode(WeaverACTMode mode)
Sets the anti-crosstalk mode.
Definition: dx12weaver.h:211
DX12Weaver(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...
DX12Weaver(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.
DX12Weaver(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.
~DX12Weaver()
Handles proper destruction of all weaver related classes, buffers and references.
Definition: dx12weaver.h:263
void setLatencyInFrames(uint64_t latencyInFrames)
Set the latency to match the expected duration of the full rendering pipeline in number of frames....
~PredictingDX12Weaver()
Handles proper destruction of all weaver related classes, buffers and references.
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.
void setLatency(uint64_t latency)
Set the latency to match the expected duration of the full rendering pipeline.
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...
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.
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...
uint64_t getLatency()
Get the latency that is used by the weaver. If setLatency has been called, the value set by that func...
Maintains WorldObject and Sense objects during the application lifetime.
Definition: srcontext.h:75
#define DIMENCOSR_API
Definition: dx12weaver.h:18
Namespace containing all C++ Simulated Reality classes.
Definition: srconfiguration.h:20