I want to use JSON5 to create a quasi-DSL for GPU stuff. LLM came up with this example.
{
// Comments are allowed, which is great for documentation!
title: "My Deferred Rendering Graph",
author: "User",
version: "1.0",
// Define all the passes (nodes) in the graph
passes: [
{
name: "G-Buffer",
type: "graphics", // Or "compute", "transfer"
shaders: {
vertex: "shaders/gbuffer.vert.spv",
fragment: "shaders/gbuffer.frag.spv"
},
inputs: [],
outputs: [
{ name: "albedo", format: "RGBA8_UNORM" },
{ name: "normal", format: "RGBA16_SFLOAT" },
{ name: "depth", format: "D32_SFLOAT" }
]
},
{
name: "Lighting Pass",
type: "graphics",
shaders: {
vertex: "shaders/quad.vert.spv",
fragment: "shaders/lighting.frag.spv"
},
inputs: [
{ name: "albedo", source: "G-Buffer.albedo" },
{ name: "normal", source: "G-Buffer.normal" },
{ name: "depth", source: "G-Buffer.depth" }
],
outputs: [
{ name: "final_color", format: "RGBA8_SRGB" }
]
}
// ... more passes
],
// Define the connections between passes (edges)
// This can be implicit in the 'inputs' fields of the passes
// or explicitly defined for clarity, like in a 'dependencies' array.
dependencies: [
// This connects the output of G-Buffer to the input of Lighting Pass
{ source: "G-Buffer", target: "Lighting Pass" }
]
}
Would be cool to have a schema too for validation, automatic type generation, and IDE tooling.
Any ideas/suggestions/related work?