Skip to content
Snippets Groups Projects

Resolve "Shader Program Class"

Merged Mark Oliver Mints requested to merge 10-shader-program-class into develop
5 unresolved threads
1 file
+ 14
2
Compare changes
  • Side-by-side
  • Inline
+ 14
2
@@ -559,8 +559,8 @@ namespace vkcv
@@ -559,8 +559,8 @@ namespace vkcv
}
}
}
}
const bool foundVertexCode = vertexCode.size() > 0;
const bool foundVertexCode = vertexCode.empty();
const bool foundFragCode = fragCode.size() > 0;
const bool foundFragCode = fragCode.empty();
const bool foundRequiredShaderCode = foundVertexCode && foundFragCode;
const bool foundRequiredShaderCode = foundVertexCode && foundFragCode;
if (!foundRequiredShaderCode) {
if (!foundRequiredShaderCode) {
std::cout << "Core::createGraphicsPipeline requires vertex and fragment shader code" << std::endl;
std::cout << "Core::createGraphicsPipeline requires vertex and fragment shader code" << std::endl;
@@ -586,7 +586,10 @@ namespace vkcv
@@ -586,7 +586,10 @@ namespace vkcv
vk::ShaderModuleCreateInfo fragmentModuleInfo({}, fragCode.size(), reinterpret_cast<uint32_t*>(fragCode.data()));
vk::ShaderModuleCreateInfo fragmentModuleInfo({}, fragCode.size(), reinterpret_cast<uint32_t*>(fragCode.data()));
vk::ShaderModule fragmentModule{};
vk::ShaderModule fragmentModule{};
if (m_Context.m_Device.createShaderModule(&fragmentModuleInfo, nullptr, &fragmentModule) != vk::Result::eSuccess)
if (m_Context.m_Device.createShaderModule(&fragmentModuleInfo, nullptr, &fragmentModule) != vk::Result::eSuccess)
 
{
 
m_Context.m_Device.destroy(vertexModule);
return false;
return false;
 
}
vk::PipelineShaderStageCreateInfo pipelineFragmentShaderStageInfo(
vk::PipelineShaderStageCreateInfo pipelineFragmentShaderStageInfo(
{},
{},
@@ -680,7 +683,11 @@ namespace vkcv
@@ -680,7 +683,11 @@ namespace vkcv
);
);
vk::PipelineLayout vkPipelineLayout{};
vk::PipelineLayout vkPipelineLayout{};
if (m_Context.m_Device.createPipelineLayout(&pipelineLayoutCreateInfo, nullptr, &vkPipelineLayout) != vk::Result::eSuccess)
if (m_Context.m_Device.createPipelineLayout(&pipelineLayoutCreateInfo, nullptr, &vkPipelineLayout) != vk::Result::eSuccess)
 
{
 
m_Context.m_Device.destroy(vertexModule);
 
m_Context.m_Device.destroy(fragmentModule);
return false;
return false;
 
}
// graphics pipeline create
// graphics pipeline create
std::vector<vk::PipelineShaderStageCreateInfo> shaderStages = { pipelineVertexShaderStageInfo, pipelineFragmentShaderStageInfo };
std::vector<vk::PipelineShaderStageCreateInfo> shaderStages = { pipelineVertexShaderStageInfo, pipelineFragmentShaderStageInfo };
@@ -706,7 +713,11 @@ namespace vkcv
@@ -706,7 +713,11 @@ namespace vkcv
vk::Pipeline vkPipeline{};
vk::Pipeline vkPipeline{};
if (m_Context.m_Device.createGraphicsPipelines(nullptr, 1, &graphicsPipelineCreateInfo, nullptr, &vkPipeline) != vk::Result::eSuccess)
if (m_Context.m_Device.createGraphicsPipelines(nullptr, 1, &graphicsPipelineCreateInfo, nullptr, &vkPipeline) != vk::Result::eSuccess)
 
{
 
m_Context.m_Device.destroy(vertexModule);
 
m_Context.m_Device.destroy(fragmentModule);
return false;
return false;
 
}
m_Context.m_Device.destroy(vertexModule);
m_Context.m_Device.destroy(vertexModule);
m_Context.m_Device.destroy(fragmentModule);
m_Context.m_Device.destroy(fragmentModule);
@@ -714,6 +725,7 @@ namespace vkcv
@@ -714,6 +725,7 @@ namespace vkcv
m_Pipelines.push_back(vkPipeline);
m_Pipelines.push_back(vkPipeline);
m_PipelineLayouts.push_back(vkPipelineLayout);
m_PipelineLayouts.push_back(vkPipelineLayout);
handle.id = m_NextPipelineId++;
handle.id = m_NextPipelineId++;
 
return true;
return true;
}
}
Loading