Hey all together!
I recently started learning vulkan for a project at my college but I ran into a problem i cannot figure out. Maybe some of you can and may help me I would really appreciate that because I’ve got no one else to ask for …
I want to create a compute pipeline, but I get the error VK_ERROR_OUT_OF_HOST_MEMORY. Memory is enough available so I think it is a another problem not showing to me …
I followed a small example which works (cloned and ran). But doing it on myself (changed for my purposes) isn’t working but I do not know why.
I attached a bit of my code. The last code line ist the problem causing one.
If you need more Information or more Code feel free to ask
Thanks a lot if you can help me! This is so frustrating when not knowing anything because of no much feedback …
Here is a bit of my code:
void createComputePipeline(Compute *compute)
{
long computeShaderSourceSize;
char *computeShaderSource = readFile("./vulkan/comp.spv", “rb”, &computeShaderSourceSize);
VkShaderModuleCreateInfo shaderModuleCreateInfo = {};
shaderModuleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
shaderModuleCreateInfo.pCode = (uint32_t *) computeShaderSource;
shaderModuleCreateInfo.codeSize = computeShaderSourceSize;
ASSERT_VK(vkCreateShaderModule(compute->device, &shaderModuleCreateInfo, NULL, &(compute->shaderModule)))
free(computeShaderSource);
VkPipelineShaderStageCreateInfo pipelineShaderStageCreateInfo = {};
pipelineShaderStageCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
pipelineShaderStageCreateInfo.stage = VK_SHADER_STAGE_COMPUTE_BIT;
pipelineShaderStageCreateInfo.module = compute->shaderModule;
pipelineShaderStageCreateInfo.pName = "main";
VkDescriptorSetLayout descriptorSetLayouts[] = {
compute->particleBufferDescriptorSetLayout,
compute->dtUniformBufferDescriptorSetLayout,
compute->staticInUniformBufferDescriptorSetLayout
};
VkPipelineLayoutCreateInfo pipelineLayoutCreateInfo = {};
pipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
pipelineLayoutCreateInfo.setLayoutCount = 3;
pipelineLayoutCreateInfo.pSetLayouts = descriptorSetLayouts;
ASSERT_VK(vkCreatePipelineLayout(compute->device, &pipelineLayoutCreateInfo, NULL, &(compute->pipelineLayout)));
VkComputePipelineCreateInfo pipelineCreateInfo = {};
pipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
pipelineCreateInfo.stage = pipelineShaderStageCreateInfo;
pipelineCreateInfo.layout = compute->pipelineLayout;
ASSERT_VK(vkCreateComputePipelines(compute->device, VK_NULL_HANDLE, 1, &pipelineCreateInfo, NULL, &(compute->pipeline)))
}