Defining vulkan shader entry point

0

My vulkan application is throwing an error while trying to create graphics pipeline

exeption-

Exception thrown at 0x03FCCCB2 (nvoglv32.dll) in VulkanSandbox.exe: 0xC0000005: Access violation reading location 0x00000049.

at line-

vkCreateGraphicsPipelines(mainDevice.logicalDevice, VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &graphicsPipeline);

validation layer says that pName has to be defined-

VUID-VkPipelineShaderStageCreateInfo-pName-00707(ERROR / SPEC): msgNum: -1282697375 - Validation Error: [ VUID-VkPipelineShaderStageCreateInfo-pName-00707 ] Object 0: handle = 0x64cca9c, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xb38b9761 | No entrypoint found named `main` for stage VK_SHADER_STAGE_FRAGMENT_BIT.. The Vulkan spec states: pName must be the name of an OpEntryPoint in module with an execution model that matches stage (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineShaderStageCreateInfo-pName-00707)
Objects: 1
    [0] 0x64cca9c, type: 3, name: NULL

but I have defined "main" in my code

    VkPipelineShaderStageCreateInfo vertexShaderCreateInfo = {};
vertexShaderCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
vertexShaderCreateInfo.stage = VK_SHADER_STAGE_VERTEX_BIT;              
vertexShaderCreateInfo.module = vertexMod;                      
vertexShaderCreateInfo.pName = "main";
// Fragment Stage creation information
VkPipelineShaderStageCreateInfo fragmentShaderCreateInfo = {};
fragmentShaderCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
fragmentShaderCreateInfo.stage = VK_SHADER_STAGE_FRAGMENT_BIT;              
fragmentShaderCreateInfo.module = fragmentMod;
fragmentShaderCreateInfo.pName = "main";
VkPipelineShaderStageCreateInfo shaderStages[] = { vertexShaderCreateInfo, fragmentShaderCreateInfo};

as well as my shaders.

void main(){
    gl_Position = vec4(pos,1.0f);
}

Where am I wrong? I am sorry if it was obvious but I am new to graphics programming. I am using NVIDIA 1050 TI, latest drivers.

c++
visual-studio
graphics
nvidia
vulkan
asked on Stack Overflow May 21, 2021 by CODER_SCREAM • edited May 21, 2021 by CODER_SCREAM

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0