Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector read functions don't use command queue #690

Open
Slonegg opened this issue Feb 13, 2017 · 2 comments
Open

Vector read functions don't use command queue #690

Slonegg opened this issue Feb 13, 2017 · 2 comments
Assignees
Labels

Comments

@Slonegg
Copy link
Contributor

Slonegg commented Feb 13, 2017

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.

@jszuppe jszuppe self-assigned this Apr 20, 2017
@jszuppe
Copy link
Contributor

jszuppe commented Apr 20, 2017

I guess there's nothing wrong in adding front(), back() and at() functions that take command queue argument.

@jszuppe
Copy link
Contributor

jszuppe commented Apr 22, 2017

After looking at the code, I think we can't do it without adding command_queue to buffer_value class.

I've noticed inconsistent behavior when reading values from vector using .back() routine.

I think commit 21ff71e should fix your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants