wined3d: Validate constant buffer alignment.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-05-25 12:04:03 +02:00 committed by Alexandre Julliard
parent 0726d7e82f
commit cb77e188d1
2 changed files with 9 additions and 2 deletions

View File

@ -1380,8 +1380,14 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
if (!size)
{
WARN("Size 0 requested, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
WARN("Size 0 requested, returning E_INVALIDARG.\n");
return E_INVALIDARG;
}
if (bind_flags & WINED3D_BIND_CONSTANT_BUFFER && size & (WINED3D_CONSTANT_BUFFER_ALIGNMENT - 1))
{
WARN("Size %#x is not suitably aligned for constant buffers.\n", size);
return E_INVALIDARG;
}
if (data && !data->data)

View File

@ -2894,6 +2894,7 @@ void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DEC
/* Tests show that the start address of resources is 32 byte aligned */
#define RESOURCE_ALIGNMENT 16
#define WINED3D_CONSTANT_BUFFER_ALIGNMENT 16
struct gl_texture
{