wijiler
February 19, 2024, 4:50am
1
As in title when I try to vkGetBufferDeviceAddress
it gives me a validation error
Heres my enabling of the device buffer address
enabledynRend:VkPhysicalDeviceVulkan13Features = .{};
enabledynRend.dynamicRendering = VK_TRUE;
enabledynRend.synchronization2 = VK_TRUE;
enabledevADDR:VkPhysicalDeviceVulkan12Features;
enabledevADDR.bufferDeviceAddress = VK_TRUE;
enabledevADDR.descriptorIndexing = VK_TRUE;
features:[2] *void;
features[0] = *enabledynRend;
features[1] = *enabledevADDR;
ldCreateInfo:VkDeviceCreateInfo = .{};
ldCreateInfo.pNext = features.data.*;
ldCreateInfo.pQueueCreateInfos = *createqInfo;
ldCreateInfo.queueCreateInfoCount = 1;
ldCreateInfo.pEnabledFeatures = *devfeatures;
ldCreateInfo.enabledExtensionCount = xx device_extensions.count;
ldCreateInfo.ppEnabledExtensionNames = device_extensions.data;
ldCreateInfo.enabledLayerCount = 0;
{
result := vkCreateDevice(vk.pDevice,*ldCreateInfo,null,*vk.lDevice);
if result != .VK_SUCCESS {
log(.Error,sprint("could not create logical device because %\n",result));
}
}
log(.Info,"succesfully created logical device");
wijiler
February 19, 2024, 4:50am
2
Heres how Im creating the buffer
alloc_buffers :: (size:u64,use:VkBufferUsageFlags,r:*fwdpp_r) -> buffer {
assert(size >= 128 && size <= U32_MAX);
buf:buffer;
bufferCI:VkBufferCreateInfo = .{};
bufferCI.size = size;
bufferCI.usage = xx use;
bufferCI.sharingMode = .EXCLUSIVE; // we want to ensure no shenanigans happen
vkCreateBuffer(r.pipeline.lDevice,*bufferCI,null,*buf.vBuffer);
buf.type = use;
memprops:VkPhysicalDeviceMemoryProperties;
vkGetPhysicalDeviceMemoryProperties(r.pipeline.pDevice,*memprops);
index:u32 = find_gpu_only_mem(memprops);
allocInfo:VkMemoryAllocateInfo = .{};
vkMemReq:VkMemoryRequirements = .{};
vkGetBufferMemoryRequirements(r.pipeline.lDevice,buf.vBuffer,*vkMemReq);
allocInfo.allocationSize = size + vkMemReq.alignment;
allocInfo.memoryTypeIndex = index;
devMem:VkDeviceMemory;
vkAllocateMemory(r.pipeline.lDevice,*allocInfo,null,*devMem);
print("%\n",vkMemReq.alignment);
offset:u64 = 0;
vkBindBufferMemory(r.pipeline.lDevice,buf.vBuffer,devMem,offset);
return buf;
}
find_gpu_only_mem :: (memProps:VkPhysicalDeviceMemoryProperties) -> u32 {
for 0..31 {
if memProps.memoryTypes[it].propertyFlags == .DEVICE_LOCAL_BIT { print("%\n",it); return xx it; }
}
print("no_local_bits\n");
return 0;
}
wijiler
February 19, 2024, 4:52am
3
Heres the call causing the validation error
mesh.vertexLoc = vkGetBufferDeviceAddress(r.pipeline.lDevice,*devAddrInfo);
wijiler
February 19, 2024, 4:53am
4
and heres the error
16
VUID-vkGetBufferDeviceAddress-bufferDeviceAddress-03324(ERROR / SPEC): msgNum: -1505668325 - Validation Error: [ VUID-vkGetBufferDeviceAddress-bufferDeviceAddress-03324 ] Object 0: handle = 0x9fde6b0000000014, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xa641531b | vkGetBufferDeviceAddress: The bufferDeviceAddress feature must: be enabled. The Vulkan spec states: The bufferDeviceAddress or VkPhysicalDeviceBufferDeviceAddressFeaturesEXT::bufferDeviceAddress feature must be enabled (https://vulkan.lunarg.com/doc/view/1.3.224.1/windows/1.3-extensions/vkspec.html#VUID-vkGetBufferDeviceAddress-bufferDeviceAddress-03324)
Objects: 1
[0] 0x9fde6b0000000014, type: 9, name: NULL
Please do not post pictures of text; post the actual text itself.
wijiler
February 19, 2024, 4:09pm
7
ok, will do, thank you for the guidelines
No, it isn’t. That’s you using “device buffer address”. Enabling it happens at device creation time, via vkCreateDevice
.
This is done by putting a VkPhysicalDeviceVulkan12Features
object in the pNext
chain of VkDeviceCreateInfo
. And that object’s bufferDeviceAddress
must be set to true. But you also need to check if the feature is available.
wijiler
February 19, 2024, 4:41pm
9
sorry I pasted the wrong text, let me fix that
wijiler
February 19, 2024, 4:43pm
10
alright I have fixed the text, am I enabling it correctly?
wijiler
February 19, 2024, 6:55pm
11
ok I needed to put devicefeatures12 in the pnext of devicefeatures 13