Home
Softono
CS2X

CS2X

Open source MIT C
136
Stars
14
Forks
0
Issues
13
Watchers
2 years
Last Commit

About CS2X

CS2X is an experimental transpiler that converts a C subset into multiple non .NET languages, powered by Microsoft's Roslyn compiler platform. It targets shader and graphics programming languages rather than CPU languages, making it suitable for GPU development workflows. Supported targets include HLSL for DirectX 9.0c and later, the older DirectX 8.0 to 9.0c assembly language, GLSL for OpenGL 2.0 and GLES 2 and above, ARB assembly, the Cg programming language used on platforms like PS Vita and Nvidia hardware, PSSL for PlayStation 4, Metal Shading Language for macOS and iOS, and Adobe Graphics Assembly Language. The project also supports custom output targets. CS2X uses a modified type system tailored for writing GPU programs and comprises several libraries: CS2X.Core for the transpilation engine, CS2X.CLI as a command-line interface, CS2X.Analyzer for analyzing C syntax and restricting unsupported features, and CS2X.CoreLib as a portable core library subset. The project requires .NET 8 and can be built usin

Platforms

Web Self-hosted iOS

Languages

C

Links

CS2X (Under development)

Transpiles a C# subset to non .NET languages. (Powered by Roslyn)
NOTE: IL2X will be for CPU targets

Goals

This project will focus on transpiling a C# subset with a modified type system for writing GPU programs.

  • HLSL (DirectX Shader Assembly Language) [D3D9.0c +]
  • ALS (DirectX Shader Assembly Language) [D3D8.0 - D3D9.0c]
  • GLSL (OpenGL shading language) [OpenGL2.0 / GLES2 +]
  • ARB (ARB assembly language) [legacy / homebrew systems]
  • CG (Cg programming language) [PSVita, Nvidia / other]
  • PSSL (PlayStation Shader Language) [PS4]
  • MSL (Metal Shading Language) [macOS / iOS]
  • AGAL (Adobe Graphics Assembly Language)
  • Custom, etc

Primary Project libraries

  • CS2X.Core: .NET transpiler lib
  • CS2X.CLI: CLI interface for CS2X.Core
  • CS2X.Analyzer: C# syntax analyzer to limit unsuported features.
  • CS2X.CoreLib: Portable CoreLib subset

Building

NOTE: To clone repo you will need the Git Large File Storage

  • Prerequisites
    • VS 2022, vscode, Rider, etc
    • .NET 8

Is this project ready for general use?

No still experimental.