Skip to content
CAI
Software that uses CAICheck a score

krauthaufen/FShade

46.9

Weak · 2 October 2026

39.5k

lines of production code

F#

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

FShade is an F\# library that compiles shader code into various graphics formats, including GLSL and SPIR-V. It provides a comprehensive compilation pipeline featuring an Ahead-Of-Time preprocessor, an optimizer for constant folding and dead-code elimination, and support for modern graphics features like raytracing and compute shaders. The system also includes a debugger for inspecting shader effects and utilities for static analysis and serialization.

How it got here

2014–2015 — Platform modernization and debugging support

6 changes.

The project underwent a significant platform upgrade to .NET 8 and restructured its solution to include dedicated GLSL and SPIR-V compilation libraries. This period also introduced the FShade.Debug library, enabling on-the-fly shader compilation and runtime debugging capabilities.

2017–2021 — Core infrastructure and multi-backend expansion

14 changes.

This period focused on establishing a robust shader compilation foundation with the introduction of FShade.Core and the development of multiple backend targets, including GLSL, SPIR-V, and an imperative C-style path. Significant effort was dedicated to adding comprehensive support for modern graphics features such as raytracing, compute shaders, and advanced sampling, alongside the creation of an Ahead-Of-Time preprocessor for static analysis. The work was reinforced by extensive test suites and the addition of debugging tools to ensure correctness and usability across the new compilation pipelines.

Features

Added FShade.SpirV library for SPIR-V shader compilation

A new FShade.SpirV library has been introduced to enable the compilation of F\# shader modules into SPIR-V format. This addition includes an auto-open module that exposes a \compileSpirV\ function, allowing users to take an F\# module and compile it using the SPIR-V backend followed by assembly. The library is configured with dependencies on Aardvark.Base, Aardvark.Base.FSharp, FSharp.Core, and Aardvark.Build, and is set up for NuGet package distribution with PDB inclusion.

src/Libs/FShade.SpirV · high confidence

Added SPIR-V core specification data and code generation scaffolding

The \src/Libs/FShade.SpirV/Core\ directory now includes the Khronos SPIR-V grammar specification files (\spirv.json\ and \spirv.core.grammar.json\) alongside new F\# source files (\NewCodeGen.fsx\, \SpirVInstructions.fs\, \SpirVTypes.fs\) that define the core types, enumerations, and instruction structures for the SPIR-V standard. This change establishes the foundational data model and a code-generation script for SPIR-V assembly/disassembly, supporting intrinsic functions while explicitly excluding texture operations for now.

src/Libs/FShade.SpirV/Core · high confidence

Initial release of FShade.Core with raytracing, sampler, and serialization support

The new FShade.Core library introduces core infrastructure for shader development, including comprehensive support for raytracing (RayId, MissId, CallableId, TraceRay, HitObject, and intersection shaders), a full suite of sampler types (1d/2d/3d/Cube, array, shadow, multisampled, integer/unsigned variants) with operations like Sample, Fetch, and Gather, and a robust serializer for uniform and type hashing. It also provides a shader debugger interface, uniform scope management, and a code generator for sampler variants.

src/Libs/FShade.Core · high confidence

Initial release of FShade.GLSL shader backend

The FShade.GLSL library is introduced, providing a new backend for compiling F\# shader code into GLSL. This addition includes support for GLSL versions 1.20, 4.10, and 4.30, as well as a Vulkan-specific profile (GLSL 4.60). The backend exposes a comprehensive set of intrinsic functions for vector and matrix operations, trigonometry, and exponential math, while also implementing support for modern graphics features such as ray tracing (including intersection, any-hit, and closest-hit shaders), compute shaders, and push constants. Configuration options allow users to manage extension requirements, sampler separation, and tessellation winding order.

src/Libs/FShade.GLSL · high confidence

Introduce AOT shader preprocessor with double-checking and IL analysis

The \src/FShade.Preprocessor\ module now provides a new Ahead-Of-Time (AOT) compilation pipeline for shaders. This includes a \DoubleChecker\ that validates shader expressions against specific builder types (e.g., \VertexBuilder\, \FragmentBuilder\) and tensor types (e.g., \V2d\, \V3d\), an \Interpreter\ that resolves IL instructions to runtime types and methods via \Mono.Cecil\, and a \Program\ entry point that loads assemblies into an isolated context to identify replaceable shader compile methods. The implementation relies on \Mono.Cecil\ for IL manipulation and \Aardvark.Build\ for build integration, enabling static analysis and transformation of F\# shader code before runtime execution.

src/FShade.Preprocessor · high confidence

Introduce FShade Debugger for shader inspection and debugging

The FShade.Debug library now provides a new ShaderDebugger that allows users to inspect and debug shader code. It supports registering and resolving effects, raytracing shaders, and compute shaders by analyzing project metadata and source definitions. The debugger handles path normalization for cross-platform compatibility and caches shader definitions for efficient lookup.

FShade.Debug · high confidence

Introduce FShade.Core as the new shader compilation foundation

The FShade.Core library has been introduced to serve as the central engine for shader compilation and optimization. This change adds core modules for managing ComputeShaders, Effects, and RaytracingEffects, alongside a new Optimizer that handles constant folding, dead-code elimination, and inlining. It also introduces EffectInputLayout for unified input management and a comprehensive set of Intrinsics and Frontend primitives for defining shader stages and raytracing data.

FShade.Core · high confidence

Introduce FShade.Debug library for shader debugging

A new FShade.Debug library has been added to provide debugging capabilities for FShade shaders. This component includes utilities for probing assembly metadata to locate source projects, a compiler module that invokes \dotnet build\ to compile shader code on-the-fly, and a file watcher system that activates on demand to respect Linux inotify limits. It also features framework detection logic to ensure compatibility with the current .NET runtime.

src/Libs/FShade.Debug · high confidence

Introduction of the Imperative Shader Backend

This change introduces the FShade.Imperative backend, a new compilation path that translates F\# shader code into imperative C-style intermediate representations. It provides the core AST definitions (CType, CIntrinsicType), a compiler module for processing function definitions and constructors, and a module compiler that manages value graphs and dependency ordering. This backend enables the generation of shader code through a structured, imperative approach distinct from previous methods.

FShade.Imperative · high confidence

New FShade.Imperative library with shader intrinsics, raytracing types, and expression hashing

The new FShade.Imperative library introduces core infrastructure for shader compilation and raytracing. It provides an abstract IntrinsicAttribute system allowing backends (like GLSL) to define specific intrinsic behaviors and required extensions. The library adds comprehensive raytracing support with RayFlags (including opacity micromap control), RayHitKind, and shader stage definitions. It also introduces DepthWriteMode for controlling depth buffer writes and expands InterpolationMode to support multiple simultaneous values. Additionally, it includes an Expr hashing mechanism for stable expression identification and utility functions like onlyInShaderCode to enforce shader-only execution contexts.

src/Libs/FShade.Imperative · high confidence

New SPIR-V assembler and module infrastructure

The FShade.SpirV library now includes a new assembler (Assembler.fs) that maps F\# functions to SPIR-V intrinsics, such as trigonometric operations via the GLSL.std.450 extension. This is supported by a new Module.fs for reading and writing SPIR-V binary modules and Utilities.fs for managing the compilation state, including ID generation, uniform binding, and instruction caching. This change introduces the core components for generating SPIR-V assembly and disassembly.

FShade.SpirV · high confidence

Architecture

Solution reorganized with new project structure

The FShade solution has been restructured to include new projects for GLSL and SPIR-V compilation, alongside core and imperative libraries. This change updates the solution file to reflect the new project hierarchy and build configurations, impacting how the project is built and maintained.

src · high confidence

Behavioural changes

1 commit (0 fixes) modifying Artwork, BinPrebuilt

A change to existing behaviour in Artwork, BinPrebuilt — 1 commit, 19 files.

Artwork, BinPrebuilt · medium confidence · unverified

GLSL backend refactoring and layout fixes

The GLSL code generation backend has been significantly refactored to improve correctness and support new features. Key changes include fixing uniform buffer layout calculations to strictly adhere to GLSL specifications, adding support for storage buffers and push constants, and implementing proper handling for sampler and image types (including unsigned integers and arrays). The backend now supports splitting samplers and textures, handles dynamic array indexing with nonuniformEXT, and includes various fixes for matrix layouts, interpolation modes, and name mangling.

FShade.GLSL · high confidence

Test coverage

Added GLSL test suite for shader compilation and validation; Added demo tests for shader input layout unification and utility function handling; Initial test suite for FShade.Core.

Dependencies

Added FShade paket template for package metadata

A new paket.template file has been added to the bin directory, defining the metadata and dependencies for the FShade package. This template specifies the project as an F\# embedded shader library authored by Georg Haaser, links to the Apache 2.0 license and GitHub repository, and declares dependencies on FShade.Imperative, FShade.Core, FShade.GLSL, and FShade.SpirV at the current version.

bin · high confidence

Upgrade to .NET 8 and Aardvark.Base 5.3

The project has been upgraded to target .NET 8 (alongside netstandard2.0) and updated to use Aardvark.Base version 5.3.18, FSharp.Core 8.0, and Aardvark.Build 2.0.4. This change also introduces a new \fshadeaot\ tool project for ahead-of-time compilation and restructures the library dependencies to use the updated Paket dependency management system.

(dependencies) · high confidence

Housekeeping

Initial repository structure and build configuration

The repository is initialized with the core project documentation (README.md) and a comprehensive release history (RELEASE\_NOTES.md) detailing the library's evolution. Build and packaging workflows are established via shell and batch scripts (build.sh, build.cmd, pack.cmd) alongside a global.json file pinning the .NET SDK to version 8.0.100. The .gitignore file is updated to standardize package directory casing and exclude IDE-specific configuration folders for Visual Studio, VS Code, and JetBrains Rider.

(repo-wide) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 46 → 47 (+0.7)
  • Rubric changed (rubric-2026.09.13 → rubric-2026.10.1) — scores are not directly comparable.

Lenses

  • Code Health 55 → 54 (-0.5)
  • Architecture 100 → 100 (+0.0)
  • Maturity 30 → 30 (+0.2)
  • Readiness 58 → 58 (+0.0)
  • Security 61 → 71 (+9.7)

Resolved (3)

  • Documentation: no usage examples (README.md)
  • Hotspot: src/Libs/FShade.Imperative/Ast.fs (src/Libs/FShade.Imperative/Ast.fs)
  • Off-boarding risk: anonymized user #1

New (6)

  • Documentation: no project overview (README.md)
  • Duplicated block (8 lines × 2) (src/Libs/FShade.Core/Shader.fs)
  • Inlining.canInline (cyclomatic 16) (src/Libs/FShade.Core/Optimizer.fs)
  • Inlining.isMutated (cognitive 18) (src/Libs/FShade.Core/Optimizer.fs)
  • Inlining.isMutated (cyclomatic 21) (src/Libs/FShade.Core/Optimizer.fs)
  • Off-boarding risk: anonymized user #1

Changes since last survey

  • 4 commits — 2 feature/other, 2 fixes

By area

  • (root) — 2 commits
  • src/Libs — 2 commits

Notable commits

  • fix: Fix ClipDistance pass-through for vs and fs composition
  • fix: Fix dead-code elimination to properly handle deprecated ref operators
  • change: Improve composition of vertex and fragment shaders with multiple returns
  • change: Update RELEASE_NOTES.md

Architecture

  • Containers 0 added · 0 removed · contexts 5 added · 0 removed · edges 5 added · 0 removed

Added bounded contexts (5)

  • FShade.Core
  • FShade.Debug
  • FShade.GLSL
  • FShade.Imperative
  • FShade.SpirV

Added dependency edges (5)

  • FShade.Core → FShade.Imperative (coupling)
  • FShade.Debug → FShade.Core
  • FShade.GLSL → FShade.Core (coupling)
  • FShade.GLSL → FShade.Imperative (coupling)
  • FShade.SpirV → FShade.Imperative (coupling)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

krauthaufen/FShade was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 2 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 7eac3a54d5dee05bee22b6622cba9178622648e8 — the exact code this score is about.
  • Scored under rubric-2026.10.1 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-351388015767.