shadertool: Fix header lookup and check if headers already attached