Gfx: Can't bind uniform buffer

Created on 1 Aug 2016  Â·  14Comments  Â·  Source: gfx-rs/gfx

I made a small gfx test that crashes with:

thread 'main' panicked at 'Error after executing command BindProgram(0): Invalid Enum'

when I try to create data for the draw pipeline:

    let data = pipe::Data {
        vertex_buffer: v_buf,
        some_uniform: [0., 0.],
        locals: factory.create_constant_buffer(1),
        out_color: target.clone(),
    };

After further investigation, I found the guilty call here:

gl.BindBuffer(gl::BUFFER_UNIFORM, buffer);

I checked my OpenGL extensions and did not find GL_ARB_uniform_buffer_object.
I'm on OpenGL 2.1.

OpenGL easy bug medium

Most helpful comment

Uh, sorry about it. This one is a blocker, I'll try to have a look tonight.

On Aug 1, 2016, at 18:14, tmielcza [email protected] wrote:

Okay !
Also there's another bug, I don't know if it's related.
thread 'main' panicked at 'gl function was not loaded'
The function seems to be gl.BindFramebuffer().
GL_ARB_framebuffer_object is missing.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

All 14 comments

Thanks! We should return an error during the pipeline creation when UBOs are not supported.

Ok. So, I can't use gfx on my laptop ? :'(

Just don't use constant buffers (gfx::ConstantBuffer<> component). Instead, pass stuff in globals (gfx::Global<> component).

Okay !
Also there's another bug, I don't know if it's related.
thread 'main' panicked at 'gl function was not loaded'
The function seems to be gl.BindFramebuffer().
GL_ARB_framebuffer_object is missing.

Uh, sorry about it. This one is a blocker, I'll try to have a look tonight.

On Aug 1, 2016, at 18:14, tmielcza [email protected] wrote:

Okay !
Also there's another bug, I don't know if it's related.
thread 'main' panicked at 'gl function was not loaded'
The function seems to be gl.BindFramebuffer().
GL_ARB_framebuffer_object is missing.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

Would you be able to get the latest version and run our examples to verify no more fixes are needed for your laptop? If you run the basics ones just fine (obviously, deferred/shadow/cubemap/ubo_tilemap will not work), I'll publish the fixed version of gfx_device_gl.

Works like a charm for almost every example.
The cube is black, though, I don't know why.
Thanks a lot for your quick intervention !

Thanks for confirmation! The cube being black needs to be looked into. Reopening the issue.
Could you provide an apitrace as well as the output with RUST_LOG=gfx=debug?

Here is the result of apitrace: trace.txt
The log (I cut it down since It looped): log.txt
Incidentally, near all the examples run with a d3d backend. How can I run them using OpenGL?

DX11 is used by the example launcher by default on windows. If you want to force GL instead, try editing main.rs with the code similar to the one in the shadow example:

pub fn main() {
    <App<_, _> as gfx_app::ApplicationGL>::launch(
        "Multi-threaded shadow rendering example with gfx-rs",
        gfx_app::DEFAULT_CONFIG);
}

Also, if the black cube is Dx11-only issue, we need to open a new bug for it and investigate further. I don't have a Windows machine, and @sectopod 's one just died, so it might take some time, unless you want to take a stub at it yourself ;)

Concerning the cube example, manually recompiling the HLSL-shaders via compile.cmd fixed the issue on my system.

awesome! I recall someone doing the same thing too. If you can make a PR with those new shaders, that would be great.

I can confirm that works for me too.

The new fixes (except for the cube shaders) were published in gfx_device_gl - 0.11.2. You should need nothing more but a simple cargo update to proceed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clevijoki picture clevijoki  Â·  3Comments

kvark picture kvark  Â·  4Comments

Fluci picture Fluci  Â·  5Comments

kvark picture kvark  Â·  5Comments

kvark picture kvark  Â·  3Comments