2016-05-22 7 views
1
alias PFN_vkDebugReportCallbackEXT = 
    VkBool32 function(VkDebugReportFlagsEXT flags, 
        VkDebugReportObjectTypeEXT objectType, 
        uint64_t object, size_t location, 
        int32_t messageCode, const char* pLayerPrefix, 
        const char* pMessage, void* pUserData); 

struct VkDebugReportCallbackCreateInfoEXT { 
    VkStructureType    sType = VkStructureType.VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT; 
    const(void)*     pNext; 
    VkDebugReportFlagsEXT   flags; 
    PFN_vkDebugReportCallbackEXT pfnCallback; 
    void*       pUserData; 
} 

..Warum markiert D diese Funktion als pure nothrow @nogc?

VkBool32 MyDebugReportCallback(
    VkDebugReportFlagsEXT  flags, 
    VkDebugReportObjectTypeEXT objectType, 
    uint64_t     object, 
    size_t      location, 
    int32_t      messageCode, 
    const char*     pLayerPrefix, 
    const char*     pMessage, 
    void*      pUserData) 
{ 
    return VK_FALSE; 
} 
auto debugcallbackCreateInfo = VkDebugReportCallbackCreateInfoEXT(
    VkStructureType.VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, 
    null, 
    VkDebugReportFlagBitsEXT.VK_DEBUG_REPORT_ERROR_BIT_EXT, 
    &MyDebugReportCallback, 
    null 
); 

Error: cannot implicitly convert expression (& MyDebugReportCallback) of type uint function(uint flags, VkDebugReportObjectTypeEXT objectType, ulong object, ulong location, int messageCode, const(char*) pLayerPrefix, const(char*) pMessage, void* pUserData) to uint function(uint flags, VkDebugReportObjectTypeEXT objectType, ulong object, ulong location, int messageCode, const(char*) pLayerPrefix, const(char*) pMessage, void* pUserData) pure nothrow @nogc

Ich verstehe nicht, warum PFN_vkDebugReportCallbackEXT reine nothrow und @nogc? Ich möchte nur writeln von innerhalb MyDebugReportCallback anrufen.

Antwort

0

Nun, die Antwort war ziemlich offensichtlich. Es ist in einem reinen, nothrow und @nogc

https://github.com/ParticlePeter/ErupteD/blob/master/source/erupted/types.d#L12

+0

blockiert Aber warum ist es da? Ich denke, es war ein Benutzerfehler ... der Callback braucht diese Dinge nicht * zu müssen * und der Autor hat die Definition einfach nicht an den richtigen Ort gebracht. –

+0

@ AdamD.Ruppe Ja Ich habe bereits ein Problem geöffnet, https://github.com/ParticlePeter/ErupteD/issues/2 –

Verwandte Themen