@julienbarnoin@mastodon.gamedev.place
@julienbarnoin@mastodon.gamedev.place avatar

julienbarnoin

@julienbarnoin@mastodon.gamedev.place

Independent maker of games.
Cofounder of current game studio, Berry & Cloud.
Working on Bioplanet Kamaryn, a game with a new Vulkan based GPU-centric engine. Expect weird things.

I support free software and the #FSF and planning to release the game's source as #GPL while also selling it on the usual platforms.

I'm from #France but living in my secret base somewhere remote in #Quebec.

Previous work: EA (Army of Two series), cofounder of Minority Media (Papo & Yo, many more).

This profile is from a federated server and may be incomplete. Browse more on the original instance.

julienbarnoin, to gamedev
@julienbarnoin@mastodon.gamedev.place avatar

When you just spent a couple hours refactoring shader code for performance, finally get it working again, measure it and it's 10x slower than before.

Yeah, I think it's time for bed.

grumpygamer, to RPG
@grumpygamer@mastodon.gamedev.place avatar

My engine now supports Tiled world maps so the map can grow without strangling resources at run-time, also (and maybe more important) different people can work on the map at the same time. I do wish Tiled understood that a file is R/O and blocked editing until it was R/W. This is so important for version control that allows locking files. It is more of a problem with world maps where the chunk you're working is so easily changed. I would help fund this change.

@tiled

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@grumpygamer @tiled Out of curiosity, what version control system are you using?

julienbarnoin, to GraphicsProgramming
@julienbarnoin@mastodon.gamedev.place avatar

I know SPIR-V is not meant for human readability and all that, but damn. Is there not any way that the variables were named anything closer to useful than %13525? I understand that it's not a one-to-one match with my glsl variables, but like... This feels like it's actively trying to obfuscate the code 🥲

Maybe there's some glslang option I don't know about that tries to make them a bit clearer?

#glsl #spirv #vulkan #programming #gamedev

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

To be clear I'm referring to disassembled SPIR-V, I'm not even quite sure if those variable names exist in the binary or if they're here to represent variables that are just indexed or something. But surely there could be some way to keep a hint when debugging.

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

Ha, in the light of the whole discussion around how people treated the original maintainer of , I'm having a little moment of self-awareness as I complain about the features in the open source software I'm using for free, while the amazing people who actually work on it like @gfxstrand and @crzwdjk patiently explain to me why it's not that simple... 😅

Thanks for all your work friends ! ❤️

julienbarnoin, to gamedev
@julienbarnoin@mastodon.gamedev.place avatar

Somehow I was under the impression that the const keyword for function parameters in was mostly there for the benefit of programmers, so we'd get an error if we try to modify something we're not supposed to, but that the compiler would figure out if it does get modified or not on its own.

I was wrong. I have a case where just adding the const keyword to one parameter makes a shader twice as fast - from 750µs to 300µs.
Totally unexpected for me, am I the only one?

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

Here's the function for context. In this test it's called 182 times in a row in one compute shader invocation. With const, I have 270µs spent calling this function as measured by clockRealTimeEXT(). Removing this const it spends 720µs in it.

Most of that time isn't registered if I measure it inside the function either, only if I measure around the function call, the time goes in the BCA_Instrument struct copying before the call.

This is on Vulkan running on Linux, nVidia proprietary drivers.

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@gfxstrand Thanks for your comment, much appreciated !
Though, my initial expectation, as a totally non-expert, would be that in my example function I shared here https://mastodon.gamedev.place/@julienbarnoin/112197202516227190 the glsl to SPIRV compiler/optimizer would ideally realize that no assignment happens in that function and basically decides to pretend the argument is const.

Of course that's easy to say from a specific example and not the general case, but it seems reasonable in this specific case, right?

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@gfxstrand To be clear though, I really wasn't looking for anyone to blame, mostly to understand and spread the awareness that this can be a super easy way to make a difference in glsl shaders. I'm definitely going to be applying liberal amounts of constness in the future.
(Or even better, avoid passing in structs as much as possible, which is what I'll do here)

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

Now this is also making me doubt another frequent assumption I make. has an "in" specifier for function parameters too, and I'm basically ignoring it most of the time because it seems to me that it's the same as not specifying anything if the parameter is not an inout. But does specifying "in" actually change anything to compilers compared to not specifying anything?

@gfxstrand do you know?

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@gfxstrand
Not sure about compilers but from the programmer's point of view, the difference between an in and const in parameter would be that modifying the passed in copy of the value within the function is allowed if it's an in but not const, and disallowed if it's const in.

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@gfxstrand Yeah it seems like it must be the default, though I have a hard time confirming it. Just really makes me wonder why this keyword exists at all if it's already the default as it's basically never needed, that's what's making me doubt.

It's like if they decided to add a new keyword "nonconst" that you can decide to specify for things that are not const, but would be the default if not specified and changes nothing. That would be weird right?

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@gfxstrand Alright, yeah. Well clearly the lesson here is to put const absolutely everywhere possible. I'm going to be going through a looot of shader code where I didn't do this, haha.

grumpygamer, to random
@grumpygamer@mastodon.gamedev.place avatar

Woke up this morning and my modem (fiber) was dead so I had no internet. Back and forth with CenturyLink and it's ready dead. Going to take a few days to be replaced, so my Mac is tethered to my phone. Fine for normal work and surfing, but no YouTube or TV for a few days. Maybe I'll get more work done this way.

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@grumpygamer Unplugging the network cable has been a solid productivity boost tactic for me for many years.

jake4480, to random
@jake4480@c.im avatar

This morning @druidess forgot her phone so I went back in the house to get it, and when I brought it out the Bluetooth connected and the Skeletonwitch she had been listening to yesterday on the drive home started blasting out of the car. Yep. That's my wife 🤣

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@jake4480 @druidess Cars auto-connecting bluetooth can cause all kinds of surprising behaviour, I personally just stopped using it.

The other day I was talking to someone on the phone. Suddenly in the middle of a sentence, somebody else starts talking to me. "What's going on, who are you?"

The phone owner had lent her car to someone else for a quick errand and they returned and parked close by, and the phone conversation transferred to the car's audio system. So much can go wrong with this.

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@jake4480 @druidess And the other party had no idea either, she kept explaining something to me for like 5 minutes and I couldn't hear, until I got the person in the car to please go in and tell her I can't hear any longer 😂

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@jake4480 @druidess
Maybe an , but honestly things should just not auto-connect without user interaction.

Every time we open our bluetooth speaker to play something, something goes wrong, we're both using it often and it just auto-connects to the last phone it saw, who might be in the office in the middle of a phone conversation while I just want to play music from my phone.

And then you spend 5 minutes trying to pair your phone instead of the other. Terrible user experience.

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@jake4480 @druidess Would it be that unreasonable that phones pop up a message asking if you want to connect this device to bluetooth before doing it?
Well, maybe some do or have an option, I don't know.

julienbarnoin, to GraphicsProgramming
@julienbarnoin@mastodon.gamedev.place avatar

I'm curious to hear if anyone has successful strategies for debugging shader compile time issues (specifically in in my case but still interested in hearing about others).

I've got this shader that takes over a minute to compile. There's various things I could do to prevent loop unrolling etc. but I still have to use trial and error to find the right place.
Do you have any better strategy than changing random places and seeing what makes a difference?

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@crzwdjk @aras @solidangle @beanz @NOTimothyLottes
Thanks for the suggestions all !
So I haven't been able to profile the compiler yet due to life things, but from some trial and error checks, it's quite clear that I'm always plagued with the same issue: I need to stop passing large structs as inout function parameters in GLSL just to change a few members.

This is not a compiler-specific issue, this tends to take a long time to optimize for multiple ones in my experience.

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@crzwdjk @aras @solidangle @beanz @NOTimothyLottes I'm not sure if this is a known GLSL trap, but I'm pretty sure I can build a simple pathological example that demonstrates it. I have a real-world code example that now takes over 10 minutes compiling.
After optimizing the result is alright I think, it all gets eliminated, but there's just so much code copying things around before optimizing that it takes forever to optimize out.

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@crzwdjk @aras @solidangle @beanz @NOTimothyLottes
There's some related discussion here https://github.com/KhronosGroup/GLSL/issues/84, though the original complaint was from a performance perspective, I might submit a pathological example there that kills the Vulkan SDK's SPIR-V optimizer (and others) in terms of compile time to demonstrate why inout is just not an adequate replacement for pass-by-reference for some uses.

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@crzwdjk @aras @solidangle @beanz @NOTimothyLottes It would be great if it did ! I know you mentioned making changes to GLSL a couple times, do you mind elaborating on your relationship with GLSL? Are you an external contributor or do you officially work on GLSL?

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@beanz @crzwdjk @aras @solidangle @NOTimothyLottes
Stop tempting me with your features... It would be so nice... But... I want independent standards ! Standards !!

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@beanz @crzwdjk @aras @solidangle @NOTimothyLottes Seriously if Microsoft gave control of HLSL to Khronos there'd be an instant adoption boost I'm sure :P

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

@dneto @NOTimothyLottes @aras @solidangle @beanz
Still have to look at this closer and make an example I can share, but just from a quick test of copy-pasting of function calls in my shader and measuring the time spirv-opt takes, I see this, which seems a pretty tight match for quadratic time.

(This is not actually measuring the spirv-opt program but calling into the shaderc library with shaderc_optimization_level_performance, I assume this ends up being pretty much the same internally?)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • magazineikmin
  • khanakhh
  • tacticalgear
  • mdbf
  • everett
  • Youngstown
  • ethstaker
  • slotface
  • Durango
  • kavyap
  • DreamBathrooms
  • InstantRegret
  • JUstTest
  • rosin
  • osvaldo12
  • GTA5RPClips
  • cisconetworking
  • anitta
  • cubers
  • ngwrru68w68
  • tester
  • modclub
  • normalnudes
  • provamag3
  • Leos
  • lostlight
  • All magazines