From patchwork Thu Jul 21 12:36:35 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: 2961 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 8ACAC23F4D for ; Thu, 21 Jul 2011 12:43:04 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 591B7A1822A for ; Thu, 21 Jul 2011 12:43:04 +0000 (UTC) Received: by mail-qw0-f52.google.com with SMTP id 8so853237qwb.11 for ; Thu, 21 Jul 2011 05:43:04 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr174509qcc.148.1311252184141; Thu, 21 Jul 2011 05:43:04 -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 hl14cs139523qcb; Thu, 21 Jul 2011 05:43:03 -0700 (PDT) Received: by 10.227.195.138 with SMTP id ec10mr166312wbb.87.1311251796902; Thu, 21 Jul 2011 05:36:36 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id ft20si2398668wbb.20.2011.07.21.05.36.36; Thu, 21 Jul 2011 05:36:36 -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 1QjsUV-0000DB-9F for ; Thu, 21 Jul 2011 12:36:35 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 06F9F2E802E for ; Thu, 21 Jul 2011 12:36:35 +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: 71 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 71: Display shader compilation/linking info only if an error has occured. Message-Id: <20110721123635.17019.60167.launchpad@loganberry.canonical.com> Date: Thu, 21 Jul 2011 12:36:35 -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: efc3a5653c039fb975048c262076990d7e83bbc8 ------------------------------------------------------------ revno: 71 committer: Alexandros Frantzis timestamp: Tue 2011-01-25 13:19:56 +0200 message: Display shader compilation/linking info only if an error has occured. modified: src/shader.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/shader.cpp' --- src/shader.cpp 2010-12-12 13:49:10 +0000 +++ src/shader.cpp 2011-01-25 11:19:56 +0000 @@ -56,6 +56,7 @@ { char *vertex_shader_source, *fragment_shader_source; char msg[512]; + GLint status; mVertexShader = glCreateShader(GL_VERTEX_SHADER); mFragmentShader = glCreateShader(GL_FRAGMENT_SHADER); @@ -74,14 +75,20 @@ free(fragment_shader_source); glCompileShader(mVertexShader); - glGetShaderInfoLog(mVertexShader, sizeof msg, NULL, msg); - if (strlen(msg) > 0) - printf("%s: %s", pVertexShaderFileName, msg); + glGetShaderiv(mVertexShader, GL_COMPILE_STATUS, &status); + if (status == GL_FALSE) { + glGetShaderInfoLog(mVertexShader, sizeof msg, NULL, msg); + fprintf(stderr, "Error compiling %s: %s", pVertexShaderFileName, + strlen(msg) > 0 ? msg : "[No info]"); + } glCompileShader(mFragmentShader); - glGetShaderInfoLog(mFragmentShader, sizeof msg, NULL, msg); - if (strlen(msg) > 0) - printf("%s: %s\n", pFragmentShaderFileName, msg); + glGetShaderiv(mFragmentShader, GL_COMPILE_STATUS, &status); + if (status == GL_FALSE) { + glGetShaderInfoLog(mFragmentShader, sizeof msg, NULL, msg); + fprintf(stderr, "Error compiling %s: %s", pFragmentShaderFileName, + strlen(msg) > 0 ? msg : "[No info]"); + } mShaderProgram = glCreateProgram(); glAttachShader(mShaderProgram, mFragmentShader); @@ -91,9 +98,12 @@ glBindAttribLocation(mShaderProgram, TexCoordAttribLocation, "texcoord"); glLinkProgram(mShaderProgram); - glGetProgramInfoLog(mShaderProgram, sizeof msg, NULL, msg); - if (strlen(msg) > 0) - printf("Shader Linking: %s\n", msg); + glGetProgramiv(mFragmentShader, GL_LINK_STATUS, &status); + if (status == GL_FALSE) { + glGetProgramInfoLog(mShaderProgram, sizeof msg, NULL, msg); + fprintf(stderr, "Error linking shader program: %s", + strlen(msg) > 0 ? msg : "[No info]"); + } mLocations.ModelViewProjectionMatrix = glGetUniformLocation(mShaderProgram, "ModelViewProjectionMatrix");