metal depth stencil state or something

This commit is contained in:
Greg Wells
2025-07-01 12:42:03 -04:00
parent dd84b3bef3
commit 4c7fe77db3
4 changed files with 29 additions and 9 deletions

View File

@@ -6,11 +6,11 @@
#include "output_device/gryphn_output_device.h"
gnBool isDepthFormat(gnImageFormat format) {
return gnFalse;
return (format == GN_FORMAT_D24S8_UINT) || (format == GN_FORMAT_D32S8_UINT);
}
gnBool isStencilFormat(gnImageFormat format) {
return gnFalse;
return (format == GN_FORMAT_D24S8_UINT) || (format == GN_FORMAT_D32S8_UINT);
}
MTLLoadAction mtlGryphnLoadOperation(gnLoadOperation loadOperation) {
@@ -45,9 +45,11 @@ gnReturnCode createMetalFramebuffer(gnFramebuffer framebuffer, gnOutputDevice de
for (int i = 0; i < info.renderPassDescriptor->info.attachmentCount; i++) {
gnBool wasDepthStencil = gnFalse;
if (isDepthFormat(info.renderPassDescriptor->info.attachmentInfos[i].format)) {
gnDebuggerSetErrorMessage(device->instance->debugger, (gnMessageData){
.message = gnCreateString("Depth attachments are not currently supported in metal (get on this)")
});
MTLRenderPassDepthAttachmentDescriptor* depthAttachment = framebuffer->framebuffer->framebuffer.depthAttachment;
depthAttachment.texture = info.attachments[i]->texture->texture;
depthAttachment.loadAction = mtlGryphnLoadOperation(info.renderPassDescriptor->info.attachmentInfos[i].loadOperation);
depthAttachment.storeAction = mtlGryphnStoreOperation(info.renderPassDescriptor->info.attachmentInfos[i].storeOperation);
depthAttachment.clearDepth = 1.0f;
wasDepthStencil = gnTrue;
}
if (isStencilFormat(info.renderPassDescriptor->info.attachmentInfos[i].format)) {