SHARE
TWEET
Untitled
a guest
Mar 14th, 2017
69
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- external_image_info = ffi.automem(vulkan.vk.ExternalMemoryImageCreateInfoKHX)
- external_image_info[0] = {
- handleTypes = "OPAQUE_FD_BIT_KHX"
- }
- external_image = vulkan.Image(gpu, {
- pNext = external_image_info
- imageType = "2D"
- format = "R8G8B8A8_UNORM"
- extent = {width = 512, height = 512, depth = 1}
- mipLevels = 1
- arrayLayers = 1
- samples = "1_BIT"
- tiling = "OPTIMAL"
- usage = ["SAMPLED_BIT", "COLOR_ATTACHMENT_BIT"]
- initialLayout = "COLOR_ATTACHMENT_OPTIMAL"
- })
- req = external_image.getMemoryRequirements()
- memoryIndex = null
- for memtype in warpgpu.memory_report(gpu.physicalDevice).types
- if 1 & (req.memoryTypeBits >> memtype.index) != 0
- memoryIndex = memtype.index
- assert memoryIndex, "No memory available for this resource"
- mem_info = ffi.automem(vulkan.vk.MemoryAllocateInfo)
- export_info = ffi.automem(vulkan.vk.ExportMemoryAllocateInfoKHX)
- export_info[0] = {
- handleTypes = "OPAQUE_FD_BIT_KHX"
- }
- mem_info[0] = {
- #pNext = export_info # if I comment this away, no crash.
- allocationSize = 1024 * 32
- memoryTypeIndex = memoryIndex
- }
- mem = gpu.allocateMemory(mem_info) #CRASH
- external_image.bindMemory(mem, 0)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

