Shader Programming
Shader programming writes GPU programs that transform vertices, shade fragments, and run compute work across many parallel invocations. Those programs define how geometry, materials, textures, and buffers become pixels or GPU-side results inside a real-time graphics pipeline.
itSoftware engineering | OpenSkills.info
Recommended first:real-time-graphics-programming
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic - Shader Programming
A shader is host-supplied GPU code. The CPU still records the draw; the GPU runs your program across a swarm of invocations, each handling one vertex, one fragment candidate, or one compute work item.
Before programmable shading, consumer GPUs largely followed fixed transform and lighting rules. Shaders replaced that fixed script with languages such as GLSL, HLSL, WGSL, and Metal Shading Language. Compilers turn that source into modules (often SPIR-V or DXIL) that a pipeline object can bind. The languages differ in syntax and packaging, but they agree on the job: say what each stage does with its inputs and bound resources.
Two ideas carry most of the weight. First, stages divide responsibility: vertex work prepares varyings, fragment work shades pixels, compute work updates buffers and images off to the side. Optional tessellation and geometry stages exist when the pipeline enables them; they are not a tax you pay on every hello-triangle. Second, the interface is part of the program: locations, bindings, and texture formats must match what the API records, or a shader that compiles still draws the wrong thing.
Uniforms hold values that stay constant for a draw. Interpolation carries vertex outputs across a primitive to fragment inputs (smooth, flat, and friends). Get the color space wrong (sRGB bytes treated as linear light) and a correct Lambert term still looks muddy. Get the matrix space wrong and specular highlights slide off into nonsense while the silhouette stays perfect.
The surprise for many readers is that fragment shaders cannot relocate a pixel in window space, and that a beautiful lighting formula will not save a mismatched descriptor set. Capture the frame before rewriting the BRDF. Compile and validate first; then look at which module, sampler, and render target the capture actually used.
For a quick map of stages and qualifiers, use the Cheatsheet. For hands-on formulas, use the Practice reference and the Lambert exercise. For judgment about graphs, permutations, and when to stop tweaking algebra, open Field Notes. The Intro remains the full tour when you want every definition in one place, and the Landscape tab names the languages and tools you will meet while doing the work.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf
Supports
- Shader processors, storage qualifiers, interpolation, built-ins, compute workgroups
- https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/main/specs/gl/GLSLangSpec.4.60.html
Supports
- Same normative GLSL 4.60 content fetched from the public registry mirror
- https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)
Supports
- GLSL core language orientation
- https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language
Supports
- OpenGL Shading Language overview for landscape entry
- https://www.khronos.org/opengl/wiki/Version
Supports
- OpenGL 2.0 GLSL (2004) and OpenGL 4.3 compute shaders (2012)
- https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl
Supports
- HLSL as DirectX high-level shading language since DirectX 9
- https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-pguide
Supports
- HLSL stages including geometry, tessellation, compute, and shader models
- https://www.w3.org/TR/WGSL/
Supports
- WGSL as WebGPU shading language
- https://raw.githubusercontent.com/gpuweb/gpuweb/main/wgsl/index.bs
Supports
- WGSL specification source text
- https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html
Supports
- SPIR-V intermediate representation for graphics and compute shaders
- https://raw.githubusercontent.com/KhronosGroup/SPIRV-Headers/main/README.md
Supports
- Machine-readable SPIR-V registry and header publication process
- https://www.khronos.org/news/press/khronos-releases-spir-v-1.0-provisional-specification
Supports
- SPIR-V 1.0 provisional publication timing for timeline
- https://github.com/KhronosGroup/glslang
Supports
- GLSL/ESSL front end, SPIR-V emission, stage file suffixes
- https://github.com/microsoft/DirectXShaderCompiler
Supports
- HLSL compilation to DXIL and optional SPIR-V
- https://developer.apple.com/metal/
Supports
- Metal and Metal Shading Language product home
- https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/main/chapters/shaders.adoc
Supports
- Shader modules, pipeline binding, and shader execution model notes
- https://research.nvidia.com/publication/2001-08_user-programmable-vertex-engine
Supports
- 2001 user-programmable vertex engine milestone
- https://devblogs.microsoft.com/directx/announcing-microsoft-directx-raytracing/
Supports
- 2018 DirectX Raytracing shader stages announcement
- https://developer.chrome.com/blog/webgpu-release
Supports
- WebGPU and WGSL availability in Chrome 113 (2023)
- https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_sRGB.txt
Supports
- sRGB texture and framebuffer conversion behavior
- https://www.shadertoy.com/howto
Supports
- Browser fragment-shader experimentation workflow
- https://renderdoc.org/docs/index.html
Supports
- Frame capture and pipeline inspection
- https://github.com/sindresorhus/awesome
Supports
- Discovery of Awesome OpenGL
- https://github.com/eug/awesome-opengl
Supports
- Shadertoy, GLSL Sandbox, RenderDoc, GLFW, GLM, glad, Learn OpenGL, Tracy, apitrace, 3D Game Shaders For Beginners
- https://www.glfw.org
Supports
- Window and context library rationale
- https://glm.g-truc.net
Supports
- GLSL-like C++ math library rationale
- https://github.com/Dav1dde/glad
Supports
- OpenGL loader generator rationale
- https://learnopengl.com
Supports
- Structured OpenGL and shader tutorials rationale
- https://github.com/lettier/3d-game-shaders-for-beginners
Supports
- Practical game shader techniques rationale
- https://apitrace.github.io
Supports
- API trace and replay rationale
- https://github.com/wolfpld/tracy
Supports
- CPU/GPU frame profiling rationale
- https://www.unrealengine.com/
Supports
- Unreal material and shader authoring landscape role
- https://unity.com/products/unity-engine
Supports
- Unity shader graph and material landscape role
- https://godotengine.org/
Supports
- Godot shading language landscape role
- https://www.khronos.org/spir/
Supports
- SPIR-V product landscape role
