wined3d: Pass a correct access flag to glMapBufferARB.

This commit is contained in:
Stefan Dösinger 2013-09-19 11:02:55 +02:00 committed by Alexandre Julliard
parent e9b4f154dd
commit d15042837a
3 changed files with 12 additions and 1 deletions

View File

@ -419,3 +419,12 @@ GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
return ret;
}
GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags)
{
if (d3d_flags & WINED3D_MAP_READONLY)
return GL_READ_ONLY_ARB;
if (d3d_flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
return GL_WRITE_ONLY_ARB;
return GL_READ_WRITE_ARB;
}

View File

@ -642,7 +642,8 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
}
else
{
base_memory = GL_EXTCALL(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
GLenum access = wined3d_resource_gl_legacy_map_flags(flags);
base_memory = GL_EXTCALL(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, access));
}
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));

View File

@ -2025,6 +2025,7 @@ void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HI
DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource,
DWORD flags) DECLSPEC_HIDDEN;
GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN;
/* Tests show that the start address of resources is 32 byte aligned */
#define RESOURCE_ALIGNMENT 16