<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-bgfx-shader-compiler-14-years-of-not-being-a-compiler-bzzcsjzae" -->

---
title: The bgfx shader compiler, 14 years of not being a compiler
description: A deep technical history of shaderc, the shader compiler behind the bgfx rendering library, explaining why it has never been a real compiler in the textbook...
canonical: https://daily.dev/posts/the-bgfx-shader-compiler-14-years-of-not-being-a-compiler-bzzcsjzae
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The bgfx shader compiler, 14 years of not being a compiler | daily.dev
og:description: A deep technical history of shaderc, the shader compiler behind the bgfx rendering library, explaining why it has never been a real compiler in the textbook...
og:url: https://daily.dev/posts/the-bgfx-shader-compiler-14-years-of-not-being-a-compiler-bzzcsjzae
og:image: https://api.daily.dev/og/posts/BZZCsjZAE.png
og:image:alt: The bgfx shader compiler, 14 years of not being a compiler
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The bgfx shader compiler, 14 years of not being a compiler

**[Overview — bgfx 1.146.9292 documentation](https://daily.dev/sources/bkaradzic)** · 18 min read · 0 upvotes · 0 comments

## Summary

A deep technical history of shaderc, the shader compiler behind the bgfx rendering library, explaining why it has never been a real compiler in the textbook sense but instead a C preprocessor plus textual patching that hands off to each platform's native shader compiler (FXC, DXC, Glslang, etc.). The piece traces the tool from its 2012 origin, through the removal of glsl-optimizer in 2026 and the deprecation of Glslang's HLSL front-end, and surveys how other engines (Godot, Filament, Slang, ANGLE, wgpu/Naga) solve the same cross-platform shader problem with varying degrees of sophistication. It concludes that Slang, a real compiler with its own IR hosted by Khronos, is the approach the author would take if starting today, but that shaderc's Frankenstein design still works fourteen years on because delegating to other maintainers' compilers, while janky, has let new targets be added without front-end rewrites.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://bkaradzic.github.io/posts/shaderc-overview>

## Questions this post answers

### Why did Glslang deprecate its HLSL front-end and what does that mean for projects depending on it?

Glslang announced in April 2026 that its HLSL front-end is deprecated and will be removed at the next major version, per the project's own README. Projects requiring continued HLSL support are told to maintain a fork of glslang pinned to the tag at the deprecation announcement. This directly threatens tools like bgfx's shaderc that route HLSL-derived shaders through Glslang on the way to SPIR-V, Metal, and WGSL targets.

_Track ecosystem shifts like this on daily.dev before a dependency you rely on quietly disappears._

### What is bgfx's shaderc and why is it described as not being a real compiler?

Shaderc is bgfx's shader compilation tool that takes a single GLSL-flavored source and produces binaries for HLSL, MSL, GLSL/ESSL, SPIR-V, and WGSL backends. It has no parser, AST, or IR of its own; instead it runs source through a C preprocessor, patches text with macros (like rewriting void main() to void_main()), then hands the result to a real compiler such as FXC, DXC, or Glslang for each target.

_daily.dev surfaces deep engine-internals writeups like this for developers weighing shader pipeline tradeoffs._

### How does Slang compare to bgfx's shaderc approach for cross-platform shader compilation?

Slang is a genuine compiler with its own front-end, IR, modules, and generics, generating code for HLSL, GLSL, SPIR-V, MSL, and WGSL from one source, unlike shaderc's preprocessor-and-handoff approach. Hosted by Khronos since late 2024 and originating from NVIDIA research, Slang reportedly let Valve compile its entire Source 2 HLSL codebase while modifying only 10 lines, making it the closest thing to solving cross-platform shader compilation rather than routing around it.

_Compare shader toolchains like Slang against legacy approaches on daily.dev before committing to one for a new engine._

## Similar posts on daily.dev

- [Writing a C preprocessor for bgfx shader compiler](https://daily.dev/posts/writing-a-c-preprocessor-for-bgfx-shader-compiler-px6oafgu6) · Overview — bgfx 1.146.9292 documentation · 2 upvotes · 0 comments
- [Shader compiler survey](https://daily.dev/posts/shader-compiler-survey-hmragio8w) · Overview — bgfx 1.146.9292 documentation · 1 upvotes · 0 comments
- [Developers said…2026 Shader Ecosystem Survey Results](https://daily.dev/posts/developers-said-2026-shader-ecosystem-survey-results-m62s9sidq) · Khronos · 0 upvotes · 0 comments
- [Microsoft Updates DirectX Shader Compiler With Improved Vulkan Driver Interoperability](https://daily.dev/posts/microsoft-updates-directx-shader-compiler-with-improved-vulkan-driver-interoperability-ztxfrpbxj) · Phoronix · 0 upvotes · 0 comments

---

Tags: [#game-development](https://daily.dev/tags/game-development), [#graphics-programming](https://daily.dev/tags/graphics-programming)

[View this post on daily.dev](https://daily.dev/posts/the-bgfx-shader-compiler-14-years-of-not-being-a-compiler-bzzcsjzae)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"The bgfx shader compiler, 14 years of not being a compiler","url":"https://daily.dev/posts/the-bgfx-shader-compiler-14-years-of-not-being-a-compiler-bzzcsjzae","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/the-bgfx-shader-compiler-14-years-of-not-being-a-compiler-bzzcsjzae"},"datePublished":"2026-09-27T23:19:58.342Z","dateModified":"2026-09-27T23:20:24.356Z","description":"A deep technical history of shaderc, the shader compiler behind the bgfx rendering library, explaining why it has never been a real compiler in the textbook...","image":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","thumbnailUrl":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","isAccessibleForFree":true,"articleSection":"Overview — bgfx 1.146.9292 documentation","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Overview — bgfx 1.146.9292 documentation","logo":"https://media.daily.dev/image/upload/logos/placeholder.jpg","url":"https://daily.dev/sources/bkaradzic"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/the-bgfx-shader-compiler-14-years-of-not-being-a-compiler-bzzcsjzae","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"game-development,graphics-programming","timeRequired":"PT18M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Overview — bgfx 1.146.9292 documentation","item":"https://daily.dev/sources/bkaradzic"},{"@type":"ListItem","position":3,"name":"The bgfx shader compiler, 14 years of not being a compiler"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/the-bgfx-shader-compiler-14-years-of-not-being-a-compiler-bzzcsjzae#faq","mainEntity":[{"@type":"Question","name":"Why did Glslang deprecate its HLSL front-end and what does that mean for projects depending on it?","acceptedAnswer":{"@type":"Answer","text":"Glslang announced in April 2026 that its HLSL front-end is deprecated and will be removed at the next major version, per the project's own README. Projects requiring continued HLSL support are told to maintain a fork of glslang pinned to the tag at the deprecation announcement. This directly threatens tools like bgfx's shaderc that route HLSL-derived shaders through Glslang on the way to SPIR-V, Metal, and WGSL targets. Track ecosystem shifts like this on daily.dev before a dependency you rely on quietly disappears."}},{"@type":"Question","name":"What is bgfx's shaderc and why is it described as not being a real compiler?","acceptedAnswer":{"@type":"Answer","text":"Shaderc is bgfx's shader compilation tool that takes a single GLSL-flavored source and produces binaries for HLSL, MSL, GLSL/ESSL, SPIR-V, and WGSL backends. It has no parser, AST, or IR of its own; instead it runs source through a C preprocessor, patches text with macros (like rewriting void main() to void_main()), then hands the result to a real compiler such as FXC, DXC, or Glslang for each target. daily.dev surfaces deep engine-internals writeups like this for developers weighing shader pipeline tradeoffs."}},{"@type":"Question","name":"How does Slang compare to bgfx's shaderc approach for cross-platform shader compilation?","acceptedAnswer":{"@type":"Answer","text":"Slang is a genuine compiler with its own front-end, IR, modules, and generics, generating code for HLSL, GLSL, SPIR-V, MSL, and WGSL from one source, unlike shaderc's preprocessor-and-handoff approach. Hosted by Khronos since late 2024 and originating from NVIDIA research, Slang reportedly let Valve compile its entire Source 2 HLSL codebase while modifying only 10 lines, making it the closest thing to solving cross-platform shader compilation rather than routing around it. Compare shader toolchains like Slang against legacy approaches on daily.dev before committing to one for a new engine."}}]}
```

