Parameter methods are probably unsound
Opened this issue · 3 comments
Method Gl::get_tex_parameter_iv
when passed GL_TEXTURE_BORDER_COLOR
will try to write four integer values in a &mut GLint
which is obviously not large enough.
The same thing can happen with Gl::get_tex_parameter_fv
.
For now, it can't happen with Gl::get_framebuffer_attachment_parameter_iv
and Gl::get_renderbuffer_parameter_iv
because all framebuffer attachment and renderbuffer parameters are single-valued, but nothing guarantees us that this will be true of all GL extensions in the future, so I would make it unsafe too.
Cc @kvark with whom I had debated about that in the past when it was a problem in gleam
.
Other methods that may need to be unsafe include Gl::get_query_iv
, Gl::get_query_object_iv
, Gl::get_query_object_uiv
, Gl::get_query_object_i64v
and Gl::get_query_object_ui64v
.
This is also an issue for the following sample parameter methods:
Gl::get_sampler_parameter_iv
Gl::get_sampler_parameter_fv
Gl::sampler_parameter_iv
Gl::sampler_parameter_fv
There are at least three extensions that can help here, ANGLE_robust_client_memory
, EXT_robustness
and ARB_robustness
.