GithubHelp home page GithubHelp logo

alaingalvan / crossshader Goto Github PK

View Code? Open in Web Editor NEW
271.0 271.0 10.0 1.45 MB

⚔️ A tool for cross compiling shaders. Convert between GLSL, HLSL, Metal Shader Language, or older versions of GLSL.

Home Page: https://alain.xyz/libraries/crossshader

License: MIT License

CMake 27.91% C++ 52.80% GLSL 6.64% JavaScript 3.20% TypeScript 9.45%
apple-metal compiler directx glsl hlsl metal opengl transpiler vulkan webgl

crossshader's Introduction

Hi there! 👋

My name is Alain Galvan Pronounced (Alan Gal-vhan), Graphics Software Engineer @ 🔺 AMD, previously at 🐒 Marmoset working 🌐 Remotely @ 🌴 West Palm Beach.

I'm extremely passionate about all aspects of computer graphics, be it making art, research, designing libraries and tools, or teaching. If you like those topics feel free to say hi here or on 🐦 Twitter (DMs Open!), 👔 LinkedIn, 🐘 Mastodon (Mirror) or 🎥 YouTube.

crossshader's People

Contributors

alaingalvan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

crossshader's Issues

typescript errors

I've tried to set up a basic typescript project but failed.
I've just called 'npm init', 'tsc --init', 'npm install cross-shader --save', and added 'test.ts' with the code from 'readme.md'.

Looks like 'tsc' does not see anything from 'd.ts' file.
Part of the 'tsc' output:

src/index.ts:16:14 - error TS7031: Binding element 'compile' implicitly has an 'any' type.
16 xsdr.then(({ compile, ShaderFormat, ShaderStage }) => {
                ~~~~~~~

It creates '.js' file but when I try to run it, it fails. Parts of the output:

TypeError: cross_shader_1.default.then is not a function
    at Object.<anonymous> (/Users/romamik/work/tmp-shader-compiler/src/index.js:18:24)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47

Then I decided to manually edit generated '.js' file
and changed cross_shader_1.default.then to cross_shader_1.default.default.then. And after that everything worked. But that is just strange.

Playground doesn't work?

Changing the dropdown in the playground doesn't seem to update the output, other than sometimes outputting glsl

compiling to metal fails for some shaders

For example, this shader cannot be compiled to MSL:

#version 450

in vec3 vertexPosition;
in vec4 vertexColor;
uniform mat4 projectionMatrix;
out vec4 fragmentColor;

void main() {
	gl_Position = projectionMatrix * vec4(vertexPosition, 1.0);
	fragmentColor = vertexColor;
}

Looks like matrix by vector multiplication is what triggers the problem.

NPM not updated, WASM build broken

I've noticed that the library was not updated on the npm. That would be great to have updated version there.

Also, I've tried building WASM but failed due to cmake error: invalid target to enable: 'AMDGPU' (not in project). That has something to do with directx compiler. Very same error is discussed here: microsoft/DirectXShaderCompiler#4480, and it looks like the problem was resolved, but I do not understand what to do.

Any ideas on Metal?

What is available now to support Metal? Are you waiting for some specific technology to grow up?

Feature request: add shader optimisation support (SPIRV-tools through glslang)

Hi Alain,

Thank you for this library 👍!

I've been digging in the source code and noticed that the outputted GLSL is not as optimised as I was hoping. I think this is due to the optimizer in glslang not being enabled. In order to enable it I followed the following build steps but unfortunately I ran into the following issue: KhronosGroup/glslang#1745.

Is this something you encountered as well when you were building this library or are interested in adding support for this? I've been looking for an alternative to https://github.com/aras-p/glsl-optimizer that is maintained more frequently.

Kind regards,

Tim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.