{
    "input": {
        "outputs": [
            "value"
        ],
        "parameters": {
            "name": "defaultName",
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            },
            "location": "0"
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "headerSnippets": [
                    "attribute highp $type $name;"
                ],
                "substitution": "highp $type $value = $name;"
            },
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 3,
                    "minor": 0
                },
                "headerSnippets": [
                    "in highp $type $name;"
                ],
                "substitution": "highp $type $value = $name;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "headerSnippets": [
                    "in $type $name;"
                ],
                "substitution": "$type $value = $name;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "headerSnippets": [
                    "layout(location = $location) in $type $name;"
                ],
                "substitution": "$type $value = $name;"
            }
        ]
    },
    "constant": {
        "outputs": [
            "value"
        ],
        "parameters": {
            "constant": "0.0",
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Float"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $value = $type($constant);"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $value = $type($constant);"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $value = $type($constant);"
            }
        ]
    },
    "sampleTexture": {
        "inputs": [
            "coord"
        ],
        "outputs": [
            "color"
        ],
        "parameters": {
            "name": "defaultName"
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "headerSnippets": [
                    "uniform sampler2D $name;"
                ],
                "substitution": "highp vec4 $color = texture2D($name, $coord);"
            },
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 3,
                    "minor": 0
                },
                "headerSnippets": [
                    "uniform sampler2D $name;"
                ],
                "substitution": "highp vec4 $color = texture($name, $coord);"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "headerSnippets": [
                    "uniform sampler2D $name;"
                ],
                "substitution": "vec4 $color = texture($name, $coord);"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "headerSnippets": [
                    "add-sampler sampler2D $name"
                ],
                "substitution": "vec4 $color = texture($name, $coord);"
            }
        ]
    },
    "fragColor": {
        "inputs": [
            "fragColor"
        ],
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "gl_FragColor = $fragColor;"
            },
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "fragColor = $fragColor;",
                "headerSnippets": [
                    "out highp vec4 fragColor;"
                ]
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "fragColor = $fragColor;",
                "headerSnippets": [
                    "out vec4 fragColor;"
                ]
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "fragColor = $fragColor;",
                "headerSnippets": [
                    "layout(location = 0) out vec4 fragColor;"
                ]
            }
        ]
    },
    "eyePosition": {
        "outputs": [
            "eyePosition"
        ],
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp vec3 $eyePosition = eyePosition;",
                "headerSnippets": [
                    "uniform highp vec3 eyePosition;"
                ]
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "vec3 $eyePosition = eyePosition;",
                "headerSnippets": [
                    "uniform vec3 eyePosition;"
                ]
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "vec3 $eyePosition = eyePosition;",
                "headerSnippets": []
            }
        ]
    },
    "time": {
        "outputs": [
            "time"
        ],
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp float $time = time;",
                "headerSnippets": [
                    "uniform highp float time;"
                ]
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "float $time = time;",
                "headerSnippets": [
                    "uniform float time;"
                ]
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "float $time = time;",
                "headerSnippets": [
                    "add-uniform float time"
                ]
            }
        ]
    },
    "transpose": {
        "inputs": [
            "input"
        ],
        "outputs": [
            "output"
        ],
        "parameters": {
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Mat3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $output = transpose($input);"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $output = transpose($input);"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $output = transpose($input);"
            }
        ]
    },
    "normalize": {
        "inputs": [
            "input"
        ],
        "outputs": [
            "output"
        ],
        "parameters": {
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $output = normalize($input);"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $output = normalize($input);"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $output = normalize($input);"
            }
        ]
    },
    "subtract": {
        "inputs": [
            "minuend",
            "subtrahend"
        ],
        "outputs": [
            "difference"
        ],
        "parameters": {
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $difference = $minuend - $subtrahend;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $difference = $minuend - $subtrahend;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $difference = $minuend - $subtrahend;"
            }
        ]
    },
    "add": {
        "inputs": [
            "first",
            "second"
        ],
        "outputs": [
            "sum"
        ],
        "parameters": {
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $sum = $first + $second;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $sum = $first + $second;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $sum = $first + $second;"
            }
        ]
    },
    "multiply": {
        "inputs": [
            "first",
            "second"
        ],
        "outputs": [
            "product"
        ],
        "parameters": {
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $product = $first * $second;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $product = $first * $second;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $product = $first * $second;"
            }
        ]
    },
    "swizzle": {
        "inputs": [
            "input"
        ],
        "outputs": [
            "output"
        ],
        "parameters": {
            "fields": "x",
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $output = $input.$fields;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $output = $input.$fields;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $output = $input.$fields;"
            }
        ]
    },
    "worldSpaceToTangentSpaceMatrix": {
        "inputs": [
            "worldNormal",
            "worldTangent"
        ],
        "outputs": [
            "matrix"
        ],
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp mat3 $matrix = calcWorldSpaceToTangentSpaceMatrix($worldNormal, $worldTangent);",
                "headerSnippets": [
                    "#pragma include :/shaders/es2/coordinatesystems.inc"
                ]
            },
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "highp mat3 $matrix = calcWorldSpaceToTangentSpaceMatrix($worldNormal, $worldTangent);",
                "headerSnippets": [
                    "#pragma include :/shaders/es3/coordinatesystems.inc"
                ]
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "mat3 $matrix = calcWorldSpaceToTangentSpaceMatrix($worldNormal, $worldTangent);",
                "headerSnippets": [
                    "#pragma include :/shaders/gl3/coordinatesystems.inc"
                ]
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "mat3 $matrix = calcWorldSpaceToTangentSpaceMatrix($worldNormal, $worldTangent);",
                "headerSnippets": [
                    "#pragma include :/shaders/rhi/coordinatesystems.inc"
                ]
            }
        ]
    },
    "phongFunction": {
        "inputs": [
            "ambient",
            "diffuse",
            "specular",
            "shininess",
            "worldPosition",
            "worldView",
            "worldNormal"
        ],
        "outputs": [
            "outputColor"
        ],
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp vec4 $outputColor = phongFunction($ambient, $diffuse, $specular, $shininess, $worldPosition, $worldView, $worldNormal);",
                "headerSnippets": [
                    "#pragma include :/shaders/es2/phong.inc.frag"
                ]
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "vec4 $outputColor = phongFunction($ambient, $diffuse, $specular, $shininess, $worldPosition, $worldView, $worldNormal);",
                "headerSnippets": [
                    "#pragma include :/shaders/gl3/phong.inc.frag"
                ]
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "vec4 $outputColor = phongFunction($ambient, $diffuse, $specular, $shininess, $worldPosition, $worldView, $worldNormal);",
                "headerSnippets": [
                    "#pragma include :/shaders/rhi/phong.inc.frag"
                ]
            }
        ]
    },
    "metalRoughFunction": {
        "inputs": [
            "baseColor",
            "metalness",
            "roughness",
            "ambientOcclusion",
            "worldPosition",
            "worldView",
            "worldNormal"
        ],
        "outputs": [
            "outputColor"
        ],
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "highp vec4 $outputColor = metalRoughFunction($baseColor, $metalness, $roughness, $ambientOcclusion, $worldPosition, $worldView, $worldNormal);",
                "headerSnippets": [
                    "#pragma include :/shaders/es3/metalrough.inc.frag"
                ]
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 1
                },
                "substitution": "vec4 $outputColor = metalRoughFunction($baseColor, $metalness, $roughness, $ambientOcclusion, $worldPosition, $worldView, $worldNormal);",
                "headerSnippets": [
                    "#pragma include :/shaders/gl3/metalrough.inc.frag"
                ]
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "vec4 $outputColor = metalRoughFunction($baseColor, $metalness, $roughness, $ambientOcclusion, $worldPosition, $worldView, $worldNormal);",
                "headerSnippets": [
                    "#pragma include :/shaders/rhi/metalrough.inc.frag"
                ]
            }
        ]
    },
    "join2": {
        "inputs": [
            "first",
            "second"
        ],
        "outputs": [
            "output"
        ],
        "parameters": {
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec2"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $output = $type($first, $second);"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $output = $type($first, $second);"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $output = $type($first, $second);"
            }
        ]
    },
    "join3": {
        "inputs": [
            "first",
            "second",
            "third"
        ],
        "outputs": [
            "output"
        ],
        "parameters": {
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $output = $type($first, $second, $third);"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $output = $type($first, $second, $third);"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $output = $type($first, $second, $third);"
            }
        ]
    },
    "join4": {
        "inputs": [
            "first",
            "second",
            "third",
            "fourth"
        ],
        "outputs": [
            "output"
        ],
        "parameters": {
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec4"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $output = $type($first, $second, $third, $fourth);"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $output = $type($first, $second, $third, $fourth);"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $output = $type($first, $second, $third, $fourth);"
            }
        ]
    },
    "cast": {
        "inputs": [
            "input"
        ],
        "outputs": [
            "output"
        ],
        "parameters": {
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $output = $type($input);"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $output = $type($input);"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $output = $type($input);"
            }
        ]
    },
    "builtinInput": {
        "outputs": [
            "value"
        ],
        "parameters": {
            "name": "defaultName",
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "substitution": "highp $type $value = $name;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "substitution": "$type $value = $name;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "substitution": "$type $value = $name;"
            }
        ]
    },
    "uniformInput": {
        "outputs": [
            "value"
        ],
        "parameters": {
            "name": "defaultName",
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            },
            "location": "0"
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "headerSnippets": [
                    "uniform highp $type $name;"
                ],
                "substitution": "highp $type $value = $name;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "headerSnippets": [
                    "uniform $type $name;"
                ],
                "substitution": "$type $value = $name;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "headerSnippets": [
                    "add-uniform $type $name"
                ],
                "substitution": "$type $value = $name;"
            }
        ]
    },
    "uniformArrayInput": {
        "outputs": [
            "value"
        ],
        "parameters": {
            "name": "defaultName",
            "size": "1",
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            },
            "location": "0"
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "headerSnippets": [
                    "uniform highp $type $name[$size];"
                ],
                "substitution": "highp $type $value = $name;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "headerSnippets": [
                    "uniform $type $name[$size];"
                ],
                "substitution": "$type $value = $name;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "headerSnippets": [
                    "add-uniform $type $name[$size]"
                ],
                "substitution": "$type $value = $name;"
            }
        ]
    },
    "textureInput": {
        "outputs": [
            "value"
        ],
        "parameters": {
            "name": "defaultName",
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "headerSnippets": [
                    "uniform highp $type $name;"
                ],
                "substitution": "highp $type $value = $name;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "headerSnippets": [
                    "uniform $type $name;"
                ],
                "substitution": "$type $value = $name;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "headerSnippets": [
                    "add-sampler $type $name"
                ],
                "substitution": "$type $value = $name;"
            }
        ]
    },
    "output": {
        "inputs": [
            "value"
        ],
        "parameters": {
            "name": "defaultName",
            "type": {
                "type": "QShaderLanguage::VariableType",
                "value": "QShaderLanguage::Vec3"
            }
        },
        "rules": [
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 2,
                    "minor": 0
                },
                "headerSnippets": [
                    "varying highp $type $name;"
                ],
                "substitution": "$name = $value;"
            },
            {
                "format": {
                    "api": "OpenGLES",
                    "major": 3,
                    "minor": 0
                },
                "headerSnippets": [
                    "out highp $type $name;"
                ],
                "substitution": "$name = $value;"
            },
            {
                "format": {
                    "api": "OpenGLCoreProfile",
                    "major": 3,
                    "minor": 0
                },
                "headerSnippets": [
                    "out $type $name;"
                ],
                "substitution": "$name = $value;"
            },
            {
                "format": {
                    "api": "RHI",
                    "major": 1,
                    "minor": 0
                },
                "headerSnippets": [
                    "add-input out $type $name"
                ],
                "substitution": "$name = $value;"
            }
        ]
    }
}
