On 20 March 2016 at 23:15, Józef Kucia jkucia@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.
On Sun, Mar 20, 2016 at 11:31 PM, Henri Verbeet hverbeet@gmail.com wrote:
On 20 March 2016 at 23:15, Józef Kucia jkucia@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.
I'm not sure I can do this. If a buffer is double-buffered, I still have to copy through system memory, even though the "buffer_object" field is non-zero.