wined3d: Introduce separate read and write resource map flags.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0282f3aade
commit
acc0f49aae
|
@ -758,21 +758,23 @@ DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type)
|
||||||
switch (map_type)
|
switch (map_type)
|
||||||
{
|
{
|
||||||
case D3D11_MAP_WRITE:
|
case D3D11_MAP_WRITE:
|
||||||
|
return WINED3D_MAP_WRITE;
|
||||||
|
|
||||||
case D3D11_MAP_READ_WRITE:
|
case D3D11_MAP_READ_WRITE:
|
||||||
return 0;
|
return WINED3D_MAP_READ | WINED3D_MAP_WRITE;
|
||||||
|
|
||||||
case D3D11_MAP_READ:
|
case D3D11_MAP_READ:
|
||||||
return WINED3D_MAP_READONLY;
|
return WINED3D_MAP_READ;
|
||||||
|
|
||||||
case D3D11_MAP_WRITE_DISCARD:
|
case D3D11_MAP_WRITE_DISCARD:
|
||||||
return WINED3D_MAP_DISCARD;
|
return WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD;
|
||||||
|
|
||||||
case D3D11_MAP_WRITE_NO_OVERWRITE:
|
case D3D11_MAP_WRITE_NO_OVERWRITE:
|
||||||
return WINED3D_MAP_NOOVERWRITE;
|
return WINED3D_MAP_WRITE | WINED3D_MAP_NOOVERWRITE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FIXME("Unhandled map_type %#x.\n", map_type);
|
FIXME("Unhandled map_type %#x.\n", map_type);
|
||||||
return 0;
|
return WINED3D_MAP_READ | WINED3D_MAP_WRITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,15 +143,20 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format)
|
||||||
|
|
||||||
unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags)
|
unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags)
|
||||||
{
|
{
|
||||||
static const unsigned int handled = D3DLOCK_READONLY
|
static const unsigned int handled = D3DLOCK_NOSYSLOCK
|
||||||
| D3DLOCK_NOSYSLOCK
|
|
||||||
| D3DLOCK_NOOVERWRITE
|
| D3DLOCK_NOOVERWRITE
|
||||||
| D3DLOCK_DISCARD
|
| D3DLOCK_DISCARD
|
||||||
| D3DLOCK_NO_DIRTY_UPDATE;
|
| D3DLOCK_NO_DIRTY_UPDATE;
|
||||||
unsigned int wined3d_flags;
|
unsigned int wined3d_flags;
|
||||||
|
|
||||||
wined3d_flags = flags & handled;
|
wined3d_flags = flags & handled;
|
||||||
flags &= ~handled;
|
if (!(flags & (D3DLOCK_NOOVERWRITE | D3DLOCK_DISCARD)))
|
||||||
|
wined3d_flags |= WINED3D_MAP_READ;
|
||||||
|
if (!(flags & D3DLOCK_READONLY))
|
||||||
|
wined3d_flags |= WINED3D_MAP_WRITE;
|
||||||
|
if (!(wined3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
|
||||||
|
wined3d_flags |= WINED3D_MAP_READ | WINED3D_MAP_WRITE;
|
||||||
|
flags &= ~(handled | D3DLOCK_READONLY);
|
||||||
|
|
||||||
if (flags)
|
if (flags)
|
||||||
FIXME("Unhandled flags %#x.\n", flags);
|
FIXME("Unhandled flags %#x.\n", flags);
|
||||||
|
@ -2225,7 +2230,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface,
|
||||||
wined3d_box.right = vb_pos + size;
|
wined3d_box.right = vb_pos + size;
|
||||||
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
||||||
if (FAILED(wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, data, size);
|
memcpy(wined3d_map_desc.data, data, size);
|
||||||
wined3d_resource_unmap(vb, 0);
|
wined3d_resource_unmap(vb, 0);
|
||||||
|
@ -2326,7 +2331,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
|
||||||
wined3d_box.right = vb_pos + vtx_size;
|
wined3d_box.right = vb_pos + vtx_size;
|
||||||
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size);
|
memcpy(wined3d_map_desc.data, (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size);
|
||||||
wined3d_resource_unmap(vb, 0);
|
wined3d_resource_unmap(vb, 0);
|
||||||
|
@ -2348,7 +2353,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
|
||||||
wined3d_box.right = ib_pos + idx_size;
|
wined3d_box.right = ib_pos + idx_size;
|
||||||
ib = wined3d_buffer_get_resource(device->index_buffer);
|
ib = wined3d_buffer_get_resource(device->index_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, index_data, idx_size);
|
memcpy(wined3d_map_desc.data, index_data, idx_size);
|
||||||
wined3d_resource_unmap(ib, 0);
|
wined3d_resource_unmap(ib, 0);
|
||||||
|
|
|
@ -162,8 +162,7 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format)
|
||||||
|
|
||||||
unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags)
|
unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags)
|
||||||
{
|
{
|
||||||
static const unsigned int handled = D3DLOCK_READONLY
|
static const unsigned int handled = D3DLOCK_NOSYSLOCK
|
||||||
| D3DLOCK_NOSYSLOCK
|
|
||||||
| D3DLOCK_NOOVERWRITE
|
| D3DLOCK_NOOVERWRITE
|
||||||
| D3DLOCK_DISCARD
|
| D3DLOCK_DISCARD
|
||||||
| D3DLOCK_DONOTWAIT
|
| D3DLOCK_DONOTWAIT
|
||||||
|
@ -171,7 +170,13 @@ unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags)
|
||||||
unsigned int wined3d_flags;
|
unsigned int wined3d_flags;
|
||||||
|
|
||||||
wined3d_flags = flags & handled;
|
wined3d_flags = flags & handled;
|
||||||
flags &= ~handled;
|
if (!(flags & (D3DLOCK_NOOVERWRITE | D3DLOCK_DISCARD)))
|
||||||
|
wined3d_flags |= WINED3D_MAP_READ;
|
||||||
|
if (!(flags & D3DLOCK_READONLY))
|
||||||
|
wined3d_flags |= WINED3D_MAP_WRITE;
|
||||||
|
if (!(wined3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
|
||||||
|
wined3d_flags |= WINED3D_MAP_READ | WINED3D_MAP_WRITE;
|
||||||
|
flags &= ~(handled | D3DLOCK_READONLY);
|
||||||
|
|
||||||
if (flags)
|
if (flags)
|
||||||
FIXME("Unhandled flags %#x.\n", flags);
|
FIXME("Unhandled flags %#x.\n", flags);
|
||||||
|
@ -2737,7 +2742,7 @@ static HRESULT WINAPI d3d9_device_DrawPrimitiveUP(IDirect3DDevice9Ex *iface,
|
||||||
wined3d_box.right = vb_pos + size;
|
wined3d_box.right = vb_pos + size;
|
||||||
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, data, size);
|
memcpy(wined3d_map_desc.data, data, size);
|
||||||
wined3d_resource_unmap(vb, 0);
|
wined3d_resource_unmap(vb, 0);
|
||||||
|
@ -2848,7 +2853,7 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa
|
||||||
wined3d_box.right = vb_pos + vtx_size;
|
wined3d_box.right = vb_pos + vtx_size;
|
||||||
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size);
|
memcpy(wined3d_map_desc.data, (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size);
|
||||||
wined3d_resource_unmap(vb, 0);
|
wined3d_resource_unmap(vb, 0);
|
||||||
|
@ -2870,7 +2875,7 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa
|
||||||
wined3d_box.right = ib_pos + idx_size;
|
wined3d_box.right = ib_pos + idx_size;
|
||||||
ib = wined3d_buffer_get_resource(device->index_buffer);
|
ib = wined3d_buffer_get_resource(device->index_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, index_data, idx_size);
|
memcpy(wined3d_map_desc.data, index_data, idx_size);
|
||||||
wined3d_resource_unmap(ib, 0);
|
wined3d_resource_unmap(ib, 0);
|
||||||
|
|
|
@ -3533,7 +3533,7 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface,
|
||||||
wined3d_box.right = vb_pos + size;
|
wined3d_box.right = vb_pos + size;
|
||||||
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, vertices, size);
|
memcpy(wined3d_map_desc.data, vertices, size);
|
||||||
wined3d_resource_unmap(vb, 0);
|
wined3d_resource_unmap(vb, 0);
|
||||||
|
@ -3725,7 +3725,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
|
||||||
wined3d_box.right = vb_pos + vtx_size;
|
wined3d_box.right = vb_pos + vtx_size;
|
||||||
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, vertices, vtx_size);
|
memcpy(wined3d_map_desc.data, vertices, vtx_size);
|
||||||
wined3d_resource_unmap(vb, 0);
|
wined3d_resource_unmap(vb, 0);
|
||||||
|
@ -3742,7 +3742,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
|
||||||
wined3d_box.right = ib_pos + idx_size;
|
wined3d_box.right = ib_pos + idx_size;
|
||||||
ib = wined3d_buffer_get_resource(device->index_buffer);
|
ib = wined3d_buffer_get_resource(device->index_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, indices, idx_size);
|
memcpy(wined3d_map_desc.data, indices, idx_size);
|
||||||
wined3d_resource_unmap(ib, 0);
|
wined3d_resource_unmap(ib, 0);
|
||||||
|
@ -4056,7 +4056,7 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM
|
||||||
wined3d_box.right = vb_pos + dst_size;
|
wined3d_box.right = vb_pos + dst_size;
|
||||||
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
pack_strided_data(wined3d_map_desc.data, vertex_count, strided_data, fvf);
|
pack_strided_data(wined3d_map_desc.data, vertex_count, strided_data, fvf);
|
||||||
wined3d_resource_unmap(vb, 0);
|
wined3d_resource_unmap(vb, 0);
|
||||||
|
@ -4172,7 +4172,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface,
|
||||||
wined3d_box.right = vb_pos + vtx_dst_size;
|
wined3d_box.right = vb_pos + vtx_dst_size;
|
||||||
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
vb = wined3d_buffer_get_resource(device->vertex_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
pack_strided_data(wined3d_map_desc.data, vertex_count, strided_data, fvf);
|
pack_strided_data(wined3d_map_desc.data, vertex_count, strided_data, fvf);
|
||||||
wined3d_resource_unmap(vb, 0);
|
wined3d_resource_unmap(vb, 0);
|
||||||
|
@ -4189,7 +4189,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface,
|
||||||
wined3d_box.right = ib_pos + idx_size;
|
wined3d_box.right = ib_pos + idx_size;
|
||||||
ib = wined3d_buffer_get_resource(device->index_buffer);
|
ib = wined3d_buffer_get_resource(device->index_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
goto done;
|
goto done;
|
||||||
memcpy(wined3d_map_desc.data, indices, idx_size);
|
memcpy(wined3d_map_desc.data, indices, idx_size);
|
||||||
wined3d_resource_unmap(ib, 0);
|
wined3d_resource_unmap(ib, 0);
|
||||||
|
@ -4409,7 +4409,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
|
||||||
wined3d_box.right = ib_pos + index_count * sizeof(WORD);
|
wined3d_box.right = ib_pos + index_count * sizeof(WORD);
|
||||||
ib = wined3d_buffer_get_resource(device->index_buffer);
|
ib = wined3d_buffer_get_resource(device->index_buffer);
|
||||||
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
|
||||||
ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
|
WINED3D_MAP_WRITE | (ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
{
|
{
|
||||||
ERR("Failed to map buffer, hr %#x.\n", hr);
|
ERR("Failed to map buffer, hr %#x.\n", hr);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
|
@ -152,9 +152,8 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
|
||||||
|
|
||||||
box.left = index_pos * sizeof(*indices);
|
box.left = index_pos * sizeof(*indices);
|
||||||
box.right = (index_pos + index_count) * sizeof(*indices);
|
box.right = (index_pos + index_count) * sizeof(*indices);
|
||||||
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->index_buffer), 0,
|
if (FAILED(hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->index_buffer), 0, &map_desc,
|
||||||
&map_desc, &box, index_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD);
|
&box, WINED3D_MAP_WRITE | (index_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD))))
|
||||||
if (FAILED(hr))
|
|
||||||
return hr;
|
return hr;
|
||||||
indices = map_desc.data;
|
indices = map_desc.data;
|
||||||
|
|
||||||
|
@ -661,7 +660,7 @@ static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *
|
||||||
box.left = buffer->src_vertex_pos * sizeof(D3DVERTEX);
|
box.left = buffer->src_vertex_pos * sizeof(D3DVERTEX);
|
||||||
box.right = box.left + data->dwVertexCount * sizeof(D3DVERTEX);
|
box.right = box.left + data->dwVertexCount * sizeof(D3DVERTEX);
|
||||||
if (FAILED(hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->src_vertex_buffer),
|
if (FAILED(hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->src_vertex_buffer),
|
||||||
0, &map_desc, &box, 0)))
|
0, &map_desc, &box, WINED3D_MAP_WRITE)))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
memcpy(map_desc.data, ((BYTE *)buffer->desc.lpData) + data->dwVertexOffset,
|
memcpy(map_desc.data, ((BYTE *)buffer->desc.lpData) + data->dwVertexOffset,
|
||||||
|
|
|
@ -5281,7 +5281,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr = wined3d_resource_map(src_resource,
|
if (FAILED(hr = wined3d_resource_map(src_resource,
|
||||||
src_surface->sub_resource_idx, &src_map_desc, NULL, 0)))
|
src_surface->sub_resource_idx, &src_map_desc, NULL, WINED3D_MAP_READ)))
|
||||||
{
|
{
|
||||||
ERR("Failed to lock source surface, hr %#x.\n", hr);
|
ERR("Failed to lock source surface, hr %#x.\n", hr);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
@ -5289,7 +5289,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr = wined3d_resource_map(dst_resource,
|
if (FAILED(hr = wined3d_resource_map(dst_resource,
|
||||||
dst_surface->sub_resource_idx, &dst_map_desc, NULL, 0)))
|
dst_surface->sub_resource_idx, &dst_map_desc, NULL, WINED3D_MAP_WRITE)))
|
||||||
{
|
{
|
||||||
ERR("Failed to lock destination surface, hr %#x.\n", hr);
|
ERR("Failed to lock destination surface, hr %#x.\n", hr);
|
||||||
wined3d_resource_unmap(src_resource, src_surface->sub_resource_idx);
|
wined3d_resource_unmap(src_resource, src_surface->sub_resource_idx);
|
||||||
|
|
|
@ -563,17 +563,22 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix
|
||||||
|
|
||||||
unsigned int wined3dmapflags_from_ddrawmapflags(unsigned int flags)
|
unsigned int wined3dmapflags_from_ddrawmapflags(unsigned int flags)
|
||||||
{
|
{
|
||||||
static const unsigned int handled = DDLOCK_READONLY
|
static const unsigned int handled = DDLOCK_NOSYSLOCK
|
||||||
| DDLOCK_NOSYSLOCK
|
|
||||||
| DDLOCK_NOOVERWRITE
|
| DDLOCK_NOOVERWRITE
|
||||||
| DDLOCK_DISCARDCONTENTS
|
| DDLOCK_DISCARDCONTENTS
|
||||||
| DDLOCK_DONOTWAIT;
|
| DDLOCK_DONOTWAIT;
|
||||||
unsigned int wined3d_flags;
|
unsigned int wined3d_flags;
|
||||||
|
|
||||||
wined3d_flags = flags & handled;
|
wined3d_flags = flags & handled;
|
||||||
|
if (!(flags & (DDLOCK_NOOVERWRITE | DDLOCK_DISCARDCONTENTS)))
|
||||||
|
wined3d_flags |= WINED3D_MAP_READ;
|
||||||
|
if (!(flags & DDLOCK_READONLY))
|
||||||
|
wined3d_flags |= WINED3D_MAP_WRITE;
|
||||||
|
if (!(wined3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
|
||||||
|
wined3d_flags |= WINED3D_MAP_READ | WINED3D_MAP_WRITE;
|
||||||
if (flags & DDLOCK_NODIRTYUPDATE)
|
if (flags & DDLOCK_NODIRTYUPDATE)
|
||||||
wined3d_flags |= WINED3D_MAP_NO_DIRTY_UPDATE;
|
wined3d_flags |= WINED3D_MAP_NO_DIRTY_UPDATE;
|
||||||
flags &= ~(handled | DDLOCK_WAIT | DDLOCK_NODIRTYUPDATE);
|
flags &= ~(handled | DDLOCK_WAIT | DDLOCK_READONLY | DDLOCK_NODIRTYUPDATE);
|
||||||
|
|
||||||
if (flags)
|
if (flags)
|
||||||
FIXME("Unhandled flags %#x.\n", flags);
|
FIXME("Unhandled flags %#x.\n", flags);
|
||||||
|
|
|
@ -1024,8 +1024,8 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
|
||||||
dirty_size = 0;
|
dirty_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & (WINED3D_MAP_NOOVERWRITE | WINED3D_MAP_DISCARD | WINED3D_MAP_READONLY))
|
if (((flags & WINED3D_MAP_WRITE) && !(flags & (WINED3D_MAP_NOOVERWRITE | WINED3D_MAP_DISCARD)))
|
||||||
|| ((flags & WINED3D_MAP_READONLY) && (buffer->locations & WINED3D_LOCATION_SYSMEM))
|
|| (!(flags & WINED3D_MAP_WRITE) && (buffer->locations & WINED3D_LOCATION_SYSMEM))
|
||||||
|| buffer->flags & WINED3D_BUFFER_PIN_SYSMEM)
|
|| buffer->flags & WINED3D_BUFFER_PIN_SYSMEM)
|
||||||
{
|
{
|
||||||
if (!(buffer->locations & WINED3D_LOCATION_SYSMEM))
|
if (!(buffer->locations & WINED3D_LOCATION_SYSMEM))
|
||||||
|
@ -1035,7 +1035,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
|
||||||
context_release(context);
|
context_release(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & WINED3D_MAP_READONLY))
|
if (flags & WINED3D_MAP_WRITE)
|
||||||
wined3d_buffer_invalidate_range(buffer, WINED3D_LOCATION_BUFFER, dirty_offset, dirty_size);
|
wined3d_buffer_invalidate_range(buffer, WINED3D_LOCATION_BUFFER, dirty_offset, dirty_size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1050,7 +1050,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
|
||||||
else
|
else
|
||||||
wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER);
|
wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_BUFFER);
|
||||||
|
|
||||||
if (!(flags & WINED3D_MAP_READONLY))
|
if (flags & WINED3D_MAP_WRITE)
|
||||||
buffer_invalidate_bo_range(buffer, dirty_offset, dirty_size);
|
buffer_invalidate_bo_range(buffer, dirty_offset, dirty_size);
|
||||||
|
|
||||||
if ((flags & WINED3D_MAP_DISCARD) && buffer->resource.heap_memory)
|
if ((flags & WINED3D_MAP_DISCARD) && buffer->resource.heap_memory)
|
||||||
|
|
|
@ -2837,8 +2837,8 @@ void context_copy_bo_address(struct wined3d_context *context,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
src_ptr = context_map_bo_address(context, src, size, src_binding, WINED3D_MAP_READONLY);
|
src_ptr = context_map_bo_address(context, src, size, src_binding, WINED3D_MAP_READ);
|
||||||
dst_ptr = context_map_bo_address(context, dst, size, dst_binding, 0);
|
dst_ptr = context_map_bo_address(context, dst, size, dst_binding, WINED3D_MAP_WRITE);
|
||||||
|
|
||||||
memcpy(dst_ptr, src_ptr, size);
|
memcpy(dst_ptr, src_ptr, size);
|
||||||
|
|
||||||
|
|
|
@ -3078,7 +3078,7 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
|
||||||
vertex_size = get_flexible_vertex_size(DestFVF);
|
vertex_size = get_flexible_vertex_size(DestFVF);
|
||||||
box.left = dwDestIndex * vertex_size;
|
box.left = dwDestIndex * vertex_size;
|
||||||
box.right = box.left + dwCount * vertex_size;
|
box.right = box.left + dwCount * vertex_size;
|
||||||
if (FAILED(hr = wined3d_resource_map(&dest->resource, 0, &map_desc, &box, 0)))
|
if (FAILED(hr = wined3d_resource_map(&dest->resource, 0, &map_desc, &box, WINED3D_MAP_WRITE)))
|
||||||
{
|
{
|
||||||
WARN("Failed to map buffer, hr %#x.\n", hr);
|
WARN("Failed to map buffer, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -3342,7 +3342,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
|
||||||
resource = &state->streams[e->stream_idx].buffer->resource;
|
resource = &state->streams[e->stream_idx].buffer->resource;
|
||||||
box.left = src_start_idx * e->stride;
|
box.left = src_start_idx * e->stride;
|
||||||
box.right = box.left + vertex_count * e->stride;
|
box.right = box.left + vertex_count * e->stride;
|
||||||
if (FAILED(wined3d_resource_map(resource, 0, &map_desc, &box, WINED3D_MAP_READONLY)))
|
if (FAILED(wined3d_resource_map(resource, 0, &map_desc, &box, WINED3D_MAP_READ)))
|
||||||
ERR("Failed to map resource.\n");
|
ERR("Failed to map resource.\n");
|
||||||
e->data.buffer_object = 0;
|
e->data.buffer_object = 0;
|
||||||
e->data.addr += (ULONG_PTR)map_desc.data;
|
e->data.addr += (ULONG_PTR)map_desc.data;
|
||||||
|
@ -4499,7 +4499,7 @@ static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined
|
||||||
struct wined3d_texture *texture;
|
struct wined3d_texture *texture;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (FAILED(wined3d_resource_map(&cursor_image->resource, sub_resource_idx, &map_desc, NULL, WINED3D_MAP_READONLY)))
|
if (FAILED(wined3d_resource_map(&cursor_image->resource, sub_resource_idx, &map_desc, NULL, WINED3D_MAP_READ)))
|
||||||
{
|
{
|
||||||
ERR("Failed to map source texture.\n");
|
ERR("Failed to map source texture.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -4603,7 +4603,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
|
||||||
memset(mask_bits, 0xff, mask_size);
|
memset(mask_bits, 0xff, mask_size);
|
||||||
|
|
||||||
wined3d_resource_map(&texture->resource, sub_resource_idx, &map_desc, NULL,
|
wined3d_resource_map(&texture->resource, sub_resource_idx, &map_desc, NULL,
|
||||||
WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY);
|
WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READ);
|
||||||
cursor_info.fIcon = FALSE;
|
cursor_info.fIcon = FALSE;
|
||||||
cursor_info.xHotspot = x_hotspot;
|
cursor_info.xHotspot = x_hotspot;
|
||||||
cursor_info.yHotspot = y_hotspot;
|
cursor_info.yHotspot = y_hotspot;
|
||||||
|
|
|
@ -306,17 +306,17 @@ static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource *
|
||||||
{
|
{
|
||||||
/* Not all flags make sense together, but Windows never returns an error.
|
/* Not all flags make sense together, but Windows never returns an error.
|
||||||
* Catch the cases that could cause issues. */
|
* Catch the cases that could cause issues. */
|
||||||
if (flags & WINED3D_MAP_READONLY)
|
if (flags & WINED3D_MAP_READ)
|
||||||
{
|
{
|
||||||
if (flags & WINED3D_MAP_DISCARD)
|
if (flags & WINED3D_MAP_DISCARD)
|
||||||
{
|
{
|
||||||
WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_DISCARD, ignoring flags.\n");
|
WARN("WINED3D_MAP_READ combined with WINED3D_MAP_DISCARD, ignoring flags.\n");
|
||||||
return 0;
|
return flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE);
|
||||||
}
|
}
|
||||||
if (flags & WINED3D_MAP_NOOVERWRITE)
|
if (flags & WINED3D_MAP_NOOVERWRITE)
|
||||||
{
|
{
|
||||||
WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.\n");
|
WARN("WINED3D_MAP_READ combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.\n");
|
||||||
return 0;
|
return flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
|
else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
|
||||||
|
@ -324,7 +324,7 @@ static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource *
|
||||||
if (!(resource->usage & WINED3DUSAGE_DYNAMIC))
|
if (!(resource->usage & WINED3DUSAGE_DYNAMIC))
|
||||||
{
|
{
|
||||||
WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n");
|
WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n");
|
||||||
return 0;
|
return flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE);
|
||||||
}
|
}
|
||||||
if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
|
if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
|
||||||
== (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
|
== (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
|
||||||
|
@ -343,6 +343,12 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
|
||||||
TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
|
TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
|
||||||
resource, sub_resource_idx, map_desc, debug_box(box), flags);
|
resource, sub_resource_idx, map_desc, debug_box(box), flags);
|
||||||
|
|
||||||
|
if (!(flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE)))
|
||||||
|
{
|
||||||
|
WARN("No read/write flags specified.\n");
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(resource->access & WINED3D_RESOURCE_ACCESS_MAP))
|
if (!(resource->access & WINED3D_RESOURCE_ACCESS_MAP))
|
||||||
{
|
{
|
||||||
WARN("Resource is not mappable.\n");
|
WARN("Resource is not mappable.\n");
|
||||||
|
@ -399,9 +405,9 @@ GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
|
||||||
{
|
{
|
||||||
GLbitfield ret = 0;
|
GLbitfield ret = 0;
|
||||||
|
|
||||||
if (!(d3d_flags & WINED3D_MAP_READONLY))
|
if (d3d_flags & WINED3D_MAP_WRITE)
|
||||||
ret |= GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
|
ret |= GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
|
||||||
if (!(d3d_flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)))
|
if (d3d_flags & WINED3D_MAP_READ)
|
||||||
ret |= GL_MAP_READ_BIT;
|
ret |= GL_MAP_READ_BIT;
|
||||||
|
|
||||||
if (d3d_flags & WINED3D_MAP_DISCARD)
|
if (d3d_flags & WINED3D_MAP_DISCARD)
|
||||||
|
@ -414,11 +420,17 @@ GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
|
||||||
|
|
||||||
GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags)
|
GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags)
|
||||||
{
|
{
|
||||||
if (d3d_flags & WINED3D_MAP_READONLY)
|
switch (d3d_flags & (WINED3D_MAP_READ | WINED3D_MAP_WRITE))
|
||||||
return GL_READ_ONLY_ARB;
|
{
|
||||||
if (d3d_flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
|
case WINED3D_MAP_READ:
|
||||||
return GL_WRITE_ONLY_ARB;
|
return GL_READ_ONLY_ARB;
|
||||||
return GL_READ_WRITE_ARB;
|
|
||||||
|
case WINED3D_MAP_WRITE:
|
||||||
|
return GL_WRITE_ONLY_ARB;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return GL_READ_WRITE_ARB;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource)
|
BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource)
|
||||||
|
|
|
@ -1369,9 +1369,9 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
||||||
wined3d_texture_get_memory(dst_texture, 0, &dst_data, map_binding);
|
wined3d_texture_get_memory(dst_texture, 0, &dst_data, map_binding);
|
||||||
|
|
||||||
src = context_map_bo_address(context, &src_data,
|
src = context_map_bo_address(context, &src_data,
|
||||||
src_texture->sub_resources[sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, 0);
|
src_texture->sub_resources[sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
|
||||||
dst = context_map_bo_address(context,
|
dst = context_map_bo_address(context,
|
||||||
&dst_data, dst_texture->sub_resources[0].size, GL_PIXEL_UNPACK_BUFFER, 0);
|
&dst_data, dst_texture->sub_resources[0].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
|
||||||
|
|
||||||
conv->convert(src, dst, src_row_pitch, dst_row_pitch, desc.width, desc.height);
|
conv->convert(src, dst, src_row_pitch, dst_row_pitch, desc.width, desc.height);
|
||||||
|
|
||||||
|
@ -2325,7 +2325,7 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
|
||||||
wined3d_format_calculate_pitch(&format, 1, width, height, &dst_row_pitch, &dst_slice_pitch);
|
wined3d_format_calculate_pitch(&format, 1, width, height, &dst_row_pitch, &dst_slice_pitch);
|
||||||
|
|
||||||
src_mem = context_map_bo_address(context, &data, src_slice_pitch,
|
src_mem = context_map_bo_address(context, &data, src_slice_pitch,
|
||||||
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READONLY);
|
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
|
||||||
if (!(dst_mem = heap_alloc(dst_slice_pitch)))
|
if (!(dst_mem = heap_alloc(dst_slice_pitch)))
|
||||||
{
|
{
|
||||||
ERR("Out of memory (%u).\n", dst_slice_pitch);
|
ERR("Out of memory (%u).\n", dst_slice_pitch);
|
||||||
|
@ -2349,7 +2349,7 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
|
||||||
width, height, &dst_row_pitch, &dst_slice_pitch);
|
width, height, &dst_row_pitch, &dst_slice_pitch);
|
||||||
|
|
||||||
src_mem = context_map_bo_address(context, &data, src_slice_pitch,
|
src_mem = context_map_bo_address(context, &data, src_slice_pitch,
|
||||||
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READONLY);
|
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
|
||||||
if (!(dst_mem = heap_alloc(dst_slice_pitch)))
|
if (!(dst_mem = heap_alloc(dst_slice_pitch)))
|
||||||
{
|
{
|
||||||
ERR("Out of memory (%u).\n", dst_slice_pitch);
|
ERR("Out of memory (%u).\n", dst_slice_pitch);
|
||||||
|
@ -3113,7 +3113,8 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
||||||
wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
|
wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
|
||||||
wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
|
wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
|
||||||
dst_map.data = context_map_bo_address(context, &dst_data,
|
dst_map.data = context_map_bo_address(context, &dst_data,
|
||||||
dst_texture->sub_resources[dst_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, 0);
|
dst_texture->sub_resources[dst_sub_resource_idx].size,
|
||||||
|
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ | WINED3D_MAP_WRITE);
|
||||||
|
|
||||||
src_map = dst_map;
|
src_map = dst_map;
|
||||||
src_format = dst_texture->resource.format;
|
src_format = dst_texture->resource.format;
|
||||||
|
@ -3149,7 +3150,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
||||||
wined3d_texture_get_pitch(src_texture, texture_level, &src_map.row_pitch, &src_map.slice_pitch);
|
wined3d_texture_get_pitch(src_texture, texture_level, &src_map.row_pitch, &src_map.slice_pitch);
|
||||||
wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &src_data, map_binding);
|
wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &src_data, map_binding);
|
||||||
src_map.data = context_map_bo_address(context, &src_data,
|
src_map.data = context_map_bo_address(context, &src_data,
|
||||||
src_texture->sub_resources[src_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, 0);
|
src_texture->sub_resources[src_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ);
|
||||||
|
|
||||||
map_binding = dst_texture->resource.map_binding;
|
map_binding = dst_texture->resource.map_binding;
|
||||||
texture_level = dst_sub_resource_idx % dst_texture->level_count;
|
texture_level = dst_sub_resource_idx % dst_texture->level_count;
|
||||||
|
@ -3159,7 +3160,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
|
||||||
wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
|
wined3d_texture_get_pitch(dst_texture, texture_level, &dst_map.row_pitch, &dst_map.slice_pitch);
|
||||||
wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
|
wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &dst_data, map_binding);
|
||||||
dst_map.data = context_map_bo_address(context, &dst_data,
|
dst_map.data = context_map_bo_address(context, &dst_data,
|
||||||
dst_texture->sub_resources[dst_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, 0);
|
dst_texture->sub_resources[dst_sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
|
||||||
}
|
}
|
||||||
flags &= ~WINED3D_BLT_RAW;
|
flags &= ~WINED3D_BLT_RAW;
|
||||||
|
|
||||||
|
@ -3600,7 +3601,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
|
||||||
&map.row_pitch, &map.slice_pitch);
|
&map.row_pitch, &map.slice_pitch);
|
||||||
wined3d_texture_get_memory(texture, view->sub_resource_idx, &data, map_binding);
|
wined3d_texture_get_memory(texture, view->sub_resource_idx, &data, map_binding);
|
||||||
map.data = context_map_bo_address(context, &data,
|
map.data = context_map_bo_address(context, &data,
|
||||||
texture->sub_resources[view->sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, 0);
|
texture->sub_resources[view->sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_WRITE);
|
||||||
map.data = (BYTE *)map.data
|
map.data = (BYTE *)map.data
|
||||||
+ (box->front * map.slice_pitch)
|
+ (box->front * map.slice_pitch)
|
||||||
+ ((box->top / view->format->block_height) * map.row_pitch)
|
+ ((box->top / view->format->block_height) * map.row_pitch)
|
||||||
|
|
|
@ -1224,7 +1224,8 @@ static void texture2d_create_dc(void *object)
|
||||||
wined3d_texture_get_pitch(texture, surface->texture_level, &row_pitch, &slice_pitch);
|
wined3d_texture_get_pitch(texture, surface->texture_level, &row_pitch, &slice_pitch);
|
||||||
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
|
wined3d_texture_get_memory(texture, sub_resource_idx, &data, texture->resource.map_binding);
|
||||||
desc.pMemory = context_map_bo_address(context, &data,
|
desc.pMemory = context_map_bo_address(context, &data,
|
||||||
texture->sub_resources[sub_resource_idx].size, GL_PIXEL_UNPACK_BUFFER, 0);
|
texture->sub_resources[sub_resource_idx].size,
|
||||||
|
GL_PIXEL_UNPACK_BUFFER, WINED3D_MAP_READ | WINED3D_MAP_WRITE);
|
||||||
|
|
||||||
if (context)
|
if (context)
|
||||||
context_release(context);
|
context_release(context);
|
||||||
|
@ -1903,7 +1904,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & WINED3D_MAP_READONLY)
|
if (flags & WINED3D_MAP_WRITE
|
||||||
&& (!(flags & WINED3D_MAP_NO_DIRTY_UPDATE) || (resource->usage & WINED3DUSAGE_DYNAMIC)))
|
&& (!(flags & WINED3D_MAP_NO_DIRTY_UPDATE) || (resource->usage & WINED3DUSAGE_DYNAMIC)))
|
||||||
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~resource->map_binding);
|
wined3d_texture_invalidate_location(texture, sub_resource_idx, ~resource->map_binding);
|
||||||
|
|
||||||
|
|
|
@ -912,12 +912,13 @@ enum wined3d_shader_byte_code_format
|
||||||
#define WINED3DUSAGE_QUERY_WRAPANDMIP 0x00200000
|
#define WINED3DUSAGE_QUERY_WRAPANDMIP 0x00200000
|
||||||
#define WINED3DUSAGE_QUERY_MASK 0x003f8400
|
#define WINED3DUSAGE_QUERY_MASK 0x003f8400
|
||||||
|
|
||||||
#define WINED3D_MAP_READONLY 0x0010
|
#define WINED3D_MAP_NOSYSLOCK 0x00000800
|
||||||
#define WINED3D_MAP_NOSYSLOCK 0x0800
|
#define WINED3D_MAP_NOOVERWRITE 0x00001000
|
||||||
#define WINED3D_MAP_NOOVERWRITE 0x1000
|
#define WINED3D_MAP_DISCARD 0x00002000
|
||||||
#define WINED3D_MAP_DISCARD 0x2000
|
#define WINED3D_MAP_DONOTWAIT 0x00004000
|
||||||
#define WINED3D_MAP_DONOTWAIT 0x4000
|
#define WINED3D_MAP_NO_DIRTY_UPDATE 0x00008000
|
||||||
#define WINED3D_MAP_NO_DIRTY_UPDATE 0x8000
|
#define WINED3D_MAP_WRITE 0x40000000
|
||||||
|
#define WINED3D_MAP_READ 0x80000000
|
||||||
|
|
||||||
#define WINED3DPRESENT_RATE_DEFAULT 0x00000000
|
#define WINED3DPRESENT_RATE_DEFAULT 0x00000000
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue