engine3d-dev / engine3d

Open-source game engine to be used for developing games
Apache License 2.0
1 stars 3 forks source link

Shader Compiler #19

Open SpinnerX opened 2 months ago

SpinnerX commented 2 months ago

This issue is for shader-related tasks.

The thing I want to think about is how Engine3D will handle loading, compiling, and writing/reading data through shaders. Including loading from cache.

Features that should come from this is how we may look into implementing our own shader compiler. Of course, there is shaderc as an option. Probably the only option that I managed to find for our use-case.

Some concerns that I have with this specific framework is that on Windows, does not allow flexibility and friendly when you are using other compilers.

Since Engine3D uses LLVM clang++ compiler. Shaderc does not work because their API uses Visual Studio includes and certain windows-related API calls. Which makes it difficult working with shaderc. Especially since Conan package of shaderc has this issue. Engine3D will not consider shaderc a framework. Might need to look into other frameworks that exist or discussing in designing our own.

This is up for discussions on an approach in taking this route, where we can make our own shader compiler that handles these. Where users in-code can load shaders more easily in hoping to supporting both glsl and hlsl. Shader compiler framework that is flexibly, portable, and expandable if users want to integrate it into their own engine, game, or application.

This image below shows the issue that appears when trying to compile shaderc.

Another thing I considered was forking it and fixing the CMake builds myself to get them working. Then simply having this dependency be part of Engine3D as a submodule. Which probably isn't a bad idea. Though I would like to minimize amount of sources of where the dependencies, if possible.

Image