fix depth attachment pixel format not being set
This commit is contained in:
@@ -45,14 +45,6 @@ gnReturnCode createMetalGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gn
|
|||||||
graphicsPipeline->graphicsPipeline = malloc(sizeof(struct gnPlatformGraphicsPipeline_t));
|
graphicsPipeline->graphicsPipeline = malloc(sizeof(struct gnPlatformGraphicsPipeline_t));
|
||||||
MTLRenderPipelineDescriptor* descriptor = [[MTLRenderPipelineDescriptor alloc] init];
|
MTLRenderPipelineDescriptor* descriptor = [[MTLRenderPipelineDescriptor alloc] init];
|
||||||
descriptor.rasterSampleCount = mtlSampleCount(info.multisample.samples);
|
descriptor.rasterSampleCount = mtlSampleCount(info.multisample.samples);
|
||||||
|
|
||||||
if (info.subpassIndex >= info.renderPassDescriptor->info.subpassCount) {
|
|
||||||
gnDebuggerSetErrorMessage(device->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Subpass index is larger then the subpass count in render pass descriptor")
|
|
||||||
});
|
|
||||||
return GN_UNKNOWN_SUBPASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct gnSubpassInfo_t subpass = info.renderPassDescriptor->info.subpassInfos[info.subpassIndex];
|
struct gnSubpassInfo_t subpass = info.renderPassDescriptor->info.subpassInfos[info.subpassIndex];
|
||||||
|
|
||||||
for (uint32_t i = 0; i < subpass.colorAttachmentCount; i++) {
|
for (uint32_t i = 0; i < subpass.colorAttachmentCount; i++) {
|
||||||
@@ -71,6 +63,11 @@ gnReturnCode createMetalGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gn
|
|||||||
} else {
|
} else {
|
||||||
[descriptor.colorAttachments objectAtIndexedSubscript:i].blendingEnabled = FALSE;
|
[descriptor.colorAttachments objectAtIndexedSubscript:i].blendingEnabled = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (subpass.depthAttachment != NULL) {
|
||||||
|
descriptor.depthAttachmentPixelFormat = mtlGryphnFormatToMetalFormat(info.renderPassDescriptor->info.attachmentInfos[subpass.depthAttachment->index].format);
|
||||||
|
// descriptor.stencilAttachmentPixelFormat = mtlGryphnFormatToMetalFormat(info.renderPassDescriptor->info.attachmentInfos[subpass.depthAttachment->index].format);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < info.shaderModuleCount; i++) {
|
for (int i = 0; i < info.shaderModuleCount; i++) {
|
||||||
@@ -108,15 +105,10 @@ gnReturnCode createMetalGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gn
|
|||||||
[descriptor setVertexDescriptor:vertexDescriptor];
|
[descriptor setVertexDescriptor:vertexDescriptor];
|
||||||
NSError* error = nil;
|
NSError* error = nil;
|
||||||
graphicsPipeline->graphicsPipeline->graphicsPipeline = [device->outputDevice->device newRenderPipelineStateWithDescriptor:descriptor error:&error];
|
graphicsPipeline->graphicsPipeline->graphicsPipeline = [device->outputDevice->device newRenderPipelineStateWithDescriptor:descriptor error:&error];
|
||||||
if (graphicsPipeline->graphicsPipeline->graphicsPipeline == nil) {
|
|
||||||
gnDebuggerSetErrorMessage(device->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCombineStrings(gnCreateString("Failed to create metal render pipeline descriptor "), error.localizedDescription.UTF8String)
|
|
||||||
});
|
|
||||||
return GN_FAILED_TO_CREATE_GRAPHICS_PIPELINE;
|
|
||||||
}
|
|
||||||
[descriptor release];
|
[descriptor release];
|
||||||
[vertexDescriptor release];
|
[vertexDescriptor release];
|
||||||
[error release];
|
[error release];
|
||||||
|
if (graphicsPipeline->graphicsPipeline->graphicsPipeline == nil) return GN_FAILED_TO_CREATE_GRAPHICS_PIPELINE;
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user