# @overwrite

# @begin header
#
# Text inside @begin/@end blocks is autogenerated by scripts/upkeep/update-glsl-sources.py.
# If this file starts with an @overwrite directive, then its entire contents are managed by the script.
#
# @end header

glsl_files = [
# @begin glsl
    'sdf_apply.frag.glsl',
    'sdf_apply.vert.glsl',
    'sdf_generate.frag.glsl',
    'sdf_generate.vert.glsl',
# @end glsl
]

subdirs = [
# @begin subdirs
# @end subdirs
]

# @begin validate
if validate_glsl
    foreach fname : glsl_files
        stage = fname.split('.')[-2]

        spirv = custom_target(
            input : fname,
            output : '@BASENAME@.spv',
            command : [
                glslc_command, glslc_args, glslc_depfile_args, get_variable(f'glslc_@stage@_args'),
                '@INPUT@', '-o', '@OUTPUT@'
            ],
            install : false,
            build_by_default : true,
            depfile : f'@fname@.d',
        )

        spirv_targets += spirv

        if transpile_glsl
            essl = custom_target(
                input : spirv,
                output : '@BASENAME@.glsl',
                command : [
                    spvc_command,
                    '--output', '@OUTPUT@', '@INPUT@',
                    spvc_args,
                    get_variable(f'spvc_@stage@_args'),
                ],
                install : false,
                build_by_default : true,
                depfile : f'@fname@.d',
            )

            essl_targets += essl
        endif
    endforeach
endif
# @end validate

foreach sd : subdirs
    subdir(sd)
endforeach
