Skip to content

juxta-tad/shaderc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

shaderc-odin

odin bindings for the shaderc library.

Documentation

shaderc provides the compiler interface to compile GLSL/HLSL source code into SPIR-V binary modules or assembly code. It can also assemble SPIR-V assembly into binary module. Example

Compile a shader into SPIR-V binary module and assembly text:

package main

import "shared:shaderc"

main :: proc(){
    compiler := shaderc.compiler_initialize()
    source :cstring= "#version 310 es\n void main() {}"
    result := shaderc.compile_into_spv(compiler,source,len(source),.FragmentShader,"shader.frag","main",nil)
    if (shaderc.result_get_compilation_status(result) != shaderc.compilationStatus.Success) {
        panic(string(shaderc.result_get_error_message(result)))
    }

    
   lenn := shaderc.result_get_length(result)
   bytes := (shaderc.result_get_bytes(result))
   shadercode := transmute([]u8)bytes[:lenn]
   //shadercode you want to put into vulkan and whatnot
}

Setup

shaderc-odin needs the C++ shaderc library. It's shipped inside the Vulkan SDK. You may be able to install it directly on some Linux distro's using the package manager. The C++ shaderc project provides artifacts downloads.

use shaderc library shaderc_combined by putting it in libs folder, on windows it should be shaderc_combined.lib on linux shaderc_combined.a

Contributions

This project is licensed under the MIT license. Please see CONTRIBUTING before contributing.

Authors

This project is initialized and mainly developed by Matthew Goodman (@antiagainst).

About

shaderc bindings for odin wip

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages