Module: wine Branch: master Commit: 980c50a0875bb14016a7c8c6a5ba6ce1ec05bcbd URL: http://source.winehq.org/git/wine.git/?a=commit;h=980c50a0875bb14016a7c8c6a5...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Thu Jun 9 20:40:49 2011 +0200
wined3d: Move PBO handling mostly out of surface_upload_data().
Currently we essentially get half of the address from the caller and half from the destination surface. Since we'd like to use surface_upload_data() for wined3d_device_update_surface() as well, we should get all of it from the caller.
---
dlls/wined3d/surface.c | 24 ++++++++++++------------ dlls/wined3d/wined3d_private.h | 6 ++++++ 2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 25b99fd..77a4f2f 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2162,7 +2162,7 @@ static void surface_download_data(struct wined3d_surface *surface, const struct * correct texture. */ /* Context activation is done by the caller. */ static void surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, - const struct wined3d_format *format, BOOL srgb, const GLvoid *data) + const struct wined3d_format *format, BOOL srgb, const struct wined3d_bo_address *data) { GLsizei width = surface->resource.width; GLsizei height = surface->resource.height; @@ -2181,8 +2181,8 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi internal = format->glInternal; }
- TRACE("surface %p, internal %#x, width %d, height %d, format %#x, type %#x, data %p.\n", - surface, internal, width, height, format->glFormat, format->glType, data); + TRACE("surface %p, internal %#x, width %d, height %d, format %#x, type %#x, data {%#x:%p}.\n", + surface, internal, width, height, format->glFormat, format->glType, data->buffer_object, data->addr); TRACE("target %#x, level %u, resource size %u.\n", surface->texture_target, surface->texture_level, surface->resource.size);
@@ -2190,13 +2190,10 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
ENTER_GL();
- if (surface->flags & SFLAG_PBO) + if (data->buffer_object) { - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, data->buffer_object)); checkGLcall("glBindBufferARB"); - - TRACE("(%p) pbo: %#x, data: %p.\n", surface, surface->pbo, data); - data = NULL; }
/* Make sure the correct pitch is used */ @@ -2207,7 +2204,7 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi TRACE("Calling glCompressedTexSubImage2DARB.\n");
GL_EXTCALL(glCompressedTexSubImage2DARB(surface->texture_target, surface->texture_level, - 0, 0, width, height, internal, surface->resource.size, data)); + 0, 0, width, height, internal, surface->resource.size, data->addr)); checkGLcall("glCompressedTexSubImage2DARB"); } else @@ -2215,14 +2212,14 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi TRACE("Calling glTexSubImage2D.\n");
glTexSubImage2D(surface->texture_target, surface->texture_level, - 0, 0, width, height, format->glFormat, format->glType, data); + 0, 0, width, height, format->glFormat, format->glType, data->addr); checkGLcall("glTexSubImage2D"); }
/* Restore the default pitch */ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- if (surface->flags & SFLAG_PBO) + if (data->buffer_object) { GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); checkGLcall("glBindBufferARB"); @@ -6072,6 +6069,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const /* Upload from system memory */ BOOL srgb = flag == SFLAG_INSRGBTEX; struct wined3d_context *context = NULL; + struct wined3d_bo_address data;
d3dfmt_get_conv(surface, TRUE /* We need color keying */, TRUE /* We will use textures */, &format, &convert); @@ -6165,7 +6163,9 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const mem = surface->resource.allocatedMemory; }
- surface_upload_data(surface, gl_info, &format, srgb, mem); + data.buffer_object = surface->flags & SFLAG_PBO ? surface->pbo : 0; + data.addr = mem; + surface_upload_data(surface, gl_info, &format, srgb, &data);
if (context) context_release(context);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d898654..44efb85 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -894,6 +894,12 @@ enum wined3d_ffp_emit_idx WINED3D_FFP_EMIT_COUNT = 17 };
+struct wined3d_bo_address +{ + GLuint buffer_object; + const BYTE *addr; +}; + struct wined3d_stream_info_element { const struct wined3d_format *format;