[PATCH v2 2/6] wined3d: Implement copying of buffer resources.

Henri Verbeet hverbeet at gmail.com
Sun Mar 20 17:31:59 CDT 2016


On 20 March 2016 at 23:15, Józef Kucia <jkucia at codeweavers.com> wrote:
> +    buffer_get_memory(dst_buffer, context, &dst_bo_address);
> +    buffer_get_memory(src_buffer, context, &src_bo_address);
> +
> +    dst_buffer_mem = dst_buffer->resource.heap_memory;
> +    src_buffer_mem = src_buffer->resource.heap_memory;
> +
> +    if (!dst_buffer_mem && !src_buffer_mem)
> +    {
The way struct wined3d_bo_address works is that if the "buffer_object"
field is non-zero, the "addr" field is relative to the start of the
corresponding buffer object, and otherwise it's relative to the start
of system memory. I.e., the correct check here should be for
src_bo_address.buffer_object and dst_bo_address.buffer_object being
non-zero, and you should be able to use src_bo_address.addr and
dst_bo_address.addr instead of src_buffer_mem and dst_buffer_mem in
most other places.

> +        if (gl_info->supported[ARB_COPY_BUFFER])
> +        {
> +            GL_EXTCALL(glBindBuffer(GL_COPY_READ_BUFFER, src_bo_address.buffer_object));
> +            GL_EXTCALL(glBindBuffer(GL_COPY_WRITE_BUFFER, dst_bo_address.buffer_object));
> +            GL_EXTCALL(glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, src_offset, dst_offset, size));
The "addr" field is always going to be NULL in practice for buffer
resources, but strictly speaking you should use something like
"(INT_PTR)src_bo_address.add + src_offset" instead of just
"src_offset" here.



More information about the wine-devel mailing list