These are chat archives for bjz/gfx-rs

5th
Jul 2014
Corey Richardson
@cmr
Jul 05 2014 03:26
fuck yeah spelled @bjz's last name right on the first try
Dzmitry Malyshau
@kvark
Jul 05 2014 03:29
Zabarauskas?
Corey Richardson
@cmr
Jul 05 2014 03:29
yeah :P
Dzmitry Malyshau
@kvark
Jul 05 2014 03:34
it doesn't seem to be an Australian name. Are your parents from Lithuania by any chance, @bjz?
@cmr r? #69
Brendan Zabarauskas
@brendanzab
Jul 05 2014 03:47
@kvark it's Latvian, but apparently the Italians wrote it down with a Lithuanian spelling when my grandfather was emigrating through there after the war, and he didn't bother getting it changed back.
Dzmitry Malyshau
@kvark
Jul 05 2014 03:48
interesting, so I kinda guessed right ;)
Brendan Zabarauskas
@brendanzab
Jul 05 2014 03:48
better than most people!
Dzmitry Malyshau
@kvark
Jul 05 2014 03:48
@bjz merge #69?
Corey Richardson
@cmr
Jul 05 2014 03:48
Ah yes I meant to merge that
Was waiting for travis
Dzmitry Malyshau
@kvark
Jul 05 2014 03:48
cool, thanks
Corey Richardson
@cmr
Jul 05 2014 03:48
Done now
Dzmitry Malyshau
@kvark
Jul 05 2014 03:48
g'night everyone!
Corey Richardson
@cmr
Jul 05 2014 03:48
'night
Dzmitry Malyshau
@kvark
Jul 05 2014 03:50
@bjz forgot to say: I'm from Belarus, so our roots are pretty close ;)
Marvin Löbel
@Kimundi
Jul 05 2014 08:16
Yay, the triangle example no longer kills my pc
:)
Brendan Zabarauskas
@brendanzab
Jul 05 2014 15:36
@Kimundi \o/
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:00
@kvark I wonder if it would be a good idea to move the gl device implementation out into a different crate
like what @bvssvni does with rust-graphics
It kind of concerns me how coupled Request is to gl
Marvin Löbel
@Kimundi
Jul 05 2014 16:09
Hm... To be honest, I'm still not entirely clear about what API space gfx-rs lives in. It is a abstraction layer above stuff like opengl/direct3d, right?
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:09
it is
I feel like it is abit entertwined right now though
Marvin Löbel
@Kimundi
Jul 05 2014 16:10
Yeah, the fact that the example uses a GLSL shader directly kinda threw me of ;)
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:10
yeah I am still not clear on shaders
I think @kvark and @photex have ideas re. that
but yeah, I definitely think moving things off into separate crates will help to decouple things
@Kimundi we are still molding it
Marvin Löbel
@Kimundi
Jul 05 2014 16:12
Oh, sure
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:12
I am very much not happy with the external API right now
Marvin Löbel
@Kimundi
Jul 05 2014 16:12
Just wondering how its kinda-maybe going to look like ;)
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:12
there are glimmers of beauty coming out though
which is really encouraging
I like the simplicity of the implementations present in the device module, I just find some of the architecture ugly right now
but I feel like that can be teased out into something much nicer
dunno if that makes sense
Marvin Löbel
@Kimundi
Jul 05 2014 16:17
Yeah, I haven't really read through the whole API yet, so I'm still fuzzy on the details
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:18
sorry if it is a tad messy
Marvin Löbel
@Kimundi
Jul 05 2014 16:26
@bjz Can you give me a short rundown about what the different modules contain? Like, the difference between platform and device, etc
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:29
render is for the high level API - it is reasonably declarative and can be sent between tasks
render communicates with device via channels
device translates the draw calls received from the channel into the API understood by the target driver
platform is the interface with the windowing lib
Marvin Löbel
@Kimundi
Jul 05 2014 16:32
Okay, that clears stuff up a bit :)
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:33
we need to document that better
:P
Marvin Löbel
@Kimundi
Jul 05 2014 16:33
hehe
brendanzab @bjz is working on making the gfx module a facade
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:34
moving platform and render into separate crates
Marvin Löbel
@Kimundi
Jul 05 2014 16:34
device already is, right?
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:34
it is
Marvin Löbel
@Kimundi
Jul 05 2014 16:36
Anything I could help with atm?
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:36
hmm - what interests you?
you could have a look through the issues, or make new ones
perhaps a new issue for moving the gl device into a new crate
(see my previous musings this morning ^)
Marvin Löbel
@Kimundi
Jul 05 2014 16:38
Ah, now I can actually understand them ;)
Something like making device itself a facade over the different APIs?
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:39
well, I would rather it be extensible by the client perhaps... but we would provide some common implementations
Corey Richardson
@cmr
Jul 05 2014 16:40
@bjz what's the benefit of a facade here? do you envision anyone using the individual crates directly?
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:40
@cmr to encourage use to make things less mutually dependent
@cmr you can't do mutually recursive imports cross-crate
@cmr do you disagree?
Corey Richardson
@cmr
Jul 05 2014 16:43
No, that makes sense.
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:44
I'm also thinking in terms of making things more understandable for new devs - like @Kimundi
Wow, up to #70 issues already
gfx is really choofing along
probably mostly thanks to @kvark ;)
brendanzab @bjz wonders whether we should drop the -rs suffix
Marvin Löbel
@Kimundi
Jul 05 2014 16:51
@bjz: Hm, you're adding a syntax extension in #70 that I can't figure out what is being used for.
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:52
oh - that's for the logging
Marvin Löbel
@Kimundi
Jul 05 2014 16:53
Ah, okay
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:53
extern crate log
we don't seem to use it in render, but I reckon it could be useful
Marvin Löbel
@Kimundi
Jul 05 2014 16:53
I mean handle!
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:53
oh woops!
Coraline Sherratt
@removed~csherratt
Jul 05 2014 16:53
bjz, can gfx win the google ranking over http://gfxtrucks.com/
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:53
that was locally
I will remove, haha
Marvin Löbel
@Kimundi
Jul 05 2014 16:55
Oh hey, so thats what the github issue manager looks like if you have actual contributor access to it ;D
Thx for adding me
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:55
@Kimundi thanks for the review!
haha, yup
Coraline Sherratt
@removed~csherratt
Jul 05 2014 16:56
at least for me gfx-rs has the first search result.
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:56
yeah
this is true
Kimundi @Kimundi now has to live in constant fear of accidentally the repo.
brendanzab @bjz wonders if we could think up a different name
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:56
llamagfx
Marvin Löbel
@Kimundi
Jul 05 2014 16:57
rs-gfx-rs :P
Dzmitry Malyshau
@kvark
Jul 05 2014 16:57
@bjz what do you consider a primary concern for the external API of ours (re: you are unhappy about it)?
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:57
because llamas are awesome
@kvark the platform stuff - and the phantom type thingy I added
Dzmitry Malyshau
@kvark
Jul 05 2014 16:58
nice #70! i can't review it now though
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:58
@kvark NO, ARE YOU TOO BUSY FOR GFX-RS?!
Coraline Sherratt
@removed~csherratt
Jul 05 2014 16:59
@Kimundi think that is bad? bjz doesn't even get a private repo to push to.
brendanzab @bjz is disappointed in @kvark
Dzmitry Malyshau
@kvark
Jul 05 2014 16:59
@bjz I just realized that since we have no render task, we can actually pass references to render methods
Marvin Löbel
@Kimundi
Jul 05 2014 16:59
I would review it if I could actually validate it yet, haha
Dzmitry Malyshau
@kvark
Jul 05 2014 16:59
@bjz :v:
Brendan Zabarauskas
@brendanzab
Jul 05 2014 16:59
@kvark oooh
Dzmitry Malyshau
@kvark
Jul 05 2014 16:59
@bjz do you think it would be acceptable in the interface, or we should keep passing everything by-value to easier render transition into its own task?
that's kinda a deciding factor for shader parameters design....
Brendan Zabarauskas
@brendanzab
Jul 05 2014 17:00
oh really? interesting
Dzmitry Malyshau
@kvark
Jul 05 2014 17:00
we could also expose the Mesh struct, and I have some good ergonomics ideas on it
Brendan Zabarauskas
@brendanzab
Jul 05 2014 17:00
if you were to pass references, you would need to be concerned about immutability I think
Dzmitry Malyshau
@kvark
Jul 05 2014 17:01
think about it: passing by reference means no need to worry about Environment structure/size/allocations at all!
Brendan Zabarauskas
@brendanzab
Jul 05 2014 17:01
@cmr would know more about that
yeah, that sounds neat
how would that work with @photex's handle manager stuff?
Dzmitry Malyshau
@kvark
Jul 05 2014 17:02
well, some things just don't need to be in handles?
Brendan Zabarauskas
@brendanzab
Jul 05 2014 17:02
but yeah, nice to see you 'thinking with references'
:P
yeah I dunno - just musing. could you make an issue for it? It would be nice to see a concrete example
Dzmitry Malyshau
@kvark
Jul 05 2014 17:03
let me know if you end up concluding we don't need references. Otherwise I'll start hacking this night to produce some usable Mesh and Environment interfaces
(let me know by the end of the day)
Brendan Zabarauskas
@brendanzab
Jul 05 2014 17:04
It certainly seems compelling to start taking advantage of Rust's crazy reference stuff, and to enforce more immuability
Dzmitry Malyshau
@kvark
Jul 05 2014 17:04
@bjz as for the name... I don't think it should be changed. Especially since there are no good candidates (llamagfx aside)
Brendan Zabarauskas
@brendanzab
Jul 05 2014 17:04
but I have no idea yet
Corey Richardson
@cmr
Jul 05 2014 17:05
@kvark what would be psased by reference?
Dzmitry Malyshau
@kvark
Jul 05 2014 17:05
Environment, Mesh
Corey Richardson
@cmr
Jul 05 2014 17:05
Wouldn't sending that to the server then require a copy/
Dzmitry Malyshau
@kvark
Jul 05 2014 17:05
@Kimundi congrats with becoming a member! we are 6 now? can't believe that ;)
@cmr that's not sent to the device. Render dissects it into multiple low-level commands
i.e. binding a mesh involves binding specific attributes to locations, etc
Corey Richardson
@cmr
Jul 05 2014 17:06
ah i see
Dzmitry Malyshau
@kvark
Jul 05 2014 17:07
@Kimundi I'm also happy to see the holy triangle not botching my system to death, at last ;)
Corey Richardson
@cmr
Jul 05 2014 17:07
if it can take a reference, it should
for the render task it's not as much of a concern
whatever wraps it can use different methods that take a value, send that, and then it passes a reference to that
Dzmitry Malyshau
@kvark
Jul 05 2014 17:09
@cmr exactly, and I envision whatever the upper level is would do batching anyway, which would reduce the cost of copying the Environment
brendanzab @bjz thinks he will have to get going on the terrain example at some point
Brendan Zabarauskas
@brendanzab
Jul 05 2014 17:11
@kvark do you think we are ready to begin tackling it?
Marvin Löbel
@Kimundi
Jul 05 2014 17:18
renderer.create_mesh(3, data, 2, 8); means "create a mesh consisting of 3 vertices, each consisting of 2 f32s that have a stride of 8=2*size_of<f32>", right?
Dzmitry Malyshau
@kvark
Jul 05 2014 17:18
@bjz the mesh is not ready... and we might need some basic rasterizer state #51 for it. Perhaps, you can wait till tomorrow? ;)
@Kimundi correct. I'm going to work on that part this night.
Marvin Löbel
@Kimundi
Jul 05 2014 17:18
Why is elements in units, and stride in bytes?
Dzmitry Malyshau
@kvark
Jul 05 2014 17:19
@Kimundi that's what device expects
ok, sorry, gtg, bbl!
Marvin Löbel
@Kimundi
Jul 05 2014 17:19
Hm, yeah I'm just wondering about the logic behind that :)
Is a f32 the only possible unit you can have there, making it unambiguous?
Dzmitry Malyshau
@kvark
Jul 05 2014 17:58
@Kimundi: no, pretty much all basic types will be supported
Marvin Löbel
@Kimundi
Jul 05 2014 17:59
So is it currently hardcoded to a 32 bit type, or am I missing the place where that gets selected?
I would probably help if I knew more about OGL in general, haha
Dzmitry Malyshau
@kvark
Jul 05 2014 18:44
Yeah, it was hardcoded to get the triangle example operational.
Marvin Löbel
@Kimundi
Jul 05 2014 18:46
Alright. I'm currently reading through an OpenGl tutorial yet again to get a grip on things :)
Dzmitry Malyshau
@kvark
Jul 05 2014 18:46
@Kimundi I was hoping you take care of the GL compatibility profile, since we got it working on your HW
Marvin Löbel
@Kimundi
Jul 05 2014 18:47
Sure!
Corey Richardson
@cmr
Jul 05 2014 18:47
@kvark #70 looks good to me, how about you?
Marvin Löbel
@Kimundi
Jul 05 2014 18:48
Currently reading up on what those things are that needed to be disable to get the triangles example to work here.
Would the compatibility profile be its own gl device, or just a compilation option of the same one?
Corey Richardson
@cmr
Jul 05 2014 18:50
Cargoification is blocked on cargo improvements, it can't pass --cfg
Marvin Löbel
@Kimundi
Jul 05 2014 18:55
Hm, I guess the device could have a ArrayBuffer emulation for the compat profile?
I I understand VAOs correctly, they are replaceable by manually doing the calls, right?
Corey Richardson
@cmr
Jul 05 2014 18:57
Your driver supports GL_ARB_vertex_array_object
I see a few distinctions here:
  • new drivers, ancient card (which will usually support many modern extensions, even with opengl 2.1)
Marvin Löbel
@Kimundi
Jul 05 2014 18:57
Oh, I guess it does. But in case it wouldn't , that could work, right?
Corey Richardson
@cmr
Jul 05 2014 18:57
  • old drivers, ancient card (do we want to support this?)
Marvin Löbel
@Kimundi
Jul 05 2014 18:57
yeah, thats definitly a difference
Corey Richardson
@cmr
Jul 05 2014 18:58
I was thinking we would have a few different "levels" of support, and query for available extensions to pick which one to use
(rather than doing per-opengl-version)
Dzmitry Malyshau
@kvark
Jul 05 2014 18:59
@Kimundi yeah, but you can start by simply ignoring VAO calls, knowing that the renderthread doesn't use them
Corey Richardson
@cmr
Jul 05 2014 19:08
@kvark do you have any ideas on avoiding multiplication of shaders for every supported backend?
Ideas that aren't make our own shading language ;P
Marvin Löbel
@Kimundi
Jul 05 2014 19:10
@cmr But that sounds like the most fun idea!
I guess predefined shaders/shader fragments are a non-starter?
Corey Richardson
@cmr
Jul 05 2014 19:13
Certainly out of scope for gfx-rs
Buyt if we're gong to support multiple versions of GL and D3D
figuring out shader source is important
Marvin Löbel
@Kimundi
Jul 05 2014 19:14
Doesn't valve have something that compiles GLSL into HSLS (Or however the acronyms go)
Coraline Sherratt
@removed~csherratt
Jul 05 2014 19:15
@Kimundi other way around
Marvin Löbel
@Kimundi
Jul 05 2014 19:15
Ah, yeah
Coraline Sherratt
@removed~csherratt
Jul 05 2014 19:16
there are a few HSLS to GLSL translators
Marvin Löbel
@Kimundi
Jul 05 2014 19:17
Maybe just provide a transparent way to let the user provide shaders with identical meaning for each supported device
Coraline Sherratt
@removed~csherratt
Jul 05 2014 19:18
to bad Cg was abandoned
Dzmitry Malyshau
@kvark
Jul 05 2014 19:33
I'm leaning towards HLSL -> GLSL, but I don't really have experience in that. Will try reading up on the topic. Meanwhile, could someone create an issue for it, where we'd discuss the ideas and post links?
Corey Richardson
@cmr
Jul 05 2014 19:34
on it
#71
Dzmitry Malyshau
@kvark
Jul 05 2014 19:40
#70 :+1:
Dzmitry Malyshau
@kvark
Jul 05 2014 19:56
Actually, the user choses api/platform, and the user provides shader source... So, perhaps shaders portability is out of gfx-rs scope?
Corey Richardson
@cmr
Jul 05 2014 19:56
Possibly.
I guess it'd be the job of another library on top?
Marvin Löbel
@Kimundi
Jul 05 2014 19:59
Well, I just started playing around with this: https://gist.github.com/Kimundi/8b697a3e605c113ffa5d
As a portable quick-n-dirty inline shader specification :P
Brendan Zabarauskas
@brendanzab
Jul 05 2014 20:38
@kvark cfg gated!
@Kimundi nice!
@kvark would be cool to be able to reference file paths too
Marvin Löbel
@Kimundi
Jul 05 2014 20:47
@bjz Is there a nice way to query the supported opengl version inside gfx, or do I need to make manual calls with gl-rs?
Brendan Zabarauskas
@brendanzab
Jul 05 2014 21:02
@Kimundi no way as of yet ^_^
Marvin Löbel
@Kimundi
Jul 05 2014 21:03
google it is then :)
Brendan Zabarauskas
@brendanzab
Jul 05 2014 21:04
@kvark is #70 ready to merge now?
Dzmitry Malyshau
@kvark
Jul 05 2014 21:06
@bjz awesome, green light is given. Thanks for the great PR!
@cmr I believe shader translation deserves its own project/crate
Haven't reaaly looked into it yet... Writing from my phone
Brendan Zabarauskas
@brendanzab
Jul 05 2014 21:28
@kvark perhaps we could keep it in-project for now as a separate crate then split it out later?
@photex beep
Marvin Löbel
@Kimundi
Jul 05 2014 22:18
Heh, the compiler does not like match c_s_b { b"1.10" => self <= GLSL_110, b"1.20" => self <= GLSL_120, b"1.30" => self <= GLSL_130, b"1.40" => self <= GLSL_140, b"1.50" => self <= GLSL_150, } at all. ICEs with "entered unreachable code".
well, so much for the hope of smart formatting...
Brendan Zabarauskas
@brendanzab
Jul 05 2014 22:24
haha
get CReduce on it!
Marvin Löbel
@Kimundi
Jul 05 2014 22:24
Nah, bug is already filed
It reduces to matching on two byte string literals
Brendan Zabarauskas
@brendanzab
Jul 05 2014 22:25
ahh
haha
Marvin Löbel
@Kimundi
Jul 05 2014 22:26
```
whoops
Not yet entirely dry, but nice to read imo
Dzmitry Malyshau
@kvark
Jul 05 2014 22:30
@bjz you mean the shader translation? I don't mind ;)
Marvin Löbel
@Kimundi
Jul 05 2014 22:33
Okay, I got device to detect and use the correct shader source at runtime.
Dzmitry Malyshau
@kvark
Jul 05 2014 22:39
@Kimundi wow nice!
Brendan Zabarauskas
@brendanzab
Jul 05 2014 22:49
ooooh
Marvin Löbel
@Kimundi
Jul 05 2014 22:54
r? bjz/gfx-rs#72
Dzmitry Malyshau
@kvark
Jul 05 2014 23:41
@bjz side question: why is bool considered an anti-pattern?
brendanzab @bjz is beginning to dislike bools because they convey no semantic information
Marvin Löbel
@Kimundi
Jul 05 2014 23:42
In create_shader(stage: s::Stage, data: s::ShaderSource) -> (Result<super::Shader, CreateShaderError>, Option<String>), what is the Option<String> for?
Dzmitry Malyshau
@kvark
Jul 05 2014 23:42
info log
@bjz but neither int or float by themselves (as values) contain any semantics
Marvin Löbel
@Kimundi
Jul 05 2014 23:43
Ah, so putting "No supported GLSL shader provided!" in an error case would be ok?
Dzmitry Malyshau
@kvark
Jul 05 2014 23:44
@Kimundi hmmm I suppose it's ok, as long as the user can see the difference between driver-provided message and yours.
perhaps, add "[gfx-rs]" in front?
Marvin Löbel
@Kimundi
Jul 05 2014 23:44
Uhm, what is the difference?
Dzmitry Malyshau
@kvark
Jul 05 2014 23:45
@bjz I read this yesterday, and then - the comments. Comments were more convincing....
Brendan Zabarauskas
@brendanzab
Jul 05 2014 23:47
@kvark I would actually prefer an ergonomically nice way of having 'unit literals'
but yeah
Our languages can still make semantic types ugly to express
brendanzab @bjz sees types as a way of modelling thoughts/ideas/designs - akin to an in-language, compile time checked UML (something simon peyton-jones has mentioned before)
Dzmitry Malyshau
@kvark
Jul 05 2014 23:52
@bjz I agree with that, but this needs to address all primitive types, not just booleans
@bjz so really we have to include the device now?
Brendan Zabarauskas
@brendanzab
Jul 05 2014 23:56
with #72?
Dzmitry Malyshau
@kvark
Jul 05 2014 23:56
yep
Marvin Löbel
@Kimundi
Jul 05 2014 23:57
Changed and commented on a few things
Dzmitry Malyshau
@kvark
Jul 05 2014 23:58
that seems to be the last concern in #72
Brendan Zabarauskas
@brendanzab
Jul 05 2014 23:59
@Kimundi sorry for the concerns - this is a super cool idea.
Marvin Löbel
@Kimundi
Jul 05 2014 23:59
No, no, they are all justified :)