From 3dc55010eae371c2ce0d343549b3681411bcf6f0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Sun, 19 Apr 2009 20:42:08 +0200 Subject: [PATCH] wined3d: Fix a few more direct buffer accesses. --- dlls/wined3d/device.c | 24 ++---------------------- dlls/wined3d/state.c | 2 +- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 253afa884a4..17f520e9d8e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -220,7 +220,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, { WARN("loadBaseVertexIndex is < 0 (%d), not using vbos\n", This->stateBlock->loadBaseVertexIndex); buffer_object = 0; - data = ((struct wined3d_buffer *)This->stateBlock->streamSource[element->input_slot])->resource.allocatedMemory; + data = buffer_get_sysmem((struct wined3d_buffer *)This->stateBlock->streamSource[element->input_slot]); if ((UINT_PTR)data < -This->stateBlock->loadBaseVertexIndex * stride) { FIXME("System memory vertex data load offset is negative!\n"); @@ -4531,27 +4531,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn ENTER_GL(); if (dest->resource.allocatedMemory == NULL) { - /* This may happen if we do direct locking into a vbo. Unlikely, - * but theoretically possible(ddraw processvertices test) - */ - dest->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), 0, dest->resource.size); - if(!dest->resource.allocatedMemory) { - LEAVE_GL(); - ERR("Out of memory\n"); - return E_OUTOFMEMORY; - } - if (dest->buffer_object) - { - const void *src; - GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, dest->buffer_object)); - checkGLcall("glBindBufferARB"); - src = GL_EXTCALL(glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_READ_ONLY_ARB)); - if(src) { - memcpy(dest->resource.allocatedMemory, src, dest->resource.size); - } - GL_EXTCALL(glUnmapBufferARB(GL_ARRAY_BUFFER_ARB)); - checkGLcall("glUnmapBufferARB"); - } + buffer_get_sysmem(dest); } /* Get a pointer into the destination vbo(create one if none exists) and diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 05e52b0fbdd..b1fbadf5d11 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3913,7 +3913,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock, if (stream_info->elements[i].buffer_object) { vb = (struct wined3d_buffer *)stateblock->streamSource[stream_info->elements[i].stream_idx]; - ptr += (long) vb->resource.allocatedMemory; + ptr += (long) buffer_get_sysmem(vb); } if (context->numbered_array_mask & (1 << i)) unload_numbered_array(stateblock, context, i); -- 2.11.4.GIT