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

Józef Kucia joseph.kucia at gmail.com
Sat Mar 19 04:46:40 CDT 2016


On Sat, Mar 19, 2016 at 10:15 AM, Henri Verbeet <hverbeet at gmail.com> wrote:
> On 18 March 2016 at 12:30, Józef Kucia <jkucia at codeweavers.com> wrote:
>> +HRESULT wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_offset,
>> +        struct wined3d_buffer *src_buffer, unsigned int src_offset, unsigned int size)
>> +{
>> +    BYTE *dst_buffer_mem, *src_buffer_mem;
>> +    const struct wined3d_gl_info *gl_info;
>> +    struct wined3d_context *context;
>> +    struct wined3d_device *device;
>> +
>> +    device = dst_buffer->resource.device;
>> +
>> +    context = context_acquire(device, NULL);
>> +    gl_info = context->gl_info;
>> +
>> +    buffer_internal_preload(dst_buffer, context, NULL);
>> +    buffer_internal_preload(src_buffer, context, NULL);
>> +
>> +    dst_buffer_mem = dst_buffer->resource.heap_memory;
>> +    src_buffer_mem = src_buffer->resource.heap_memory;
> This is probably fine, but I wonder why you're not using
> buffer_get_memory()? Somewhat related, there may be something to be
> said for the function just taking wined3d_bo_address structures and a
> size, although I don't have an immediate use for that yet.

You're right, buffer_get_memory() should be better in this case.

>
>> +
>> +    if (!dst_buffer_mem && !src_buffer_mem)
>> +    {
>> +        if (!gl_info->supported[ARB_COPY_BUFFER])
>> +        {
>> +            FIXME("Direct buffer copy not supported.\n");
>> +            return WINED3DERR_INVALIDCALL;
>> +        }
> I think that's fine, but we could of course implement that case by
> mapping the buffers and using memcpy().
>
>

It can be implemented. However, I don't expect it to be very useful in practice.



More information about the wine-devel mailing list