From patchwork Wed Jun 27 22:20:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barker X-Patchwork-Id: 9657 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 D040023E40 for ; Wed, 27 Jun 2012 22:20:19 +0000 (UTC) Received: from mail-yw0-f47.google.com (mail-yw0-f47.google.com [209.85.213.47]) by fiordland.canonical.com (Postfix) with ESMTP id 7FD7CA18461 for ; Wed, 27 Jun 2012 22:20:19 +0000 (UTC) Received: by yhjj56 with SMTP id j56so1741649yhj.20 for ; Wed, 27 Jun 2012 15:20:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=Ga92WvXX6emToJfjPuW/6IootA0C67UbpZpW/MH3a04=; b=PdMkNAM9HLr1cHCiFnvXuFv8u5tVR4nJRNHVhRThsrX/UlPQgxD+xhNWc1WWJKSZPq A9Jq8EhYK67gM+XfjaMdtCrPMbvAHTB5BPzTrQeV8tdCwvVHRvAYkyDztqJizoPjFbl8 9SenuTXSEu3qHpQURhyY26304HDfd8ed+5mtHcenyNzgzn8e6Hn0ymj+incWno/wKlo4 3JvcOc/EupGfPahErbKVmMrKKRa/26WSW2GbEsse6DxcDa4IYty6xT5UjS9H7tHf8+VN 0hU9vWGZsOGj1FB+Xyr0cryw+NJ4q0rEKxd+gsvJvpgP/iwe5hMokStLg6Jvpf4d3fEd Sl0w== Received: by 10.50.40.193 with SMTP id z1mr2771859igk.0.1340835618821; Wed, 27 Jun 2012 15:20:18 -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.231.24.148 with SMTP id v20csp25069ibb; Wed, 27 Jun 2012 15:20:17 -0700 (PDT) Received: by 10.180.109.194 with SMTP id hu2mr8149744wib.0.1340835616982; Wed, 27 Jun 2012 15:20:16 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id hs4si13967061wib.32.2012.06.27.15.20.16 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jun 2012 15:20:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Sk0au-0003Ld-FN for ; Wed, 27 Jun 2012 22:20:16 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 5EAB0E00A7 for ; Wed, 27 Jun 2012 22:20:16 +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: 225 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 225: SceneIdeas: Convert all element array handling from unsigned int to unsigned short. Message-Id: <20120627222016.16618.20019.launchpad@ackee.canonical.com> Date: Wed, 27 Jun 2012 22:20: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="15490"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 5cd21bd99415a89800ad47f5a38f6d663f1208a1 X-Gm-Message-State: ALoCoQkNTBfvXZpaHVfjvF4mcZ6MUE3QFvoObO6u1NbY9i9aNikoRLavT9IxklqcbQ1HQNuchLQp ------------------------------------------------------------ revno: 225 committer: Jesse Barker branch nick: trunk timestamp: Wed 2012-06-27 15:16:47 -0700 message: SceneIdeas: Convert all element array handling from unsigned int to unsigned short. OpenGL ES 2.0 only allows GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT for the index type, and the use of GL_UNSIGNED_INT, while legal for OpenGL and permitted by several OpenGL ES 2.0 implmentations generates an error on stricter ones. modified: src/scene-ideas/a.cc src/scene-ideas/characters.h src/scene-ideas/d.cc src/scene-ideas/e.cc src/scene-ideas/i.cc src/scene-ideas/lamp.cc src/scene-ideas/lamp.h src/scene-ideas/logo.cc src/scene-ideas/logo.h src/scene-ideas/m.cc src/scene-ideas/n.cc src/scene-ideas/o.cc src/scene-ideas/s.cc src/scene-ideas/t.cc src/scene-ideas/table.cc src/scene-ideas/table.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 'src/scene-ideas/a.cc' --- src/scene-ideas/a.cc 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/a.cc 2012-06-27 22:16:47 +0000 @@ -170,10 +170,10 @@ // Primitive state so that the draw call can issue the primitives we want. unsigned int curOffset(0); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 28, curOffset)); - curOffset += (28 * sizeof(unsigned int)); + curOffset += (28 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 17, curOffset)); - curOffset += (17 * sizeof(unsigned int)); + curOffset += (17 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 28, curOffset)); - curOffset += (28 * sizeof(unsigned int)); + curOffset += (28 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 17, curOffset)); } === modified file 'src/scene-ideas/characters.h' --- src/scene-ideas/characters.h 2012-05-08 20:53:58 +0000 +++ src/scene-ideas/characters.h 2012-06-27 22:16:47 +0000 @@ -37,7 +37,7 @@ ~PrimitiveState() {} void issue() const { - glDrawElements(type_, count_, GL_UNSIGNED_INT, + glDrawElements(type_, count_, GL_UNSIGNED_SHORT, reinterpret_cast(bufferOffset_)); } private: @@ -86,7 +86,7 @@ // Now repeat for our index data. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferObjects_[1]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, - indexData_.size() * sizeof(unsigned int), &indexData_.front(), + indexData_.size() * sizeof(unsigned short), &indexData_.front(), GL_STATIC_DRAW); // Unbind our vertex buffer objects so that their state isn't affected @@ -103,7 +103,7 @@ vertexArray_(0) {} unsigned int bufferObjects_[2]; std::vector vertexData_; - std::vector indexData_; + std::vector indexData_; int vertexIndex_; unsigned int vertexArray_; std::vector primVec_; === modified file 'src/scene-ideas/d.cc' --- src/scene-ideas/d.cc 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/d.cc 2012-06-27 22:16:47 +0000 @@ -137,6 +137,6 @@ // Primitive state so that the draw call can issue the primitives we want. unsigned int curOffset(0); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 34, curOffset)); - curOffset += (34 * sizeof(unsigned int)); + curOffset += (34 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 34, curOffset)); } === modified file 'src/scene-ideas/e.cc' --- src/scene-ideas/e.cc 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/e.cc 2012-06-27 22:16:47 +0000 @@ -134,6 +134,6 @@ // Primitive state so that the draw call can issue the primitives we want. unsigned int curOffset(0); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 33, curOffset)); - curOffset += (33 * sizeof(unsigned int)); + curOffset += (33 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 33, curOffset)); } === modified file 'src/scene-ideas/i.cc' --- src/scene-ideas/i.cc 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/i.cc 2012-06-27 22:16:47 +0000 @@ -107,10 +107,10 @@ // Primitive state so that the draw call can issue the primitives we want. unsigned int curOffset(0); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 20, curOffset)); - curOffset += (20 * sizeof(unsigned int)); + curOffset += (20 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 4, curOffset)); - curOffset += (4 * sizeof(unsigned int)); + curOffset += (4 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 20, curOffset)); - curOffset += (20 * sizeof(unsigned int)); + curOffset += (20 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 4, curOffset)); } === modified file 'src/scene-ideas/lamp.cc' --- src/scene-ideas/lamp.cc 2012-05-08 20:53:58 +0000 +++ src/scene-ideas/lamp.cc 2012-06-27 22:16:47 +0000 @@ -204,7 +204,7 @@ // Now repeat for our index data. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferObjects_[1]); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexData_.size() * sizeof(unsigned int), &indexData_.front(), GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexData_.size() * sizeof(unsigned short), &indexData_.front(), GL_STATIC_DRAW); // We're ready to go. valid_ = true; @@ -234,10 +234,10 @@ litProgram_[light0PositionName_] = lightPositions[0]; litProgram_[light1PositionName_] = lightPositions[1]; litProgram_[light2PositionName_] = lightPositions[2]; - static const unsigned int sui(sizeof(unsigned int)); + static const unsigned int sus(sizeof(unsigned short)); for (unsigned int i = 0; i < 5; i++) { - glDrawElements(GL_TRIANGLE_STRIP, 26, GL_UNSIGNED_INT, reinterpret_cast(i * 26 * sui)); + glDrawElements(GL_TRIANGLE_STRIP, 26, GL_UNSIGNED_SHORT, reinterpret_cast(i * 26 * sus)); } glDisableVertexAttribArray(normalIndex); glDisableVertexAttribArray(vertexIndex); @@ -249,7 +249,7 @@ glEnableVertexAttribArray(vertexIndex); unlitProgram_[modelviewName_] = mv; unlitProgram_[projectionName_] = projection.getCurrent(); - glDrawElements(GL_TRIANGLE_FAN, 12, GL_UNSIGNED_INT, reinterpret_cast(5 * 26 * sui)); + glDrawElements(GL_TRIANGLE_FAN, 12, GL_UNSIGNED_SHORT, reinterpret_cast(5 * 26 * sus)); glDisableVertexAttribArray(vertexIndex); unlitProgram_.stop(); === modified file 'src/scene-ideas/lamp.h' --- src/scene-ideas/lamp.h 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/lamp.h 2012-06-27 22:16:47 +0000 @@ -56,7 +56,7 @@ static const std::string normalAttribName_; static const std::string normalMatrixName_; std::vector vertexData_; - std::vector indexData_; + std::vector indexData_; unsigned int bufferObjects_[2]; bool valid_; }; === modified file 'src/scene-ideas/logo.cc' --- src/scene-ideas/logo.cc 2012-05-08 20:53:58 +0000 +++ src/scene-ideas/logo.cc 2012-06-27 22:16:47 +0000 @@ -487,7 +487,7 @@ // Now repeat for our index data. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferObjects_[1]); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexData_.size() * sizeof(unsigned int), + glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexData_.size() * sizeof(unsigned short), &indexData_.front(), GL_STATIC_DRAW); // Setup our the texture that the shadow program will use... @@ -560,7 +560,6 @@ void SGILogo::drawElbow(void) { - static const unsigned int sui(sizeof(unsigned int)); unsigned int startIdx(0); unsigned int endIdx(6); if (drawStyle_ == LOGO_NORMAL) @@ -579,8 +578,8 @@ for (unsigned int i = startIdx; i < endIdx; i++) { - unsigned int curOffset(i * 18 * sui); - glDrawElements(GL_TRIANGLE_STRIP, 18, GL_UNSIGNED_INT, + unsigned int curOffset(i * 18 * sizeof(unsigned short)); + glDrawElements(GL_TRIANGLE_STRIP, 18, GL_UNSIGNED_SHORT, reinterpret_cast(curOffset)); } } === modified file 'src/scene-ideas/logo.h' --- src/scene-ideas/logo.h 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/logo.h 2012-06-27 22:16:47 +0000 @@ -71,7 +71,7 @@ std::vector elbowVertices_; std::vector elbowNormals_; std::vector elbowShadowVertices_; - std::vector indexData_; + std::vector indexData_; // A simple map so we know where each section of our data starts within // our vertex buffer object. struct VertexDataMap === modified file 'src/scene-ideas/m.cc' --- src/scene-ideas/m.cc 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/m.cc 2012-06-27 22:16:47 +0000 @@ -197,14 +197,14 @@ // Primitive state so that the draw call can issue the primitives we want. unsigned int curOffset(0); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 13, curOffset)); - curOffset += (13 * sizeof(unsigned int)); + curOffset += (13 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 17, curOffset)); - curOffset += (17 * sizeof(unsigned int)); + curOffset += (17 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 24, curOffset)); - curOffset += (24 * sizeof(unsigned int)); + curOffset += (24 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 13, curOffset)); - curOffset += (13 * sizeof(unsigned int)); + curOffset += (13 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 17, curOffset)); - curOffset += (17 * sizeof(unsigned int)); + curOffset += (17 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 24, curOffset)); } === modified file 'src/scene-ideas/n.cc' --- src/scene-ideas/n.cc 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/n.cc 2012-06-27 22:16:47 +0000 @@ -137,10 +137,10 @@ // Primitive state so that the draw call can issue the primitives we want. unsigned int curOffset(0); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 11, curOffset)); - curOffset += (11 * sizeof(unsigned int)); + curOffset += (11 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 23, curOffset)); - curOffset += (23 * sizeof(unsigned int)); + curOffset += (23 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 11, curOffset)); - curOffset += (11 * sizeof(unsigned int)); + curOffset += (11 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 23, curOffset)); } === modified file 'src/scene-ideas/o.cc' --- src/scene-ideas/o.cc 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/o.cc 2012-06-27 22:16:47 +0000 @@ -134,6 +134,6 @@ // Primitive state so that the draw call can issue the primitives we want. unsigned int curOffset(0); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 33, curOffset)); - curOffset += (33 * sizeof(unsigned int)); + curOffset += (33 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 33, curOffset)); } === modified file 'src/scene-ideas/s.cc' --- src/scene-ideas/s.cc 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/s.cc 2012-06-27 22:16:47 +0000 @@ -125,6 +125,6 @@ // Primitive state so that the draw call can issue the primitives we want. unsigned int curOffset(0); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 30, curOffset)); - curOffset += (30 * sizeof(unsigned int)); + curOffset += (30 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 30, curOffset)); } === modified file 'src/scene-ideas/t.cc' --- src/scene-ideas/t.cc 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/t.cc 2012-06-27 22:16:47 +0000 @@ -134,14 +134,14 @@ // Primitive state so that the draw call can issue the primitives we want. unsigned int curOffset(0); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 18, curOffset)); - curOffset += (18 * sizeof(unsigned int)); + curOffset += (18 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 7, curOffset)); - curOffset += (7 * sizeof(unsigned int)); + curOffset += (7 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_TRIANGLE_STRIP, 8, curOffset)); - curOffset += (8 * sizeof(unsigned int)); + curOffset += (8 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 18, curOffset)); - curOffset += (18 * sizeof(unsigned int)); + curOffset += (18 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 7, curOffset)); - curOffset += (7 * sizeof(unsigned int)); + curOffset += (7 * sizeof(unsigned short)); primVec_.push_back(PrimitiveState(GL_LINE_STRIP, 8, curOffset)); } === modified file 'src/scene-ideas/table.cc' --- src/scene-ideas/table.cc 2012-05-08 20:53:58 +0000 +++ src/scene-ideas/table.cc 2012-06-27 22:16:47 +0000 @@ -178,7 +178,7 @@ // Now repeat for our index data. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferObjects_[1]); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexData_.size() * sizeof(unsigned int), + glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexData_.size() * sizeof(unsigned short), &indexData_.front(), GL_STATIC_DRAW); // We're ready to go. @@ -238,8 +238,8 @@ static const unsigned int twiceRes(2 * (TABLERES_ + 1)); for (unsigned int i = 0; i < TABLERES_; i++) { - glDrawElements(GL_TRIANGLE_STRIP, twiceRes, GL_UNSIGNED_INT, - reinterpret_cast(i * twiceRes * sizeof(unsigned int))); + glDrawElements(GL_TRIANGLE_STRIP, twiceRes, GL_UNSIGNED_SHORT, + reinterpret_cast(i * twiceRes * sizeof(unsigned short))); } glDisableVertexAttribArray(tableVertexIndex_); tableProgram_.stop(); @@ -340,8 +340,8 @@ static const unsigned int twiceRes(2 * (TABLERES_ + 1)); for (unsigned int i = 0; i < TABLERES_; i++) { - glDrawElements(GL_TRIANGLE_STRIP, twiceRes, GL_UNSIGNED_INT, - reinterpret_cast(i * twiceRes * sizeof(unsigned int))); + glDrawElements(GL_TRIANGLE_STRIP, twiceRes, GL_UNSIGNED_SHORT, + reinterpret_cast(i * twiceRes * sizeof(unsigned short))); } glDisableVertexAttribArray(underVertexIndex_); underProgram_.stop(); === modified file 'src/scene-ideas/table.h' --- src/scene-ideas/table.h 2012-04-30 18:37:22 +0000 +++ src/scene-ideas/table.h 2012-06-27 22:16:47 +0000 @@ -83,7 +83,7 @@ unsigned int totalSize; } dataMap_; unsigned int bufferObjects_[2]; - std::vector indexData_; + std::vector indexData_; int tableVertexIndex_; int paperVertexIndex_; int textVertexIndex_;