summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhid3d11_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/rhi/qrhid3d11_p.h')
-rw-r--r--src/gui/rhi/qrhid3d11_p.h46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/gui/rhi/qrhid3d11_p.h b/src/gui/rhi/qrhid3d11_p.h
index e410375029..7644748407 100644
--- a/src/gui/rhi/qrhid3d11_p.h
+++ b/src/gui/rhi/qrhid3d11_p.h
@@ -16,7 +16,7 @@
//
#include "qrhi_p.h"
-#include "qshaderdescription.h"
+#include <rhi/qshaderdescription.h>
#include <QWindow>
#include <d3d11_1.h>
@@ -356,6 +356,8 @@ struct QD3D11CommandBuffer : public QRhiCommandBuffer
struct Command {
enum Cmd {
+ BeginFrame,
+ EndFrame,
ResetShaderResources,
SetRenderTarget,
Clear,
@@ -386,6 +388,15 @@ struct QD3D11CommandBuffer : public QRhiCommandBuffer
// QRhiTexture/Buffer/etc. pointers).
union Args {
struct {
+ ID3D11Query *tsQuery;
+ ID3D11Query *tsDisjointQuery;
+ QD3D11RenderTargetData *swapchainData;
+ } beginFrame;
+ struct {
+ ID3D11Query *tsQuery;
+ ID3D11Query *tsDisjointQuery;
+ } endFrame;
+ struct {
QRhiRenderTarget *rt;
} setRenderTarget;
struct {
@@ -556,17 +567,15 @@ struct QD3D11CommandBuffer : public QRhiCommandBuffer
}
};
-static const int QD3D11_SWAPCHAIN_BUFFER_COUNT = 2;
-
-struct QD3D11Timestamps
+struct QD3D11SwapChainTimestamps
{
- static const int MAX_TIMESTAMP_PAIRS = QD3D11_SWAPCHAIN_BUFFER_COUNT;
- bool active[MAX_TIMESTAMP_PAIRS] = {};
- ID3D11Query *disjointQuery[MAX_TIMESTAMP_PAIRS] = {};
- ID3D11Query *query[MAX_TIMESTAMP_PAIRS * 2] = {};
- int pairCount = 0;
+ static const int TIMESTAMP_PAIRS = 2;
+
+ bool active[TIMESTAMP_PAIRS] = {};
+ ID3D11Query *disjointQuery[TIMESTAMP_PAIRS] = {};
+ ID3D11Query *query[TIMESTAMP_PAIRS * 2] = {};
- bool prepare(int pairCount, QRhiD3D11 *rhiD);
+ bool prepare(QRhiD3D11 *rhiD);
void destroy();
bool tryQueryTimestamps(int idx, ID3D11DeviceContext *context, double *elapsedSec);
};
@@ -579,6 +588,7 @@ struct QD3D11SwapChain : public QRhiSwapChain
QRhiCommandBuffer *currentFrameCommandBuffer() override;
QRhiRenderTarget *currentFrameRenderTarget() override;
+ QRhiRenderTarget *currentFrameRenderTarget(StereoTargetBuffer targetBuffer) override;
QSize surfacePixelSize() override;
bool isFormatSupported(Format f) override;
@@ -594,6 +604,7 @@ struct QD3D11SwapChain : public QRhiSwapChain
QWindow *window = nullptr;
QSize pixelSize;
QD3D11SwapChainRenderTarget rt;
+ QD3D11SwapChainRenderTarget rtRight;
QD3D11CommandBuffer cb;
DXGI_FORMAT colorFormat;
DXGI_FORMAT srgbAdjustedColorFormat;
@@ -601,7 +612,8 @@ struct QD3D11SwapChain : public QRhiSwapChain
UINT swapChainFlags = 0;
ID3D11Texture2D *backBufferTex;
ID3D11RenderTargetView *backBufferRtv;
- static const int BUFFER_COUNT = QD3D11_SWAPCHAIN_BUFFER_COUNT;
+ ID3D11RenderTargetView *backBufferRtvRight = nullptr;
+ static const int BUFFER_COUNT = 2;
ID3D11Texture2D *msaaTex[BUFFER_COUNT];
ID3D11RenderTargetView *msaaRtv[BUFFER_COUNT];
DXGI_SAMPLE_DESC sampleDesc;
@@ -611,7 +623,8 @@ struct QD3D11SwapChain : public QRhiSwapChain
UINT swapInterval = 1;
IDCompositionTarget *dcompTarget = nullptr;
IDCompositionVisual *dcompVisual = nullptr;
- QD3D11Timestamps timestamps;
+ QD3D11SwapChainTimestamps timestamps;
+ int currentTimestampPairIndex = 0;
};
class QRhiD3D11 : public QRhiImplementation
@@ -736,8 +749,8 @@ public:
const uint *dynOfsPairs, int dynOfsPairCount,
bool offsetOnlyChange);
void resetShaderResources();
- void executeCommandBuffer(QD3D11CommandBuffer *cbD, QD3D11SwapChain *timestampSwapChain = nullptr);
- DXGI_SAMPLE_DESC effectiveSampleCount(int sampleCount) const;
+ void executeCommandBuffer(QD3D11CommandBuffer *cbD);
+ DXGI_SAMPLE_DESC effectiveSampleDesc(int sampleCount) const;
void finishActiveReadbacks();
void reportLiveObjects(ID3D11Device *device);
void clearShaderCache();
@@ -757,6 +770,7 @@ public:
IDXGIFactory1 *dxgiFactory = nullptr;
IDCompositionDevice *dcompDevice = nullptr;
bool supportsAllowTearing = false;
+ bool useLegacySwapchainModel = false;
bool deviceLost = false;
QRhiD3D11NativeHandles nativeHandlesStruct;
QRhiDriverInfo driverInfoStruct;
@@ -778,8 +792,8 @@ public:
OffscreenFrame(QRhiImplementation *rhi) : cbWrapper(rhi) { }
bool active = false;
QD3D11CommandBuffer cbWrapper;
- QD3D11Timestamps timestamps;
- int timestampIdx = 0;
+ ID3D11Query *tsQueries[2] = {};
+ ID3D11Query *tsDisjointQuery = nullptr;
} ofr;
struct TextureReadback {