Skip to content

Add EGL 1.5 support, bug fix and refactoring.#4

Open
timothee-haudebourg wants to merge 4 commits intoseankerr:masterfrom
timothee-haudebourg:egl-1.5
Open

Add EGL 1.5 support, bug fix and refactoring.#4
timothee-haudebourg wants to merge 4 commits intoseankerr:masterfrom
timothee-haudebourg:egl-1.5

Conversation

@timothee-haudebourg
Copy link

@timothee-haudebourg timothee-haudebourg commented Jun 15, 2019

So I have added support for EGL 1.5. To do so I first had to refactor the code and order everything by EGL version so I can find my way around (sorry about that). I think it will be more sustainable this way, since it follows the structure of the original egl.h file it should be easier for other people to understand the structure of lib.rs.

On the way i've spotted a bug: the eglGetConfigs function was wrongly typed. configs
should be a pointer to an array of EGLConfig, hence have type *mut EGLConfig where it had the (wrong) type EGLConfig. Note that, if I fixed the signature problem, the bug is still here:

pub fn get_configs(display: EGLDisplay, config_size: EGLint) -> EGLConfigList {
    unsafe {
        let list = EGLConfigList{ configs: ptr::null_mut(),
                                  count:   0 };

        ffi::eglGetConfigs(display, list.configs, config_size, list.count as *mut int32_t);

        list
    }
}

You are always calling eglGetConfigs with the null pointer. According to the Khronos documentation,

configs does not return values, if it is specified as NULL

So you'r outputting a EGLConfigList instance where configs is always null (ouch).

Timothée Haudebourg added 3 commits June 15, 2019 22:20
Bug fix: the `eglGetConfigs' function was wrongly typed. `configs'
should be a pointer to an array of `EGLConfig', hence have type `*mut
EGLConfig' where it had the (wrong) type `EGLConfig'.

Refactoring: constants and functions are now ordered by EGL version to
have a more sustainable code.
@timothee-haudebourg
Copy link
Author

I've added a proposition to fix the get_configs issue. Now the function outputs a Vec<EGLConfig>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant