import ctypes as C,re,sys from pathlib import Path s=C.CDLL('/usr/lib/x86_64-linux-gnu/libshaderc.so.1') def fn(name,restype,args): f=getattr(s,name);f.restype=restype;f.argtypes=args;return f init=fn('shaderc_compiler_initialize',C.c_void_p,[]); optinit=fn('shaderc_compile_options_initialize',C.c_void_p,[]) setenv=fn('shaderc_compile_options_set_target_env',None,[C.c_void_p,C.c_int,C.c_uint]); auto=fn('shaderc_compile_options_set_auto_bind_uniforms',None,[C.c_void_p,C.c_bool]); loc=fn('shaderc_compile_options_set_auto_map_locations',None,[C.c_void_p,C.c_bool]); compile=fn('shaderc_compile_into_spv',C.c_void_p,[C.c_void_p,C.c_char_p,C.c_size_t,C.c_int,C.c_char_p,C.c_char_p,C.c_void_p]);status=fn('shaderc_result_get_compilation_status',C.c_int,[C.c_void_p]); msg=fn('shaderc_result_get_error_message',C.c_char_p,[C.c_void_p]);release=fn('shaderc_result_release',None,[C.c_void_p]) c=init(); o=optinit();setenv(o,1,450);auto(o,True);loc(o,True) failed=0 for p in sorted(p for p in Path('/tmp').glob('b-review-*.*') if p.suffix in ('.vert','.frag')): src=p.read_text().replace('#version 300 es','#version 310 es',1) src=re.sub(r'\baverage\b','threeAverage',src) # 'average' becomes reserved after production GLSL ES 300 src=src.encode();r=compile(c,src,len(src),0 if p.suffix=='.vert' else 1,str(p).encode(),b'main',o) code=status(r);failed+=code!=0 print(p.name,'status:',code,msg(r).decode());release(r) print('CPU/offline shaderc only; version raised 300 es -> 310 es solely for SPIR-V compiler acceptance and stock average() renamed to avoid later-version reserved keyword; auto bindings/locations. No changes to B code. No WebGL or GPU execution.') sys.exit(1 if failed else 0)