Skip to content

Remove .device_size from vk::*_buffer_params parameter struct and just take the whole span. #34

@SpinnerX

Description

@SpinnerX

Take a look into this situation for vk::buffer_stream. There is a parameter called .device_size to specify the size in bytes of the total data to the buffer stream.

I realize this causes more requirements to ensure the usability for specifying information about its metadata. By passing in std::span, you should be able to extract the size of bytes through the .size_bytes() API, which span gives you.

Currently Specifying Parameters

buffer_parameters index_params = {
    .device_size = p_info.indices.size_bytes(),
    .physical_memory_properties = p_info.phsyical_memory_properties,
    .property_flags = memory_property::host_visible_bit | memory_property::host_cached_bit,
    .usage = buffer_usage::index_buffer_bit,
    .debug_name = p_info.debug_name.c_str(),
    .vkSetDebugUtilsObjectNameEXT = p_info.vkSetDebugUtilsObjectNameEXT
};

vk::buffer_stream32 index_buffer = buffer_stream32(logical_device, index_params);

Applied New Parameter Change

The constructor will accept indices. Writing the indices of meshes at object construction.

std::array<uint32_t, 4> indices = {0, 1, 1, 2};
buffer_parameters index_params = {
    // .device_size // remove this
    .physical_memory_properties = p_info.phsyical_memory_properties,
    .property_flags = memory_property::host_visible_bit | memory_property::host_cached_bit,
    .usage = buffer_usage::index_buffer_bit,
    .debug_name = p_info.debug_name.c_str(),
    .vkSetDebugUtilsObjectNameEXT = p_info.vkSetDebugUtilsObjectNameEXT
};


vk::buffer_stream32 index_buffer = buffer_stream32(logical_device, indices, index_params);

Requirement for Successfully Completing this Task

Goals behind this change is rather then having to specify extra parameters on the user-side. You sho

Goals behind this change:
Is to remove redundancy in the configuration step for the buffer streams. This task is relatively simple to get working.

Metadata

Metadata

Assignees

Labels

💳 Tech DebtTasks that have some kind of user API tech debt🚪entryTasks suitable for new contributors to the codebase. Easy to getting started.

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions