4#ifndef QRHIMETAL_ICB_P_H
5#define QRHIMETAL_ICB_P_H
22#include <metal_stdlib>
23using namespace metal;
24
25struct DrawCmd {
26 uint indexCount;
27 uint instanceCount;
28 uint firstIndex;
29 int baseVertex;
30 uint baseInstance;
31};
32
33struct ICBContainer {
34 command_buffer cmdBuffer [[id(0)]];
35};
36
37kernel void encode_icb_indexed_u32(
38 const device char *argsRaw [[buffer(0)]],
39 device ICBContainer *container [[buffer(1)]],
40 constant uint &drawCount [[buffer(2)]],
41 const device uint *indexBuffer [[buffer(3)]],
42 constant uint &primType [[buffer(4)]],
43 constant uint &stride [[buffer(5)]],
44 uint gid [[thread_position_in_grid]])
45{
46 if (gid >= drawCount) return;
47
48 const device DrawCmd &a = *(const device DrawCmd *)(argsRaw + gid * stride);
49 render_command cmd(container->cmdBuffer, gid);
50 if (a.indexCount > 0u) {
51 cmd.draw_indexed_primitives(
52 static_cast<primitive_type>(primType),
53 a.indexCount,
54 indexBuffer + a.firstIndex,
55 a.instanceCount,
56 uint(a.baseVertex),
57 a.baseInstance
58 );
59 } else {
60 cmd.reset();
61 }
62}
63
64kernel void encode_icb_indexed_u16(
65 const device char *argsRaw [[buffer(0)]],
66 device ICBContainer *container [[buffer(1)]],
67 constant uint &drawCount [[buffer(2)]],
68 const device ushort *indexBuffer [[buffer(3)]],
69 constant uint &primType [[buffer(4)]],
70 constant uint &stride [[buffer(5)]],
71 uint gid [[thread_position_in_grid]])
72{
73 if (gid >= drawCount) return;
74
75 const device DrawCmd &a = *(const device DrawCmd *)(argsRaw + gid * stride);
76 render_command cmd(container->cmdBuffer, gid);
77 if (a.indexCount > 0u) {
78 cmd.draw_indexed_primitives(
79 static_cast<primitive_type>(primType),
80 a.indexCount,
81 indexBuffer + a.firstIndex,
82 a.instanceCount,
83 uint(a.baseVertex),
84 a.baseInstance
85 );
86 } else {
87 cmd.reset();
88 }
89}
90)";
static QRhiResourceUpdateBatchPrivate * get(QRhiResourceUpdateBatch *b)
Combined button and popup list for selecting options.
Int aligned(Int v, Int byteAlign)
\variable QRhiVulkanQueueSubmitParams::waitSemaphoreCount
id< MTLTexture > viewForLevel(int level)
id< MTLTexture > perLevelViews[QRhi::MAX_MIP_LEVELS]
id< MTLBuffer > stagingBuf[QMTL_FRAMES_IN_FLIGHT]
QMetalTextureData(QMetalTexture *t)
~QMetalTextureRenderTarget()
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
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.
id< MTLComputePipelineState > pipelineState
id< MTLDepthStencilState > depthStencilState
std::array< id< MTLComputePipelineState >, 3 > tessVertexComputeState
id< MTLRasterizationRateMap > rateMap
id< MTLSamplerState > samplerState
id< MTLBuffer > argBuffer
id< MTLBuffer > stagingBuffers[QMTL_FRAMES_IN_FLIGHT]
id< MTLComputePipelineState > tessTessControlComputeState
id< MTLIndirectCommandBuffer > icb
id< MTLRenderPipelineState > pipelineState
id< MTLBuffer > buffers[QMTL_FRAMES_IN_FLIGHT]
id< MTLTexture > views[QRhi::MAX_MIP_LEVELS]
QRhiReadbackDescription desc
QRhiReadbackResult * result
QRhiTexture::Format format
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
float maxPotentialColorComponentValue
LuminanceBehavior luminanceBehavior
float maxColorComponentValue
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h