wined3d: Use the chunk allocator for GL element array buffers.

This commit is contained in:
Anton Baskanov 2022-11-09 13:06:02 +07:00 committed by Alexandre Julliard
parent c7f6dc641d
commit bb6482686b

View file

@ -1084,7 +1084,8 @@ static struct wined3d_allocator_block *wined3d_device_gl_allocate_memory(struct
return block;
}
static bool use_buffer_chunk_suballocation(const struct wined3d_gl_info *gl_info, GLenum binding)
static bool use_buffer_chunk_suballocation(struct wined3d_device_gl *device_gl,
const struct wined3d_gl_info *gl_info, GLenum binding)
{
switch (binding)
{
@ -1095,6 +1096,12 @@ static bool use_buffer_chunk_suballocation(const struct wined3d_gl_info *gl_info
case GL_UNIFORM_BUFFER:
return true;
case GL_ELEMENT_ARRAY_BUFFER:
/* There is no way to specify an element array buffer offset for
* indirect draws in OpenGL. */
return device_gl->d.wined3d->flags & WINED3D_NO_DRAW_INDIRECT
|| !gl_info->supported[ARB_DRAW_INDIRECT];
case GL_TEXTURE_BUFFER:
return gl_info->supported[ARB_TEXTURE_BUFFER_RANGE];
@ -1117,7 +1124,7 @@ bool wined3d_device_gl_create_bo(struct wined3d_device_gl *device_gl, struct win
if (gl_info->supported[ARB_BUFFER_STORAGE])
{
if (use_buffer_chunk_suballocation(gl_info, binding))
if (use_buffer_chunk_suballocation(device_gl, gl_info, binding))
{
if ((memory = wined3d_device_gl_allocate_memory(device_gl, context_gl, memory_type_idx, size, &id)))
buffer_offset = memory->offset;