Commit cb77e188 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Validate constant buffer alignment.

parent 0726d7e8
...@@ -1380,8 +1380,14 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device ...@@ -1380,8 +1380,14 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
if (!size) if (!size)
{ {
WARN("Size 0 requested, returning WINED3DERR_INVALIDCALL.\n"); WARN("Size 0 requested, returning E_INVALIDARG.\n");
return WINED3DERR_INVALIDCALL; 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) if (data && !data->data)
......
...@@ -2894,6 +2894,7 @@ void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DEC ...@@ -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 */ /* Tests show that the start address of resources is 32 byte aligned */
#define RESOURCE_ALIGNMENT 16 #define RESOURCE_ALIGNMENT 16
#define WINED3D_CONSTANT_BUFFER_ALIGNMENT 16
struct gl_texture struct gl_texture
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment