From patchwork Thu Jul 21 12:36:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 2990 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7F9DA23F4D for ; Thu, 21 Jul 2011 12:43:53 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id 389DEA1822A for ; Thu, 21 Jul 2011 12:43:53 +0000 (UTC) Received: by mail-qy0-f173.google.com with SMTP id 10so3962301qyk.11 for ; Thu, 21 Jul 2011 05:43:53 -0700 (PDT) Received: by 10.229.68.200 with SMTP id w8mr191831qci.114.1311252232994; Thu, 21 Jul 2011 05:43:52 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.217.78 with SMTP id hl14cs139564qcb; Thu, 21 Jul 2011 05:43:52 -0700 (PDT) Received: by 10.227.178.135 with SMTP id bm7mr179193wbb.52.1311251797281; Thu, 21 Jul 2011 05:36:37 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id gb12si2367826wbb.139.2011.07.21.05.36.36; Thu, 21 Jul 2011 05:36:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) client-ip=91.189.90.139; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.139 as permitted sender) smtp.mail=bounces@canonical.com Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QjsUW-0000DN-CM for ; Thu, 21 Jul 2011 12:36:36 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 5BB022E889B for ; Thu, 21 Jul 2011 12:36:36 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 86 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 86: Improve debug and error message reporting. Message-Id: <20110721123636.17019.61627.launchpad@loganberry.canonical.com> Date: Thu, 21 Jul 2011 12:36:36 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13475"; Instance="initZopeless config overlay" X-Launchpad-Hash: 1af4b7617083249faacf1fc5f10b791c9db5cbc6 ------------------------------------------------------------ revno: 86 committer: Alexandros Frantzis timestamp: Tue 2011-06-21 15:38:07 +0300 message: Improve debug and error message reporting. modified: src/mesh.cpp src/model.cpp src/screen-sdl-glesv2.cpp src/screen-sdl.cpp --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'src/mesh.cpp' --- src/mesh.cpp 2011-06-21 12:24:15 +0000 +++ src/mesh.cpp 2011-06-21 12:38:07 +0000 @@ -140,10 +140,6 @@ void Mesh::build_vbo() { -#ifdef _DEBUG - printf("Building vbo for mesh... "); -#endif - float *vertex; float *texel; float *normal; @@ -187,9 +183,6 @@ delete [] vertex; delete [] texel; delete [] normal; -#ifdef _DEBUG - printf("[ Done ]\n"); -#endif } void === modified file 'src/model.cpp' --- src/model.cpp 2011-06-17 09:39:44 +0000 +++ src/model.cpp 2011-06-21 12:38:07 +0000 @@ -23,6 +23,7 @@ */ #include "model.h" #include "vec.h" +#include "log.h" long filelength(int f) { @@ -47,9 +48,6 @@ void Model::convert_to_mesh(Mesh *pMesh) { -#ifdef _DEBUG - printf("Converting model to mesh... "); -#endif pMesh->reset(); pMesh->mVertexQty = 3 * mPolygonQty; @@ -72,17 +70,10 @@ pMesh->mVertex[i + 1].t = mVertex[mPolygon[i / 3].mB].t; pMesh->mVertex[i + 2].t = mVertex[mPolygon[i / 3].mC].t; } - -#ifdef _DEBUG - printf("[ Done ]\n"); -#endif } void Model::calculate_normals() { -#ifdef _DEBUG - printf("Calculating normals for model... "); -#endif LibMatrix::vec3 n; for(unsigned i = 0; i < mPolygonQty; i++) @@ -97,10 +88,6 @@ for(unsigned i = 0; i < mVertexQty; i++) mVertex[i].n.normalize(); - -#ifdef _DEBUG - printf("[ Done ]\n"); -#endif } void Model::center() @@ -142,16 +129,10 @@ unsigned short l_qty; size_t nread; -#ifdef _DEBUG - printf("Loading model from 3ds file... "); -#endif + Log::debug("Loading model from 3ds file '%s'\n", pFileName); - if ((l_file=fopen (pFileName, "rb"))== NULL) { -#ifdef _DEBUG - printf("[ Fail ]\n"); -#else - printf("Could not open 3ds file\n"); -#endif + if ((l_file = fopen (pFileName, "rb")) == NULL) { + Log::error("Could not open 3ds file '%s'\n", pFileName); return 0; } @@ -269,12 +250,10 @@ } fclose(l_file); // Closes the file stream -#ifdef _DEBUG - printf("[ Success ]\n"); - printf(" Model Information\n"); - printf(" Name: %s\n", mName); - printf(" Vertex count: %d\n", mVertexQty); - printf(" Polygon count: %d\n", mPolygonQty); -#endif + Log::debug(" Model Information\n" + " Name: %s\n" + " Vertex count: %d\n" + " Polygon count: %d\n", + mName, mVertexQty, mPolygonQty); return 1; } === modified file 'src/screen-sdl-glesv2.cpp' --- src/screen-sdl-glesv2.cpp 2011-06-15 10:11:13 +0000 +++ src/screen-sdl-glesv2.cpp 2011-06-21 12:38:07 +0000 @@ -24,6 +24,7 @@ #include "screen-sdl-glesv2.h" #include "sdlgles/SDL_gles.h" #include "options.h" +#include "log.h" #include ScreenSDLGLESv2::ScreenSDLGLESv2(int pWidth, int pHeight, int pBpp, int pFullScreen, int pFlags) @@ -52,25 +53,23 @@ return; } -#ifdef _DEBUG - { - int buf, red, green, blue, alpha, depth; - SDL_GLES_GetAttribute(SDL_GLES_BUFFER_SIZE, &buf); - SDL_GLES_GetAttribute(SDL_GLES_RED_SIZE, &red); - SDL_GLES_GetAttribute(SDL_GLES_GREEN_SIZE, &green); - SDL_GLES_GetAttribute(SDL_GLES_BLUE_SIZE, &blue); - SDL_GLES_GetAttribute(SDL_GLES_ALPHA_SIZE, &alpha); - SDL_GLES_GetAttribute(SDL_GLES_DEPTH_SIZE, &depth); - printf("EGL chosen config:\n" - " Buffer: %d bits\n" - " Red: %d bits\n" - " Green: %d bits\n" - " Blue: %d bits\n" - " Alpha: %d bits\n" - " Depth: %d bits\n", - buf, red, green, blue, alpha, depth); + if (Options::show_debug) { + int buf, red, green, blue, alpha, depth; + SDL_GLES_GetAttribute(SDL_GLES_BUFFER_SIZE, &buf); + SDL_GLES_GetAttribute(SDL_GLES_RED_SIZE, &red); + SDL_GLES_GetAttribute(SDL_GLES_GREEN_SIZE, &green); + SDL_GLES_GetAttribute(SDL_GLES_BLUE_SIZE, &blue); + SDL_GLES_GetAttribute(SDL_GLES_ALPHA_SIZE, &alpha); + SDL_GLES_GetAttribute(SDL_GLES_DEPTH_SIZE, &depth); + Log::debug("EGL chosen config:\n" + " Buffer: %d bits\n" + " Red: %d bits\n" + " Green: %d bits\n" + " Blue: %d bits\n" + " Alpha: %d bits\n" + " Depth: %d bits\n", + buf, red, green, blue, alpha, depth); } -#endif glClearColor(0.0f, 0.0f, 0.0f, 0.5f); glClearDepthf(1.0f); === modified file 'src/screen-sdl.cpp' --- src/screen-sdl.cpp 2011-06-17 08:27:49 +0000 +++ src/screen-sdl.cpp 2011-06-21 12:38:07 +0000 @@ -22,6 +22,7 @@ * Alexandros Frantzis (glmark2) */ #include "screen-sdl.h" +#include "log.h" ScreenSDL::ScreenSDL(int pWidth, int pHeight, int pBpp, int pFullScreen, int pFlags) { @@ -33,12 +34,9 @@ if (mFullScreen) pFlags |= SDL_FULLSCREEN; -#ifdef _DEBUG - printf("Initializing Screen... "); -#endif if(SDL_Init(SDL_INIT_VIDEO) < 0) { - fprintf(stderr, "[ Fail ] - Video initialization failed: %s\n", SDL_GetError()); + Log::error("[ Fail ] - Video initialization failed: %s\n", SDL_GetError()); return; } @@ -55,7 +53,7 @@ if(SDL_SetVideoMode(mWidth, mHeight, mBpp, pFlags) == 0) { - fprintf(stderr, "[ Fail ] - Video mode set failed: %s\n", SDL_GetError()); + Log::error("[ Fail ] - Video mode set failed: %s\n", SDL_GetError()); return; } @@ -63,11 +61,6 @@ mProjection = LibMatrix::Mat4::perspective(60.0, mWidth / (float)mHeight, 1.0, 1024.0); - -#ifdef _DEBUG - mProjection.print(); -#endif - mInitSuccess = 1; }