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.mm File Reference

(578e8a01a23ab13f382bcfb339dc8309269940d7)

#include "qrhimetal_p.h"
#include "qshader_p.h"
#include <QGuiApplication>
#include <QWindow>
#include <QUrl>
#include <QFile>
#include <QTemporaryFile>
#include <QFileInfo>
#include <qmath.h>
#include <QOperatingSystemVersion>
#include <QtCore/private/qcore_mac_p.h>
#include <QtGui/private/qmetallayer_p.h>
#include <QtGui/qpa/qplatformwindow_p.h>
#include <UIKit/UIKit.h>
#include <QuartzCore/CATransaction.h>
#include <Metal/Metal.h>
Include dependency graph for qrhimetal.mm:

Go to the source code of this file.

Classes

struct  QMetalShader
 \variable QRhiMetalCommandBufferNativeHandles::commandBuffer More...
struct  QRhiMetalData
struct  QRhiMetalData::DeferredReleaseEntry
struct  QRhiMetalData::OffscreenFrame
struct  QRhiMetalData::TextureReadback
struct  QRhiMetalData::BufferReadback
struct  QMetalBufferData
struct  QMetalBufferData::BufferUpdate
struct  QMetalRenderBufferData
struct  QMetalTextureData
struct  QMetalSamplerData
struct  QMetalShadingRateMapData
struct  QMetalShaderResourceBindingsData
struct  QMetalShaderResourceBindingsData::Stage
struct  QMetalShaderResourceBindingsData::Stage::Buffer
struct  QMetalShaderResourceBindingsData::Stage::Texture
struct  QMetalShaderResourceBindingsData::Stage::Sampler
struct  QMetalCommandBufferData
struct  QMetalRenderTargetData
struct  QMetalRenderTargetData::ColorAtt
struct  QMetalGraphicsPipelineData
struct  QMetalGraphicsPipelineData::ExtraBufferManager
struct  QMetalGraphicsPipelineData::Tessellation
struct  QMetalComputePipelineData
struct  QMetalSwapChainData
struct  QMetalPipelineCacheDataHeader

Macros

#define QRHI_METAL_DISABLE_BINARY_ARCHIVE
#define QRHI_METAL_COMMAND_BUFFERS_WITH_UNRETAINED_REFERENCES

Enumerations

enum class  BindingType {
  Buffer , Texture , Sampler , Buffer ,
  Texture , Sampler
}
enum class  BindingType {
  Buffer , Texture , Sampler , Buffer ,
  Texture , Sampler
}

Functions

 Q_DECLARE_TYPEINFO (QRhiMetalData::DeferredReleaseEntry, Q_RELOCATABLE_TYPE)
 Q_DECLARE_TYPEINFO (QRhiMetalData::TextureReadback, Q_RELOCATABLE_TYPE)
template<class Int>
Int aligned (Int v, Int byteAlign)
static int mapBinding (int binding, int stageIndex, const QShader::NativeResourceBindingMap *nativeResourceBindingMaps[], BindingType type)
static void bindStageBuffers (QMetalCommandBuffer *cbD, int stage, const QRhiBatchedBindings< id< MTLBuffer > >::Batch &bufferBatch, const QRhiBatchedBindings< NSUInteger >::Batch &offsetBatch)
static void bindStageTextures (QMetalCommandBuffer *cbD, int stage, const QRhiBatchedBindings< id< MTLTexture > >::Batch &textureBatch)
static void bindStageSamplers (QMetalCommandBuffer *cbD, int encoderStage, const QRhiBatchedBindings< id< MTLSamplerState > >::Batch &samplerBatch)
static void rebindShaderResources (QMetalCommandBuffer *cbD, int resourceStage, int encoderStage, const QMetalShaderResourceBindingsData *customBindingState=nullptr)
static QRhiShaderResourceBinding::StageFlag toRhiSrbStage (int stage)
static id< MTLComputeCommandEncoder > tessellationComputeEncoder (QMetalCommandBuffer *cbD)
static void endTessellationComputeEncoding (QMetalCommandBuffer *cbD)
static void qrhimtl_releaseBuffer (const QRhiMetalData::DeferredReleaseEntry &e)
static void qrhimtl_releaseRenderBuffer (const QRhiMetalData::DeferredReleaseEntry &e)
static void qrhimtl_releaseTexture (const QRhiMetalData::DeferredReleaseEntry &e)
static void qrhimtl_releaseSampler (const QRhiMetalData::DeferredReleaseEntry &e)
static MTLPixelFormat toMetalTextureFormat (QRhiTexture::Format format, QRhiTexture::Flags flags, const QRhiMetal *d)
static MTLSamplerMinMagFilter toMetalFilter (QRhiSampler::Filter f)
static MTLSamplerMipFilter toMetalMipmapMode (QRhiSampler::Filter f)
static MTLSamplerAddressMode toMetalAddressMode (QRhiSampler::AddressMode m)
static MTLCompareFunction toMetalTextureCompareFunction (QRhiSampler::CompareOp op)
static MTLVertexFormat toMetalAttributeFormat (QRhiVertexInputAttribute::Format format)
static MTLBlendFactor toMetalBlendFactor (QRhiGraphicsPipeline::BlendFactor f)
static MTLBlendOperation toMetalBlendOp (QRhiGraphicsPipeline::BlendOp op)
static uint toMetalColorWriteMask (QRhiGraphicsPipeline::ColorMask c)
static MTLCompareFunction toMetalCompareOp (QRhiGraphicsPipeline::CompareOp op)
static MTLStencilOperation toMetalStencilOp (QRhiGraphicsPipeline::StencilOp op)
static MTLPrimitiveType toMetalPrimitiveType (QRhiGraphicsPipeline::Topology t)
static MTLPrimitiveTopologyClass toMetalPrimitiveTopologyClass (QRhiGraphicsPipeline::Topology t)
static MTLCullMode toMetalCullMode (QRhiGraphicsPipeline::CullMode c)
static MTLTriangleFillMode toMetalTriangleFillMode (QRhiGraphicsPipeline::PolygonMode mode)
static MTLWinding toMetalTessellationWindingOrder (QShaderDescription::TessellationWindingOrder w)
static MTLTessellationPartitionMode toMetalTessellationPartitionMode (QShaderDescription::TessellationPartitioning p)
static MTLLanguageVersion toMetalLanguageVersion (const QShaderVersion &version)
static bool indexTaken (quint32 index, quint64 indices)
static void takeIndex (quint32 index, quint64 &indices)
static int nextAttributeIndex (quint64 indices)
static int aligned (quint32 offset, quint32 alignment)
template<typename T>
static void addUnusedVertexAttribute (const T &variable, QRhiMetal *rhiD, quint32 &offset, quint32 &vertexAlignment)
template<typename T>
static void addVertexAttribute (const T &variable, int binding, QRhiMetal *rhiD, int &index, quint32 &offset, MTLVertexAttributeDescriptorArray *attributes, quint64 &indices, quint32 &vertexAlignment)
static bool matches (const QList< QShaderDescription::BlockVariable > &a, const QList< QShaderDescription::BlockVariable > &b)
static bool matches (const QShaderDescription::InOutVariable &a, const QShaderDescription::InOutVariable &b)
static CAMetalLayer * layerForWindow (QWindow *window)

Macro Definition Documentation

◆ QRHI_METAL_COMMAND_BUFFERS_WITH_UNRETAINED_REFERENCES

#define QRHI_METAL_COMMAND_BUFFERS_WITH_UNRETAINED_REFERENCES

Definition at line 57 of file qrhimetal.mm.

◆ QRHI_METAL_DISABLE_BINARY_ARCHIVE

#define QRHI_METAL_DISABLE_BINARY_ARCHIVE

Definition at line 52 of file qrhimetal.mm.

Enumeration Type Documentation

◆ BindingType [1/2]

enum class BindingType
strong
Enumerator
Buffer 
Texture 
Sampler 
Buffer 
Texture 
Sampler 

Definition at line 1134 of file qrhimetal.mm.

◆ BindingType [2/2]

enum class BindingType
strong
Enumerator
Buffer 
Texture 
Sampler 
Buffer 
Texture 
Sampler 

Definition at line 1134 of file qrhimetal.mm.

Function Documentation

◆ addUnusedVertexAttribute()

template<typename T>
void addUnusedVertexAttribute ( const T & variable,
QRhiMetal * rhiD,
quint32 & offset,
quint32 & vertexAlignment )
static

Definition at line 5376 of file qrhimetal.mm.

◆ addVertexAttribute()

template<typename T>
void addVertexAttribute ( const T & variable,
int binding,
QRhiMetal * rhiD,
int & index,
quint32 & offset,
MTLVertexAttributeDescriptorArray * attributes,
quint64 & indices,
quint32 & vertexAlignment )
static

Definition at line 5406 of file qrhimetal.mm.

◆ aligned() [1/2]

template<class Int>
Int aligned ( Int v,
Int byteAlign )
inline

Definition at line 508 of file qrhimetal.mm.

◆ aligned() [2/2]

int aligned ( quint32 offset,
quint32 alignment )
inlinestatic

Definition at line 5370 of file qrhimetal.mm.

◆ bindStageBuffers()

void bindStageBuffers ( QMetalCommandBuffer * cbD,
int stage,
const QRhiBatchedBindings< id< MTLBuffer > >::Batch & bufferBatch,
const QRhiBatchedBindings< NSUInteger >::Batch & offsetBatch )
inlinestatic

◆ bindStageSamplers()

void bindStageSamplers ( QMetalCommandBuffer * cbD,
int encoderStage,
const QRhiBatchedBindings< id< MTLSamplerState > >::Batch & samplerBatch )
inlinestatic

◆ bindStageTextures()

void bindStageTextures ( QMetalCommandBuffer * cbD,
int stage,
const QRhiBatchedBindings< id< MTLTexture > >::Batch & textureBatch )
inlinestatic

◆ endTessellationComputeEncoding()

void endTessellationComputeEncoding ( QMetalCommandBuffer * cbD)
static

Definition at line 1979 of file qrhimetal.mm.

References QMetalRenderTargetData::colorAttCount, QMetalCommandBuffer::d, QMetalSwapChainRenderTarget::d, QMetalTextureRenderTarget::d, QMetalRenderTargetData::dsAttCount, and QMetalCommandBuffer::resetPerPassCachedState().

Referenced by QRhiMetal::tessellatedDraw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ indexTaken()

bool indexTaken ( quint32 index,
quint64 indices )
inlinestatic

Definition at line 5344 of file qrhimetal.mm.

◆ layerForWindow()

CAMetalLayer * layerForWindow ( QWindow * window)
inlinestatic

Definition at line 6334 of file qrhimetal.mm.

◆ mapBinding()

int mapBinding ( int binding,
int stageIndex,
const QShader::NativeResourceBindingMap * nativeResourceBindingMaps[],
BindingType type )
inlinestatic

Definition at line 1140 of file qrhimetal.mm.

References Sampler.

◆ matches() [1/2]

bool matches ( const QList< QShaderDescription::BlockVariable > & a,
const QList< QShaderDescription::BlockVariable > & b )
inlinestatic

Definition at line 5447 of file qrhimetal.mm.

◆ matches() [2/2]

bool matches ( const QShaderDescription::InOutVariable & a,
const QShaderDescription::InOutVariable & b )
inlinestatic

Definition at line 5462 of file qrhimetal.mm.

◆ nextAttributeIndex()

int nextAttributeIndex ( quint64 indices)
inlinestatic

Definition at line 5354 of file qrhimetal.mm.

◆ Q_DECLARE_TYPEINFO() [1/2]

◆ Q_DECLARE_TYPEINFO() [2/2]

◆ qrhimtl_releaseBuffer()

void qrhimtl_releaseBuffer ( const QRhiMetalData::DeferredReleaseEntry & e)
static

Definition at line 3243 of file qrhimetal.mm.

Referenced by QRhiMetal::executeDeferredReleases().

Here is the caller graph for this function:

◆ qrhimtl_releaseRenderBuffer()

void qrhimtl_releaseRenderBuffer ( const QRhiMetalData::DeferredReleaseEntry & e)
static

Definition at line 3249 of file qrhimetal.mm.

Referenced by QRhiMetal::executeDeferredReleases().

Here is the caller graph for this function:

◆ qrhimtl_releaseSampler()

void qrhimtl_releaseSampler ( const QRhiMetalData::DeferredReleaseEntry & e)
static

Definition at line 3263 of file qrhimetal.mm.

Referenced by QRhiMetal::executeDeferredReleases().

Here is the caller graph for this function:

◆ qrhimtl_releaseTexture()

void qrhimtl_releaseTexture ( const QRhiMetalData::DeferredReleaseEntry & e)
static

Definition at line 3254 of file qrhimetal.mm.

Referenced by QRhiMetal::executeDeferredReleases().

Here is the caller graph for this function:

◆ rebindShaderResources()

void rebindShaderResources ( QMetalCommandBuffer * cbD,
int resourceStage,
int encoderStage,
const QMetalShaderResourceBindingsData * customBindingState = nullptr )
inlinestatic

Definition at line 1249 of file qrhimetal.mm.

References QMetalCommandBuffer::d.

Referenced by QRhiMetal::tessellatedDraw().

Here is the caller graph for this function:

◆ takeIndex()

void takeIndex ( quint32 index,
quint64 & indices )
inlinestatic

Definition at line 5349 of file qrhimetal.mm.

◆ tessellationComputeEncoder()

id< MTLComputeCommandEncoder > tessellationComputeEncoder ( QMetalCommandBuffer * cbD)
static

Definition at line 1966 of file qrhimetal.mm.

References QMetalCommandBuffer::d.

◆ toMetalAddressMode()

MTLSamplerAddressMode toMetalAddressMode ( QRhiSampler::AddressMode m)
inlinestatic

Definition at line 4095 of file qrhimetal.mm.

◆ toMetalAttributeFormat()

MTLVertexFormat toMetalAttributeFormat ( QRhiVertexInputAttribute::Format format)
inlinestatic

Definition at line 4594 of file qrhimetal.mm.

◆ toMetalBlendFactor()

MTLBlendFactor toMetalBlendFactor ( QRhiGraphicsPipeline::BlendFactor f)
inlinestatic

Definition at line 4657 of file qrhimetal.mm.

◆ toMetalBlendOp()

MTLBlendOperation toMetalBlendOp ( QRhiGraphicsPipeline::BlendOp op)
inlinestatic

Definition at line 4704 of file qrhimetal.mm.

◆ toMetalColorWriteMask()

uint toMetalColorWriteMask ( QRhiGraphicsPipeline::ColorMask c)
inlinestatic

Definition at line 4723 of file qrhimetal.mm.

◆ toMetalCompareOp()

MTLCompareFunction toMetalCompareOp ( QRhiGraphicsPipeline::CompareOp op)
inlinestatic

Definition at line 4737 of file qrhimetal.mm.

◆ toMetalCullMode()

MTLCullMode toMetalCullMode ( QRhiGraphicsPipeline::CullMode c)
inlinestatic

Definition at line 4824 of file qrhimetal.mm.

◆ toMetalFilter()

MTLSamplerMinMagFilter toMetalFilter ( QRhiSampler::Filter f)
inlinestatic

Definition at line 4067 of file qrhimetal.mm.

◆ toMetalLanguageVersion()

MTLLanguageVersion toMetalLanguageVersion ( const QShaderVersion & version)
inlinestatic

Definition at line 4880 of file qrhimetal.mm.

◆ toMetalMipmapMode()

MTLSamplerMipFilter toMetalMipmapMode ( QRhiSampler::Filter f)
inlinestatic

Definition at line 4080 of file qrhimetal.mm.

◆ toMetalPrimitiveTopologyClass()

MTLPrimitiveTopologyClass toMetalPrimitiveTopologyClass ( QRhiGraphicsPipeline::Topology t)
inlinestatic

Definition at line 4806 of file qrhimetal.mm.

◆ toMetalPrimitiveType()

MTLPrimitiveType toMetalPrimitiveType ( QRhiGraphicsPipeline::Topology t)
inlinestatic

Definition at line 4787 of file qrhimetal.mm.

◆ toMetalStencilOp()

MTLStencilOperation toMetalStencilOp ( QRhiGraphicsPipeline::StencilOp op)
inlinestatic

Definition at line 4762 of file qrhimetal.mm.

◆ toMetalTessellationPartitionMode()

MTLTessellationPartitionMode toMetalTessellationPartitionMode ( QShaderDescription::TessellationPartitioning p)
inlinestatic

Definition at line 4865 of file qrhimetal.mm.

◆ toMetalTessellationWindingOrder()

MTLWinding toMetalTessellationWindingOrder ( QShaderDescription::TessellationWindingOrder w)
inlinestatic

Definition at line 4852 of file qrhimetal.mm.

◆ toMetalTextureCompareFunction()

MTLCompareFunction toMetalTextureCompareFunction ( QRhiSampler::CompareOp op)
inlinestatic

Definition at line 4110 of file qrhimetal.mm.

◆ toMetalTextureFormat()

MTLPixelFormat toMetalTextureFormat ( QRhiTexture::Format format,
QRhiTexture::Flags flags,
const QRhiMetal * d )
inlinestatic

Definition at line 3483 of file qrhimetal.mm.

◆ toMetalTriangleFillMode()

MTLTriangleFillMode toMetalTriangleFillMode ( QRhiGraphicsPipeline::PolygonMode mode)
inlinestatic

Definition at line 4839 of file qrhimetal.mm.

◆ toRhiSrbStage()

QRhiShaderResourceBinding::StageFlag toRhiSrbStage ( int stage)
inlinestatic

Definition at line 1271 of file qrhimetal.mm.