shader validation in intellij using glslangValidator

tech post, feel free to ignore.

If you're like me and you're writing shaders in glsl using IntelliJ  as your IDE*, you probably have noticed a few things:

1. The glsl plugin for IntelliJ sucks. It just doesn't work well or do what you want. I uninstalled it.
2. Different graphics cards support different features, and can be more strict or less strict.
3. The shader version you select has a sweeping impact on how you need to write your shaders. I go back and forth between writing for GLES 2.0 (version 100) and desktop OpenGL 3.0 (version 130) so I get confused a lot.
4. The lack of validation or simple IDE features means that I spend a lot of time editing, running my app to see the shader compile errors, and then fixing them.

Ok so that's terrible. But you can have really good glsl validation right in your IDE in just a few easy steps. Thanks Nick for helping me out with the File Watcher step!

1. Khronos maintains a glsl reference compiler. You can get it here. Download it and put it somewhere safe.

2. IntelliJ has a plugin called File Watchers, that will wait for a file to be modified and then run an external tool on that file. Install that plugin (you will have to hit the "browse repositories" button to find it. You'll need to restart IntelliJ.



3. Create a file type for your shaders. Make sure to include the *.vert and *.frag line endings (and whatever else if you use tessellation shaders, etc.. The glslangValidator tool expects your files to be named canonically.


Bonus, you can add in a bunch of keywords. I have the OpenGL Shading Language Reference Cards for the OpenGL versions I'm targetting (ES 2.0, ES 3.0) printed out, so I added all of the preprocessor directives, data types, and the builtin functions to the keyword tabs. Yeah!


4. Setup a file watcher by going to the File Watchers section that should now be present under project settings.


Tell it to track the shader file type you set up in step 3. Tell it to run the glslangValidator program that you downloaded in step 1. Set the input and working directory. You could also play around with conf files and other command line options if you want of course.


Then you should get some awesome feedback on your shaders!
 


*Haha so a couple people? Maybe?

three years, perspective and philosophy

Happy Anniversary Annie! It's been great so far. <3 p="">
~

I've been struggling a lot with perspective these days. Because I work from home, I'm out of the day-to-day crush of urgency that offices tend to develop into, and instead I have a lot more time to get lost in my own head.

We've been trying to sell the Hawthorne house. That's been disappointing so we might have to hang on to it for a while. We were pretty upset about that for a couple of weeks, but, not with good reason. We're doing well enough that we have no right to complain. :-)

Working from home is tremendous. I get more actual code accomplished in one good day than I did in a good week at Riot. And I get to hang out with my baby and my wife! I definitely miss the people though, and the sense of urgency and importance that comes with working on a live product. I hope I can get some of that back when Legacy goes live.

It looks like we'll be trying to rent a place in Austin until we can get our money lined up to buy. That's slightly inconvenient but I'm sure it'll turn out fine. I'm excited to leave Los Angeles. I don't think we take advantage of the place, we don't eat out or go clubbing or have fancy jobs that tie us here (anymore). So we'll be better off living somewhere with a low cost of living and great culture.

A friend and former colleague committed suicide last week. I don't have a lot to say about it but I wanted to mark it here. The main lesson I'm drawing is to practice gratefulness every day. My life is truly blessed -- I'm not spiritual but I have no better word for the abundance of good fortune that surrounds me every day.

I've been reading a lot about stoicism and there's a lot that I like about it. The central point, to me, is to separate what you can control (your own actions, mostly) and what you can't control (other people's actions, nature, your genetics, etc..) and focus only on the things you can control. The philosophy emphasizes rationality and virtue over pleasure and passion. That's sometimes tough medicine for me.

We've been watching a lot of nature documentaries on Netflix and we recently picked up the new Cosmos. Zooming in and out all the time is good for breaking you out of your everyday cares and concerns. I've had an incredibly wonderful last few years! I'm looking forward to many many more.