Skip to content

Instantly share code, notes, and snippets.

View Qirias's full-sized avatar

Kiriakos Gavras Qirias

  • Tampere, Finland
View GitHub Profile
@Qirias
Qirias / depth_pyramid.cpp
Created February 12, 2026 21:07
Depth Pyramid - Single Pass Downsampler in Metal
void depth_pyramid(MTL::CommandBuffer *commandBuffer) {
uint32_t zero = 0;
memcpy(_spdAtomicBuffer->contents(), &zero, sizeof(uint32_t));
MTL::ComputeCommandEncoder* encoder = commandBuffer->computeCommandEncoder();
encoder->setLabel(NS::String::string("Depth Pyramid SPD", NS::ASCIIStringEncoding));
encoder->setComputePipelineState(_depthPyramidPSO);
encoder->setTexture(depthTexture, 0);
encoder->setTexture(_depthPyramidTexture, 1);