Great stuff. I find it really funny that a big feature of modern API’s is that applications place barriers instead of being handled by the driver, and we all tried it for a while and then threw up our hands and decided to write graph systems to automatically place them because it was too hard.
- 1 Post
- 17 Comments
graphicsguyto CSCareerQuestions•What advice would you give to someone just starting out with a career in programming?4·1 year agoI like to not think of anything as “absolute” or “dealbreaker” (within reason. If there’s a culture of harassment I’m gone, for example). But spend intentional time throughout your career reflecting on what matters to you in terms of team culture, code culture, career growth opportunities, compensation, etc. There are a lot of factors to being happy in your work, and a lot of ways to get there. Be intentional about it, and try to always move toward it. It matters a lot more than whatever software you’re writing.
graphicsguyto Game Development•Humble advice for those who want to switch to game development2·1 year agoMan it sounds like you’ve had a rough go. I’m sorry that’s been your experience.
graphicsguyto Advent Of Code•[2023 day 8] some guy on reddit manged to brute force part 2 in 57 seconds on a gpu3·1 year agoGraphics Programmer here.
More likely you would just write data to a buffer (basically an array of whatever element type you want) rather than a render target and then read it back to the cpu. Dx, vulkan, etc. all have APIs to upload / download to / from the GPU quite easily, and CUDA makes it even easier, so a simple compute shader or CUDA kernel that writes to a buffer would make the most sense for general purpose computation like an advent of code problem.
As a graphics programmer in the games industry, it’s always exciting to me when people discover how much fun all this stuff is
graphicsguyto Programming Languages•Implementing a GPU's Programming Model on a CPU (Compilers)2·2 years agoThis is interesting. I’ve always wondered “could I write something that would execute an .hlsl shader on the CPU”. After reading this, no I don’t think I could lol
Launch your .exe from renderdoc and take a gpu capture. From there you should be able to see:
- Did it actually dispatch more than 1 draw call? If not, then there’s a problem in your source file not dispatching all your draws
- If it dispatched multiple draws, inspect the VS output. Did they all just project offscreen or to a singular point or to the exact same points so they’re all on top of each other? If so you have an error in your VS shader or your constants
- If the VS output is correct, then the problem lies in your pixel shader or output merger. Pixel shader might be 0’ing out your pixels, blend state might be alpha-0, write mask might be turned off, a whole bunch of possibilities.
Renderdoc is your best friend for these bugs
graphicsguyto Game Development•(Partial rant) Why are gaming communities for multiplayer games so often filled with toxicity? Why aren't game developers doing more to stop this?3·2 years agoYa fair enough. I’d put my “razor” at behaviour that targets vulnerable / minorities, which is probably broader / vaguer than just slurs, but it’s going to be a spectrum of opinions and preferences
graphicsguyto Experienced Devs•what do you folks discuss in your weekly/monthly 1:1 with your engineering managers?2·2 years agoThis.
I ask my boss about project-wide stuff that might impact me and my team, discuss strategy / priorities / roadmaps, ask them to weigh in on anything where I need project leadership to help resolve an issue, and any perfunctory “goals” stuff (I hate it so much haha)
graphicsguyto Game Development•(Partial rant) Why are gaming communities for multiplayer games so often filled with toxicity? Why aren't game developers doing more to stop this?111·2 years agoYou’re right that it’s messy and imperfect and false positives can be really frustrating.
But the alternative - no efforts to maintain a safe space - is that vulnerable people are typically the target. Toxicity typically punches down.
I’ll happily trade some clunky inconvenience so that those people can safely participate
My broken brain just goes “but how would a decompressor know if ‘3101’ was originally ‘30’ or 101 '3’s in a row?”
graphicsguyto Game Development•QOTD: What game development tools or software do you find most essential and why?1·2 years agoRenderDoc for debugging graphics
Imgui for tool UI
graphicsguyto Lifestyle and Leisure•What are some advantages and challenges you've experienced while working remotely?English3·2 years agoI worked remotely for the first 2 years of the pandemic. It was fine at first but when I switched teams and no longer knew everybody from before the pandemic, the social loss started to wear on me. It’s not like we had social meetings on my old team, but I think I was able to pretend better or something when I knew everyone in real life.
I also started to struggle to stop working and I hated that and hated the space occupied by my workstation.
I also have a lot of equipment (console dev kits in games industry) and it takes up a lot of precious space.
For all those reasons I’m back in the office 100%. Also I prefer to collaborate in person in my job (it’s much easier to hash things out with an artist in person).
Still, there are some things that are permanently changed in ways that make me sad. There will always be some remote folks, so every meeting must be remote accessible (and rightly so), which means we still have to sit on zoom calls a lot of the time. Also zoom has lowered the friction to having a meeting, so we end up having way more meetings.
I don’t begrudge the WFHers. I want everyone to have what they want and be happy, and particularly for the parents out there, the saved commute time and flexible hours are a godsend.
Also if you branch on a GPU, the compiler has to reserve enough registers to walk through both branches (handwavey), which means lower occupancy.
Often you have no choice, or removing the branch leaves you with just as much code so it’s irrelevant. But sometimes it matters. If you know that a particular draw call will always use one side of the branch but not the other, a typical optimization is to compile a separate version of the shader that removes the unused branch and saves on registers
Pointers also allow you to do fun and dangerous things like casting between types!
For example, if you’re implementing your own memory allocator, at the base level your allocator only really cares about how many bytes are being requested (along with alignment, offset, other things) so you’d probably just implement it to return a char*, u8*, or void* pointing to the blob of memory you allocated with new, malloc, or whatever scheme you’ve cooked up. The calling code or higher level allocator code could then cast it to the actual type
RenderDoc is made by one person. It’s used by every graphics programmer. It’s free, open source, faster + better than anything else. I love it.
Download renderdoc: https://renderdoc.org/ It’s a great, easy graphics debugging tool.
There, you should be able to inspect your draw call and see what’s going wrong.
But also, on the topic of API’s. OpenGL is basically obsolete as you suggested, but Vulkan / DX12 / Metal are a huge pain. I’d recommend DX11 if you have windows access, or WebGPU if you don’t. For WebGPU you can write it in javascript or natively in C++ / Rust (good tutorial here: https://eliemichel.github.io/LearnWebGPU/)
That being said, if all you want to do is live on the shader side and you don’t want to write the API side, then Electronic Arts recently open sourced a great tool called GiGi that lets you get right down to authoring shaders and connecting them together. Think ShaderToy but WAY MORE FEATURES. https://github.com/electronicarts/gigi