Results 1 to 10 of 10

Thread: vkCreateWin32SurfaceKHR access violation

  1. #1
    Junior Member
    Join Date
    May 2018
    Posts
    10

    vkCreateWin32SurfaceKHR access violation

    Hello everyone,
    I get an access violation exception when execute vkCreateWin32SurfaceKHR: Exception thrown at 0x0000000000000000 in MIO_Vulkan_Cookbook.exe: 0xC0000005: Access violation executing location 0x0000000000000000.

    that is strange because every parameters seems ok:

    vkCreateWin32SurfaceKHR(instance, &surface_create_info, NULL, &presentation_surface)

    Instance: 0x000001082d3d0a30 {...}

    surface_create_info: {sType=VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO _KHR (1000009000) pNext=0x0000000000000000 flags=0 ...
    hinstance=MIO_Vulkan_Cookbook.exe!0x00007ff760d600 00 {unused=9460301 }
    hwnd=0x00000000002c0be8 {unused=??? }
    }

    presentation_surface: 0x0000000000000000 <NULL>

    Could someone help me?
    Thank you
    Last edited by Aidoru; 06-06-2018 at 08:55 AM.

  2. #2
    Senior Member
    Join Date
    Mar 2016
    Posts
    308
    Looks like you are calling nullptr.

    What is the type and value of vkCreateWin32SurfaceKHR. Which loader are you using?

  3. #3
    Junior Member
    Join Date
    May 2018
    Posts
    10
    Hello krOoze, sorry but I don't understand, the arguments and its value used to call vkCreateWin32SurfaceKHR are those I describedin my qyestion:

    Instance: 0x000001082d3d0a30 {...}

    surface_create_info: {sType=VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO _KHR (1000009000) pNext=0x0000000000000000 flags=0 ...
    hinstance=MIO_Vulkan_Cookbook.exe!0x00007ff760d600 00 {unused=9460301 }
    hwnd=0x00000000002c0be8 {unused=??? }
    }

    presentation_surface: 0x0000000000000000 <NULL>

    This is a copy using breakpoint on function call

    Thank you

  4. #4
    Senior Member
    Join Date
    Mar 2016
    Posts
    308
    What I mean is that you are probably calling function pointer that has a value of nullptr. Which may happen if you are using third-party Vulkan loader...

  5. #5
    Junior Member
    Join Date
    May 2018
    Posts
    10
    I'm using vulkan-1.dll.
    I had disable the function prototypes defined in the vulkan.h header file and loaded function pointers dynamically. So you think that I have problems loading fuction pointer? How can I check?

  6. #6
    Junior Member
    Join Date
    May 2018
    Posts
    10
    Anyway I checked and you are right, function pointer is NULL, but I don't understand why, all other functions pointer are ok

  7. #7
    Senior Member
    Join Date
    Mar 2016
    Posts
    308
    Dunno, show me yer code.
    Maybe typo in the command name, for which the vkGetInstanceProcAddr would return nullptr.
    Or you do not have VK_KHR_win32_surface extension enabled.
    Last edited by krOoze; 06-07-2018 at 03:05 AM.

  8. #8
    Junior Member
    Join Date
    May 2018
    Posts
    10
    Solved! It Was a vkGetInstanceProcAddr problem, I thought that I called this function but it seems that I forgot.
    Anyway thank you very much krOoze, you helped me a lot!
    The problem is that I use #define macro and somewhere I forgot to call it.

    Anyway I don't understand a thing, I'm following Vulkan cookbook examples, and I have (for example) in header file: #define EXPORTED_VULKAN_FUNCTION( name ) extern PFN_##name name;
    and then in cpp file #define EXPORTED_VULKAN_FUNCTION( name ) PFN_##name name;

    Why I can't define in header file like in cpp? If I put directly in head#define EXPORTED_VULKAN_FUNCTION( name ) PFN_##name name; I got LNK2005 error, like "functions already defined in file.obj"
    Last edited by Aidoru; 06-07-2018 at 05:14 AM.

  9. #9
    Senior Member
    Join Date
    Mar 2016
    Posts
    308
    I would assume because of the One Definition Rule. Do you have include guards in the header?

  10. #10
    Junior Member
    Join Date
    May 2018
    Posts
    10
    I can't check atm, but I think that there is the #pragma once, but is it not enough to call header inly once?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean