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
QRhiMetalData Struct Reference
Collaboration diagram for QRhiMetalData:

Classes

struct  DeferredReleaseEntry
struct  OffscreenFrame
struct  TextureReadback
struct  BufferReadback
struct  StagingArea

Public Types

using ShaderCacheKey = std::pair<QRhiShaderStage, bool>
using ShaderCacheKey = std::pair<QRhiShaderStage, bool>

Public Member Functions

 QRhiMetalData (QRhiMetal *rhi)
id< MTLCommandBuffer > newCommandBuffer ()
MTLRenderPassDescriptor * createDefaultRenderPass (bool hasDepthStencil, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, int colorAttCount, QRhiShadingRateMap *shadingRateMap)
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)
bool setupBinaryArchive (NSURL *sourceFileUrl=nil)
void addRenderPipelineToBinaryArchive (MTLRenderPipelineDescriptor *rpDesc)
void trySeedingRenderPipelineFromBinaryArchive (MTLRenderPipelineDescriptor *rpDesc)
void addComputePipelineToBinaryArchive (MTLComputePipelineDescriptor *cpDesc)
void trySeedingComputePipelineFromBinaryArchive (MTLComputePipelineDescriptor *cpDesc)
id< MTLBuffer > allocFromStagingArea (StagingArea *area, quint32 size, quint32 alignment, int frameSlot, quint32 minBlockSize, quint32 *offset)
id< MTLBuffer > allocArgumentBuffer (quint32 size, quint32 alignment, int frameSlot, quint32 *offset)
id< MTLBuffer > allocBufferStaging (quint32 size, int frameSlot, quint32 *offset)
id< MTLBuffer > newOneShotStagingBuffer (quint32 size, int frameSlot)
void resetAndResizeBufferStagingArea (int frameSlot)
 QRhiMetalData (QRhiMetal *rhi)
id< MTLCommandBuffer > newCommandBuffer ()
MTLRenderPassDescriptor * createDefaultRenderPass (bool hasDepthStencil, const QColor &colorClearValue, const QRhiDepthStencilClearValue &depthStencilClearValue, int colorAttCount, QRhiShadingRateMap *shadingRateMap)
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)
bool setupBinaryArchive (NSURL *sourceFileUrl=nil)
void addRenderPipelineToBinaryArchive (MTLRenderPipelineDescriptor *rpDesc)
void trySeedingRenderPipelineFromBinaryArchive (MTLRenderPipelineDescriptor *rpDesc)
void addComputePipelineToBinaryArchive (MTLComputePipelineDescriptor *cpDesc)
void trySeedingComputePipelineFromBinaryArchive (MTLComputePipelineDescriptor *cpDesc)
id< MTLBuffer > allocFromStagingArea (StagingArea *area, quint32 size, quint32 alignment, int frameSlot, quint32 minBlockSize, quint32 *offset)
id< MTLBuffer > allocArgumentBuffer (quint32 size, quint32 alignment, int frameSlot, quint32 *offset)
id< MTLBuffer > allocBufferStaging (quint32 size, int frameSlot, quint32 *offset)
id< MTLBuffer > newOneShotStagingBuffer (quint32 size, int frameSlot)
void resetAndResizeBufferStagingArea (int frameSlot)

Public Attributes

QRhiMetal * q
id< MTLDevice > dev = nil
id< MTLCommandQueue > cmdQueue = nil
id< MTLBinaryArchive > binArch = nil
QVector< DeferredReleaseEntry > releaseQueue
struct QRhiMetalData::OffscreenFrame ofr
QVarLengthArray< TextureReadback, 2 > activeTextureReadbacks
QVarLengthArray< BufferReadback, 2 > activeBufferReadbacks
MTLCaptureManager * captureMgr
id< MTLCaptureScope > captureScope = nil
id< MTLIndirectCommandBuffer > icb = nil
NSUInteger icbCapacity = 0
id< MTLComputePipelineState > icbEncodePipeline = nil
id< MTLComputePipelineState > icbEncodePipelineU32 = nil
id< MTLComputePipelineState > icbEncodePipelineU16 = nil
id< MTLFunction > icbEncodeFunction = nil
id< MTLFunction > icbEncodeFunctionU32 = nil
id< MTLFunction > icbEncodeFunctionU16 = nil
id< MTLBuffer > icbArgumentBuffer = nil
id< MTLBuffer > icbRangeBuffer = nil
id< MTLBuffer > icbNoCountBuffer = nil
bool icbSetupFailed = false
QHash< ShaderCacheKey, QMetalShader > shaderCache
StagingArea argBufPool [QMTL_FRAMES_IN_FLIGHT]
StagingArea bufStagingPool [QMTL_FRAMES_IN_FLIGHT]
quint64 globalFrameId = 0

Static Public Attributes

static const int TEXBUF_ALIGN = 256
static constexpr quint32 LARGE_STAGING_ALLOC = 512 * 1024
static constexpr quint32 STAGING_AREA_MIN = 64 * 1024
static constexpr quint32 STAGING_AREA_MAX = 16 * 1024 * 1024
static constexpr int STAGING_AREA_LOW_DEMAND_FRAMES = 60
static constexpr int STAGING_AREA_HIGH_DEMAND_FRAMES = 3

Detailed Description

Definition at line 179 of file qrhimetal.mm.

Member Typedef Documentation

◆ ShaderCacheKey [1/2]

Definition at line 307 of file qrhimetal.mm.

◆ ShaderCacheKey [2/2]

Definition at line 307 of file qrhimetal.mm.

Constructor & Destructor Documentation

◆ QRhiMetalData() [1/2]

QRhiMetalData::QRhiMetalData ( QRhiMetal * rhi)
inline

Definition at line 181 of file qrhimetal.mm.

References q.

Referenced by QRhiMetal::QRhiMetal().

Here is the caller graph for this function:

◆ QRhiMetalData() [2/2]

QRhiMetalData::QRhiMetalData ( QRhiMetal * rhi)
inline

Definition at line 181 of file qrhimetal.mm.

Member Function Documentation

◆ addComputePipelineToBinaryArchive() [1/2]

void QRhiMetalData::addComputePipelineToBinaryArchive ( MTLComputePipelineDescriptor * cpDesc)

Definition at line 8012 of file qrhimetal.mm.

◆ addComputePipelineToBinaryArchive() [2/2]

void QRhiMetalData::addComputePipelineToBinaryArchive ( MTLComputePipelineDescriptor * cpDesc)

◆ addRenderPipelineToBinaryArchive() [1/2]

void QRhiMetalData::addRenderPipelineToBinaryArchive ( MTLRenderPipelineDescriptor * rpDesc)

Definition at line 6980 of file qrhimetal.mm.

◆ addRenderPipelineToBinaryArchive() [2/2]

void QRhiMetalData::addRenderPipelineToBinaryArchive ( MTLRenderPipelineDescriptor * rpDesc)

◆ allocArgumentBuffer() [1/2]

id< MTLBuffer > QRhiMetalData::allocArgumentBuffer ( quint32 size,
quint32 alignment,
int frameSlot,
quint32 * offset )

Definition at line 6647 of file qrhimetal.mm.

◆ allocArgumentBuffer() [2/2]

id< MTLBuffer > QRhiMetalData::allocArgumentBuffer ( quint32 size,
quint32 alignment,
int frameSlot,
quint32 * offset )

◆ allocBufferStaging() [1/2]

id< MTLBuffer > QRhiMetalData::allocBufferStaging ( quint32 size,
int frameSlot,
quint32 * offset )

Definition at line 6665 of file qrhimetal.mm.

◆ allocBufferStaging() [2/2]

id< MTLBuffer > QRhiMetalData::allocBufferStaging ( quint32 size,
int frameSlot,
quint32 * offset )

◆ allocFromStagingArea() [1/2]

id< MTLBuffer > QRhiMetalData::allocFromStagingArea ( StagingArea * area,
quint32 size,
quint32 alignment,
int frameSlot,
quint32 minBlockSize,
quint32 * offset )

◆ allocFromStagingArea() [2/2]

id< MTLBuffer > QRhiMetalData::allocFromStagingArea ( StagingArea * area,
quint32 size,
quint32 alignment,
int frameSlot,
quint32 minBlockSize,
quint32 * offset )

◆ createDefaultRenderPass() [1/2]

MTLRenderPassDescriptor * QRhiMetalData::createDefaultRenderPass ( bool hasDepthStencil,
const QColor & colorClearValue,
const QRhiDepthStencilClearValue & depthStencilClearValue,
int colorAttCount,
QRhiShadingRateMap * shadingRateMap )

Definition at line 3524 of file qrhimetal.mm.

◆ createDefaultRenderPass() [2/2]

MTLRenderPassDescriptor * QRhiMetalData::createDefaultRenderPass ( bool hasDepthStencil,
const QColor & colorClearValue,
const QRhiDepthStencilClearValue & depthStencilClearValue,
int colorAttCount,
QRhiShadingRateMap * shadingRateMap )

◆ createMetalLib() [1/2]

id< MTLLibrary > QRhiMetalData::createMetalLib ( const QShader & shader,
QShader::Variant shaderVariant,
bool preferArgumentBuffers,
QString * error,
QByteArray * entryPoint,
QShaderKey * activeKey )

Definition at line 6738 of file qrhimetal.mm.

◆ createMetalLib() [2/2]

id< MTLLibrary > QRhiMetalData::createMetalLib ( const QShader & shader,
QShader::Variant shaderVariant,
bool preferArgumentBuffers,
QString * error,
QByteArray * entryPoint,
QShaderKey * activeKey )

◆ createMSLShaderFunction() [1/2]

id< MTLFunction > QRhiMetalData::createMSLShaderFunction ( id< MTLLibrary > lib,
const QByteArray & entryPoint )

Definition at line 6823 of file qrhimetal.mm.

◆ createMSLShaderFunction() [2/2]

id< MTLFunction > QRhiMetalData::createMSLShaderFunction ( id< MTLLibrary > lib,
const QByteArray & entryPoint )

◆ newCommandBuffer() [1/2]

id< MTLCommandBuffer > QRhiMetalData::newCommandBuffer ( )

Definition at line 610 of file qrhimetal.mm.

◆ newCommandBuffer() [2/2]

id< MTLCommandBuffer > QRhiMetalData::newCommandBuffer ( )

◆ newOneShotStagingBuffer() [1/2]

id< MTLBuffer > QRhiMetalData::newOneShotStagingBuffer ( quint32 size,
int frameSlot )

◆ newOneShotStagingBuffer() [2/2]

id< MTLBuffer > QRhiMetalData::newOneShotStagingBuffer ( quint32 size,
int frameSlot )

◆ resetAndResizeBufferStagingArea() [1/2]

void QRhiMetalData::resetAndResizeBufferStagingArea ( int frameSlot)

◆ resetAndResizeBufferStagingArea() [2/2]

void QRhiMetalData::resetAndResizeBufferStagingArea ( int frameSlot)

◆ setupBinaryArchive() [1/2]

bool QRhiMetalData::setupBinaryArchive ( NSURL * sourceFileUrl = nil)

Definition at line 622 of file qrhimetal.mm.

◆ setupBinaryArchive() [2/2]

bool QRhiMetalData::setupBinaryArchive ( NSURL * sourceFileUrl = nil)

◆ trySeedingComputePipelineFromBinaryArchive() [1/2]

void QRhiMetalData::trySeedingComputePipelineFromBinaryArchive ( MTLComputePipelineDescriptor * cpDesc)

Definition at line 8004 of file qrhimetal.mm.

◆ trySeedingComputePipelineFromBinaryArchive() [2/2]

void QRhiMetalData::trySeedingComputePipelineFromBinaryArchive ( MTLComputePipelineDescriptor * cpDesc)

◆ trySeedingRenderPipelineFromBinaryArchive() [1/2]

void QRhiMetalData::trySeedingRenderPipelineFromBinaryArchive ( MTLRenderPipelineDescriptor * rpDesc)

Definition at line 6972 of file qrhimetal.mm.

◆ trySeedingRenderPipelineFromBinaryArchive() [2/2]

void QRhiMetalData::trySeedingRenderPipelineFromBinaryArchive ( MTLRenderPipelineDescriptor * rpDesc)

Member Data Documentation

◆ activeBufferReadbacks

QVarLengthArray< BufferReadback, 2 > QRhiMetalData::activeBufferReadbacks

Definition at line 284 of file qrhimetal.mm.

◆ activeTextureReadbacks

QVarLengthArray< TextureReadback, 2 > QRhiMetalData::activeTextureReadbacks

Definition at line 274 of file qrhimetal.mm.

◆ argBufPool

StagingArea QRhiMetalData::argBufPool

Definition at line 318 of file qrhimetal.mm.

◆ binArch

id< MTLBinaryArchive > QRhiMetalData::binArch = nil

Definition at line 186 of file qrhimetal.mm.

◆ bufStagingPool

StagingArea QRhiMetalData::bufStagingPool

Definition at line 319 of file qrhimetal.mm.

◆ captureMgr

MTLCaptureManager * QRhiMetalData::captureMgr

Definition at line 286 of file qrhimetal.mm.

◆ captureScope

id< MTLCaptureScope > QRhiMetalData::captureScope = nil

Definition at line 287 of file qrhimetal.mm.

◆ cmdQueue

id< MTLCommandQueue > QRhiMetalData::cmdQueue = nil

Definition at line 185 of file qrhimetal.mm.

◆ dev

id< MTLDevice > QRhiMetalData::dev = nil

Definition at line 184 of file qrhimetal.mm.

◆ globalFrameId

quint64 QRhiMetalData::globalFrameId = 0

Definition at line 338 of file qrhimetal.mm.

◆ icb

id< MTLIndirectCommandBuffer > QRhiMetalData::icb = nil

Definition at line 290 of file qrhimetal.mm.

◆ icbArgumentBuffer

id< MTLBuffer > QRhiMetalData::icbArgumentBuffer = nil

Definition at line 298 of file qrhimetal.mm.

◆ icbCapacity

NSUInteger QRhiMetalData::icbCapacity = 0

Definition at line 291 of file qrhimetal.mm.

◆ icbEncodeFunction

id< MTLFunction > QRhiMetalData::icbEncodeFunction = nil

Definition at line 295 of file qrhimetal.mm.

◆ icbEncodeFunctionU16

id< MTLFunction > QRhiMetalData::icbEncodeFunctionU16 = nil

Definition at line 297 of file qrhimetal.mm.

◆ icbEncodeFunctionU32

id< MTLFunction > QRhiMetalData::icbEncodeFunctionU32 = nil

Definition at line 296 of file qrhimetal.mm.

◆ icbEncodePipeline

id< MTLComputePipelineState > QRhiMetalData::icbEncodePipeline = nil

Definition at line 292 of file qrhimetal.mm.

◆ icbEncodePipelineU16

id< MTLComputePipelineState > QRhiMetalData::icbEncodePipelineU16 = nil

Definition at line 294 of file qrhimetal.mm.

◆ icbEncodePipelineU32

id< MTLComputePipelineState > QRhiMetalData::icbEncodePipelineU32 = nil

Definition at line 293 of file qrhimetal.mm.

◆ icbNoCountBuffer

id< MTLBuffer > QRhiMetalData::icbNoCountBuffer = nil

Definition at line 302 of file qrhimetal.mm.

◆ icbRangeBuffer

id< MTLBuffer > QRhiMetalData::icbRangeBuffer = nil

Definition at line 300 of file qrhimetal.mm.

◆ icbSetupFailed

bool QRhiMetalData::icbSetupFailed = false

Definition at line 303 of file qrhimetal.mm.

Referenced by QRhiMetal::destroy(), and QRhiMetal::prepareIcbKernels().

◆ LARGE_STAGING_ALLOC

constexpr quint32 QRhiMetalData::LARGE_STAGING_ALLOC = 512 * 1024
staticconstexpr

Definition at line 330 of file qrhimetal.mm.

◆ ofr

struct QRhiMetalData::OffscreenFrame QRhiMetalData::ofr

◆ q

QRhiMetal * QRhiMetalData::q

Definition at line 183 of file qrhimetal.mm.

Referenced by QRhiMetalData().

◆ releaseQueue

QVector< DeferredReleaseEntry > QRhiMetalData::releaseQueue

Definition at line 256 of file qrhimetal.mm.

◆ shaderCache

QHash< ShaderCacheKey, QMetalShader > QRhiMetalData::shaderCache

Definition at line 308 of file qrhimetal.mm.

◆ STAGING_AREA_HIGH_DEMAND_FRAMES

constexpr int QRhiMetalData::STAGING_AREA_HIGH_DEMAND_FRAMES = 3
staticconstexpr

Definition at line 334 of file qrhimetal.mm.

Referenced by resetAndResizeBufferStagingArea().

◆ STAGING_AREA_LOW_DEMAND_FRAMES

constexpr int QRhiMetalData::STAGING_AREA_LOW_DEMAND_FRAMES = 60
staticconstexpr

Definition at line 333 of file qrhimetal.mm.

Referenced by resetAndResizeBufferStagingArea().

◆ STAGING_AREA_MAX

constexpr quint32 QRhiMetalData::STAGING_AREA_MAX = 16 * 1024 * 1024
staticconstexpr

Definition at line 332 of file qrhimetal.mm.

◆ STAGING_AREA_MIN

constexpr quint32 QRhiMetalData::STAGING_AREA_MIN = 64 * 1024
staticconstexpr

Definition at line 331 of file qrhimetal.mm.

◆ TEXBUF_ALIGN

const int QRhiMetalData::TEXBUF_ALIGN = 256
static

Definition at line 305 of file qrhimetal.mm.


The documentation for this struct was generated from the following file: