redo metal graphics pipeline creation
This commit is contained in:
@@ -23,8 +23,20 @@ gnReturnCode gnCreateGraphicsPipelineFn(struct gnGraphicsPipeline_t* graphicsPip
|
|||||||
graphicsPipeline->graphicsPipeline = malloc(sizeof(struct gnPlatformGraphicsPipeline_t));
|
graphicsPipeline->graphicsPipeline = malloc(sizeof(struct gnPlatformGraphicsPipeline_t));
|
||||||
MTLRenderPipelineDescriptor* descriptor = [[MTLRenderPipelineDescriptor alloc] init];
|
MTLRenderPipelineDescriptor* descriptor = [[MTLRenderPipelineDescriptor alloc] init];
|
||||||
|
|
||||||
for (int i = 0; i < info.renderPassDescriptor->info.attachmentCount; i++) {
|
if (info.subpassIndex >= info.renderPassDescriptor->info.subpassCount) {
|
||||||
[descriptor.colorAttachments objectAtIndexedSubscript:i].pixelFormat = mtlGryphnFormatToVulkanFormat(info.renderPassDescriptor->info.attachmentInfos[i].format);
|
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];
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < subpass.colorAttachmentCount; i++) {
|
||||||
|
gnSubpassAttachmentInfo subpassAtt = subpass.colorAttachments[i];
|
||||||
|
|
||||||
|
gnRenderPassAttachmentInfo attInfo = info.renderPassDescriptor->info.attachmentInfos[subpassAtt.index];
|
||||||
|
descriptor.colorAttachments[i].pixelFormat = mtlGryphnFormatToVulkanFormat(attInfo.format);
|
||||||
if (info.colorBlending.enable == gnTrue) {
|
if (info.colorBlending.enable == gnTrue) {
|
||||||
[descriptor.colorAttachments objectAtIndexedSubscript:i].blendingEnabled = YES;
|
[descriptor.colorAttachments objectAtIndexedSubscript:i].blendingEnabled = YES;
|
||||||
[descriptor.colorAttachments objectAtIndexedSubscript:i].rgbBlendOperation = vkGryphnBlendOperation(info.colorBlending.colorBlendOperation);
|
[descriptor.colorAttachments objectAtIndexedSubscript:i].rgbBlendOperation = vkGryphnBlendOperation(info.colorBlending.colorBlendOperation);
|
||||||
|
@@ -207,4 +207,6 @@ void gnDestroyGraphicsPipelineFn(struct gnGraphicsPipeline_t *graphicsPipeline)
|
|||||||
if (graphicsPipeline->graphicsPipeline->createdPipelineLayout)
|
if (graphicsPipeline->graphicsPipeline->createdPipelineLayout)
|
||||||
vkDestroyPipelineLayout(graphicsPipeline->device->outputDevice->device, graphicsPipeline->graphicsPipeline->pipelineLayout, NULL);
|
vkDestroyPipelineLayout(graphicsPipeline->device->outputDevice->device, graphicsPipeline->graphicsPipeline->pipelineLayout, NULL);
|
||||||
vkDestroyPipeline(graphicsPipeline->device->outputDevice->device, graphicsPipeline->graphicsPipeline->graphicsPipeline, NULL);
|
vkDestroyPipeline(graphicsPipeline->device->outputDevice->device, graphicsPipeline->graphicsPipeline->graphicsPipeline, NULL);
|
||||||
|
|
||||||
|
free(graphicsPipeline->graphicsPipeline);
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,8 @@ typedef enum gnReturnCode_t {
|
|||||||
GN_FAILED_TO_CREATE_UNIFORM_LAYOUT,
|
GN_FAILED_TO_CREATE_UNIFORM_LAYOUT,
|
||||||
GN_FAILED_TO_CREATE_RENDER_PASS,
|
GN_FAILED_TO_CREATE_RENDER_PASS,
|
||||||
GN_FAILED_TO_CREATE_GRAPHICS_PIPELINE,
|
GN_FAILED_TO_CREATE_GRAPHICS_PIPELINE,
|
||||||
GN_UNSUPPORTED_SHADER_MODULE
|
GN_UNSUPPORTED_SHADER_MODULE,
|
||||||
|
GN_UNKNOWN_SUBPASS
|
||||||
} gnReturnCode;
|
} gnReturnCode;
|
||||||
|
|
||||||
typedef gnReturnCode gnErrorCode;
|
typedef gnReturnCode gnErrorCode;
|
||||||
@@ -52,5 +53,6 @@ static const char* gnErrorCodeToCString(enum gnReturnCode_t returnCode) {
|
|||||||
case GN_FAILED_TO_CREATE_RENDER_PASS: return "GN_FAILED_TO_CREATE_RENDER_PASS";
|
case GN_FAILED_TO_CREATE_RENDER_PASS: return "GN_FAILED_TO_CREATE_RENDER_PASS";
|
||||||
case GN_FAILED_TO_CREATE_GRAPHICS_PIPELINE: return "GN_FAILED_TO_CREATE_GRAPHICS_PIPELINE";
|
case GN_FAILED_TO_CREATE_GRAPHICS_PIPELINE: return "GN_FAILED_TO_CREATE_GRAPHICS_PIPELINE";
|
||||||
case GN_UNSUPPORTED_SHADER_MODULE: return "GN_UNSUPPORTED_SHADER_MODULE";
|
case GN_UNSUPPORTED_SHADER_MODULE: return "GN_UNSUPPORTED_SHADER_MODULE";
|
||||||
|
case GN_UNKNOWN_SUBPASS: return "GN_UNKNOWN_SUBPASS";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user