[PATCH 3/4] wined3d: Use the chunk allocator for GL as well.
Henri Verbeet
hverbeet at gmail.com
Thu Dec 9 06:59:24 CST 2021
On Thu, 9 Dec 2021 at 05:41, Zebediah Figura <zfigura at codeweavers.com> wrote:
> @@ -2902,12 +3098,45 @@ void wined3d_context_gl_destroy_bo(struct wined3d_context_gl *context_gl, struct
> bool wined3d_context_gl_create_bo(struct wined3d_context_gl *context_gl, GLsizeiptr size,
> GLenum binding, GLenum usage, bool coherent, GLbitfield flags, struct wined3d_bo_gl *bo)
> {
> + unsigned int memory_type_idx = wined3d_device_gl_find_memory_type(flags);
> const struct wined3d_gl_info *gl_info = context_gl->gl_info;
> + struct wined3d_allocator_block *memory = NULL;
> + GLsizeiptr buffer_offset = 0;
> GLuint id = 0;
>
> TRACE("context_gl %p, size %lu, binding %#x, usage %#x, coherent %#x, flags %#x, bo %p.\n",
> context_gl, size, binding, usage, coherent, flags, bo);
>
> + if (gl_info->supported[ARB_BUFFER_STORAGE])
> + {
> + switch (binding)
> + {
> + case GL_ARRAY_BUFFER:
> + case GL_ATOMIC_COUNTER_BUFFER:
> + case GL_DRAW_INDIRECT_BUFFER:
> + case GL_PIXEL_UNPACK_BUFFER:
> + case GL_TEXTURE_BUFFER:
> + case GL_TRANSFORM_FEEDBACK_BUFFER:
> + case GL_UNIFORM_BUFFER:
> + if ((memory = wined3d_context_gl_allocate_memory(context_gl, memory_type_idx, size, &id)))
> + buffer_offset = memory->offset;
> + break;
> +
> + default:
> + WARN_(d3d_perf)("Not allocating chunk memory for binding type %#x.\n", binding);
> + id = wined3d_context_gl_allocate_vram_chunk_buffer(context_gl, memory_type_idx, size);
> + break;
> + }
> +
> + if (!id)
> + {
> + WARN("Failed to allocate buffer.\n");
> + return false;
> + }
> +
> + goto done;
> + }
> +
> GL_EXTCALL(glGenBuffers(1, &id));
> if (!id)
> {
For bisection purposes, it would probably make sense to split this
into several patches by binding type. I'm also a little hesitant about
committing this so close before code-freeze. This is a fairly
significant change to the way things work, and there are certainly
opportunities for regressions here.
More information about the wine-devel
mailing list