Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qrhimetal_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// Qt-Security score:significant reason:default
4
5#ifndef QRHIMETAL_P_H
6#define QRHIMETAL_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include "qrhi_p.h"
20#include <QWindow>
21
23
24static const int QMTL_FRAMES_IN_FLIGHT = 2;
25
26// have to hide the ObjC stuff, this header cannot contain MTL* at all
27struct QMetalBufferData;
28
29struct QMetalBuffer : public QRhiBuffer
30{
31 QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size);
32 ~QMetalBuffer();
33 void destroy() override;
34 bool create() override;
38
42 friend class QRhiMetal;
44
45 static constexpr int WorkBufPoolUsage = 1 << 8;
47};
48
50
52{
53 QMetalRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize,
54 int sampleCount, QRhiRenderBuffer::Flags flags,
55 QRhiTexture::Format backingFormatHint);
57 void destroy() override;
58 bool create() override;
59 QRhiTexture::Format backingFormat() const override;
60
62 int samples = 1;
65 friend class QRhiMetal;
66};
67
69
71{
72 QMetalTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth,
73 int arraySize, int sampleCount, Flags flags);
75 void destroy() override;
76 bool create() override;
77 bool createFrom(NativeTexture src) override;
79
80 bool prepareCreate(QSize *adjustedSize = nullptr);
81
84 int samples = 1;
87 friend class QRhiMetal;
89 friend struct QMetalTextureData;
90};
91
93
95{
96 QMetalSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
97 AddressMode u, AddressMode v, AddressMode w);
99 void destroy() override;
100 bool create() override;
101
105 friend class QRhiMetal;
107};
108
110
112{
113 QMetalShadingRateMap(QRhiImplementation *rhi);
115 void destroy() override;
116 bool createFrom(NativeShadingRateMap src) override;
117
121 friend class QRhiMetal;
122};
123
125
127{
128 QMetalIndirectCommandBuffer(QRhiImplementation *rhi, Type type, quint32 maxCommandCount);
130 void destroy() override;
131 bool create() override;
132
134 {
135 return reinterpret_cast<const QRhiIndirectDrawCommand *>(m_data.constData());
136 }
138 {
139 return reinterpret_cast<const QRhiIndexedIndirectDrawCommand *>(m_data.constData());
140 }
141 quint64 contentsGeneration() const { return m_generation; }
142
145 friend class QRhiMetal;
146};
147
149{
150 QMetalRenderPassDescriptor(QRhiImplementation *rhi);
152 void destroy() override;
153 bool isCompatible(const QRhiRenderPassDescriptor *other) const override;
155 QVector<quint32> serializedFormat() const override;
156
158
159 // there is no MTLRenderPassDescriptor here as one will be created for each pass in beginPass()
160
161 // but the things needed for the render pipeline descriptor have to be provided
162 static const int MAX_COLOR_ATTACHMENTS = 8;
164 bool hasDepthStencil = false;
167 bool hasShadingRateMap = false;
169};
170
172
174{
175 QMetalSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain);
177 void destroy() override;
178
179 QSize pixelSize() const override;
180 float devicePixelRatio() const override;
181 int sampleCount() const override;
182
184};
185
187{
188 QMetalTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags);
190 void destroy() override;
191
192 QSize pixelSize() const override;
193 float devicePixelRatio() const override;
194 int sampleCount() const override;
195
197 bool create() override;
198
200 friend class QRhiMetal;
201};
202
205
253
256struct QMetalShader;
257
259{
260 QMetalGraphicsPipeline(QRhiImplementation *rhi);
262 void destroy() override;
263 bool create() override;
264
267 void setupMetalDepthStencilDescriptor(void *metalDsDesc);
268 void mapStates();
270 bool createTessellationPipelines(const QShader &tessVert, const QShader &tesc, const QShader &tese, const QShader &tessFrag);
271
275 friend class QRhiMetal;
276};
277
279
281{
282 QMetalComputePipeline(QRhiImplementation *rhi);
284 void destroy() override;
285 bool create() override;
286
290 friend class QRhiMetal;
291};
292
294struct QMetalSwapChain;
295
297{
298 QMetalCommandBuffer(QRhiImplementation *rhi);
300 void destroy() override;
301
304
310
311 // per-pass (render or compute command encoder) persistent state
314
315 // per-pass (render or compute command encoder) volatile (cached) state
330 std::pair<float, float> currentDepthBiasValues;
338
340 void resetState(double lastGpuTime = 0);
341 void resetPerPassState();
343};
344
346
348{
349 QMetalSwapChain(QRhiImplementation *rhi);
351 void destroy() override;
352
353 QRhiCommandBuffer *currentFrameCommandBuffer() override;
355 QSize surfacePixelSize() override;
356 bool isFormatSupported(Format f) override;
357
359
361
362 virtual QRhiSwapChainHdrInfo hdrInfo() override;
363
364 void chooseFormats();
365 void waitUntilCompleted(int slot);
366
367 QWindow *window = nullptr;
369 int currentFrameSlot = 0; // 0..QMTL_FRAMES_IN_FLIGHT-1
370 int frameCount = 0;
371 int samples = 1;
376};
377
378struct QRhiMetalData;
379
381{
382public:
383 QRhiMetal(QRhiMetalInitParams *params, QRhiMetalNativeHandles *importDevice = nullptr);
384 ~QRhiMetal();
385
386 static bool probe(QRhiMetalInitParams *params);
387 static QRhiSwapChainProxyData updateSwapChainProxyData(QWindow *window);
388
389 bool create(QRhi::Flags flags) override;
390 void destroy() override;
391
395 QRhiBuffer *createBuffer(QRhiBuffer::Type type,
396 QRhiBuffer::UsageFlags usage,
397 quint32 size) override;
398 QRhiRenderBuffer *createRenderBuffer(QRhiRenderBuffer::Type type,
399 const QSize &pixelSize,
400 int sampleCount,
401 QRhiRenderBuffer::Flags flags,
402 QRhiTexture::Format backingFormatHint) override;
403 QRhiTexture *createTexture(QRhiTexture::Format format,
404 const QSize &pixelSize,
405 int depth,
406 int arraySize,
407 int sampleCount,
408 QRhiTexture::Flags flags) override;
409 QRhiSampler *createSampler(QRhiSampler::Filter magFilter,
410 QRhiSampler::Filter minFilter,
411 QRhiSampler::Filter mipmapMode,
412 QRhiSampler:: AddressMode u,
413 QRhiSampler::AddressMode v,
414 QRhiSampler::AddressMode w) override;
415
416 QRhiTextureRenderTarget *createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc,
417 QRhiTextureRenderTarget::Flags flags) override;
418
419 QRhiShadingRateMap *createShadingRateMap() override;
420
421 QRhiIndirectCommandBuffer *createIndirectCommandBuffer(QRhiIndirectCommandBuffer::Type type,
422 quint32 maxCommandCount) override;
423 void buildIndirect(QRhiCommandBuffer *cb, QRhiIndirectCommandBuffer *icb,
424 const QRhiIndirectCommandBufferBuildInfo &info) override;
425 void executeIndirect(QRhiCommandBuffer *cb, QRhiIndirectCommandBuffer *icb,
426 quint32 firstCommand, quint32 commandCount) override;
427 void commitIndirectCommandBuffer(QRhiResourceUpdateBatch *u,
428 QRhiIndirectCommandBuffer *icb) override;
429
430 QRhiSwapChain *createSwapChain() override;
431 QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override;
432 QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override;
433 QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override;
434 QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override;
435 QRhi::FrameOpResult finish() override;
436
437 void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
438
439 void beginPass(QRhiCommandBuffer *cb,
440 QRhiRenderTarget *rt,
441 const QColor &colorClearValue,
442 const QRhiDepthStencilClearValue &depthStencilClearValue,
443 QRhiResourceUpdateBatch *resourceUpdates,
444 QRhiCommandBuffer::BeginPassFlags flags) override;
445 void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
446
447 void setGraphicsPipeline(QRhiCommandBuffer *cb,
448 QRhiGraphicsPipeline *ps) override;
449
450 void setShaderResources(QRhiCommandBuffer *cb,
451 QRhiShaderResourceBindings *srb,
452 int dynamicOffsetCount,
453 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override;
454
455 void setVertexInput(QRhiCommandBuffer *cb,
456 int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings,
457 QRhiBuffer *indexBuf, quint32 indexOffset,
458 QRhiCommandBuffer::IndexFormat indexFormat) override;
459
460 void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override;
461 void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override;
462 void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override;
463 void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override;
464 void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override;
465
466 void draw(QRhiCommandBuffer *cb, quint32 vertexCount,
467 quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override;
468
469 void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount,
470 quint32 instanceCount, quint32 firstIndex,
471 qint32 vertexOffset, quint32 firstInstance) override;
472
473 void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
474 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
475
476 void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
477 quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override;
478
479 void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override;
480 void debugMarkEnd(QRhiCommandBuffer *cb) override;
481 void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override;
482
483 void beginComputePass(QRhiCommandBuffer *cb,
484 QRhiResourceUpdateBatch *resourceUpdates,
485 QRhiCommandBuffer::BeginPassFlags flags) override;
486 void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override;
487 void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override;
488 void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override;
489 void dispatchIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer,
490 quint32 indirectBufferOffset) override;
491
492 void drawIndirectCount(QRhiCommandBuffer *cb,
493 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
494 QRhiBuffer *countBuffer, quint32 countBufferOffset,
495 quint32 maxDrawCount, quint32 stride) override;
496 void drawIndexedIndirectCount(QRhiCommandBuffer *cb,
497 QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset,
498 QRhiBuffer *countBuffer, quint32 countBufferOffset,
499 quint32 maxDrawCount, quint32 stride) override;
500
501 const char *icbUnavailableReason(QMetalCommandBuffer *cbD) const;
502 bool prepareIcbKernels();
503 bool prepareIcb(quint32 maxDrawCount);
504 bool icbDraw(QMetalCommandBuffer *cbD, bool indexed,
505 QMetalBuffer *indirectBufD, quint32 indirectBufferOffset,
506 QMetalBuffer *countBufD, quint32 countBufferOffset,
507 quint32 maxDrawCount, quint32 stride);
508
509 const QRhiNativeHandles *nativeHandles(QRhiCommandBuffer *cb) override;
510 void beginExternal(QRhiCommandBuffer *cb) override;
511 void endExternal(QRhiCommandBuffer *cb) override;
512 double lastCompletedGpuTime(QRhiCommandBuffer *cb) override;
513
514 QList<int> supportedSampleCounts() const override;
515 QList<QSize> supportedShadingRates(int sampleCount) const override;
516 int ubufAlignment() const override;
517 bool isYUpInFramebuffer() const override;
518 bool isYUpInNDC() const override;
519 bool isClipDepthZeroToOne() const override;
520 QMatrix4x4 clipSpaceCorrMatrix() const override;
521 bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override;
522 bool isFeatureSupported(QRhi::Feature feature) const override;
523 int resourceLimit(QRhi::ResourceLimit limit) const override;
524 const QRhiNativeHandles *nativeHandles() override;
525 QRhiDriverInfo driverInfo() const override;
526 QRhiStats statistics() override;
528 void setQueueSubmitParams(QRhiNativeHandles *params) override;
530 bool isDeviceLost() const override;
531
532 QByteArray pipelineCacheData() override;
533 void setPipelineCacheData(const QByteArray &data) override;
534
535 void executeDeferredReleases(bool forced = false);
536 void finishActiveReadbacks(bool forced = false);
537 qsizetype subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const;
538 void enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEncPtr,
539 int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc,
540 qsizetype *curOfs);
541 void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates);
542 void executeBufferHostWritesForSlot(QMetalBuffer *bufD, int slot);
544 void finalizeDeferredStoreActions(QMetalCommandBuffer *cbD, bool passIsEnding);
546 static const int SUPPORTED_STAGES = 5;
549 int dynamicOffsetCount,
550 const QRhiCommandBuffer::DynamicOffset *dynamicOffsets,
551 bool offsetOnlyChange,
552 const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[SUPPORTED_STAGES],
553 const QMetalShader *shaders[SUPPORTED_STAGES]);
555
582 void tessellatedDraw(const TessDrawArgs &args);
583 void adjustForMultiViewDraw(quint32 *instanceCount, QRhiCommandBuffer *cb);
584
586 bool importedDevice = false;
587 bool importedCmdQueue = false;
594
595 struct {
596 int maxTextureSize = 4096;
599 bool isAppleGPU = false;
601 bool multiView = false;
603 bool shadingRateMap = false;
604 bool depthClamp = true;
605 } caps;
606
607 QRhiMetalData *d = nullptr;
608};
609
610QT_END_NAMESPACE
611
612#endif
void buildIndirect(QRhiCommandBuffer *cb, QRhiIndirectCommandBuffer *icb, const QRhiIndirectCommandBufferBuildInfo &info) override
void drawIndirectCount(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, QRhiBuffer *countBuffer, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride) override
bool shadingRateMap
static QRhiSwapChainProxyData updateSwapChainProxyData(QWindow *window)
QMetalSwapChain * currentSwapChain
bool isDeviceLost() const override
QRhiMetalNativeHandles nativeHandlesStruct
void setBlendConstants(QRhiCommandBuffer *cb, const QColor &c) override
QRhiStats statistics() override
void drawIndexed(QRhiCommandBuffer *cb, quint32 indexCount, quint32 instanceCount, quint32 firstIndex, qint32 vertexOffset, quint32 firstInstance) override
void executeBufferHostWritesForCurrentFrame(QMetalBuffer *bufD)
int ubufAlignment() const override
Definition qrhimetal.mm:810
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags) const override
Definition qrhimetal.mm:841
void endExternal(QRhiCommandBuffer *cb) override
QRhiMetalData * d
void drawIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
QRhiMetal(QRhiMetalInitParams *params, QRhiMetalNativeHandles *importDevice=nullptr)
Definition qrhimetal.mm:534
void beginPass(QRhiCommandBuffer *cb, QRhiRenderTarget *rt, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
qsizetype subresUploadByteSize(const QRhiTextureSubresourceUploadDescription &subresDesc) const
void beginExternal(QRhiCommandBuffer *cb) override
quint32 osMajor
void adjustForMultiViewDraw(quint32 *instanceCount, QRhiCommandBuffer *cb)
void setDefaultScissor(QMetalCommandBuffer *cbD)
void enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD, QMetalCommandBuffer *cbD, int dynamicOffsetCount, const QRhiCommandBuffer::DynamicOffset *dynamicOffsets, bool offsetOnlyChange, const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[SUPPORTED_STAGES], const QMetalShader *shaders[SUPPORTED_STAGES])
bool indirectCommandBuffers
QRhiSwapChain * createSwapChain() override
Definition qrhimetal.mm:800
QRhiGraphicsPipeline * createGraphicsPipeline() override
QRhiIndirectCommandBuffer * createIndirectCommandBuffer(QRhiIndirectCommandBuffer::Type type, quint32 maxCommandCount) override
const char * icbUnavailableReason(QMetalCommandBuffer *cbD) const
bool create(QRhi::Flags flags) override
Definition qrhimetal.mm:610
QRhi::FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, QRhi::BeginFrameFlags flags) override
QRhi::Flags rhiFlags
void dispatchIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset) override
void dispatch(QRhiCommandBuffer *cb, int x, int y, int z) override
void resourceUpdate(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
QRhiSampler * createSampler(QRhiSampler::Filter magFilter, QRhiSampler::Filter minFilter, QRhiSampler::Filter mipmapMode, QRhiSampler::AddressMode u, QRhiSampler::AddressMode v, QRhiSampler::AddressMode w) override
static const int SUPPORTED_STAGES
bool multiView
QRhiRenderBuffer * createRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint) override
void setGraphicsPipeline(QRhiCommandBuffer *cb, QRhiGraphicsPipeline *ps) override
bool isYUpInNDC() const override
Definition qrhimetal.mm:820
void commitIndirectCommandBuffer(QRhiResourceUpdateBatch *u, QRhiIndirectCommandBuffer *icb) override
int resourceLimit(QRhi::ResourceLimit limit) const override
Definition qrhimetal.mm:996
QRhiShaderResourceBindings * createShaderResourceBindings() override
void executeBufferHostWritesForSlot(QMetalBuffer *bufD, int slot)
QRhi::FrameOpResult beginFrame(QRhiSwapChain *swapChain, QRhi::BeginFrameFlags flags) override
QMatrix4x4 clipSpaceCorrMatrix() const override
Definition qrhimetal.mm:830
void drawIndexedIndirectCount(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, QRhiBuffer *countBuffer, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride) override
int maxTextureSize
void setQueueSubmitParams(QRhiNativeHandles *params) override
const QRhiNativeHandles * nativeHandles() override
void interruptRenderPass(QMetalCommandBuffer *cbD)
void executeDeferredReleases(bool forced=false)
void endPass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
QRhiComputePipeline * createComputePipeline() override
void drawIndexedIndirect(QRhiCommandBuffer *cb, QRhiBuffer *indirectBuffer, quint32 indirectBufferOffset, quint32 drawCount, quint32 stride) override
bool isClipDepthZeroToOne() const override
Definition qrhimetal.mm:825
QVector< int > supportedSampleCounts
QRhiTextureRenderTarget * createTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags) override
int maxThreadGroupSize
bool isYUpInFramebuffer() const override
Definition qrhimetal.mm:815
bool prepareIcbKernels()
QRhi::FrameOpResult endOffscreenFrame(QRhi::EndFrameFlags flags) override
quint32 osMinor
const QRhiNativeHandles * nativeHandles(QRhiCommandBuffer *cb) override
void enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates)
void setPipelineCacheData(const QByteArray &data) override
bool isAppleGPU
void finalizeDeferredStoreActions(QMetalCommandBuffer *cbD, bool passIsEnding)
QByteArray pipelineCacheData() override
void setShadingRate(QRhiCommandBuffer *cb, const QSize &coarsePixelSize) override
bool depthClamp
void setScissor(QRhiCommandBuffer *cb, const QRhiScissor &scissor) override
void setVertexInput(QRhiCommandBuffer *cb, int startBinding, int bindingCount, const QRhiCommandBuffer::VertexInput *bindings, QRhiBuffer *indexBuf, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat) override
void setComputePipeline(QRhiCommandBuffer *cb, QRhiComputePipeline *ps) override
bool importedDevice
void tessellatedDraw(const TessDrawArgs &args)
void debugMarkBegin(QRhiCommandBuffer *cb, const QByteArray &name) override
void debugMarkEnd(QRhiCommandBuffer *cb) override
QRhi::FrameOpResult finish() override
QSet< QMetalSwapChain * > swapchains
bool baseVertexAndInstance
QRhiShadingRateMap * createShadingRateMap() override
bool importedCmdQueue
QRhi::FrameOpResult endFrame(QRhiSwapChain *swapChain, QRhi::EndFrameFlags flags) override
bool makeThreadLocalNativeContextCurrent() override
QRhiTexture * createTexture(QRhiTexture::Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, QRhiTexture::Flags flags) override
QRhiBuffer * createBuffer(QRhiBuffer::Type type, QRhiBuffer::UsageFlags usage, quint32 size) override
Definition qrhimetal.mm:805
void setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBindings *srb, int dynamicOffsetCount, const QRhiCommandBuffer::DynamicOffset *dynamicOffsets) override
void releaseCachedResources() override
bool icbDraw(QMetalCommandBuffer *cbD, bool indexed, QMetalBuffer *indirectBufD, quint32 indirectBufferOffset, QMetalBuffer *countBufD, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride)
QRhiDriverInfo driverInfoStruct
void setStencilRef(QRhiCommandBuffer *cb, quint32 refValue) override
void setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) override
void endComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates) override
QRhiDriverInfo driverInfo() const override
double lastCompletedGpuTime(QRhiCommandBuffer *cb) override
QList< int > supportedSampleCounts() const override
void draw(QRhiCommandBuffer *cb, quint32 vertexCount, quint32 instanceCount, quint32 firstVertex, quint32 firstInstance) override
void executeIndirect(QRhiCommandBuffer *cb, QRhiIndirectCommandBuffer *icb, quint32 firstCommand, quint32 commandCount) override
bool prepareIcb(quint32 maxDrawCount)
void finishActiveReadbacks(bool forced=false)
static bool probe(QRhiMetalInitParams *params)
Definition qrhimetal.mm:565
void debugMarkMsg(QRhiCommandBuffer *cb, const QByteArray &msg) override
bool isFeatureSupported(QRhi::Feature feature) const override
Definition qrhimetal.mm:874
void enqueueSubresUpload(QMetalTexture *texD, void *mp, void *blitEncPtr, int layer, int level, const QRhiTextureSubresourceUploadDescription &subresDesc, qsizetype *curOfs)
void destroy() override
Definition qrhimetal.mm:725
QList< QSize > supportedShadingRates(int sampleCount) const override
Definition qrhimetal.mm:794
void beginComputePass(QRhiCommandBuffer *cb, QRhiResourceUpdateBatch *resourceUpdates, QRhiCommandBuffer::BeginPassFlags flags) override
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
Definition qrhi_p.h:639
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:325
\inmodule QtGui
Definition qshader.h:81
Combined button and popup list for selecting options.
#define __has_feature(x)
@ UnBounded
Definition qrhi_p.h:327
@ Bounded
Definition qrhi_p.h:328
#define QRHI_RES_RHI(t)
Definition qrhi_p.h:31
#define QRHI_RES(t, x)
Definition qrhi_p.h:30
Int aligned(Int v, Int byteAlign)
\variable QRhiVulkanQueueSubmitParams::waitSemaphoreCount
static bool usesTextures(const QShaderDescription &desc)
static MTLStencilOperation toMetalStencilOp(QRhiGraphicsPipeline::StencilOp op)
static void qrhimtl_releaseIcbSlots(QRhiMetal *rhiD, QMetalIndirectCommandBuffer *icbD)
static MTLLanguageVersion toMetalLanguageVersion(const QShaderVersion &version)
static MTLPrimitiveTopologyClass toMetalPrimitiveTopologyClass(QRhiGraphicsPipeline::Topology t)
static CAMetalLayer * layerForWindow(QWindow *window)
static void addVertexAttribute(const T &variable, int binding, QRhiMetal *rhiD, int &index, quint32 &offset, MTLVertexAttributeDescriptorArray *attributes, quint64 &indices, quint32 &vertexAlignment)
static void qrhimtl_releaseRenderBuffer(const QRhiMetalData::DeferredReleaseEntry &e)
static void qrhimtl_encodeIcbFromCpu(QMetalIndirectCommandBuffer *icbD, QMetalIndirectCommandBufferData::Slot &slot, MTLPrimitiveType primitiveType, id< MTLBuffer > indexBufMtl, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat)
static bool hasArgumentBufferVariant(const QShader &shader)
static bool matches(const QList< QShaderDescription::BlockVariable > &a, const QList< QShaderDescription::BlockVariable > &b)
Q_DECLARE_TYPEINFO(QRhiMetalData::TextureReadback, Q_RELOCATABLE_TYPE)
static MTLBlendOperation toMetalBlendOp(QRhiGraphicsPipeline::BlendOp op)
static QMetalRenderTargetData * currentRenderTargetData(QMetalCommandBuffer *cbD)
static MTLBlendFactor toMetalBlendFactor(QRhiGraphicsPipeline::BlendFactor f)
static MTLWinding toMetalTessellationWindingOrder(QShaderDescription::TessellationWindingOrder w)
static MTLPrimitiveType toMetalPrimitiveType(QRhiGraphicsPipeline::Topology t)
static MTLCompareFunction toMetalCompareOp(QRhiGraphicsPipeline::CompareOp op)
static MTLVertexFormat toMetalAttributeFormat(QRhiVertexInputAttribute::Format format)
static constexpr quint32 ICB_DRAW_COUNT_THRESHOLD
BindingType
static MTLTriangleFillMode toMetalTriangleFillMode(QRhiGraphicsPipeline::PolygonMode mode)
static MTLSamplerMinMagFilter toMetalFilter(QRhiSampler::Filter f)
static MTLCullMode toMetalCullMode(QRhiGraphicsPipeline::CullMode c)
static void qrhimtl_releaseBuffer(const QRhiMetalData::DeferredReleaseEntry &e)
static void endTempComputeEncoding(QRhiMetal *rhiD, QMetalCommandBuffer *cbD, id< MTLComputeCommandEncoder > computeEncoder)
static void takeIndex(quint32 index, quint64 &indices)
static int mapBinding(int binding, int stageIndex, const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[], BindingType type)
static id< MTLComputeCommandEncoder > tempComputeEncoder(QRhiMetal *rhiD, QMetalCommandBuffer *cbD, id< MTLComputeCommandEncoder > maybeComputeEncoder)
static void rebindShaderResources(QMetalCommandBuffer *cbD, int resourceStage, int encoderStage, const QMetalShaderResourceBindingsData *customBindingState=nullptr)
static void qrhimtl_releaseSampler(const QRhiMetalData::DeferredReleaseEntry &e)
static MTLPixelFormat toMetalTextureFormat(QRhiTexture::Format format, QRhiTexture::Flags flags, const QRhiMetal *d)
static QRhiShaderResourceBinding::StageFlag toRhiSrbStage(int stage)
static void setupArgumentBufferEncoder(QMetalShader *shader)
static void addUnusedVertexAttribute(const T &variable, QRhiMetal *rhiD, quint32 &offset, quint32 &vertexAlignment)
static uint toMetalColorWriteMask(QRhiGraphicsPipeline::ColorMask c)
static MTLStoreAction interruptionStoreAction(MTLStoreAction finalAction, bool passIsEnding)
#define QRHI_METAL_COMMAND_BUFFERS_WITH_UNRETAINED_REFERENCES
Definition qrhimetal.mm:61
static void qrhimtl_replayIcbOnCpu(QMetalCommandBuffer *cbD, QMetalIndirectCommandBuffer *icbD, quint32 firstCommand, quint32 count, int currentFrameSlot)
static bool qrhimtl_ensureIcbSlots(QRhiMetal *rhiD, QMetalIndirectCommandBuffer *icbD, QMetalIndirectCommandBufferData::Fill fill)
static MTLSamplerMipFilter toMetalMipmapMode(QRhiSampler::Filter f)
static MTLTessellationPartitionMode toMetalTessellationPartitionMode(QShaderDescription::TessellationPartitioning p)
static MTLCompareFunction toMetalTextureCompareFunction(QRhiSampler::CompareOp op)
static int aligned(quint32 offset, quint32 alignment)
static void declareStageArgumentBufferResources(QMetalCommandBuffer *cbD, int encoderStage, const QMetalShaderResourceBindingsData::Stage &res)
static bool canStoreAttachment(id< MTLTexture > tex)
Q_DECLARE_TYPEINFO(QRhiMetalData::DeferredReleaseEntry, Q_RELOCATABLE_TYPE)
static MTLResourceUsage storageImageUsage(QRhiShaderResourceBinding::Type type)
static bool qrhimtl_icbSlotMatches(const QMetalIndirectCommandBuffer *icbD, const QMetalIndirectCommandBufferData::Slot &slot, MTLPrimitiveType primitiveType, id< MTLBuffer > indexBufMtl, quint32 indexOffset, QRhiCommandBuffer::IndexFormat indexFormat)
static MTLSamplerAddressMode toMetalAddressMode(QRhiSampler::AddressMode m)
static void bindStageBuffers(QMetalCommandBuffer *cbD, int stage, const QRhiBatchedBindings< id< MTLBuffer > >::Batch &bufferBatch, const QRhiBatchedBindings< NSUInteger >::Batch &offsetBatch)
static void qrhimtl_releaseTexture(const QRhiMetalData::DeferredReleaseEntry &e)
static void encodeIcbWithCompute(QRhiMetalData *d, id< MTLComputeCommandEncoder > computeEncoder, id< MTLIndirectCommandBuffer > targetIcb, id< MTLBuffer > targetArgBuffer, id< MTLBuffer > targetRangeBuffer, bool indexed, QRhiCommandBuffer::IndexFormat indexFormat, MTLPrimitiveType primitiveType, id< MTLBuffer > indirectBufMtl, quint32 indirectBufferOffset, id< MTLBuffer > indexBufMtl, quint32 indexBufferOffset, id< MTLBuffer > countBufMtl, quint32 countBufferOffset, quint32 maxDrawCount, quint32 stride)
static bool indexTaken(quint32 index, quint64 indices)
static void bindStageTextures(QMetalCommandBuffer *cbD, int stage, const QRhiBatchedBindings< id< MTLTexture > >::Batch &textureBatch)
#define QRHI_METAL_DISABLE_BINARY_ARCHIVE
Definition qrhimetal.mm:56
static void bindStageSamplers(QMetalCommandBuffer *cbD, int encoderStage, const QRhiBatchedBindings< id< MTLSamplerState > >::Batch &samplerBatch)
static int nextAttributeIndex(quint64 indices)
static QT_BEGIN_NAMESPACE const int QMTL_FRAMES_IN_FLIGHT
Definition qrhimetal_p.h:24
void f(int c)
[26]
QVarLengthArray< BufferUpdate, 16 > pendingUpdates[QMTL_FRAMES_IN_FLIGHT]
Definition qrhimetal.mm:332
id< MTLBuffer > buf[QMTL_FRAMES_IN_FLIGHT]
Definition qrhimetal.mm:327
char * beginFullDynamicBufferUpdateForCurrentFrame() override
QMetalBufferData * d
Definition qrhimetal_p.h:39
QMetalBuffer(QRhiImplementation *rhi, Type type, UsageFlags usage, quint32 size)
static constexpr int WorkBufPoolUsage
Definition qrhimetal_p.h:45
int lastActiveFrameSlot
Definition qrhimetal_p.h:41
QRhiBuffer::NativeBuffer nativeBuffer() override
void endFullDynamicBufferUpdateForCurrentFrame() override
To be called when the entire contents of the buffer data has been updated in the memory block returne...
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool create() override
Creates the corresponding native graphics resources.
MTLRenderPassDescriptor * currentPassRpDesc
Definition qrhimetal.mm:400
id< MTLDepthStencilState > currentDepthStencilState
Definition qrhimetal.mm:404
QMetalShaderResourceBindingsData currentShaderResourceBindingState
Definition qrhimetal.mm:405
MTLStoreAction deferredStencilStoreAction
Definition qrhimetal.mm:411
QVarLengthArray< std::pair< uint, MTLStoreAction >, 4 > deferredColorStoreActions
Definition qrhimetal.mm:409
MTLStoreAction deferredDepthStoreAction
Definition qrhimetal.mm:410
id< MTLComputeCommandEncoder > tessellationComputeEncoder
Definition qrhimetal.mm:399
QRhiBatchedBindings< id< MTLBuffer > > currentVertexInputsBuffers
Definition qrhimetal.mm:402
id< MTLRenderCommandEncoder > currentRenderPassEncoder
Definition qrhimetal.mm:397
id< MTLCommandBuffer > cb
Definition qrhimetal.mm:395
QRhiBatchedBindings< NSUInteger > currentVertexInputOffsets
Definition qrhimetal.mm:403
id< MTLComputeCommandEncoder > currentComputePassEncoder
Definition qrhimetal.mm:398
QMetalBuffer * currentIndexBuffer
std::pair< float, float > currentDepthBiasValues
QRhiCommandBuffer::IndexFormat currentIndexFormat
QRhiMetalCommandBufferNativeHandles nativeHandlesStruct
QRhiScissor currentScissor
QRhiViewport currentViewport
const QRhiNativeHandles * nativeHandles()
QMetalShaderResourceBindings * currentComputeSrb
QMetalComputePipeline * currentComputePipeline
QMetalShaderResourceBindings * currentGraphicsSrb
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QMetalCommandBuffer(QRhiImplementation *rhi)
void resetPerPassCachedState()
QMetalCommandBufferData * d
QRhiRenderTarget * currentTarget
QMetalGraphicsPipeline * currentGraphicsPipeline
void resetState(double lastGpuTime=0)
id< MTLComputePipelineState > ps
Definition qrhimetal.mm:514
QMetalBuffer * bufferSizeBuffer
Definition qrhimetal.mm:519
QMetalComputePipeline(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QMetalComputePipelineData * d
bool create() override
QVector< QMetalBuffer * > deviceLocalWorkBuffers
Definition qrhimetal.mm:468
QMetalBuffer * acquireWorkBuffer(QRhiMetal *rhiD, quint32 size, WorkBufType type=WorkBufType::DeviceLocal)
QVector< QMetalBuffer * > hostVisibleWorkBuffers
Definition qrhimetal.mm:469
quint32 tescCompOutputBufferSize(quint32 patchCount) const
Definition qrhimetal.mm:487
std::array< id< MTLComputePipelineState >, 3 > vertexComputeState
Definition qrhimetal.mm:478
quint32 tescCompPatchOutputBufferSize(quint32 patchCount) const
Definition qrhimetal.mm:491
static int vsCompVariantToIndex(QShader::Variant vertexCompVariant)
id< MTLComputePipelineState > tescCompPipeline(QRhiMetal *rhiD)
id< MTLRenderPipelineState > teseFragRenderPipeline(QRhiMetal *rhiD, QMetalGraphicsPipeline *pipeline)
QMetalGraphicsPipelineData * q
Definition qrhimetal.mm:472
id< MTLComputePipelineState > vsCompPipeline(QRhiMetal *rhiD, QShader::Variant vertexCompVariant)
quint32 patchCountForDrawCall(quint32 vertexOrIndexCount, quint32 instanceCount) const
Definition qrhimetal.mm:496
quint32 vsCompOutputBufferSize(quint32 vertexOrIndexCount, quint32 instanceCount) const
Definition qrhimetal.mm:482
id< MTLComputePipelineState > tessControlComputeState
Definition qrhimetal.mm:479
QMetalGraphicsPipeline * q
Definition qrhimetal.mm:449
MTLDepthClipMode depthClipMode
Definition qrhimetal.mm:457
MTLPrimitiveType primitiveType
Definition qrhimetal.mm:453
id< MTLRenderPipelineState > ps
Definition qrhimetal.mm:450
QMetalBuffer * bufferSizeBuffer
Definition qrhimetal.mm:509
void setupVertexInputDescriptor(MTLVertexDescriptor *desc)
void setupStageInputDescriptor(MTLStageInputOutputDescriptor *desc)
id< MTLDepthStencilState > ds
Definition qrhimetal.mm:451
MTLTriangleFillMode triangleFillMode
Definition qrhimetal.mm:456
QMetalGraphicsPipelineData * d
bool createVertexFragmentPipeline()
QMetalGraphicsPipeline(QRhiImplementation *rhi)
void setupAttachmentsInMetalRenderPassDescriptor(void *metalRpDesc, QMetalRenderPassDescriptor *rpD)
void makeActiveForCurrentRenderPassEncoder(QMetalCommandBuffer *cbD)
bool create() override
Creates the corresponding native graphics resources.
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
void setupMetalDepthStencilDescriptor(void *metalDsDesc)
bool createTessellationPipelines(const QShader &tessVert, const QShader &tesc, const QShader &tese, const QShader &tessFrag)
QRhiCommandBuffer::IndexFormat indexFormat
id< MTLIndirectCommandBuffer > icb
QRhiIndirectCommandBufferBuildInfo buildInfo
Slot frameSlots[QMTL_FRAMES_IN_FLIGHT]
QMetalIndirectCommandBuffer(QRhiImplementation *rhi, Type type, quint32 maxCommandCount)
const QRhiIndirectDrawCommand * drawCommands() const
quint64 contentsGeneration() const
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QMetalIndirectCommandBufferData * d
const QRhiIndexedIndirectDrawCommand * indexedDrawCommands() const
bool create() override
Creates the corresponding native objects.
id< MTLTexture > tex
Definition qrhimetal.mm:338
MTLPixelFormat format
Definition qrhimetal.mm:337
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QMetalRenderBufferData * d
Definition qrhimetal_p.h:61
QRhiTexture::Format backingFormat() const override
bool create() override
Creates the corresponding native graphics resources.
QMetalRenderBuffer(QRhiImplementation *rhi, Type type, const QSize &pixelSize, int sampleCount, QRhiRenderBuffer::Flags flags, QRhiTexture::Format backingFormatHint)
QMetalRenderPassDescriptor(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QVector< quint32 > serializedFormatData
QVector< quint32 > serializedFormat() const override
bool isCompatible(const QRhiRenderPassDescriptor *other) const override
int colorFormat[MAX_COLOR_ATTACHMENTS]
static const int MAX_COLOR_ATTACHMENTS
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() const override
ColorAtt colorAtt[QMetalRenderPassDescriptor::MAX_COLOR_ATTACHMENTS]
Definition qrhimetal.mm:435
id< MTLTexture > dsResolveTex
Definition qrhimetal.mm:437
QRhiRenderTargetAttachmentTracker::ResIdList currentResIdList
Definition qrhimetal.mm:444
id< MTLTexture > dsTex
Definition qrhimetal.mm:436
id< MTLSamplerState > samplerState
Definition qrhimetal.mm:357
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QMetalSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, AddressMode u, AddressMode v, AddressMode w)
QMetalSamplerData * d
int lastActiveFrameSlot
bool create() override
QVarLengthArray< Buffer, 8 > buffers
Definition qrhimetal.mm:381
QVarLengthArray< Sampler, 8 > samplers
Definition qrhimetal.mm:383
QRhiBatchedBindings< NSUInteger > bufferOffsetBatches
Definition qrhimetal.mm:385
QVarLengthArray< Texture, 8 > textures
Definition qrhimetal.mm:382
QRhiBatchedBindings< id< MTLSamplerState > > samplerBatches
Definition qrhimetal.mm:387
QRhiBatchedBindings< id< MTLTexture > > textureBatches
Definition qrhimetal.mm:386
QRhiBatchedBindings< id< MTLBuffer > > bufferBatches
Definition qrhimetal.mm:384
bool create() override
Creates the corresponding resource binding set.
QMetalComputePipeline * lastUsedComputePipeline
QMetalShaderResourceBindings(QRhiImplementation *rhi)
QMetalGraphicsPipeline * lastUsedGraphicsPipeline
QVarLengthArray< QRhiShaderResourceBinding, 8 > sortedBindings
QVarLengthArray< BoundResourceData, 8 > boundResourceData
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
void updateResources(UpdateFlags flags) override
id< MTLRasterizationRateMap > rateMap
Definition qrhimetal.mm:362
QMetalShadingRateMapData * d
QMetalShadingRateMap(QRhiImplementation *rhi)
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
bool createFrom(NativeShadingRateMap src) override
Sets up the shading rate map to use a native 3D API shading rate object src.
id< CAMetalDrawable > curDrawable
Definition qrhimetal.mm:525
dispatch_semaphore_t sem[QMTL_FRAMES_IN_FLIGHT]
Definition qrhimetal.mm:526
MTLPixelFormat colorFormat
Definition qrhimetal.mm:531
MTLRenderPassDescriptor * rp
Definition qrhimetal.mm:528
CAMetalLayer * layer
Definition qrhimetal.mm:524
double lastGpuTime[QMTL_FRAMES_IN_FLIGHT]
Definition qrhimetal.mm:527
id< MTLTexture > msaaTex[QMTL_FRAMES_IN_FLIGHT]
Definition qrhimetal.mm:529
QRhiTexture::Format rhiColorFormat
Definition qrhimetal.mm:530
QMetalRenderTargetData * d
QMetalSwapChainRenderTarget(QRhiImplementation *rhi, QRhiSwapChain *swapchain)
QSize pixelSize() const override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
float devicePixelRatio() const override
int sampleCount() const override
QWindow * window
void waitUntilCompleted(int slot)
bool createOrResize() override
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size...
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QRhiCommandBuffer * currentFrameCommandBuffer() override
QMetalSwapChain(QRhiImplementation *rhi)
QMetalCommandBuffer cbWrapper
virtual QRhiSwapChainHdrInfo hdrInfo() override
\variable QRhiSwapChainHdrInfo::limitsType
QMetalRenderBuffer * ds
QMetalSwapChainRenderTarget rtWrapper
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
QMetalSwapChainData * d
bool isFormatSupported(Format f) override
QSize surfacePixelSize() override
QRhiRenderTarget * currentFrameRenderTarget() override
id< MTLTexture > tex
Definition qrhimetal.mm:347
id< MTLTexture > viewForLevel(int level)
QMetalTexture * q
Definition qrhimetal.mm:345
id< MTLTexture > perLevelViews[QRhi::MAX_MIP_LEVELS]
Definition qrhimetal.mm:350
id< MTLBuffer > stagingBuf[QMTL_FRAMES_IN_FLIGHT]
Definition qrhimetal.mm:348
QMetalTextureData(QMetalTexture *t)
Definition qrhimetal.mm:343
MTLPixelFormat format
Definition qrhimetal.mm:346
float devicePixelRatio() const override
QMetalRenderTargetData * d
QMetalTextureRenderTarget(QRhiImplementation *rhi, const QRhiTextureRenderTargetDescription &desc, Flags flags)
bool create() override
Creates the corresponding native graphics resources.
QRhiRenderPassDescriptor * newCompatibleRenderPassDescriptor() override
int sampleCount() const override
QSize pixelSize() const override
void destroy() override
Releases (or requests deferred releasing of) the underlying native graphics resources.
QMetalTexture(QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags)
bool prepareCreate(QSize *adjustedSize=nullptr)
NativeTexture nativeTexture() override
QMetalTextureData * d
Definition qrhimetal_p.h:82
bool create() override
Creates the corresponding native graphics resources.
int lastActiveFrameSlot
Definition qrhimetal_p.h:86
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.
\variable QRhiIndirectDrawCommand::vertexCount
Definition qrhi.h:1718
QRhiReadbackResult * result
Definition qrhimetal.mm:277
id< MTLComputePipelineState > pipelineState
Definition qrhimetal.mm:243
id< MTLDepthStencilState > depthStencilState
Definition qrhimetal.mm:238
std::array< id< MTLComputePipelineState >, 3 > tessVertexComputeState
Definition qrhimetal.mm:239
id< MTLRasterizationRateMap > rateMap
Definition qrhimetal.mm:246
id< MTLSamplerState > samplerState
Definition qrhimetal.mm:231
id< MTLBuffer > stagingBuffers[QMTL_FRAMES_IN_FLIGHT]
Definition qrhimetal.mm:227
id< MTLComputePipelineState > tessTessControlComputeState
Definition qrhimetal.mm:240
id< MTLIndirectCommandBuffer > icb
Definition qrhimetal.mm:249
id< MTLRenderPipelineState > pipelineState
Definition qrhimetal.mm:237
id< MTLBuffer > buffers[QMTL_FRAMES_IN_FLIGHT]
Definition qrhimetal.mm:220
id< MTLTexture > views[QRhi::MAX_MIP_LEVELS]
Definition qrhimetal.mm:228
QMetalCommandBuffer cbWrapper
Definition qrhimetal.mm:260
OffscreenFrame(QRhiImplementation *rhi)
Definition qrhimetal.mm:257
QRhiReadbackDescription desc
Definition qrhimetal.mm:265
QRhiReadbackResult * result
Definition qrhimetal.mm:266
QRhiTexture::Format format
Definition qrhimetal.mm:270
void trySeedingRenderPipelineFromBinaryArchive(MTLRenderPipelineDescriptor *rpDesc)
id< MTLComputePipelineState > icbEncodePipelineU32
Definition qrhimetal.mm:291
QRhiMetalData(QRhiMetal *rhi)
Definition qrhimetal.mm:181
QVarLengthArray< BufferReadback, 2 > activeBufferReadbacks
Definition qrhimetal.mm:282
quint32 capacity
Definition qrhimetal.mm:311
QHash< ShaderCacheKey, QMetalShader > shaderCache
Definition qrhimetal.mm:306
bool setupBinaryArchive(NSURL *sourceFileUrl=nil)
Definition qrhimetal.mm:590
bool icbSetupFailed
Definition qrhimetal.mm:301
id< MTLFunction > icbEncodeFunctionU16
Definition qrhimetal.mm:295
void addRenderPipelineToBinaryArchive(MTLRenderPipelineDescriptor *rpDesc)
id< MTLFunction > icbEncodeFunctionU32
Definition qrhimetal.mm:294
MTLCaptureManager * captureMgr
Definition qrhimetal.mm:284
id< MTLBuffer > icbArgumentBuffer
Definition qrhimetal.mm:296
NSUInteger icbCapacity
Definition qrhimetal.mm:289
void trySeedingComputePipelineFromBinaryArchive(MTLComputePipelineDescriptor *cpDesc)
id< MTLIndirectCommandBuffer > icb
Definition qrhimetal.mm:288
QVector< DeferredReleaseEntry > releaseQueue
Definition qrhimetal.mm:254
id< MTLBuffer > allocArgumentBuffer(quint32 size, quint32 alignment, int frameSlot, quint32 *offset)
id< MTLLibrary > createMetalLib(const QShader &shader, QShader::Variant shaderVariant, bool preferArgumentBuffers, QString *error, QByteArray *entryPoint, QShaderKey *activeKey)
id< MTLFunction > createMSLShaderFunction(id< MTLLibrary > lib, const QByteArray &entryPoint)
id< MTLCaptureScope > captureScope
Definition qrhimetal.mm:285
MTLRenderPassDescriptor * createDefaultRenderPass(bool hasDepthStencil, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, int colorAttCount, QRhiShadingRateMap *shadingRateMap)
QRhiMetal * q
Definition qrhimetal.mm:183
id< MTLComputePipelineState > icbEncodePipeline
Definition qrhimetal.mm:290
id< MTLFunction > icbEncodeFunction
Definition qrhimetal.mm:293
id< MTLComputePipelineState > icbEncodePipelineU16
Definition qrhimetal.mm:292
static const int TEXBUF_ALIGN
Definition qrhimetal.mm:303
id< MTLBuffer > icbRangeBuffer
Definition qrhimetal.mm:298
id< MTLBinaryArchive > binArch
Definition qrhimetal.mm:186
quint32 offset
Definition qrhimetal.mm:310
id< MTLCommandBuffer > newCommandBuffer()
Definition qrhimetal.mm:578
id< MTLBuffer > buf
Definition qrhimetal.mm:309
QVarLengthArray< TextureReadback, 2 > activeTextureReadbacks
Definition qrhimetal.mm:272
id< MTLDevice > dev
Definition qrhimetal.mm:184
quint64 globalFrameId
Definition qrhimetal.mm:317
void addComputePipelineToBinaryArchive(MTLComputePipelineDescriptor *cpDesc)
id< MTLCommandQueue > cmdQueue
Definition qrhimetal.mm:185
id< MTLBuffer > icbNoCountBuffer
Definition qrhimetal.mm:300
QMetalCommandBuffer * cbD
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1962
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1566
LimitsType limitsType
Definition qrhi.h:1577
float maxPotentialColorComponentValue
Definition qrhi.h:1585
LuminanceBehavior luminanceBehavior
Definition qrhi.h:1588
float maxColorComponentValue
Definition qrhi.h:1584
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1599