Skip to content

glGetPointerv's pointer argument gets the wrong mutability #541

@hikari-no-yume

Description

@hikari-no-yume

Example usage:

let mut pointer: *mut GLvoid = std::ptr::null_mut();
gl21::GetPointerv(gl21::NORMAL_ARRAY_POINTER, &mut pointer);

I was surprised when Clippy gave me this warning:

warning: the function gl21::GetPointerv doesn't need a mutable reference

Looking at the generated documentation, it seems that gl_generator produced this signature:

pub unsafe fn GetPointerv(pname: u32, params: *const *mut c_void)

I think the mutability here is the exact opposite of what it should be: the pointer returned is *const so far as the API should care, but it needs a *mut pointer to be able to write it out. Though I see that the Khronos C headers use void** so *mut *mut might be more faithful to the original API.

This happens for at least OpenGL 2.1 compatibility profile and OpenGL ES 1.1.

I might eventually attempt to fix this myself, I assume it's something simple.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions