gl perf test cleanup.

Change-Id: Ic486774e25421bd2f412f0ba2bbac4660e3982b8
This commit is contained in:
Jason Sams
2010-07-12 11:41:46 -07:00
parent 5958091dd9
commit 93bab39af5
2 changed files with 5 additions and 109 deletions

View File

@@ -132,7 +132,7 @@ void endTimer(const char *str, int w, int h, double dc, int count) {
double mpps = pixels / delta / 1000000;
double dc60 = pixels / delta / (w * h) / 60;
printf("test %s, Mpps %f, dc = %f\n", str, mpps, dc60);
printf("%s, %f, %f\n", str, mpps, dc60);
}
static const char gVertexShader[] =
@@ -319,12 +319,12 @@ static void doSingleTest(uint32_t w, uint32_t h,
glBlendFunc(GL_ONE, GL_ONE);
glDisable(GL_BLEND);
sprintf(str2, "Test varColor=%i, texCount=%i, modulate=%i, extraMath=%i, texSize=%i, blend=0",
sprintf(str2, "%i, %i, %i, %i, %i, 0",
useVarColor, texCount, modulateFirstTex, extraMath, tex0);
doLoop(w, h, str2);
glEnable(GL_BLEND);
sprintf(str2, "Test varColor=%i, texCount=%i, modulate=%i, extraMath=%i, texSize=%i, blend=1",
sprintf(str2, "%i, %i, %i, %i, %i, 1",
useVarColor, texCount, modulateFirstTex, extraMath, tex0);
doLoop(w, h, str2);
}
@@ -361,6 +361,8 @@ bool doTest(uint32_t w, uint32_t h) {
setupVA();
genTextures();
printf("\nvarColor, texCount, modulate, extraMath, texSize, blend, Mpps, DC60\n");
for (int texCount = 0; texCount < 3; texCount++) {
for (int extraMath = 0; extraMath < 5; extraMath++) {

View File

@@ -31,18 +31,6 @@
using namespace android;
static void printGLString(const char *name, GLenum s) {
// fprintf(stderr, "printGLString %s, %d\n", name, s);
const char *v = (const char *) glGetString(s);
// int error = glGetError();
// fprintf(stderr, "glGetError() = %d, result of glGetString = %x\n", error,
// (unsigned int) v);
// if ((v < (const char*) 0) || (v > (const char*) 0x10000))
// fprintf(stderr, "GL %s = %s\n", name, v);
// else
// fprintf(stderr, "GL %s = (null) 0x%08x\n", name, (unsigned int) v);
fprintf(stderr, "GL %s = %s\n", name, v);
}
static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
if (returnVal != EGL_TRUE) {
@@ -63,89 +51,6 @@ static void checkGlError(const char* op) {
}
}
void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) {
#define X(VAL) {VAL, #VAL}
struct {EGLint attribute; const char* name;} names[] = {
X(EGL_BUFFER_SIZE),
X(EGL_ALPHA_SIZE),
X(EGL_BLUE_SIZE),
X(EGL_GREEN_SIZE),
X(EGL_RED_SIZE),
X(EGL_DEPTH_SIZE),
X(EGL_STENCIL_SIZE),
X(EGL_CONFIG_CAVEAT),
X(EGL_CONFIG_ID),
X(EGL_LEVEL),
X(EGL_MAX_PBUFFER_HEIGHT),
X(EGL_MAX_PBUFFER_PIXELS),
X(EGL_MAX_PBUFFER_WIDTH),
X(EGL_NATIVE_RENDERABLE),
X(EGL_NATIVE_VISUAL_ID),
X(EGL_NATIVE_VISUAL_TYPE),
X(EGL_SAMPLES),
X(EGL_SAMPLE_BUFFERS),
X(EGL_SURFACE_TYPE),
X(EGL_TRANSPARENT_TYPE),
X(EGL_TRANSPARENT_RED_VALUE),
X(EGL_TRANSPARENT_GREEN_VALUE),
X(EGL_TRANSPARENT_BLUE_VALUE),
X(EGL_BIND_TO_TEXTURE_RGB),
X(EGL_BIND_TO_TEXTURE_RGBA),
X(EGL_MIN_SWAP_INTERVAL),
X(EGL_MAX_SWAP_INTERVAL),
X(EGL_LUMINANCE_SIZE),
X(EGL_ALPHA_MASK_SIZE),
X(EGL_COLOR_BUFFER_TYPE),
X(EGL_RENDERABLE_TYPE),
X(EGL_CONFORMANT),
};
#undef X
for (size_t j = 0; j < sizeof(names) / sizeof(names[0]); j++) {
EGLint value = -1;
EGLint returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
EGLint error = eglGetError();
if (returnVal && error == EGL_SUCCESS) {
printf(" %s: ", names[j].name);
printf("%d (0x%x)", value, value);
}
}
printf("\n");
}
int printEGLConfigurations(EGLDisplay dpy) {
EGLint numConfig = 0;
EGLint returnVal = eglGetConfigs(dpy, NULL, 0, &numConfig);
checkEglError("eglGetConfigs", returnVal);
if (!returnVal) {
return false;
}
printf("Number of EGL configuration: %d\n", numConfig);
EGLConfig* configs = (EGLConfig*) malloc(sizeof(EGLConfig) * numConfig);
if (! configs) {
printf("Could not allocate configs.\n");
return false;
}
returnVal = eglGetConfigs(dpy, configs, numConfig, &numConfig);
checkEglError("eglGetConfigs", returnVal);
if (!returnVal) {
free(configs);
return false;
}
for(int i = 0; i < numConfig; i++) {
printf("Configuration %d\n", i);
printEGLConfiguration(dpy, configs[i]);
}
free(configs);
return true;
}
bool doTest(uint32_t w, uint32_t h);
static EGLDisplay dpy;
@@ -176,7 +81,6 @@ int main(int argc, char** argv) {
returnValue = eglInitialize(dpy, &majorVersion, &minorVersion);
checkEglError("eglInitialize", returnValue);
fprintf(stderr, "EGL version %d.%d\n", majorVersion, minorVersion);
if (returnValue != EGL_TRUE) {
printf("eglInitialize failed\n");
return 0;
@@ -191,9 +95,6 @@ int main(int argc, char** argv) {
checkEglError("EGLUtils::selectConfigForNativeWindow");
printf("Chose this configuration:\n");
printEGLConfiguration(dpy, myConfig);
surface = eglCreateWindowSurface(dpy, myConfig, window, NULL);
checkEglError("eglCreateWindowSurface");
if (surface == EGL_NO_SURFACE) {
@@ -218,13 +119,6 @@ int main(int argc, char** argv) {
checkEglError("eglQuerySurface");
GLint dim = w < h ? w : h;
fprintf(stderr, "Window dimensions: %d x %d\n", w, h);
printGLString("Version", GL_VERSION);
printGLString("Vendor", GL_VENDOR);
printGLString("Renderer", GL_RENDERER);
printGLString("Extensions", GL_EXTENSIONS);
glViewport(0, 0, w, h);
for (;;) {