-
Notifications
You must be signed in to change notification settings - Fork 543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved gl_device out #598
Moved gl_device out #598
Conversation
Maybe they could be unsafe getters/setters? |
I will think on this. |
@bjz I think I know a good solution:
It's unlikely that anyone will try to reach for it, but even one does - one probably knows what one is doing. There is gonna be near zero chance of "accidental" creation of invalid handles and such. |
Note to self: cleanup instancing parameters in the renderer. |
Ok, the last problem now is with macros. Having a code like this doesn't really compile: impl<R: gfx::Resources> gfx::VertexFormat for Foo {
type Resources = R;
...
} Because Rust doesn't know how to constrain
Any ideas? |
Here is a standalone snippet exposing the problem: trait Foo {}
trait Bar {
type F: Foo;
fn fun(&self, Self::F);
}
impl<F: Foo> Bar for () {
type F = F;
fn fun(&self, _:F) {}
} One straightforward solution would be to provide an exact However, I don't like where this is going. Not only it is already verbose, even if you do a typedef, it would be the hell in a complex application with many vertex/shader formats and multiple supported backends. Too much noise, especially since it's not obvious why the original one shouldn't work. @cmr halp |
@Kimundi provided a good explanation on why this is not sound:
The solution, as it seems, could be to remove the associated type from |
@bjz @csherratt - this is ready I fought with |
Also, deferred example doesn't work for me. When rendering to Gbuffer, we get an exception saying the target frame doesn't have depth (mask = 64). I tried logging it up in the example code, and the mask seems to be 71, so something happens inside the submission. I blame that Rust bug. |
@@ -14,10 +14,10 @@ | |||
|
|||
[package] | |||
name = "gfx" | |||
version = "0.1.7" | |||
version = "0.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay~
LGTM. I'd like @bjz to look over it too. |
@csherratt sure thing. Thanks! |
@@ -84,7 +86,7 @@ struct CubeVertex { | |||
pos: [i8; 3], | |||
} | |||
|
|||
#[shader_param] | |||
#[shader_param(R)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ok for now, but it would be nice to have a better way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I just wasn't able to come up with anything better than that... The problem comes from the fact that this structure has to implement ShaderParam
for every device. We need to somehow make it device-independent.
598: Enable READ access for texture storage r=kvark a=kvark This is a short-term workaround until we properly implement gfx-rs#597 Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
Closes #80
Depends on https://github.com/gfx-rs/gfx_device_gl/pull/1
The biggest problem is security. Once
device_gl
is in a separate crate, it can no longer constructHandle
and*Mapping
types, since they have private fields. Making the fields public could be a temporary solution but I wish we had something more secure to offer.