whole lotta pipeline jazz
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
#include "vulkan_graphics_pipeline.h"
|
#include "vulkan_graphics_pipeline.h"
|
||||||
|
#include "core/debugger/gryphn_debugger.h"
|
||||||
|
#include "output_device/vulkan_output_devices.h"
|
||||||
|
|
||||||
VkDynamicState vkGryphnDynamicStateToVulkanDynamicState(enum gnDynamicState_e state) {
|
VkDynamicState vkGryphnDynamicStateToVulkanDynamicState(enum gnDynamicState_e state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
@@ -146,10 +148,32 @@ gnReturnCode gnCreateGraphicsPipelineFn(struct gnGraphicsPipeline_t* graphicsPip
|
|||||||
.blendConstants[3] = 0.0f
|
.blendConstants[3] = 0.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (info.uniformLayout == NULL) {
|
||||||
|
VkPipelineLayoutCreateInfo pipelineLayoutInfo = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
|
||||||
|
.setLayoutCount = 0,
|
||||||
|
pipelineLayoutInfo.pSetLayouts = NULL,
|
||||||
|
pipelineLayoutInfo.pushConstantRangeCount = 0,
|
||||||
|
pipelineLayoutInfo.pPushConstantRanges = NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
if (vkCreatePipelineLayout(device->outputDevice->device, &pipelineLayoutInfo, NULL, &graphicsPipeline->graphicsPipeline->pipelineLayout) != VK_SUCCESS) {
|
||||||
|
return GN_FAILED_TO_CREATE_UNIFORM_LAYOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
graphicsPipeline->graphicsPipeline->createdPipelineLayout = gnTrue;
|
||||||
|
} else {
|
||||||
|
graphicsPipeline->graphicsPipeline->createdPipelineLayout = gnFalse;
|
||||||
|
gnDebuggerSetErrorMessage(device->instance->debugger, (gnMessageData){
|
||||||
|
.message = gnCreateString("Graphics pipelines can not currently accept uniform layouts")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
free(dynamicStates);
|
free(dynamicStates);
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gnDestroyGraphicsPipelineFn(struct gnGraphicsPipeline_t *graphicsPipeline) {
|
void gnDestroyGraphicsPipelineFn(struct gnGraphicsPipeline_t *graphicsPipeline) {
|
||||||
|
if (graphicsPipeline->graphicsPipeline->createdPipelineLayout)
|
||||||
|
vkDestroyPipelineLayout(graphicsPipeline->device->outputDevice->device, graphicsPipeline->graphicsPipeline->pipelineLayout, NULL);
|
||||||
}
|
}
|
||||||
|
@@ -14,4 +14,7 @@ typedef struct gnPlatformGraphicsPipeline_t {
|
|||||||
VkPipelineRasterizationStateCreateInfo rasterizer;
|
VkPipelineRasterizationStateCreateInfo rasterizer;
|
||||||
VkPipelineColorBlendAttachmentState colorBlendAttachment;
|
VkPipelineColorBlendAttachmentState colorBlendAttachment;
|
||||||
VkPipelineColorBlendStateCreateInfo colorBlending;
|
VkPipelineColorBlendStateCreateInfo colorBlending;
|
||||||
|
|
||||||
|
gnBool createdPipelineLayout;
|
||||||
|
VkPipelineLayout pipelineLayout;
|
||||||
} gnPlatformGraphicsPipeline;
|
} gnPlatformGraphicsPipeline;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <core/output_device/gryphn_output_device.h>
|
#include <core/output_device/gryphn_output_device.h>
|
||||||
|
#include <core/pipelines/gryphn_uniform_layout.h>
|
||||||
|
|
||||||
typedef enum gnDynamicState_e {
|
typedef enum gnDynamicState_e {
|
||||||
GN_DYNAMIC_VIEWPORT,
|
GN_DYNAMIC_VIEWPORT,
|
||||||
@@ -76,6 +77,8 @@ typedef struct gnGraphicsPipelineInfo_t {
|
|||||||
enum gnFillMode_e fillMode;
|
enum gnFillMode_e fillMode;
|
||||||
struct gnCullMode_t cullMode;
|
struct gnCullMode_t cullMode;
|
||||||
struct gnColorBlending_t colorBlending;
|
struct gnColorBlending_t colorBlending;
|
||||||
|
|
||||||
|
struct gnUniformLayout_t* uniformLayout;
|
||||||
} gnGraphicsPipelineInfo;
|
} gnGraphicsPipelineInfo;
|
||||||
|
|
||||||
struct gnPlatformGraphicsPipeline_t;
|
struct gnPlatformGraphicsPipeline_t;
|
||||||
|
5
src/core/pipelines/gryphn_uniform_layout.h
Normal file
5
src/core/pipelines/gryphn_uniform_layout.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef struct gnUniformLayout_t {
|
||||||
|
|
||||||
|
} gnUniformLayout;
|
@@ -19,7 +19,8 @@ typedef enum gnReturnCode_t {
|
|||||||
GN_FAILED_TO_CREATE_IMAGE_VIEW,
|
GN_FAILED_TO_CREATE_IMAGE_VIEW,
|
||||||
GN_FAILED_TO_CREATE_SHADER_MODULE,
|
GN_FAILED_TO_CREATE_SHADER_MODULE,
|
||||||
GN_FAILED_TO_CONVERT_SHADER_CODE,
|
GN_FAILED_TO_CONVERT_SHADER_CODE,
|
||||||
GN_FAILED_TO_FIND_ENTRY_POINT
|
GN_FAILED_TO_FIND_ENTRY_POINT,
|
||||||
|
GN_FAILED_TO_CREATE_UNIFORM_LAYOUT
|
||||||
|
|
||||||
// GN_UNKNOWN_FRAMEBUFFER_ATTACHMENT,
|
// GN_UNKNOWN_FRAMEBUFFER_ATTACHMENT,
|
||||||
// GN_UNKNOWN_FUNCTION,
|
// GN_UNKNOWN_FUNCTION,
|
||||||
@@ -52,5 +53,6 @@ static const char* gnErrorCodeToCString(enum gnReturnCode_t returnCode) {
|
|||||||
case GN_FAILED_TO_CREATE_SHADER_MODULE: return "GN_FAILED_TO_CREATE_SHADER_MODULE";
|
case GN_FAILED_TO_CREATE_SHADER_MODULE: return "GN_FAILED_TO_CREATE_SHADER_MODULE";
|
||||||
case GN_FAILED_TO_CONVERT_SHADER_CODE: return "GN_FAILED_TO_CONVERT_SHADER_CODE";
|
case GN_FAILED_TO_CONVERT_SHADER_CODE: return "GN_FAILED_TO_CONVERT_SHADER_CODE";
|
||||||
case GN_FAILED_TO_FIND_ENTRY_POINT: return "GN_FAILED_TO_FIND_ENTRY_POINT";
|
case GN_FAILED_TO_FIND_ENTRY_POINT: return "GN_FAILED_TO_FIND_ENTRY_POINT";
|
||||||
|
case GN_FAILED_TO_CREATE_UNIFORM_LAYOUT: return "GN_FAILED_TO_CREATE_UNIFORM_LAYOUT";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user