mightymandel
v16
GPU-based Mandelbrot set explorer
vram.c
Go to the documentation of this file.
1
// mightymandel -- GPU-based Mandelbrot Set explorer
2
// Copyright (C) 2012,2013,2014,2015 Claude Heiland-Allen
3
// License GPL3+ http://www.gnu.org/licenses/gpl.html
4
5
#include <GL/glew.h>
6
#include <stdio.h>
7
8
#include "
utility.h
"
9
#include "
logging.h
"
10
18
int
vram_nvidia
() {
19
GLint mem = 0;
20
glGetIntegerv(0x9049, &mem);
21
int
e = glGetError();
22
if
(e == GL_NO_ERROR) {
23
return
mem;
24
}
else
if
(e == GL_INVALID_ENUM) {
25
return
-1;
26
}
else
{
27
log_message
(
LOG_WARN
,
"OpenGL error %d in vram_nvidia()\n"
, e);
28
return
-2;
29
}
30
}
31
39
int
vram_ati
() {
40
GLint mem[4] = { 0, 0, 0, 0 };
41
glGetIntegerv(0x87FB, &mem[0]);
42
int
e = glGetError();
43
if
(e == GL_NO_ERROR) {
44
return
mem[1];
45
}
else
if
(e == GL_INVALID_ENUM) {
46
return
-1;
47
}
else
{
48
log_message
(
LOG_WARN
,
"OpenGL error %d in vram_ati()\n"
, e);
49
return
-2;
50
}
51
}
52
53
int
vram_available
() {
54
int
nvx =
vram_nvidia
();
55
int
ati =
vram_ati
();
56
return
max
(nvx, ati);
57
}
src
vram.c
Generated on Mon Jan 19 2015 16:18:12 for mightymandel by
1.8.1.2