[{"data":1,"prerenderedAt":629},["ShallowReactive",2],{"txrJU6Tyxq":3},{"title":4,"description":5,"parent":6,"type":7,"xrefs":8,"body":10,"_type":628,"_id":4},"PFN_vkAllocationFunction","Application-defined memory allocation function","VK_VERSION_1_0","funcpointers",[9],"VkAllocationCallbacks",{"type":11,"children":12,"toc":626},"root",[13,30,364,450,455,498,559,597,620],{"type":14,"tag":15,"props":16,"children":17},"element","p",{},[18,21,28],{"type":19,"value":20},"text","The type of ",{"type":14,"tag":22,"props":23,"children":25},"code",{"className":24},[],[26],{"type":19,"value":27},"pfnAllocation",{"type":19,"value":29}," is:",{"type":14,"tag":31,"props":32,"children":33},"code-group",{},[34,129],{"type":14,"tag":35,"props":36,"children":42},"pre",{"className":37,"code":38,"filename":39,"language":40,"meta":41,"style":41},"language-c shiki shiki-themes github-light-default github-dark-default","typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)(\n void* pUserData,\n size_t size,\n size_t alignment,\n VkSystemAllocationScope allocationScope);\n","C","c","",[43],{"type":14,"tag":22,"props":44,"children":45},{"__ignoreMap":41},[46,79,93,107,120],{"type":14,"tag":47,"props":48,"children":51},"span",{"class":49,"line":50},"line",1,[52,58,63,69,74],{"type":14,"tag":47,"props":53,"children":55},{"style":54},"--shiki-default:#CF222E;--shiki-dark:#FF7B72",[56],{"type":19,"value":57},"typedef",{"type":14,"tag":47,"props":59,"children":60},{"style":54},[61],{"type":19,"value":62}," void*",{"type":14,"tag":47,"props":64,"children":66},{"style":65},"--shiki-default:#1F2328;--shiki-dark:#E6EDF3",[67],{"type":19,"value":68}," (VKAPI_PTR ",{"type":14,"tag":47,"props":70,"children":71},{"style":54},[72],{"type":19,"value":73},"*",{"type":14,"tag":47,"props":75,"children":76},{"style":65},[77],{"type":19,"value":78},"PFN_vkAllocationFunction)(\n",{"type":14,"tag":47,"props":80,"children":82},{"class":49,"line":81},2,[83,88],{"type":14,"tag":47,"props":84,"children":85},{"style":54},[86],{"type":19,"value":87}," void*",{"type":14,"tag":47,"props":89,"children":90},{"style":65},[91],{"type":19,"value":92}," pUserData,\n",{"type":14,"tag":47,"props":94,"children":96},{"class":49,"line":95},3,[97,102],{"type":14,"tag":47,"props":98,"children":99},{"style":54},[100],{"type":19,"value":101}," size_t",{"type":14,"tag":47,"props":103,"children":104},{"style":65},[105],{"type":19,"value":106}," size,\n",{"type":14,"tag":47,"props":108,"children":110},{"class":49,"line":109},4,[111,115],{"type":14,"tag":47,"props":112,"children":113},{"style":54},[114],{"type":19,"value":101},{"type":14,"tag":47,"props":116,"children":117},{"style":65},[118],{"type":19,"value":119}," alignment,\n",{"type":14,"tag":47,"props":121,"children":123},{"class":49,"line":122},5,[124],{"type":14,"tag":47,"props":125,"children":126},{"style":65},[127],{"type":19,"value":128}," VkSystemAllocationScope allocationScope);\n",{"type":14,"tag":35,"props":130,"children":135},{"className":131,"code":132,"filename":133,"language":134,"meta":41,"style":41},"language-rs shiki shiki-themes github-light-default github-dark-default","pub type PFN_vkAllocationFunction = Option\u003C\n unsafe extern \"system\" fn(\n p_user_data: *mut std::ffi::c_void,\n size: usize,\n alignment: usize,\n allocation_scope: vk::SystemAllocationScope,\n ) -> *mut std::ffi::c_void\n>;\n","Rust","rs",[136],{"type":14,"tag":22,"props":137,"children":138},{"__ignoreMap":41},[139,173,201,243,265,285,316,355],{"type":14,"tag":47,"props":140,"children":141},{"class":49,"line":50},[142,147,152,158,163,168],{"type":14,"tag":47,"props":143,"children":144},{"style":54},[145],{"type":19,"value":146},"pub",{"type":14,"tag":47,"props":148,"children":149},{"style":54},[150],{"type":19,"value":151}," type",{"type":14,"tag":47,"props":153,"children":155},{"style":154},"--shiki-default:#953800;--shiki-dark:#FFA657",[156],{"type":19,"value":157}," PFN_vkAllocationFunction",{"type":14,"tag":47,"props":159,"children":160},{"style":54},[161],{"type":19,"value":162}," =",{"type":14,"tag":47,"props":164,"children":165},{"style":154},[166],{"type":19,"value":167}," Option",{"type":14,"tag":47,"props":169,"children":170},{"style":65},[171],{"type":19,"value":172},"\u003C\n",{"type":14,"tag":47,"props":174,"children":175},{"class":49,"line":81},[176,181,186,191,196],{"type":14,"tag":47,"props":177,"children":178},{"style":54},[179],{"type":19,"value":180}," unsafe",{"type":14,"tag":47,"props":182,"children":183},{"style":54},[184],{"type":19,"value":185}," extern",{"type":14,"tag":47,"props":187,"children":188},{"style":65},[189],{"type":19,"value":190}," \"system\" ",{"type":14,"tag":47,"props":192,"children":193},{"style":54},[194],{"type":19,"value":195},"fn",{"type":14,"tag":47,"props":197,"children":198},{"style":65},[199],{"type":19,"value":200},"(\n",{"type":14,"tag":47,"props":202,"children":203},{"class":49,"line":95},[204,209,214,219,224,229,234,238],{"type":14,"tag":47,"props":205,"children":206},{"style":65},[207],{"type":19,"value":208}," p_user_data",{"type":14,"tag":47,"props":210,"children":211},{"style":54},[212],{"type":19,"value":213},":",{"type":14,"tag":47,"props":215,"children":216},{"style":54},[217],{"type":19,"value":218}," *mut",{"type":14,"tag":47,"props":220,"children":221},{"style":65},[222],{"type":19,"value":223}," std",{"type":14,"tag":47,"props":225,"children":226},{"style":54},[227],{"type":19,"value":228},"::",{"type":14,"tag":47,"props":230,"children":231},{"style":65},[232],{"type":19,"value":233},"ffi",{"type":14,"tag":47,"props":235,"children":236},{"style":54},[237],{"type":19,"value":228},{"type":14,"tag":47,"props":239,"children":240},{"style":65},[241],{"type":19,"value":242},"c_void,\n",{"type":14,"tag":47,"props":244,"children":245},{"class":49,"line":109},[246,251,255,260],{"type":14,"tag":47,"props":247,"children":248},{"style":65},[249],{"type":19,"value":250}," size",{"type":14,"tag":47,"props":252,"children":253},{"style":54},[254],{"type":19,"value":213},{"type":14,"tag":47,"props":256,"children":257},{"style":154},[258],{"type":19,"value":259}," usize",{"type":14,"tag":47,"props":261,"children":262},{"style":65},[263],{"type":19,"value":264},",\n",{"type":14,"tag":47,"props":266,"children":267},{"class":49,"line":122},[268,273,277,281],{"type":14,"tag":47,"props":269,"children":270},{"style":65},[271],{"type":19,"value":272}," alignment",{"type":14,"tag":47,"props":274,"children":275},{"style":54},[276],{"type":19,"value":213},{"type":14,"tag":47,"props":278,"children":279},{"style":154},[280],{"type":19,"value":259},{"type":14,"tag":47,"props":282,"children":283},{"style":65},[284],{"type":19,"value":264},{"type":14,"tag":47,"props":286,"children":288},{"class":49,"line":287},6,[289,294,298,303,307,312],{"type":14,"tag":47,"props":290,"children":291},{"style":65},[292],{"type":19,"value":293}," allocation_scope",{"type":14,"tag":47,"props":295,"children":296},{"style":54},[297],{"type":19,"value":213},{"type":14,"tag":47,"props":299,"children":300},{"style":65},[301],{"type":19,"value":302}," vk",{"type":14,"tag":47,"props":304,"children":305},{"style":54},[306],{"type":19,"value":228},{"type":14,"tag":47,"props":308,"children":309},{"style":154},[310],{"type":19,"value":311},"SystemAllocationScope",{"type":14,"tag":47,"props":313,"children":314},{"style":65},[315],{"type":19,"value":264},{"type":14,"tag":47,"props":317,"children":319},{"class":49,"line":318},7,[320,325,330,334,338,342,346,350],{"type":14,"tag":47,"props":321,"children":322},{"style":65},[323],{"type":19,"value":324}," ) ",{"type":14,"tag":47,"props":326,"children":327},{"style":54},[328],{"type":19,"value":329},"->",{"type":14,"tag":47,"props":331,"children":332},{"style":54},[333],{"type":19,"value":218},{"type":14,"tag":47,"props":335,"children":336},{"style":65},[337],{"type":19,"value":223},{"type":14,"tag":47,"props":339,"children":340},{"style":54},[341],{"type":19,"value":228},{"type":14,"tag":47,"props":343,"children":344},{"style":65},[345],{"type":19,"value":233},{"type":14,"tag":47,"props":347,"children":348},{"style":54},[349],{"type":19,"value":228},{"type":14,"tag":47,"props":351,"children":352},{"style":65},[353],{"type":19,"value":354},"c_void\n",{"type":14,"tag":47,"props":356,"children":358},{"class":49,"line":357},8,[359],{"type":14,"tag":47,"props":360,"children":361},{"style":65},[362],{"type":19,"value":363},">;\n",{"type":14,"tag":365,"props":366,"children":367},"ul",{},[368,394,405,423],{"type":14,"tag":369,"props":370,"children":371},"li",{},[372,378,380,386,387,392],{"type":14,"tag":22,"props":373,"children":375},{"className":374},[],[376],{"type":19,"value":377},"pUserData",{"type":19,"value":379}," is the value specified for\n",{"type":14,"tag":381,"props":382,"children":384},"a",{"href":383},"/man/VkAllocationCallbacks",[385],{"type":19,"value":9},{"type":19,"value":228},{"type":14,"tag":22,"props":388,"children":390},{"className":389},[],[391],{"type":19,"value":377},{"type":19,"value":393}," in the allocator specified\nby the application.",{"type":14,"tag":369,"props":395,"children":396},{},[397,403],{"type":14,"tag":22,"props":398,"children":400},{"className":399},[],[401],{"type":19,"value":402},"size",{"type":19,"value":404}," is the size in bytes of the requested allocation.",{"type":14,"tag":369,"props":406,"children":407},{},[408,414,416,421],{"type":14,"tag":22,"props":409,"children":411},{"className":410},[],[412],{"type":19,"value":413},"alignment",{"type":19,"value":415}," is the requested alignment of the allocation in bytes\nand ",{"type":14,"tag":417,"props":418,"children":420},"normative",{"type":419},"must",[],{"type":19,"value":422}," be a power of two.",{"type":14,"tag":369,"props":424,"children":425},{},[426,432,434,440,442,448],{"type":14,"tag":22,"props":427,"children":429},{"className":428},[],[430],{"type":19,"value":431},"allocationScope",{"type":19,"value":433}," is a ",{"type":14,"tag":381,"props":435,"children":437},{"href":436},"/man/VkSystemAllocationScope",[438],{"type":19,"value":439},"VkSystemAllocationScope",{"type":19,"value":441}," value\nspecifying the allocation scope of the lifetime of the allocation, as\ndescribed ",{"type":14,"tag":381,"props":443,"children":445},{"href":444},"/man/VkSystemAllocationScope#memory-host-allocation-scope",[446],{"type":19,"value":447},"here",{"type":19,"value":449},".",{"type":14,"tag":451,"props":452,"children":454},"anchor",{"id":453},"vkAllocationFunction\\_return\\_rules",[],{"type":14,"tag":15,"props":456,"children":457},{},[458,460,465,467,470,472,478,480,483,485,490,492,497],{"type":19,"value":459},"If ",{"type":14,"tag":22,"props":461,"children":463},{"className":462},[],[464],{"type":19,"value":27},{"type":19,"value":466}," is unable to allocate the requested memory, it ",{"type":14,"tag":417,"props":468,"children":469},{"type":419},[],{"type":19,"value":471},"\nreturn ",{"type":14,"tag":22,"props":473,"children":475},{"className":474},[],[476],{"type":19,"value":477},"NULL",{"type":19,"value":479},".\nIf the allocation was successful, it ",{"type":14,"tag":417,"props":481,"children":482},{"type":419},[],{"type":19,"value":484}," return a valid pointer to memory\nallocation containing at least ",{"type":14,"tag":22,"props":486,"children":488},{"className":487},[],[489],{"type":19,"value":402},{"type":19,"value":491}," bytes, and with the pointer value\nbeing a multiple of ",{"type":14,"tag":22,"props":493,"children":495},{"className":494},[],[496],{"type":19,"value":413},{"type":19,"value":449},{"type":14,"tag":499,"props":500,"children":501},"note",{},[502,513],{"type":14,"tag":15,"props":503,"children":504},{},[505,507,511],{"type":19,"value":506},"Correct Vulkan operation ",{"type":14,"tag":417,"props":508,"children":510},{"type":509},"cannot",[],{"type":19,"value":512}," be assumed if the application does not\nfollow these rules.",{"type":14,"tag":15,"props":514,"children":515},{},[516,518,523,525,531,533,536,538,544,546,552,554,557],{"type":19,"value":517},"For example, ",{"type":14,"tag":22,"props":519,"children":521},{"className":520},[],[522],{"type":19,"value":27},{"type":19,"value":524}," (or ",{"type":14,"tag":22,"props":526,"children":528},{"className":527},[],[529],{"type":19,"value":530},"pfnReallocation",{"type":19,"value":532},") could cause\ntermination of running Vulkan instance(s) on a failed allocation for\ndebugging purposes, either directly or indirectly.\nIn these circumstances, it ",{"type":14,"tag":417,"props":534,"children":535},{"type":509},[],{"type":19,"value":537}," be assumed that any part of any affected\n",{"type":14,"tag":381,"props":539,"children":541},{"href":540},"/man/VkInstance",[542],{"type":19,"value":543},"VkInstance",{"type":19,"value":545}," objects are going to operate correctly (even\n",{"type":14,"tag":381,"props":547,"children":549},{"href":548},"/man/vkDestroyInstance",[550],{"type":19,"value":551},"vkDestroyInstance",{"type":19,"value":553},"), and the application ",{"type":14,"tag":417,"props":555,"children":556},{"type":419},[],{"type":19,"value":558}," ensure it cleans up\nproperly via other means (e.g. process termination).",{"type":14,"tag":15,"props":560,"children":561},{},[562,563,568,570,575,577,580,582,588,590,596],{"type":19,"value":459},{"type":14,"tag":22,"props":564,"children":566},{"className":565},[],[567],{"type":19,"value":27},{"type":19,"value":569}," returns ",{"type":14,"tag":22,"props":571,"children":573},{"className":572},[],[574],{"type":19,"value":477},{"type":19,"value":576},", and if the implementation is unable\nto continue correct processing of the current command without the requested\nallocation, it ",{"type":14,"tag":417,"props":578,"children":579},{"type":419},[],{"type":19,"value":581}," treat this as a runtime error, and generate\n",{"type":14,"tag":22,"props":583,"children":585},{"className":584},[],[586],{"type":19,"value":587},"VK_ERROR_OUT_OF_HOST_MEMORY",{"type":19,"value":589}," at the appropriate time for the command in\nwhich the condition was detected, as described in ",{"type":14,"tag":381,"props":591,"children":593},{"href":592},"/404#fundamentals-errorcodes",[594],{"type":19,"value":595},"Return Codes",{"type":19,"value":449},{"type":14,"tag":15,"props":598,"children":599},{},[600,602,606,608,611,613,618],{"type":19,"value":601},"If the implementation is able to continue correct processing of the current\ncommand without the requested allocation, then it ",{"type":14,"tag":417,"props":603,"children":605},{"type":604},"may",[],{"type":19,"value":607}," do so, and ",{"type":14,"tag":417,"props":609,"children":610},{"type":419},[],{"type":19,"value":612}," not\ngenerate ",{"type":14,"tag":22,"props":614,"children":616},{"className":615},[],[617],{"type":19,"value":587},{"type":19,"value":619}," as a result of this failed\nallocation.",{"type":14,"tag":621,"props":622,"children":623},"style",{},[624],{"type":19,"value":625},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":41,"searchDepth":81,"depth":81,"links":627},[],"markdown",1725732532618]