Skip to content

Vector read functions don't use command queue #690

Open
@Slonegg

Description

@Slonegg

I've noticed inconsistent behavior when reading values from vector using .back() routine. Digging it I've realized that essentially most of the vector read routines rely on the buffer_value class to read values from buffer and it uses some dummy command queue.

    operator value_type() const
    {
        if(m_buffer.get()){
            const context &context = m_buffer.get_context();
            const device &device = context.get_device();
            command_queue queue(context, device);

            return detail::read_single_value<T>(m_buffer, m_index / sizeof(T), queue);
        }
        else {
            return m_value;
        }
}

I suggest to add command queue argument to read routines, this way you can ensure that operations on the buffer have been performed before actually reading values from it.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions