Begin implementation of textured images.
[Ale.git] / accel.h
blob7b6908d6292ff06c80d440cc36d93dd3868948d0
1 // Copyright 2008 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@gmail.com>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * accel.h: acceleration
25 #ifndef __accel_h__
26 #define __accel_h__
28 #include "gpu.h"
30 #include <assert.h>
31 #include <stdio.h>
32 #include <string.h>
33 #include <stdlib.h>
35 class accel {
36 static int use_gpu;
38 public:
40 static void set_gpu() {
41 use_gpu = 1;
44 static void set_none() {
45 use_gpu = 0;
48 static void set_auto() {
49 const char *accel_default = getenv("ALE_GPU_ACCEL_DEFAULT");
50 if (accel_default && !strcmp(accel_default, "1") && gpu::is_ok())
51 use_gpu = 1;
52 else
53 use_gpu = 0;
56 static int is_gpu() {
57 if (use_gpu == 2)
58 set_auto();
60 if (use_gpu > 0 && gpu::is_ok())
61 return 1;
63 if (use_gpu == 1) {
64 fprintf(stderr, "GPU acceleration error.\n");
65 exit(1);
68 return 0;
72 #endif