From patchwork Thu Jul 21 12:36:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandros Frantzis X-Patchwork-Id: 2915 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 0901C23F52 for ; Thu, 21 Jul 2011 12:36:46 +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 CC677A184BF for ; Thu, 21 Jul 2011 12:36:45 +0000 (UTC) Received: by mail-qw0-f52.google.com with SMTP id 8so850361qwb.11 for ; Thu, 21 Jul 2011 05:36:45 -0700 (PDT) Received: by 10.229.25.212 with SMTP id a20mr168939qcc.148.1311251804022; Thu, 21 Jul 2011 05:36:44 -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 hl14cs139335qcb; Thu, 21 Jul 2011 05:36:43 -0700 (PDT) Received: by 10.227.28.206 with SMTP id n14mr181167wbc.52.1311251794820; Thu, 21 Jul 2011 05:36:34 -0700 (PDT) Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by mx.google.com with ESMTP id ev16si2381303wbb.92.2011.07.21.05.36.34; Thu, 21 Jul 2011 05:36:34 -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 1QjsUT-0000D2-Fw for ; Thu, 21 Jul 2011 12:36:33 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 0DA802EA048 for ; Thu, 21 Jul 2011 12:36:32 +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: 29 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 29: Add Shader::unload() method. Message-Id: <20110721123632.17019.81377.launchpad@loganberry.canonical.com> Date: Thu, 21 Jul 2011 12:36:32 -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: d898b8a99cf3b23c020f4827dc1de64f6cc0d487 ------------------------------------------------------------ revno: 29 committer: Alexandros Frantzis timestamp: Fri 2010-07-09 14:16:34 +0300 message: Add Shader::unload() method. Change Shader::remove() to remove a shader from use (but not unload it). modified: shader.cpp shader.h --- 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 'shader.cpp' --- shader.cpp 2010-07-09 10:28:57 +0000 +++ shader.cpp 2010-07-09 11:16:34 +0000 @@ -27,7 +27,7 @@ Shader::~Shader() { - remove(); + unload(); } void Shader::load(const char *pVertexShaderFileName, const char *pFragmentShaderFileName) @@ -122,8 +122,19 @@ void Shader::remove() { + glUseProgramObjectARB(0); +} + +void Shader::unload() +{ glDetachObjectARB(mShaderProgram, mVertexShader); glDetachObjectARB(mShaderProgram, mFragmentShader); - + + glDeleteObjectARB(mVertexShader); + glDeleteObjectARB(mFragmentShader); glDeleteObjectARB(mShaderProgram); + + mVertexShader = 0; + mFragmentShader = 0; + mShaderProgram = 0; } === modified file 'shader.h' --- shader.h 2010-07-09 10:28:57 +0000 +++ shader.h 2010-07-09 11:16:34 +0000 @@ -11,8 +11,10 @@ public: ~Shader(); void load(const char *pVertexShaderFileName, const char *pFragmentShaderFileName); + void unload(); + + void use(); void remove(); - void use(); GLuint mVertexShader; GLuint mFragmentShader;