These are chat archives for bjz/gfx-rs

20th
Jul 2014
Corey Richardson
@cmr
Jul 20 2014 00:57
@kvark ok, I can't figure out how to implement texture binding in the renderer.
Its interaction with uniforms is weird and I can't really piece together the different parts
Is just binding them to the texture unit it was created in order with fine, and the user is responsible for setting the proper uniform?
Is that also how HLSL works?
I feel like the user shouldn't have to manage that though
Dzmitry Malyshau
@kvark
Jul 20 2014 02:16
@cmr you can leave this part to me, I don't want your PR to be held for too long. Envir is going away soon anyhow.
Corey Richardson
@cmr
Jul 20 2014 02:16
Ok.
It can be merged now then.
I hope it works :shipit:
Brendan Zabarauskas
@brendanzab
Jul 20 2014 02:18
@kvark aww, you beat me!
:D
Dzmitry Malyshau
@kvark
Jul 20 2014 02:18
sorry, didn't know who was around :)
Corey Richardson
@cmr
Jul 20 2014 02:18
Yay :D
Any thoughts on #113?
My first idea is to add a special buffer storage type
Dzmitry Malyshau
@kvark
Jul 20 2014 02:19
@cmr since we can't send a slice really, we can send an Arc instead
Corey Richardson
@cmr
Jul 20 2014 02:20
That allows for reference-counted slices.
Essentially the slice type for this becomes (*refcount, *base, length)
And getting a real slice from this would borrow.
Destructor would decrease the refcount
I think this is like a DST Rc<[T]> but I am not sure...
Dzmitry Malyshau
@kvark
Jul 20 2014 02:23
@cmr If only we had a test-case for it, but we really do not. I'd come back to this problem after @bjz (or anyone else) implements the terrain example, where the buffer is updated every frame.
@cmr but Rc<> can not be sent between tasks, no?
Corey Richardson
@cmr
Jul 20 2014 02:25
@kvark It would have to be Arc, right.
kvark @kvark didn't know GH closes referred issues automatically
Corey Richardson
@cmr
Jul 20 2014 02:32
Anyone mind if I take #80?
Dzmitry Malyshau
@kvark
Jul 20 2014 02:33
@cmr that would be great
Corey Richardson
@cmr
Jul 20 2014 02:35
Hum. Moving the backends out of device will require device to expose a lot more of its internals.
Not sure we should actually do it -- @bjz?
Brendan Zabarauskas
@brendanzab
Jul 20 2014 02:39
it would be nice to componentise the backends
not sure what it would look like
perhaps we should look to piston?
Corey Richardson
@cmr
Jul 20 2014 02:40
oh, also, @bvssvni was asking in #rust-gamedev earlier about gfx-rs's plans, to help plan for piston.
Dzmitry Malyshau
@kvark
Jul 20 2014 02:47
I see he's got some ideas on the high-level interfaces (catching up on reddit...)
Corey Richardson
@cmr
Jul 20 2014 02:57
Hm, it's very difficult to break the circular dependency between device and gldevice.
Due to the lack of associated types.
device uses types gldevice defines, gldevice implements traits device defines...
Dzmitry Malyshau
@kvark
Jul 20 2014 03:15
macro gods are kind to me today, I've got the shader link construction implemented:
struct Params {
    b: gfx::BufferHandle,
    x: int,
    t: gfx::TextureHandle,
}
struct _ParamsLink {
    b: ::gfx::BlockVarId,
    x: ::gfx::UniformVarId,
    t: ::gfx::TextureVarId,
}
#[automatically_derived]
impl ::gfx::ShaderParam<_ParamsLink> for Params {
    fn create_link<S: ::gfx::ParameterSink>(__arg_0: &S) ->
     Result<_ParamsLink, ::gfx::ParameterLinkError> {
        ::std::result::Ok(_ParamsLink{b: __arg_0.find_block("b").unwrap(),
                                      x: __arg_0.find_uniform("x").unwrap(),
                                      t: __arg_0.find_texture("t").unwrap(),})
    }
}
It's not processing the result properly yet though
Brendan Zabarauskas
@brendanzab
Jul 20 2014 03:17
@cmr yeah, the circular dependency concerns me
@kvark ooh neat
Dzmitry Malyshau
@kvark
Jul 20 2014 03:20
@bjz it may seem so trivial if you look at this, but the amount of code (and effort) is stunning
Corey Richardson
@cmr
Jul 20 2014 03:26
@kvark can I take #50?
Just trying to find something to do
Can't write useful code with it until your shader parameter stuff is done :P
Or maybe I will try and set up a blog...
Oh yes that was what I wanted to do.
@bjz create a gfx-rs organization and migrate the repos to it?
org created
you two are owners I think
Dzmitry Malyshau
@kvark
Jul 20 2014 03:29
@cmr sure, feel free to tackle #50. I'm gonna be busy with shader parameters for some time... BTW, the current system still works, so you should be able to write useful code.
Corey Richardson
@cmr
Jul 20 2014 03:29
bbl, dinner.
Dzmitry Malyshau
@kvark
Jul 20 2014 03:31
@bjz how do we move gfx-rs into the organization?
funny how we, members, are listed: Brendan, Corey, Dzmitry. Don't you think we are missing an A here (Andrey @ozkriff) ? ;)
Coraline Sherratt
@removed~csherratt
Jul 20 2014 04:18
:/ I don't think Cargo is mature enough for gfx-rs yet
It assumes that there is only one library per crate I think
Corey Richardson
@cmr
Jul 20 2014 04:32
@csherratt one crate per project, but you can put multiple Cargo.toml, one for each subdirectory.
It will look in the right place.
Brendan Zabarauskas
@brendanzab
Jul 20 2014 07:20
@cmr you have the org now?
I am wondering if we should have an org per project...
:/
Corey Richardson
@cmr
Jul 20 2014 13:32
@bjz you are also an owner
of the org
Dzmitry Malyshau
@kvark
Jul 20 2014 13:32
@cmr is it possible to "transfer" the project? or do we need to re-create it?
Corey Richardson
@cmr
Jul 20 2014 13:33
Yes.
@bjz can go into the repo admin page and do a transfer
Dzmitry Malyshau
@kvark
Jul 20 2014 13:34
I suppose the same happened to rust at some point. I kinda like the automatic redirection that happened afterwards
Dzmitry Malyshau
@kvark
Jul 20 2014 14:40
Got the proper parameter link errors now:
#[automatically_derived]
impl ::gfx::ShaderParam<_ParamsLink> for Params {
    fn create_link<S: ::gfx::ParameterSink>(__arg_0: &S) ->
     Result<_ParamsLink, ::gfx::ParameterLinkError<'static>> {
        ::std::result::Ok(_ParamsLink{b:
                                          match __arg_0.find_block("b") {
                                              Some(_p) => _p,
                                              None =>
                                              return ::std::result::Err(::gfx::LinkMissingBlock("b"))
                                          },
                                      x:
                                          match __arg_0.find_uniform("x") {
                                              Some(_p) => _p,
                                              None =>
                                              return ::std::result::Err(::gfx::LinkMissingUniform("x"))
                                          },
                                      t:
                                          match __arg_0.find_texture("t") {
                                              Some(_p) => _p,
                                              None =>
                                              return ::std::result::Err(::gfx::LinkMissingTexture("t"))
                                          },})
    }
}
Corey Richardson
@cmr
Jul 20 2014 14:41
:ear_of_rice:
Dzmitry Malyshau
@kvark
Jul 20 2014 14:42
@cmr what does that mean? too much code?
Corey Richardson
@cmr
Jul 20 2014 14:43
I have no idea.
I just picked a random emoji
Dzmitry Malyshau
@kvark
Jul 20 2014 14:43
I'm really excited about this system. It's gonna be the greatest shader parameter architecture I've ever worked with. Kudos to @csherratt for the vision!
Corey Richardson
@cmr
Jul 20 2014 14:44
Agree! Yay Rust!
Do you think it will be done this weekend? :horse_racing:
Dzmitry Malyshau
@kvark
Jul 20 2014 14:49
@cmr If I had the whole day in my disposal - yes, but there is a lot of stuff I need to do family-wise, so please expect the PR next week.
Corey Richardson
@cmr
Jul 20 2014 14:49
Ok
Dzmitry Malyshau
@kvark
Jul 20 2014 15:47
@cmr besides, It will not work until rust-lang/rust#15814 is merged
Corey Richardson
@cmr
Jul 20 2014 16:19
@kvark greased the wheels a bit for that one :sparkles:
Dzmitry Malyshau
@kvark
Jul 20 2014 16:32
@cmr :fast_forward: :fast_forward: :fast_forward: thanks!
Brendan Zabarauskas
@brendanzab
Jul 20 2014 16:49
So are we 100% sure that gfx-rs is a good name?
cmr @cmr likes it
Brendan Zabarauskas
@brendanzab
Jul 20 2014 16:49
(for the lib)
Corey Richardson
@cmr
Jul 20 2014 16:49
extern crate gfx; and now all of your graphical needs are solved ;)
Brendan Zabarauskas
@brendanzab
Jul 20 2014 16:50
yeah, that's nice
my only worry is the addition of -rs
Dzmitry Malyshau
@kvark
Jul 20 2014 16:50
indeed :dart:
Marvin Löbel
@Kimundi
Jul 20 2014 16:51
Yeah, I'm not sure how the -rs should be handled in general
Brendan Zabarauskas
@brendanzab
Jul 20 2014 16:51
-rs is good for bindings
and wrappers to existing APIs/libs
where as gfx is a level above
Dzmitry Malyshau
@kvark
Jul 20 2014 16:53
I just kinda got used to it. Not minding any name as long as it says something and is used consistently
Corey Richardson
@cmr
Jul 20 2014 16:54
I like -rs for project names.
Marvin Löbel
@Kimundi
Jul 20 2014 16:55
Me too, but there needs to be a convention about how the library should be called
cause extern crate gfx-rs doesn't work, and making extern crate foo = "foo-rs" the convention seems bad :)
Dzmitry Malyshau
@kvark
Jul 20 2014 16:56
We need to migrate to the org chat room...
Brendan Zabarauskas
@brendanzab
Jul 20 2014 17:21
@Kimundi yeah, extern crate foo = "foo-rs" is a little unfortunate... :(
Corey Richardson
@cmr
Jul 20 2014 17:21
I like foo-rs for the project name, but once you are inside the universe of rustc, having rs anywhere in a name doesn't make sense
Brendan Zabarauskas
@brendanzab
Jul 20 2014 17:29
yep
Dzmitry Malyshau
@kvark
Jul 20 2014 18:32
I just realized that prototype-3 has one important ability lacking - to ensure that all the program parameters are provided. Now the question is whether I should finish prototype-3 first, merge, and then continue to p-4.
p-3 should be mostly forward-compatible (from the user standpoint), so I guess that should be fine
anyway, bbl
Brendan Zabarauskas
@brendanzab
Jul 20 2014 20:03
So we are good with gfx-rs? I think I am good with it.
cmr @cmr is good with it
Corey Richardson
@cmr
Jul 20 2014 22:04
@kvark what is the end goal of Surface stuff? FBO/render target support?