On Mon, 8 Nov 2021 at 23:51, Zebediah Figura zfigura@codeweavers.com wrote:
@@ -4474,8 +4475,15 @@ static void indexbuffer(struct wined3d_context *context, const struct wined3d_st }
buffer_gl = wined3d_buffer_gl(state->index_buffer);
- GL_EXTCALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer_gl->bo.id));
- buffer_gl->b.bo_user.valid = true;
- if ((bo_gl = wined3d_bo_gl(buffer_gl->b.buffer_object)))
- {
GL_EXTCALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bo_gl->id));
buffer_gl->b.bo_user.valid = true;
- }
- else
- {
GL_EXTCALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
- }
}
I'm not too bothered about this, but note that calling wined3d_bo_gl() on a potentially NULL "buffer_object" only works because "b" is the first field in the wined3d_bo_gl structure. The safer approach is to check for NULL first. (As wined3d_bo_gl_id() does, incidentally.)
@@ -972,11 +974,13 @@ static void wined3d_shader_resource_view_gl_cs_init(void *object) { struct wined3d_buffer *buffer = buffer_from_resource(resource); struct wined3d_context *context;
struct wined3d_bo *bo; context = context_acquire(resource->device, NULL, 0); create_buffer_view(&view_gl->gl_view, context, desc, buffer, view_format);
bo = (struct wined3d_bo *)buffer->buffer_object;
That cast should be redundant now.