ddraw: Filter out redundant discard maps.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
42d0e56643
commit
6784684abf
|
@ -22,6 +22,7 @@
|
|||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#define COBJMACROS
|
||||
#define NONAMELESSSTRUCT
|
||||
#define NONAMELESSUNION
|
||||
|
@ -598,6 +599,7 @@ struct d3d_vertex_buffer
|
|||
DWORD fvf;
|
||||
DWORD size;
|
||||
BOOL dynamic;
|
||||
bool discarded;
|
||||
};
|
||||
|
||||
HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **buffer, struct ddraw *ddraw,
|
||||
|
|
|
@ -4293,6 +4293,8 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE
|
|||
return D3D_OK;
|
||||
}
|
||||
|
||||
vb_impl->discarded = false;
|
||||
|
||||
stride = get_flexible_vertex_size(vb_impl->fvf);
|
||||
|
||||
if (vb_impl->Caps & D3DVBCAPS_SYSTEMMEMORY)
|
||||
|
@ -4412,6 +4414,8 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
|
|||
return D3D_OK;
|
||||
}
|
||||
|
||||
vb_impl->discarded = false;
|
||||
|
||||
if (vb_impl->Caps & D3DVBCAPS_SYSTEMMEMORY)
|
||||
{
|
||||
TRACE("Drawing from D3DVBCAPS_SYSTEMMEMORY vertex buffer, forwarding to DrawIndexedPrimitive().\n");
|
||||
|
|
|
@ -159,10 +159,14 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface,
|
|||
if (buffer->version != 7)
|
||||
flags &= ~(DDLOCK_NOOVERWRITE | DDLOCK_DISCARDCONTENTS);
|
||||
|
||||
if (buffer->discarded)
|
||||
flags &= ~DDLOCK_DISCARDCONTENTS;
|
||||
|
||||
if (!(flags & DDLOCK_WAIT))
|
||||
flags |= DDLOCK_DONOTWAIT;
|
||||
if (flags & DDLOCK_DISCARDCONTENTS)
|
||||
{
|
||||
buffer->discarded = true;
|
||||
if (!buffer->dynamic)
|
||||
{
|
||||
struct wined3d_buffer *new_buffer;
|
||||
|
|
Loading…
Reference in New Issue