#DescriptorBufferInfo offset error

38 messages · Page 1 of 1 (latest)

fading vine
#

may code for looping DescriptorBufferInfo

        var descriptorBuffers = ArrayList(vk.DescriptorBufferInfo).init(Self.allocator);

        for (data.items, 0..) |value, i| {
            try descriptorBuffers.append(vk.DescriptorBufferInfo{
                .buffer = value.local_memory_Buffer,
                .offset = i,
                .range = value.size,
            });
        }

data.items type

const memory_output = struct {
    local_memory_Buffer: vk.Buffer,
    size: u32,
};

error i get

VUID-VkWriteDescriptorSet-descriptorType-00328(ERROR / SPEC): msgNum: -368569266 - Validation Error: [ VUID-VkWriteDescriptorSet-descriptorType-00328 ] | MessageID = 0xea08144e | vkUpdateDescriptorSets(): pDescriptorWrites[0].pBufferInfo[1].offset (0x1) must be a multiple of device limit minStorageBufferOffsetAlignment 0x4. The Vulkan spec states: If descriptorType is VK_DESCRIPTOR_TYPE_STORAGE_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, the offset member of each element of pBufferInfo must be a multiple of VkPhysicalDeviceLimits::minStorageBufferOffsetAlignment (https://vulkan.lunarg.com/doc/view/1.3.261.1/windows/1.3-extensions/vkspec.html#VUID-VkWriteDescriptorSet-descriptorType-00328)
#

i am new any help is welcome ❤️

flat pawn
#

You're offsetting into the buffer by 'i' bytes. Which isn't allowed. You need to offset by at least minStorageBufferOffsetAlignment (4 on your machine).

Are you really intending to have multiple buffers of only 1 byte?

fading vine
#

ohh i is 64 bit

#

i changed to

        for (data.items, 0..) |value, i| {
            try descriptorBuffers.append(vk.DescriptorBufferInfo{
                .buffer = value.local_memory_Buffer,
                .offset = @as(u32, @intCast(i)),
                .range = value.size,
            });
        }
#

still same error

#

Are you really intending to have multiple buffers of only 1 byte? > not really

hollow plover
#

that is not what they are telling you

#

it does not matter what type the value is

#

the offset value needs to be divisible by minStorageBufferOffsetAlignment

#

you can get that from the physical device

#

VkPhysicalDeviceProperties::limits::minStorageBufferOffsetAlignment

fading vine
#

oh now i get it

hollow plover
#

i have no idea why you would be offsetting your SSBO/UBO by 1 byte

#

that doesn't even make sense to me

#

you're just gonna get NaNs in everything or garbage data

fading vine
#

xD i am new

#

well you right

hollow plover
#

it's good to know exactly what you want to do before you start writing code

fading vine
#

well i trying to get this 1 + 1 work on gpu

#

GPU 1+1 accelerated

hollow plover
#

if you are doing a simple compute example, i recommend adding two buffers together

#

instead of adding a single value

#

make a compute shader that adds together a gigabite of integers or something

#

it'll teach you more, trust me, and you will be surprised at how fast it is

fading vine
#

well i working on it
i just pick up vulkan last week
and i had no idea how to get this working with zig and stuff

hollow plover
#

do you know C++

#

or C in that matter

fading vine
#

i know C

#

not much c++

hollow plover
fading vine
#

yeah but i want use reusable code
last time i get it to work but i duplicate all codes

hollow plover
#

wdym reusable code

#

what code are you trying to reuse

fading vine
#

like allocating function for buffer

#

i did this example on zig