Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qrhid3d11_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QRHID3D11_P_H
5#define QRHID3D11_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qrhi_p.h"
20#include <QWindow>
21
22#include <d3d11_1.h>
23#include <dxgi1_6.h>
24#include <dcomp.h>
25
27
28class QRhiD3D11;
29
30struct QD3D11Buffer : public QRhiBuffer
31{
34 void destroy() override;
35 bool create() override;
39
40 ID3D11UnorderedAccessView *unorderedAccessView(quint32 offset);
41
42 ID3D11Buffer *buffer = nullptr;
43 char *dynBuf = nullptr;
45 QHash<quint32, ID3D11UnorderedAccessView *> uavs;
47 friend class QRhiD3D11;
48};
49
51{
53 int sampleCount, QRhiRenderBuffer::Flags flags,
54 QRhiTexture::Format backingFormatHint);
56 void destroy() override;
57 bool create() override;
58 QRhiTexture::Format backingFormat() const override;
59
60 ID3D11Texture2D *tex = nullptr;
61 ID3D11DepthStencilView *dsv = nullptr;
62 ID3D11RenderTargetView *rtv = nullptr;
63 DXGI_FORMAT dxgiFormat;
64 DXGI_SAMPLE_DESC sampleDesc;
66 friend class QRhiD3D11;
67};
68
70{
74 void destroy() override;
75 bool create() override;
76 bool createFrom(NativeTexture src) override;
78
79 bool prepareCreate(QSize *adjustedSize = nullptr);
80 bool finishCreate();
81 ID3D11UnorderedAccessView *unorderedAccessViewForLevel(int level);
82 ID3D11Resource *textureResource() const
83 {
84 if (tex)
85 return tex;
86 else if (tex1D)
87 return tex1D;
88 return tex3D;
89 }
90
91 ID3D11Texture2D *tex = nullptr;
92 ID3D11Texture3D *tex3D = nullptr;
93 ID3D11Texture1D *tex1D = nullptr;
94 bool owns = true;
95 ID3D11ShaderResourceView *srv = nullptr;
96 DXGI_FORMAT dxgiFormat;
98 DXGI_SAMPLE_DESC sampleDesc;
99 ID3D11UnorderedAccessView *perLevelViews[QRhi::MAX_MIP_LEVELS];
101 friend class QRhiD3D11;
102};
103
105{
109 void destroy() override;
110 bool create() override;
111
112 ID3D11SamplerState *samplerState = nullptr;
114 friend class QRhiD3D11;
115};
116
118{
121 void destroy() override;
122 bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
124 QVector<quint32> serializedFormat() const override;
125};
126
128{
130 {
131 for (int i = 0; i < MAX_COLOR_ATTACHMENTS; ++i)
132 rtv[i] = nullptr;
133 }
134
137 float dpr = 1;
138 int sampleCount = 1;
140 int dsAttCount = 0;
141
142 static const int MAX_COLOR_ATTACHMENTS = 8;
143 ID3D11RenderTargetView *rtv[MAX_COLOR_ATTACHMENTS];
144 ID3D11DepthStencilView *dsv = nullptr;
145
147};
148
150{
153 void destroy() override;
154
155 QSize pixelSize() const override;
156 float devicePixelRatio() const override;
157 int sampleCount() const override;
158
160};
161
163{
166 void destroy() override;
167
168 QSize pixelSize() const override;
169 float devicePixelRatio() const override;
170 int sampleCount() const override;
171
173 bool create() override;
174
178 bool ownsDsv = false;
179 ID3D11DepthStencilView *dsv = nullptr;
180 friend class QRhiD3D11;
181};
182
184{
187 void destroy() override;
188 bool create() override;
189 void updateResources(UpdateFlags flags) override;
190
191 bool hasDynamicOffset = false;
192 QVarLengthArray<QRhiShaderResourceBinding, 8> sortedBindings;
194
195 // Keep track of the generation number of each referenced QRhi* to be able
196 // to detect that the batched bindings are out of date.
226 QVarLengthArray<BoundResourceData, 8> boundResourceData;
227
229 bool present = false;
230 QRhiBatchedBindings<ID3D11Buffer *> ubufs;
231 QRhiBatchedBindings<UINT> ubuforigbindings;
232 QRhiBatchedBindings<UINT> ubufoffsets;
233 QRhiBatchedBindings<UINT> ubufsizes;
234 void finish() {
235 present = ubufs.finish();
239 }
240 void clear() {
241 ubufs.clear();
245 }
246 };
247
249 bool present = false;
250 QRhiBatchedBindings<ID3D11SamplerState *> samplers;
251 QRhiBatchedBindings<ID3D11ShaderResourceView *> shaderresources;
252 void finish() {
253 present = samplers.finish();
255 }
256 void clear() {
257 samplers.clear();
259 }
260 };
261
263 bool present = false;
264 QRhiBatchedBindings<ID3D11UnorderedAccessView *> uavs;
265 void finish() {
266 present = uavs.finish();
267 }
268 void clear() {
269 uavs.clear();
270 }
271 };
272
279
286
288
289 friend class QRhiD3D11;
290};
291
293
295{
298 void destroy() override;
299 bool create() override;
300
301 ID3D11DepthStencilState *dsState = nullptr;
302 ID3D11BlendState *blendState = nullptr;
303 struct {
304 ID3D11VertexShader *shader = nullptr;
306 } vs;
307 struct {
308 ID3D11HullShader *shader = nullptr;
310 } hs;
311 struct {
312 ID3D11DomainShader *shader = nullptr;
314 } ds;
315 struct {
316 ID3D11GeometryShader *shader = nullptr;
318 } gs;
319 struct {
320 ID3D11PixelShader *shader = nullptr;
322 } fs;
323 ID3D11InputLayout *inputLayout = nullptr;
324 D3D11_PRIMITIVE_TOPOLOGY d3dTopology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
325 ID3D11RasterizerState *rastState = nullptr;
327 friend class QRhiD3D11;
328};
329
331{
334 void destroy() override;
335 bool create() override;
336
337 struct {
338 ID3D11ComputeShader *shader = nullptr;
340 } cs;
342 friend class QRhiD3D11;
343};
344
345struct QD3D11SwapChain;
346
348{
351 void destroy() override;
352
353 // these must be kept at a reasonably low value otherwise sizeof Command explodes
354 static const int MAX_DYNAMIC_OFFSET_COUNT = 8;
356
357 struct Command {
384 enum ClearFlag { Color = 1, Depth = 2, Stencil = 4 };
386
387 // QRhi*/QD3D11* references should be kept at minimum (so no
388 // QRhiTexture/Buffer/etc. pointers).
389 union Args {
390 struct {
391 ID3D11Query *tsQuery;
392 ID3D11Query *tsDisjointQuery;
395 struct {
396 ID3D11Query *tsQuery;
397 ID3D11Query *tsDisjointQuery;
399 struct {
402 struct {
404 int mask;
405 float c[4];
406 float d;
409 struct {
410 float x, y, w, h;
411 float d0, d1;
413 struct {
414 int x, y, w, h;
416 struct {
423 struct {
424 ID3D11Buffer *buffer;
426 DXGI_FORMAT format;
428 struct {
431 struct {
435 uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT * 2]; // binding, offsetInConstants
437 struct {
441 struct {
443 float c[4];
445 struct {
452 struct {
460 struct {
461 ID3D11Resource *dst;
464 D3D11_BOX dstBox;
465 const void *src; // must come from retain*()
468 struct {
469 ID3D11Resource *dst;
470 UINT dstSubRes;
471 UINT dstX;
472 UINT dstY;
473 UINT dstZ;
474 ID3D11Resource *src;
477 D3D11_BOX srcBox;
479 struct {
480 ID3D11Resource *dst;
481 UINT dstSubRes;
482 ID3D11Resource *src;
483 UINT srcSubRes;
484 DXGI_FORMAT format;
486 struct {
487 ID3D11ShaderResourceView *srv;
489 struct {
490 char s[64];
492 struct {
495 struct {
496 UINT x;
497 UINT y;
498 UINT z;
501 };
502
508
509 QRhiBackendCommandList<Command> commands;
511 double lastGpuTime = 0;
519 ID3D11Buffer *currentIndexBuffer;
522 ID3D11Buffer *currentVertexBuffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
523 quint32 currentVertexOffsets[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
524
525 QVarLengthArray<QByteArray, 4> dataRetainPool;
526 QVarLengthArray<QRhiBufferData, 4> bufferDataRetainPool;
527 QVarLengthArray<QImage, 4> imageRetainPool;
528
529 // relies heavily on implicit sharing (no copies of the actual data will be made)
532 return reinterpret_cast<const uchar *>(dataRetainPool.last().constData());
533 }
536 return reinterpret_cast<const uchar *>(bufferDataRetainPool.last().constData());
537 }
548 void resetState() {
550 // do not zero lastGpuTime
551 currentTarget = nullptr;
554 }
556 currentGraphicsPipeline = nullptr;
557 currentComputePipeline = nullptr;
559 currentGraphicsSrb = nullptr;
560 currentComputeSrb = nullptr;
562 currentIndexBuffer = nullptr;
564 currentIndexFormat = DXGI_FORMAT_R16_UINT;
565 memset(currentVertexBuffers, 0, sizeof(currentVertexBuffers));
566 memset(currentVertexOffsets, 0, sizeof(currentVertexOffsets));
567 }
568};
569
571{
572 static const int TIMESTAMP_PAIRS = 2;
573
575 ID3D11Query *disjointQuery[TIMESTAMP_PAIRS] = {};
576 ID3D11Query *query[TIMESTAMP_PAIRS * 2] = {};
577
578 bool prepare(QRhiD3D11 *rhiD);
579 void destroy();
580 bool tryQueryTimestamps(int idx, ID3D11DeviceContext *context, double *elapsedSec);
581};
582
584{
587 void destroy() override;
588
592
593 QSize surfacePixelSize() override;
594 bool isFormatSupported(Format f) override;
595 QRhiSwapChainHdrInfo hdrInfo() override;
596
598 bool createOrResize() override;
599
600 void releaseBuffers();
601 bool newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI_SAMPLE_DESC sampleDesc,
602 ID3D11Texture2D **tex, ID3D11RenderTargetView **rtv) const;
603
604 QWindow *window = nullptr;
609 DXGI_FORMAT colorFormat;
611 IDXGISwapChain *swapChain = nullptr;
613 ID3D11Texture2D *backBufferTex;
614 ID3D11RenderTargetView *backBufferRtv;
615 ID3D11RenderTargetView *backBufferRtvRight = nullptr;
616 static const int BUFFER_COUNT = 2;
617 ID3D11Texture2D *msaaTex[BUFFER_COUNT];
618 ID3D11RenderTargetView *msaaRtv[BUFFER_COUNT];
619 DXGI_SAMPLE_DESC sampleDesc;
621 int frameCount = 0;
623 UINT swapInterval = 1;
624 IDCompositionTarget *dcompTarget = nullptr;
625 IDCompositionVisual *dcompVisual = nullptr;
628};
629
631{
632public:
634
635 bool create(QRhi::Flags flags) override;
636 void destroy() override;
637
642 QRhiBuffer::UsageFlags usage,
643 quint32 size) override;
645 const QSize &pixelSize,
646 int sampleCount,
647 QRhiRenderBuffer::Flags flags,
648 QRhiTexture::Format backingFormatHint) override;
650 const QSize &pixelSize,
651 int depth,
652 int arraySize,
653 int sampleCount,
654 QRhiTexture::Flags flags) override;
656 QRhiSampler::Filter minFilter,
657 QRhiSampler::Filter mipmapMode,
660 QRhiSampler::AddressMode w) override;
661
663 QRhiTextureRenderTarget::Flags flags) override;
664
665 QRhiSwapChain *createSwapChain() override;
666 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
667 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
668 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
669 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
670 QRhi::FrameOpResult finish() override;
671
672 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
673
676 const QColor &colorClearValue,
677 const QRhiDepthStencilClearValue &depthStencilClearValue,
678 QRhiResourceUpdateBatch *resourceUpdates,
679 QRhiCommandBuffer::BeginPassFlags flags) override;
680 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
681
683 QRhiGraphicsPipeline *ps) override;
684
687 int dynamicOffsetCount,
688 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
689
691 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
692 QRhiBuffer *indexBuf, quint32 indexOffset,
693 QRhiCommandBuffer::IndexFormat indexFormat) override;
694
695 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
696 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
697 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
698 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
699
700 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
701 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
702
703 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
704 quint32 instanceCount, quint32 firstIndex,
705 qint32 vertexOffset, quint32 firstInstance) override;
706
707 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
708 void debugMarkEnd(QRhiCommandBuffer *cb) override;
709 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
710
712 QRhiResourceUpdateBatch *resourceUpdates,
713 QRhiCommandBuffer::BeginPassFlags flags) override;
714 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
716 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
717
719 void beginExternal(QRhiCommandBuffer *cb) override;
720 void endExternal(QRhiCommandBuffer *cb) override;
721 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
722
723 QList<int> supportedSampleCounts() const override;
724 int ubufAlignment() const override;
725 bool isYUpInFramebuffer() const override;
726 bool isYUpInNDC() const override;
727 bool isClipDepthZeroToOne() const override;
728 QMatrix4x4 clipSpaceCorrMatrix() const override;
729 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
730 bool isFeatureSupported(QRhi::Feature feature) const override;
731 int resourceLimit(QRhi::ResourceLimit limit) const override;
732 const QRhiNativeHandles *nativeHandles() override;
733 QRhiDriverInfo driverInfo() const override;
734 QRhiStats statistics() override;
736 void releaseCachedResources() override;
737 bool isDeviceLost() const override;
738
739 QByteArray pipelineCacheData() override;
740 void setPipelineCacheData(const QByteArray &data) override;
741
743 int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc);
746 const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[]);
749 const uint *dynOfsPairs, int dynOfsPairCount,
750 bool offsetOnlyChange);
753 DXGI_SAMPLE_DESC effectiveSampleDesc(int sampleCount) const;
755 void reportLiveObjects(ID3D11Device *device);
756 void clearShaderCache();
758 QString *error, QShaderKey *usedShaderKey);
760
761 QRhi::Flags rhiFlags;
762 bool debugLayer = false;
764 ID3D11Device *dev = nullptr;
765 ID3D11DeviceContext1 *context = nullptr;
766 D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL(0);
767 LUID adapterLuid = {};
768 ID3DUserDefinedAnnotation *annotations = nullptr;
769 IDXGIAdapter1 *activeAdapter = nullptr;
770 IDXGIFactory1 *dxgiFactory = nullptr;
771 IDCompositionDevice *dcompDevice = nullptr;
774 bool deviceLost = false;
777
778 struct {
790
793 bool active = false;
795 ID3D11Query *tsQueries[2] = {};
796 ID3D11Query *tsDisjointQuery = nullptr;
798
808 QVarLengthArray<TextureReadback, 2> activeTextureReadbacks;
814 QVarLengthArray<BufferReadback, 2> activeBufferReadbacks;
815
824 QHash<QRhiShaderStage, Shader> m_shaderCache;
825
826 // This is what gets exposed as the "pipeline cache", not that that concept
827 // applies anyway. Here we are just storing the DX bytecode for a shader so
828 // we can skip the HLSL->DXBC compilation when the QShader has HLSL source
829 // code and the same shader source has already been compiled before.
830 // m_shaderCache seemingly does the same, but this here does not care about
831 // the ID3D11*Shader, this is just about the bytecode and about allowing
832 // the data to be serialized to persistent storage and then reloaded in
833 // future runs of the app, or when creating another QRhi, etc.
840 QHash<BytecodeCacheKey, QByteArray> m_bytecodeCache;
841};
842
845
847{
848 return a.sourceHash == b.sourceHash
849 && a.target == b.target
850 && a.entryPoint == b.entryPoint
851 && a.compileFlags == b.compileFlags;
852}
853
855{
856 return !(a == b);
857}
858
859inline size_t qHash(const QRhiD3D11::BytecodeCacheKey &k, size_t seed = 0) noexcept
860{
861 return qHash(k.sourceHash, seed) ^ qHash(k.target) ^ qHash(k.entryPoint) ^ k.compileFlags;
862}
863
865
866#endif
IOBluetoothDevice * device
\inmodule QtCore
Definition qbytearray.h:57
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:124
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtGui
Definition qimage.h:37
const uchar * constBits() const
Returns a pointer to the first pixel data.
Definition qimage.cpp:1733
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
const char * constData() const
Definition qrhi_p.h:353
\inmodule QtGui
Definition qrhi.h:846
Type
Specifies storage type of buffer resource.
Definition qrhi.h:848
\inmodule QtGui
Definition qrhi.h:1651
QPair< int, quint32 > DynamicOffset
Synonym for QPair<int, quint32>.
Definition qrhi.h:1676
QPair< QRhiBuffer *, quint32 > VertexInput
Synonym for QPair<QRhiBuffer *, quint32>.
Definition qrhi.h:1680
IndexFormat
Specifies the index data type.
Definition qrhi.h:1653
\inmodule QtGui
Definition qrhi.h:1622
\inmodule QtGui
\variable QRhiD3D11InitParams::enableDebugLayer
struct QRhiD3D11::@261 contextState
int gsHighestActiveSrvBinding
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override
bool deviceLost
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override
int dsHighestActiveSrvBinding
QRhiD3D11NativeHandles nativeHandlesStruct
bool isYUpInNDC() const override
ID3D11Device * dev
QRhiSwapChain * createSwapChain() override
void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
bool isFeatureSupported(QRhi::Feature feature) const override
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override
bool isDeviceLost() const override
bool vsHasIndexBufferBound
void executeBufferHostWrites(QD3D11Buffer *bufD)
void resetShaderResources()
void updateShaderResourceBindings(QD3D11ShaderResourceBindings *srbD, const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[])
QRhiStats statistics() override
QHash< BytecodeCacheKey, QByteArray > m_bytecodeCache
QRhiComputePipeline * createComputePipeline() override
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override
bool debugLayer
QRhi::FrameOpResult finish() override
void setVertexInput(QRhiCommandBuffer *cb, int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings, QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat) override
IDXGIAdapter1 * activeAdapter
QRhiGraphicsPipeline * createGraphicsPipeline() override
QRhiShaderResourceBindings * createShaderResourceBindings() override
QVarLengthArray< BufferReadback, 2 > activeBufferReadbacks
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override
ID3D11DeviceContext1 * context
QList< int > supportedSampleCounts() const override
QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override
QRhi::Flags rhiFlags
QByteArray compileHlslShaderSource(const QShader &shader, QShader::Variant shaderVariant, uint flags, QString *error, QShaderKey *usedShaderKey)
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override
int csHighestActiveSrvBinding
bool isClipDepthZeroToOne() const override
IDCompositionDevice * dcompDevice
QRhiDriverInfo driverInfoStruct
QHash< QRhiShaderStage, Shader > m_shaderCache
bool ensureDirectCompositionDevice()
void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override
void enqueueSubresUpload(QD3D11Texture *texD, QD3D11CommandBuffer *cbD, int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc)
QD3D11SwapChain * currentSwapChain
void reportLiveObjects(ID3D11Device *device)
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
void destroy() override
QMatrix4x4 clipSpaceCorrMatrix() const override
struct QRhiD3D11::OffscreenFrame ofr
bool isYUpInFramebuffer() const override
int resourceLimit(QRhi::ResourceLimit limit) const override
void beginExternal(QRhiCommandBuffer *cb) override
QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags) override
void setPipelineCacheData(const QByteArray &data) override
void bindShaderResources(QD3D11ShaderResourceBindings *srbD, const uint *dynOfsPairs, int dynOfsPairCount, bool offsetOnlyChange)
LUID adapterLuid
void executeCommandBuffer(QD3D11CommandBuffer *cbD)
void debugMarkEnd(QRhiCommandBuffer *cb) override
void releaseCachedResources() override
double lastCompletedGpuTime(QRhiCommandBuffer *cb) override
ID3DUserDefinedAnnotation * annotations
bool importedDeviceAndContext
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) override
bool supportsAllowTearing
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
void endExternal(QRhiCommandBuffer *cb) override
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override
QVarLengthArray< TextureReadback, 2 > activeTextureReadbacks
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
void setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBindings *srb, int dynamicOffsetCount, const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override
void clearShaderCache()
D3D_FEATURE_LEVEL featureLevel
bool useLegacySwapchainModel
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
bool makeThreadLocalNativeContextCurrent() override
int csHighestActiveUavBinding
void finishActiveReadbacks()
IDXGIFactory1 * dxgiFactory
int fsHighestActiveSrvBinding
QByteArray pipelineCacheData() override
const QRhiNativeHandles * nativeHandles() override
QRhiDriverInfo driverInfo() const override
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
int ubufAlignment() const override
void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance) override
QRhiSampler * createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w) override
int vsHighestActiveSrvBinding
QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint) override
int hsHighestActiveSrvBinding
void setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps) override
QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *importDevice=nullptr)
DXGI_SAMPLE_DESC effectiveSampleDesc(int sampleCount) const
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override
int vsHighestActiveVertexBufferBinding
\inmodule QtGui
Definition qrhi.h:44
\inmodule QtGui
Definition qrhi.h:1270
\inmodule QtGui
Definition qrhi.h:777
\inmodule QtGui
Definition qrhi.h:1094
QSize pixelSize() const
Definition qrhi.h:1115
int sampleCount() const
Definition qrhi.h:1118
Type
Specifies the type of the renderbuffer.
Definition qrhi.h:1096
\inmodule QtGui
Definition qrhi.h:1142
\inmodule QtGui
Definition qrhi.h:1158
\inmodule QtGui
Definition qrhi.h:1731
QRhi * rhi() const
Definition qrhi.cpp:3603
\inmodule QtGui
Definition qrhi.h:1030
Filter
Specifies the minification, magnification, or mipmap filtering.
Definition qrhi.h:1032
Filter magFilter() const
Definition qrhi.h:1057
AddressMode
Specifies the addressing mode.
Definition qrhi.h:1038
Filter minFilter() const
Definition qrhi.h:1060
Filter mipmapMode() const
Definition qrhi.h:1063
\inmodule QtGui
Definition qrhi.h:138
\inmodule QtGui
Definition qrhi.h:1214
\inmodule QtGui
Definition qrhi.h:1173
\inmodule QtGui
Definition qrhi.h:1549
Format
Describes the swapchain format.
Definition qrhi.h:1561
StereoTargetBuffer
Selects the backbuffer to use with a stereoscopic swapchain.
Definition qrhi.h:1568
\inmodule QtGui
Definition qrhi.h:1184
\inmodule QtGui
Definition qrhi.h:895
int arraySize() const
Definition qrhi.h:981
int sampleCount() const
Definition qrhi.h:995
Format
Specifies the texture format.
Definition qrhi.h:914
QSize pixelSize() const
Definition qrhi.h:975
\inmodule QtGui
Definition qrhi.h:85
static constexpr int MAX_MIP_LEVELS
Definition qrhi.h:1997
ResourceLimit
Describes the resource limit to query.
Definition qrhi.h:1886
Feature
Flag values to indicate what features are supported by the backend currently in use.
Definition qrhi.h:1831
FrameOpResult
Describes the result of operations that can have a soft failure.
Definition qrhi.h:1824
\inmodule QtGui
Definition qshader.h:178
\inmodule QtGui
Definition qshader.h:81
Variant
Describes what kind of shader code an entry contains.
Definition qshader.h:103
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
void append(const T &t)
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
Definition image.cpp:4
static void * context
DBusConnection const char DBusError * error
static int instanceCount
EGLOutputLayerEXT layer
Flags
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLuint const GLuint * buffers
GLint GLenum GLsizei GLsizei GLsizei depth
GLenum GLuint GLint level
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei const GLubyte * commands
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat f
GLenum src
GLenum GLuint buffer
GLenum type
GLbitfield flags
GLenum GLuint GLintptr offset
GLuint name
GLint GLsizei GLsizei GLenum format
GLint y
void ** params
GLdouble s
[6]
Definition qopenglext.h:235
GLenum query
const GLubyte * c
GLuint GLsizei const GLuint const GLintptr * offsets
GLuint shader
Definition qopenglext.h:665
GLint limit
GLuint * samplers
GLsizei const GLuint const GLintptr const GLsizei * strides
GLsizeiptr const void GLenum usage
Definition qopenglext.h:543
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
size_t qHash(const QRhiD3D11::BytecodeCacheKey &k, size_t seed=0) noexcept
bool operator!=(const QRhiD3D11::BytecodeCacheKey &a, const QRhiD3D11::BytecodeCacheKey &b) noexcept
bool operator==(const QRhiD3D11::BytecodeCacheKey &a, const QRhiD3D11::BytecodeCacheKey &b) noexcept
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
unsigned int quint32
Definition qtypes.h:50
unsigned char uchar
Definition qtypes.h:32
int qint32
Definition qtypes.h:49
unsigned long long quint64
Definition qtypes.h:61
unsigned int uint
Definition qtypes.h:34
QSharedPointer< T > other(t)
[5]
view viewport() -> scroll(dx, dy, deviceRect)
view create()
bool hasPendingDynamicUpdates
Definition qrhid3d11_p.h:44
void endFullDynamicBufferUpdateForCurrentFrame() override
To be called when the entire contents of the buffer data has been updated in the memory block returne...
char * dynBuf
Definition qrhid3d11_p.h:43
QD3D11Buffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
char * beginFullDynamicBufferUpdateForCurrentFrame() override
bool create() override
Creates the corresponding native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QHash< quint32, ID3D11UnorderedAccessView * > uavs
Definition qrhid3d11_p.h:45
QRhiBuffer::NativeBuffer nativeBuffer() override
ID3D11UnorderedAccessView * unorderedAccessView(quint32 offset)
union QD3D11CommandBuffer::Command::Args args
QRhiRenderTarget * currentTarget
static const int MAX_DYNAMIC_OFFSET_COUNT
QVarLengthArray< QRhiBufferData, 4 > bufferDataRetainPool
const uchar * retainBufferData(const QRhiBufferData &data)
ID3D11Buffer * currentVertexBuffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]
QVarLengthArray< QImage, 4 > imageRetainPool
static const int MAX_VERTEX_BUFFER_BINDING_COUNT
QRhiShaderResourceBindings * currentGraphicsSrb
const uchar * retainImage(const QImage &image)
QD3D11CommandBuffer(QRhiImplementation *rhi)
const uchar * retainData(const QByteArray &data)
QRhiShaderResourceBindings * currentComputeSrb
QRhiBackendCommandList< Command > commands
QVarLengthArray< QByteArray, 4 > dataRetainPool
QRhiComputePipeline * currentComputePipeline
ID3D11Buffer * currentIndexBuffer
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
DXGI_FORMAT currentIndexFormat
quint32 currentVertexOffsets[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]
QRhiGraphicsPipeline * currentGraphicsPipeline
QD3D11ComputePipeline(QRhiImplementation *rhi)
struct QD3D11ComputePipeline::@238 cs
bool create() override
QShader::NativeResourceBindingMap nativeResourceBindingMap
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
struct QD3D11GraphicsPipeline::@236 gs
struct QD3D11GraphicsPipeline::@233 vs
struct QD3D11GraphicsPipeline::@237 fs
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QD3D11GraphicsPipeline(QRhiImplementation *rhi)
struct QD3D11GraphicsPipeline::@234 hs
ID3D11InputLayout * inputLayout
ID3D11BlendState * blendState
ID3D11RasterizerState * rastState
D3D11_PRIMITIVE_TOPOLOGY d3dTopology
bool create() override
Creates the corresponding native graphics resources.
ID3D11DepthStencilState * dsState
QShader::NativeResourceBindingMap nativeResourceBindingMap
struct QD3D11GraphicsPipeline::@235 ds
QD3D11RenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint)
ID3D11RenderTargetView * rtv
Definition qrhid3d11_p.h:62
DXGI_FORMAT dxgiFormat
Definition qrhid3d11_p.h:63
ID3D11DepthStencilView * dsv
Definition qrhid3d11_p.h:61
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
DXGI_SAMPLE_DESC sampleDesc
Definition qrhid3d11_p.h:64
bool create() override
Creates the corresponding native graphics resources.
QRhiTexture::Format backingFormat() const override
ID3D11Texture2D * tex
Definition qrhid3d11_p.h:60
QD3D11RenderPassDescriptor(QRhiImplementation *rhi)
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() const override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool isCompatible(const QRhiRenderPassDescriptor *other) const override
QVector< quint32 > serializedFormat() const override
static const int MAX_COLOR_ATTACHMENTS
ID3D11RenderTargetView * rtv[MAX_COLOR_ATTACHMENTS]
QD3D11RenderTargetData(QRhiImplementation *)
ID3D11DepthStencilView * dsv
QD3D11RenderPassDescriptor * rp
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QD3D11Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, AddressMode u, AddressMode v, AddressMode w)
ID3D11SamplerState * samplerState
bool create() override
struct QD3D11ShaderResourceBindings::BoundSampledTextureData::@230 d[QRhiShaderResourceBinding::Data::MAX_TEX_SAMPLER_ARRAY_SIZE]
QRhiBatchedBindings< ID3D11SamplerState * > samplers
QRhiBatchedBindings< ID3D11ShaderResourceView * > shaderresources
QRhiBatchedBindings< ID3D11UnorderedAccessView * > uavs
QRhiBatchedBindings< ID3D11Buffer * > ubufs
QVarLengthArray< BoundResourceData, 8 > boundResourceData
StageSamplerBatches hsSamplerBatches
QVarLengthArray< QRhiShaderResourceBinding, 8 > sortedBindings
StageSamplerBatches gsSamplerBatches
StageUniformBufferBatches dsUniformBufferBatches
StageUniformBufferBatches gsUniformBufferBatches
void updateResources(UpdateFlags flags) override
StageSamplerBatches vsSamplerBatches
StageSamplerBatches fsSamplerBatches
StageUniformBufferBatches fsUniformBufferBatches
StageSamplerBatches dsSamplerBatches
StageSamplerBatches csSamplerBatches
StageUniformBufferBatches csUniformBufferBatches
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QD3D11ShaderResourceBindings(QRhiImplementation *rhi)
StageUniformBufferBatches hsUniformBufferBatches
StageUniformBufferBatches vsUniformBufferBatches
int sampleCount() const override
QD3D11SwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
float devicePixelRatio() const override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QD3D11RenderTargetData d
QSize pixelSize() const override
bool prepare(QRhiD3D11 *rhiD)
bool tryQueryTimestamps(int idx, ID3D11DeviceContext *context, double *elapsedSec)
bool active[TIMESTAMP_PAIRS]
ID3D11Query * disjointQuery[TIMESTAMP_PAIRS]
static const int TIMESTAMP_PAIRS
QRhiSwapChainHdrInfo hdrInfo() override
\variable QRhiSwapChainHdrInfo::limitsType
QD3D11SwapChainTimestamps timestamps
QD3D11CommandBuffer cb
ID3D11RenderTargetView * backBufferRtv
QWindow * window
QD3D11RenderBuffer * ds
QRhiRenderTarget * currentFrameRenderTarget() override
QD3D11SwapChainRenderTarget rtRight
ID3D11RenderTargetView * backBufferRtvRight
ID3D11Texture2D * msaaTex[BUFFER_COUNT]
DXGI_FORMAT colorFormat
QD3D11SwapChain(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
IDCompositionTarget * dcompTarget
ID3D11RenderTargetView * msaaRtv[BUFFER_COUNT]
bool createOrResize() override
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size...
QSize surfacePixelSize() override
bool newColorBuffer(const QSize &size, DXGI_FORMAT format, DXGI_SAMPLE_DESC sampleDesc, ID3D11Texture2D **tex, ID3D11RenderTargetView **rtv) const
static const int BUFFER_COUNT
QD3D11SwapChainRenderTarget rt
bool isFormatSupported(Format f) override
DXGI_SAMPLE_DESC sampleDesc
IDCompositionVisual * dcompVisual
QRhiCommandBuffer * currentFrameCommandBuffer() override
int currentTimestampPairIndex
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
IDXGISwapChain * swapChain
DXGI_FORMAT srgbAdjustedColorFormat
ID3D11Texture2D * backBufferTex
QSize pixelSize() const override
QD3D11TextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags)
ID3D11DepthStencilView * dsv
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
float devicePixelRatio() const override
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
int sampleCount() const override
bool ownsRtv[QD3D11RenderTargetData::MAX_COLOR_ATTACHMENTS]
ID3D11RenderTargetView * rtv[QD3D11RenderTargetData::MAX_COLOR_ATTACHMENTS]
bool create() override
Creates the corresponding native graphics resources.
QD3D11RenderTargetData d
ID3D11Texture1D * tex1D
Definition qrhid3d11_p.h:93
bool create() override
Creates the corresponding native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool createFrom(NativeTexture src) override
Similar to create(), except that no new native textures are created.
NativeTexture nativeTexture() override
ID3D11UnorderedAccessView * perLevelViews[QRhi::MAX_MIP_LEVELS]
Definition qrhid3d11_p.h:99
ID3D11Texture2D * tex
Definition qrhid3d11_p.h:91
bool prepareCreate(QSize *adjustedSize=nullptr)
DXGI_FORMAT dxgiFormat
Definition qrhid3d11_p.h:96
QD3D11Texture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags)
ID3D11UnorderedAccessView * unorderedAccessViewForLevel(int level)
DXGI_SAMPLE_DESC sampleDesc
Definition qrhid3d11_p.h:98
bool finishCreate()
ID3D11ShaderResourceView * srv
Definition qrhid3d11_p.h:95
ID3D11Texture3D * tex3D
Definition qrhid3d11_p.h:92
ID3D11Resource * textureResource() const
Definition qrhid3d11_p.h:82
\inmodule QtGui
Definition qrhi.h:862
ID3D11Buffer * stagingBuf
QRhiReadbackResult * result
OffscreenFrame(QRhiImplementation *rhi)
ID3D11Query * tsDisjointQuery
ID3D11Query * tsQueries[2]
QD3D11CommandBuffer cbWrapper
Shader(IUnknown *s, const QByteArray &bytecode, const QShader::NativeResourceBindingMap &rbm)
QShader::NativeResourceBindingMap nativeResourceBindingMap
QByteArray bytecode
QRhiReadbackResult * result
QRhiTexture::Format format
QRhiReadbackDescription desc
ID3D11Texture2D * stagingTex
\inmodule QtGui
Definition qrhi.h:1759
\variable QRhiReadbackResult::completed
Definition qrhi.h:800
\inmodule QtGui
Definition qrhi.h:1723
static constexpr int MAX_TEX_SAMPLER_ARRAY_SIZE
Definition qrhi.h:506
\inmodule QtGui
Definition qrhi.h:1782
\inmodule QtGui
Definition qrhi.h:1511
\inmodule QtGui
Definition qrhi.h:965
Definition moc.h:23
struct QD3D11CommandBuffer::Command::Args::@249 stencilRef
QD3D11ShaderResourceBindings * srb
struct QD3D11CommandBuffer::Command::Args::@247 bindGraphicsPipeline
struct QD3D11CommandBuffer::Command::Args::@239 beginFrame
QD3D11RenderTargetData * swapchainData
struct QD3D11CommandBuffer::Command::Args::@250 blendConstants
struct QD3D11CommandBuffer::Command::Args::@257 debugMark
struct QD3D11CommandBuffer::Command::Args::@258 bindComputePipeline
struct QD3D11CommandBuffer::Command::Args::@255 resolveSubRes
struct QD3D11CommandBuffer::Command::Args::@244 scissor
ID3D11ShaderResourceView * srv
struct QD3D11CommandBuffer::Command::Args::@241 setRenderTarget
struct QD3D11CommandBuffer::Command::Args::@252 drawIndexed
struct QD3D11CommandBuffer::Command::Args::@245 bindVertexBuffers
struct QD3D11CommandBuffer::Command::Args::@240 endFrame
struct QD3D11CommandBuffer::Command::Args::@251 draw
uint dynamicOffsetPairs[MAX_DYNAMIC_OFFSET_COUNT *2]
QD3D11ComputePipeline * ps
struct QD3D11CommandBuffer::Command::Args::@242 clear
QD3D11GraphicsPipeline * ps
struct QD3D11CommandBuffer::Command::Args::@256 genMip
struct QD3D11CommandBuffer::Command::Args::@259 dispatch
struct QD3D11CommandBuffer::Command::Args::@253 updateSubRes
struct QD3D11CommandBuffer::Command::Args::@243 viewport
struct QD3D11CommandBuffer::Command::Args::@246 bindIndexBuffer
struct QD3D11CommandBuffer::Command::Args::@254 copySubRes
struct QD3D11CommandBuffer::Command::Args::@248 bindShaderResources