#!/usr/bin/env python3 """Lists vertex/fragment shader pairs whose varyings differ in type between the two stages (vec2 in the vertex shader, vec4 in the fragment one, ...), over WE's assets and every installed workshop item (scene.pkg and loose shaders/ dirs). Varyings declared more than once (one per #if branch) are marked, ShaderUnit's varying compatibility passes leave those alone. Usage: shader_varying_scan.py [assets dir] [workshop dir] """ import collections import glob import os import re import struct import sys ASSETS = sys.argv[1] if len(sys.argv) > 1 else '/workspace/SteamLibrary/steamapps/common/wallpaper_engine/assets' WORKSHOP = sys.argv[2] if len(sys.argv) > 2 else '/workspace/SteamLibrary/steamapps/workshop/content/431960' DECLARATION = re.compile(r'\bvarying\s+(\w+)\s+(\w+)\s*;') def pkg_shaders(path): with open(path, 'rb') as f: f.read(struct.unpack(' 1 or len(other) > 1 else '' print(f'{name} {varying}: vertex {kinds}, fragment {other}{note}') if __name__ == '__main__': main()