https://github.com/feliwir/sharpshadercompiler
A .NET Standard wrapper to shaderc
https://github.com/feliwir/sharpshadercompiler
compiler csharp opengl shader shaderc vulkan wrapper
Last synced: about 1 year ago
JSON representation
A .NET Standard wrapper to shaderc
- Host: GitHub
- URL: https://github.com/feliwir/sharpshadercompiler
- Owner: feliwir
- License: mit
- Created: 2018-05-23T18:14:01.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-31T08:01:40.000Z (about 8 years ago)
- Last Synced: 2025-04-13T08:27:24.991Z (about 1 year ago)
- Topics: compiler, csharp, opengl, shader, shaderc, vulkan, wrapper
- Language: C#
- Size: 7.85 MB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SharpShaderCompiler
[](https://github.com/feliwir/SharpShaderCompiler/blob/master/LICENSE)
[](https://ci.appveyor.com/project/feliwir/sharpshadercompiler)
**SharpShaderCompiler** is a .NET shader compiler for compiling GLSL and HLSL to SPIRV bytecode.
## Example
```csharp
void Compile()
{
//Create a new compiler and new options
var c = new ShaderCompiler();
var o = new CompileOptions();
//Set our compile options
o.Language = CompileOptions.InputLanguage.GLSL;
o.Optimization = CompileOptions.OptimizationLevel.Performance;
//Specify a minimal vertex shader
string testShader = @"#version 450
void main()
{}";
//Compile the specified vertex shader and give it a name
var r = c.Compile(testShader, ShaderCompiler.Stage.Vertex, o,"testShader");
//Check if we had any compilation errors
if(r.CompileStatus != CompileResult.Status.Success)
{
//Write the error out
System.Console.WriteLine(r.ErrorMessage);
return;
}
//Get the produced SPV bytecode
var bc = r.GetBytes();
}
```