Saturday, April 25, 2015

OpenGL NVIDIA GPU 메모리 체크 예제 다운로드

NVIDIA GPU에서만 사용가능한 메모리 체크 함수이다.
GLUT와 GL_NVX_GPU_memory_info 확장을 사용한다.

#include "GL\glew.h"
#include "GL\wglew.h"
#include "GL\glut.h"
#include <Windows.h>

#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glut32.lib")

#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B

int _tmain(int argc, _TCHAR* argv[])
{
 glutCreateWindow("NVXGpuMemoryInfo");

 int total, current;
 glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &total);
 glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &current);

 printf("total: %d\n", total);
 printf("current: %d\n", current);

 return 0;
}

다운로드

No comments:

Post a Comment