From patchwork Tue Jun 21 12:49:16 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: 2121 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 48BC223E54 for ; Tue, 21 Jun 2011 12:49:20 +0000 (UTC) Received: from mail-vx0-f180.google.com (mail-vx0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id E2DEAA187E5 for ; Tue, 21 Jun 2011 12:49:19 +0000 (UTC) Received: by vxd7 with SMTP id 7so3482565vxd.11 for ; Tue, 21 Jun 2011 05:49:19 -0700 (PDT) Received: by 10.52.163.6 with SMTP id ye6mr172645vdb.127.1308660559285; Tue, 21 Jun 2011 05:49:19 -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.52.183.130 with SMTP id em2cs63917vdc; Tue, 21 Jun 2011 05:49:18 -0700 (PDT) Received: by 10.227.182.129 with SMTP id cc1mr6173518wbb.10.1308660557662; Tue, 21 Jun 2011 05:49:17 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id fs18si11680566wbb.49.2011.06.21.05.49.17; Tue, 21 Jun 2011 05:49:17 -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 1QZ0OL-0008It-0u for ; Tue, 21 Jun 2011 12:49:17 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id F33542E84FB for ; Tue, 21 Jun 2011 12:49:16 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~afrantzis/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 ~afrantzis/glmark2/trunk] Rev 86: Improve debug and error message reporting. Message-Id: <20110621124916.14638.748.launchpad@loganberry.canonical.com> Date: Tue, 21 Jun 2011 12:49:16 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13242"; Instance="initZopeless config overlay" X-Launchpad-Hash: 4a1159507f926ea57d0f47a73dbc5549076eec26 ------------------------------------------------------------ revno: 86 committer: Alexandros Frantzis branch nick: trunk 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/~afrantzis/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~afrantzis/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; }