These are chat archives for bjz/gfx-rs

15th
Jul 2014
Dzmitry Malyshau
@kvark
Jul 15 2014 00:44
@bjz formatting on #102 is updated
Dzmitry Malyshau
@kvark
Jul 15 2014 00:49
@bjz @cmr I just realized that Primitive state (or PA - Primitive Assembly) is not exactly a rasterizer state, it happens before rasterization. This becomes obvious once you look at the tessellation pipeline, where there is tons of stuff happening after PA and before the actual rasterizing (namly: HS, tessellator, DS).
Corey Richardson
@cmr
Jul 15 2014 00:50
ah tessellation, everyone's favorite feature!
Dzmitry Malyshau
@kvark
Jul 15 2014 00:50
So perhaps moving PA out of the current rast state is a good idea... I'm just worried about having one more parameter to pass into draw calls, but we've got to solve this parameters problem nevertheless
@cmr I've only been working with tessellation for about 1 year or a bit more, it's relatively new to me...
Corey Richardson
@cmr
Jul 15 2014 00:50
I was thinking it could take a single parameter for all of the state, and you use the builder pattern to make it?
Dzmitry Malyshau
@kvark
Jul 15 2014 00:51
@cmr Isn't that what we do now?..
all of the parameters could be a single one?
Dzmitry Malyshau
@kvark
Jul 15 2014 00:54
@cmr yeah, we could do that. But really - the builder pattern fits where there are lots of unused parameters. In case of this function (draw) - all parameters are used all the time (and need to be provided). The only place where there is defaults is the rast::DrawState, which is already constructed by a builder...
Corey Richardson
@cmr
Jul 15 2014 00:54
it's true.
the benefit from using the builder would be something like "named arguments"
Dzmitry Malyshau
@kvark
Jul 15 2014 00:55
yeah...
Corey Richardson
@cmr
Jul 15 2014 00:56
on the other hand maybe it is not so bad
It is certainly a lot of parameters, but the draw call should be pretty limited, you only need to deal with it once or a few times in your engine
Metal handles this in a similar way to the builder pattern
you build up a Pipeline object that has descriptors for all of the state, and send that single object along.
Dzmitry Malyshau
@kvark
Jul 15 2014 00:58
@cmr sorry, brb 1h. @bjz so no merge for me? :(
Corey Richardson
@cmr
Jul 15 2014 00:58
travis is already broken :P
cmr @cmr doesn't know where curl went
Brendan Zabarauskas
@brendanzab
Jul 15 2014 00:59
curl :(
Corey Richardson
@cmr
Jul 15 2014 00:59
also rustup.sh installs cargo now!
Dzmitry Malyshau
@kvark
Jul 15 2014 02:24
@cmr so what would be the point of passing a big struct into draw if you know exactly that 5-6 members of it are always set?
I'd rather pass the whole FFP state as a struct, but leave mesh data, program (and its parameters), and targets separately.
it's pretty much there, but needs to be called differently. Perhaps, a gfx::State?
kvark @kvark can't find a good (ergonomic) solution for shader parameters. This needs active collective brainstorming.
Corey Richardson
@cmr
Jul 15 2014 02:37
@kvark do you want to schedule a time where all of us have an hour free to just talk?
Dzmitry Malyshau
@kvark
Jul 15 2014 02:56
on a second thought, not sure if talking works as effectively in remote as being in the same room. We can just discuss it tomorrow when @cmr, @bjz , and @csherratt are available
(discuss here, I mean)
Brendan Zabarauskas
@brendanzab
Jul 15 2014 02:58
could you define what you mean by 'shader parameters'?
Corey Richardson
@cmr
Jul 15 2014 03:57
@kvark I have a mumble server, or we could google+ hangout etc
still not as good :(
brendanzab @bjz wonders if @kvark is actually an android.
Coraline Sherratt
@removed~csherratt
Jul 15 2014 06:05
@bjz you know to much
Coraline Sherratt
@removed~csherratt
Jul 15 2014 06:58
@cmr @bjz bjz/gfx-rs#104
Corey Richardson
@cmr
Jul 15 2014 09:20
It seems to be about 50/50 if a given search result for "opengl tesselation" is going to be about gluTess* crap or actual GL4 tesselation.
@kvark @csherratt do you know of any clever use of compute (either GL or D3D) in the wild?
Corey Richardson
@cmr
Jul 15 2014 09:27
There are plenty of cute demos but I don't know how well they scale to actual applications...
Dzmitry Malyshau
@kvark
Jul 15 2014 11:45
@bjz by shader parameters I mean uniforms, textures, and blocks (currently encapsulated into Environment)
@cmr compute shaders on D3D should be fairly straightforward. Created like regular shaders, parameters are managed in the same way, only call Dispatch instead of Draw* to issue. OpenGL side I'm not sure, I assume OpenCL needs to be hooked up.
Dzmitry Malyshau
@kvark
Jul 15 2014 11:53
for the shader parameters, I'll present the new version prototype later today, and then will go from there (discuss, polish, rework completely if needed)
@bjz I got iPhone4, but there are also lots of androids lying around at home. Actually looking forward to buy some linux phone as soon as it's available: Jolla doesn't seem very energetic about NA region, so leaning towards Tizen, if only it's not delayed even more...
Dzmitry Malyshau
@kvark
Jul 15 2014 12:05
Welcome @ozkriff and @jeremyletang !
Dzmitry Malyshau
@kvark
Jul 15 2014 14:51
@bjz u here yet? Have a look at my gfx-rs Contribution Guidelines, especially at the issue labels - the new scheme I propose us to adopt.
Brendan Zabarauskas
@brendanzab
Jul 15 2014 15:14
I like the tagging proposal
Dzmitry Malyshau
@kvark
Jul 15 2014 15:17
@bjz awesome! I think the README should be much shorter, merely just a hub for different pages (contributing, research, architecture, etc). Perhaps, we can store these pages in a separate folder (info/ or wiki/).
Brendan Zabarauskas
@brendanzab
Jul 15 2014 15:18
Yep
There are ways of adding more pages to a rust-doc generated thing
we currently generate docs on rust-ci
Dzmitry Malyshau
@kvark
Jul 15 2014 15:20
I see. Yeah, we definitely need our wiki pages to be accessible from there
^interesting
Dzmitry Malyshau
@kvark
Jul 15 2014 15:32
Sadly no DX10+ support...
Brendan Zabarauskas
@brendanzab
Jul 15 2014 15:32
ahh
bugger
@kvark Are you ok with mesh::Constructor->mesh::Builder?
Dzmitry Malyshau
@kvark
Jul 15 2014 15:35
sure!
@bjz @cmr @csherratt are you ready to discuss something?
Brendan Zabarauskas
@brendanzab
Jul 15 2014 15:36
also moving Constructor::embed_to to Mesh::embed?
Dzmitry Malyshau
@kvark
Jul 15 2014 15:36
@bjz sure
Brendan Zabarauskas
@brendanzab
Jul 15 2014 15:37
enum FrontType { Cw, Ccw } -> enum WindingOrder { Clockwise, CounterClocwise }?
Coraline Sherratt
@removed~csherratt
Jul 15 2014 15:37
@cmr snowmew uses compute shaders for object culling
Brendan Zabarauskas
@brendanzab
Jul 15 2014 15:37
@csherratt is that OpenCL?
Coraline Sherratt
@removed~csherratt
Jul 15 2014 15:39
The culling currently uses OpenGL compute shaders since they fit better in the pipeline. Moving from OpenCL to OpenGL right now is pretty ugly.
Dzmitry Malyshau
@kvark
Jul 15 2014 15:40
@bjz WindingOrder is good, but fix CounterClocKwise
@csherratt oh so OpenGL has compute shaders on its own? That's neat but a bit confusing (in regards to OpenCL)
ok, our waffle board is now full of shiny tags and colors
Coraline Sherratt
@removed~csherratt
Jul 15 2014 15:45
Yes, it's a 4.2+ feature.
Dzmitry Malyshau
@kvark
Jul 15 2014 15:48
@csherratt 4.3+ sadly, need to check if the extension is supported on my DX10.1 class board
Coraline Sherratt
@removed~csherratt
Jul 15 2014 15:48
The Problem with OpenGL -> OpenCL is that you need to acquire and release objects. There is some voodoo about how this can be done safely. The recommended solution from the community is to inject glFinish and clFinish at the boundaries between the two.
Dzmitry Malyshau
@kvark
Jul 15 2014 15:49
@csherratt well screw OpenCL then... For us, supporting OpenGL compute should be the way to go.
Coraline Sherratt
@removed~csherratt
Jul 15 2014 15:50
Yeah, there is a reason OpenGL compute was invented.
There are some other ugly problems, buffer packing is a bit of a unknown to me. OpenCL follows C packing standards, where the closest you can get to that in OpenGL is std430.
Brendan Zabarauskas
@brendanzab
Jul 15 2014 15:55
There is OpenGL compute now? :o
Dzmitry Malyshau
@kvark
Jul 15 2014 15:55
Isn't std430 sufficient? Also, there is std140. I haven't tried them yet, but from reading about it I got an impression that they solve the packing issue quite nicely.
Coraline Sherratt
@removed~csherratt
Jul 15 2014 15:56
@cmr the other uses for Compute are going to be things like light culling in a forward+ pipeline. I have no idea if a Forward+ pipeline can be done without it, short of reading back to the cpu... which is a crime in some countries
kvark, I think I have avoided std430 because it does not work on Mac OS, I can't recall it was to long ago.
@kvark you wanting a meeting today?
Brendan Zabarauskas
@brendanzab
Jul 15 2014 16:00
@kvark #106
Dzmitry Malyshau
@kvark
Jul 15 2014 16:00
@csherratt not a real meeting. Just wanted to discuss the new shader params design. @bjz and @cmr look as well please
kvark @kvark actually got a meeting at work right now...
Brendan Zabarauskas
@brendanzab
Jul 15 2014 16:02
np
@kvark proposed design looks good from a cursory look
I need to get to work now
The proposed API in intefrace.rs looks good. :+1: from me.
Dzmitry Malyshau
@kvark
Jul 15 2014 16:06
@bjz awesome, thanks for having a look! :)
@bjz do you think we should return Result on everything? Or leave it for the async error channel to handle?
Brendan Zabarauskas
@brendanzab
Jul 15 2014 16:07
Not sure. I think lets return Result for now, then we can come back to it at a later date
Dzmitry Malyshau
@kvark
Jul 15 2014 16:08
ok
Dzmitry Malyshau
@kvark
Jul 15 2014 16:14
@bjz good stuff in #106, just a couple of concerns to address for you
@csherratt how does the shader parameter design looks for you?
Coraline Sherratt
@removed~csherratt
Jul 15 2014 16:17
It looks ok as a whole. The part I am wondering about is if there is something nicer then using unwrap().
I imagine I would take the environment and take each shader uniform index and throw it into a structure on the client side.
UniformVar with your wording. But you obviously can't partially initialize the structure, and having a bunch of if params.my_var.is_some() in the render loop is ugly too.
I think you want to catch them early, So result does satisfy that problem. But there is the case where OpenGL optimizes out an unused uniform when you are hacking away on a shader that worries me.
Dzmitry Malyshau
@kvark
Jul 15 2014 16:21
@csherratt thanks for great feeback! I'll digest it and get back with more ideas, hopefully.
Coraline Sherratt
@removed~csherratt
Jul 15 2014 16:22
The problem for me is that an optimized away variable looks the same as naming the variable wrong... and you want the latter to be caught.
I see no way around having a check on the client side before setting an argument.
Coraline Sherratt
@removed~csherratt
Jul 15 2014 16:34
The last time I used gfx there were nearly 200 less commits. That was like 2 weeks ago 0_0
Brendan Zabarauskas
@brendanzab
Jul 15 2014 16:35
haha
Coraline Sherratt
@removed~csherratt
Jul 15 2014 16:36
Kudos
Dzmitry Malyshau
@kvark
Jul 15 2014 17:29

@csherratt

take each shader uniform index and throw it into a structure on the client side

I believe @photex proposed a similar idea some time ago. I haven't figured out the exact way this is going to work, but clearly there is a lot of benefits of using the struct. I'll be looking into this, though I'm not sure if I should implement my basic proposal first (we kinda have it working now, so we can wait longer for the proper thing to come).

The problem for me is that an optimized away variable looks the same as naming the variable wrong...

I don't think we can catch this with the way GL is made (unless we want to parse the code ourselves)

Coraline Sherratt
@removed~csherratt
Jul 15 2014 17:50
@kvark I agree.
Dzmitry Malyshau
@kvark
Jul 15 2014 18:00
@csherratt I recall now it was you who initially proposed it! Thinking about how to implement it... So the user declares a struct, for which we somehow need to implement some trait with a method that actually sets all the required parameters given the struct. Method itself doesn't guarantee integrity or safety, but whatever creates this method (a macro, presumable) has got to validate everything. Now there is a problem. A macro doesn't know what parameters are used by a program and at what slots they are expected. Hence, we can't really generate the binding routine in compile time...
Dzmitry Malyshau
@kvark
Jul 15 2014 19:09
I need some heavy macro think-tank here...
Corey Richardson
@cmr
Jul 15 2014 19:42
@kvark @bjz @csherratt I'll look over the proposals later today... the timezone difference is awful :(
Dzmitry Malyshau
@kvark
Jul 15 2014 19:43
@cmr aren't you in SF?
brendanzab @bjz is in SF, @cmr is in MV
Dzmitry Malyshau
@kvark
Jul 15 2014 21:48
Mountain View? so he is on the same timezone as you
Sven Nilsen
@bvssvni
Jul 15 2014 22:09
Please post some update notices on the new Rust gamedev subreddit http://www.reddit.com/r/rust_gamedev/
Dzmitry Malyshau
@kvark
Jul 15 2014 22:10
@bvssvni wow nice!
Interesting how you stumbled upon the same issue (GLSL versions) that @Kimundi was helping us with
Dzmitry Malyshau
@kvark
Jul 15 2014 23:35
rust gaming ecosystem grows rapidly, and fragmentation kicks in. I'm kinda surprised to see that many math libraries (nalgebra, cgmath-rs, vecmath), didn't expect a niche here at all. I do clearly see the lack of low-level graphics engine (that is API agnostic) to be a missing opportunity. When we reach Ready To Roll milestone, we'll need to become more public (posting updates and such) to prevent people getting stuck with their own engines (instead of making games).
Coraline Sherratt
@removed~csherratt
Jul 15 2014 23:38
hmm
Dzmitry Malyshau
@kvark
Jul 15 2014 23:38
hmm? please speak ;)
Coraline Sherratt
@removed~csherratt
Jul 15 2014 23:43
Are there plans on building anything higher level as part of gfx? or is it mostly, abstract the details of OpenGL/DX and let the user provide the pipeliine?
Dzmitry Malyshau
@kvark
Jul 15 2014 23:48
@csherratt I believe a higher level is the scope of another library. That library would handle the transformations, culling, sorting, render phases, and hell knows what else. There are no plans (at least for me), until gfx-rs reaches Ready To Roll state.
I'm very positive about the low-level interface that gfx-rs provides at the moment. We have a narrow but pretty definite scope, which gives a chance to produce a high quality library for that domain. A small piece to do its thing right - abstract the device, put it into its own thread, provide safe interface for drawing stuff.
Coraline Sherratt
@removed~csherratt
Jul 15 2014 23:54
That makes sense. I'm just trying to think of as how a novice would see GFX. I mean the first though is, why use this over bare opengl or HGL? Might be a marketing question more then a technical question.
It's safe, it's bindless, it supports multiple backends to help support older architectures.
It gives the user a mult-threaded render.
Coraline Sherratt
@removed~csherratt
Jul 15 2014 23:59
The bindless is actually a pretty big selling point IMHO.