//環境選択(簡易) public bool Environment(int type) { int count = GetEnvironmentCount(); if (count == -1) { return(false); } for (int i = 0; i < count; i++) { Ailia.AILIAEnvironment env = GetEnvironment(i); if (env == null) { return(false); } if (env.type == type) { if (!SelectEnvironment(i)) { return(false); } if (env.backend == Ailia.AILIA_ENVIRONMENT_BACKEND_CUDA || env.backend == Ailia.AILIA_ENVIRONMENT_BACKEND_VULKAN) { return(true); //優先 } } } return(true); }
public bool SelectEnvironment(int idx) { Ailia.AILIAEnvironment env = GetEnvironment(idx); if (env == null) { return(false); } env_id = env.id; env_name = Marshal.PtrToStringAnsi(env.name); return(true); }
public Ailia.AILIAEnvironment GetEnvironment(int idx) { IntPtr env_ptr = IntPtr.Zero; int status = Ailia.ailiaGetEnvironment(ref env_ptr, (uint)idx, Ailia.AILIA_ENVIRONMENT_VERSION); if (status != Ailia.AILIA_STATUS_SUCCESS) { if (logging) { Debug.Log("ailiaGetEnvironment failed " + status); } return(null); } Ailia.AILIAEnvironment env = (Ailia.AILIAEnvironment)Marshal.PtrToStructure(env_ptr, typeof(Ailia.AILIAEnvironment)); if (logging) { //Debug.Log("ENV id:"+env.id+", name:"+Marshal.PtrToStringAnsi(env.name)+", type:"+env.type); } return(env); }