Shader cross-compiler #34

Merged
cosmonaut merged 3 commits from TheSpydog/Refresh:shadercompiler into main 2023-01-20 23:19:14 +00:00

This PR adds a shader cross-compiler program (written in C#) that uses glslc and spirv-cross to compile GLSL source files to a custom, Refresh-specific shader blob format that contains shader code for various backends.

The goal is that whenever you want to compile your shaders, you just run this program (either via refreshc or dotnet run), passing in the path to the GLSL source file. You can specify which backends you want to support via flags (--vulkan, for instance), and it will generate a .refresh blob file for Refresh to consume.

This can also be extended via C# defines and the partial class system. An example is the PS5 shader implementation, whose logic is squirreled away in the NDA'd repository but can be called in sequence with the rest of the shader cross-compile logic. This way, we don't have to run two separate programs to compile our shaders to all supported platforms.

Refresh handles all the parsing of the file format in Refresh_CreateShaderModule, so individual backends do not need to concern themselves with the particulars.

This PR adds a shader cross-compiler program (written in C#) that uses glslc and spirv-cross to compile GLSL source files to a custom, Refresh-specific shader blob format that contains shader code for various backends. The goal is that whenever you want to compile your shaders, you just run this program (either via `refreshc` or `dotnet run`), passing in the path to the GLSL source file. You can specify which backends you want to support via flags (`--vulkan`, for instance), and it will generate a .refresh blob file for Refresh to consume. This can also be extended via C# defines and the `partial class` system. An example is the PS5 shader implementation, whose logic is squirreled away in the NDA'd repository but can be called in sequence with the rest of the shader cross-compile logic. This way, we don't have to run two separate programs to compile our shaders to all supported platforms. Refresh handles all the parsing of the file format in Refresh_CreateShaderModule, so individual backends do not need to concern themselves with the particulars.
TheSpydog added 1 commit 2023-01-15 04:51:55 +00:00
continuous-integration/drone/pr Build is passing Details
2b773101c8
Added shader cross-compiler using glslc and spirv-cross
TheSpydog added 1 commit 2023-01-15 20:04:44 +00:00
continuous-integration/drone/pr Build is passing Details
8a0d4472b4
Add support for compiling all files in a directory
TheSpydog added 1 commit 2023-01-20 20:04:17 +00:00
TheSpydog changed title from WIP: Shader cross-compiler to Shader cross-compiler 2023-01-20 20:10:45 +00:00
cosmonaut merged commit 05900bee14 into main 2023-01-20 23:19:14 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: MoonsideGames/Refresh#34
There is no content yet.