Shader loading
This commit is contained in:
parent
29ac49fb6a
commit
e3c26e01ac
1 changed files with 5 additions and 12 deletions
|
|
@ -752,20 +752,14 @@ public:
|
||||||
|
|
||||||
// Load shaders
|
// Load shaders
|
||||||
// Shaders are loaded from the SPIR-V format, which can be generated from glsl
|
// Shaders are loaded from the SPIR-V format, which can be generated from glsl
|
||||||
VkPipelineShaderStageCreateInfo shaderStages[2] = { {},{} };
|
std::array<VkPipelineShaderStageCreateInfo,2> shaderStages;
|
||||||
std::string shaderPath;
|
shaderStages[0] = loadShader(getAssetPath() + "shaders/triangle.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
||||||
#if defined(__ANDROID__)
|
shaderStages[1] = loadShader(getAssetPath() + "shaders/triangle.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
||||||
shaderStages[0] = loadShader("shaders/triangle.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
|
||||||
shaderStages[1] = loadShader("shaders/triangle.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
|
||||||
#else
|
|
||||||
shaderStages[0] = loadShader("./../data/shaders/triangle.vert.spv", VK_SHADER_STAGE_VERTEX_BIT);
|
|
||||||
shaderStages[1] = loadShader("./../data/shaders/triangle.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Assign states
|
// Assign states
|
||||||
// Two shader stages
|
|
||||||
pipelineCreateInfo.stageCount = 2;
|
|
||||||
// Assign pipeline state create information
|
// Assign pipeline state create information
|
||||||
|
pipelineCreateInfo.stageCount = shaderStages.size();
|
||||||
|
pipelineCreateInfo.pStages = shaderStages.data();
|
||||||
pipelineCreateInfo.pVertexInputState = &vertices.vi;
|
pipelineCreateInfo.pVertexInputState = &vertices.vi;
|
||||||
pipelineCreateInfo.pInputAssemblyState = &inputAssemblyState;
|
pipelineCreateInfo.pInputAssemblyState = &inputAssemblyState;
|
||||||
pipelineCreateInfo.pRasterizationState = &rasterizationState;
|
pipelineCreateInfo.pRasterizationState = &rasterizationState;
|
||||||
|
|
@ -773,7 +767,6 @@ public:
|
||||||
pipelineCreateInfo.pMultisampleState = &multisampleState;
|
pipelineCreateInfo.pMultisampleState = &multisampleState;
|
||||||
pipelineCreateInfo.pViewportState = &viewportState;
|
pipelineCreateInfo.pViewportState = &viewportState;
|
||||||
pipelineCreateInfo.pDepthStencilState = &depthStencilState;
|
pipelineCreateInfo.pDepthStencilState = &depthStencilState;
|
||||||
pipelineCreateInfo.pStages = shaderStages;
|
|
||||||
pipelineCreateInfo.renderPass = renderPass;
|
pipelineCreateInfo.renderPass = renderPass;
|
||||||
pipelineCreateInfo.pDynamicState = &dynamicState;
|
pipelineCreateInfo.pDynamicState = &dynamicState;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue