No depth attachment in the new MTL4RenderPipelineDescriptor ?

Hello everyone,

I must have missed something but why isn't there a depthAttachmentPixelFormat to the new Metal 4 MTL4RenderPipelineDescriptor, unlike the old MTLRenderPipelineDescriptor?

So how do you set the depth pixel format?

Thanks in advance!

Answered by DTS Engineer in 850894022

Hello,

For color attachments first create an unspecialized MTLRenderPipelineState and then compile a new specialized MTLRenderPipelineState with a specialized color attachment configuration:

// ... Set specialized values

// Create new specialized pipeline
id<MTLRenderPipelineState> specializedPipeline = 
[compiler newRenderPipelineStateBySpecializationWithDescriptor:pipelineDescriptor
pipeline: unspecializedPipeline
error: &error];

For more details watch Explore Metal 4 games.

Accepted Answer

You no longer need to set the depth format ahead of time; you can just supply a depth texture when setting up your render pass later on.

Oh, I see! Thanks, noah-w! That's a nice change... But why not do the same thing with colorAttachments?

Hello,

For color attachments first create an unspecialized MTLRenderPipelineState and then compile a new specialized MTLRenderPipelineState with a specialized color attachment configuration:

// ... Set specialized values

// Create new specialized pipeline
id<MTLRenderPipelineState> specializedPipeline = 
[compiler newRenderPipelineStateBySpecializationWithDescriptor:pipelineDescriptor
pipeline: unspecializedPipeline
error: &error];

For more details watch Explore Metal 4 games.

OK... I see... Thanks!

No depth attachment in the new MTL4RenderPipelineDescriptor ?
 
 
Q