You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to streamline my uniform pipeline by using uniform blocks. I want to create a block called StaticUniforms which is created using glium::uniforms::UniformBuffer::immutable. Based on the documentation this should be reserved for uniforms which do not change much if at all.
My current layout looks like this:
use glium::{implement_uniform_block, uniforms::Sampler, texture::SrgbCubemap};#[derive(Clone,Copy)]pubstructStaticUniforms<'a>{pubu_perspective:[[f32;4];4],pubu_skybox:Sampler<'a,SrgbCubemap>}implement_uniform_block!(StaticUniforms,u_perspective, u_skybox);
I am able to successfully create and use this uniform block with just the perspective matrix.
However, when I try to add a Sampler<'_, T> the implement_uniform_block! macro yields the compiler error: the trait bound 'Sampler<'_, glium::texture::SrgbCubemap>: glium::uniforms::UniformBlock' is not satisfied
Further investigation shows that this might be an issue with the macro itself as the full diagnostic yields:
error[E0726]: implicit elided lifetime not allowed here
--> src\glib\uniform.rs:8:1
|
8 | implement_uniform_block!(StaticUniforms,u_perspective, u_skybox);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected lifetime parameter
|
= note: assuming a `'static` lifetime...
= note: this error originates in the macro `$crate::implement_uniform_block` which comes from the expansion of the macro `implement_uniform_block` (in Nightly builds, run with -Z macro-backtrace for more info)
help: indicate the anonymous lifetime
--> C:\Users\usr\.cargo\git\checkouts\glium-77a94afc886844c8\bdb70bc\src\macros.rs:369:75
|
36| impl<$($gs)*> $crate::uniforms::UniformBlock for $struct_name<'_, $($gs)*> {
| +++
Should I simply modify the macro as the compiler suggests? Or is there a different way to use structs with lifetime parameters within a uniform block?
The text was updated successfully, but these errors were encountered:
Thank you for opening this issue. It does sound like a problem with glium, I'll try and look into it on the weekend. Could you maybe upload a full example somewhere? That way it's easier for me to test whether it fixes the actual issue.
I am trying to streamline my uniform pipeline by using uniform blocks. I want to create a block called
StaticUniforms
which is created usingglium::uniforms::UniformBuffer::immutable
. Based on the documentation this should be reserved for uniforms which do not change much if at all.My current layout looks like this:
I am able to successfully create and use this uniform block with just the perspective matrix.
However, when I try to add a
Sampler<'_, T>
theimplement_uniform_block!
macro yields the compiler error:the trait bound 'Sampler<'_, glium::texture::SrgbCubemap>: glium::uniforms::UniformBlock' is not satisfied
Further investigation shows that this might be an issue with the macro itself as the full diagnostic yields:
Should I simply modify the macro as the compiler suggests? Or is there a different way to use structs with lifetime parameters within a uniform block?
The text was updated successfully, but these errors were encountered: