From patchwork Tue May 21 22:18:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barker X-Patchwork-Id: 17081 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 65B0C238F5 for ; Tue, 21 May 2013 22:19:09 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id q16sf1559236vbe.11 for ; Tue, 21 May 2013 15:18:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to :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:x-original-sender :x-original-authentication-results:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=B9yZvDA8oyj76DolKzhssuINeVYYvl+JP2XQnNUyrBY=; b=Vw0J35CteNwdKNhVEUnq13YCZGs+4BAdUdE8disFc6sK4BSnDyp3ckm9o03dKPBJbv mEKx8rzY62cLAQzTkM9fLr0VJ7gvIn0xvC12gyyKxj7xEm8fgA1QnuMklCpD9vQmeII2 puDVxoC3dCDRMJIlyaB7/cs/AzbfXpL5XbUJqgBNZFch5dmsvILffwuriKAVxPkIYPbF Q46fMjkXg6IodhGFeQ2tu313A9fu5pgSdM98tqIygzQujQWM8RLIR7nCAjQLjOhSz4db LCr+Zi9gvDvao/3hZRvTpG/++hIRCekQ8KYq2VUR5Zq7JHLucK1NAt5peqECz8PLFkO3 HLdA== X-Received: by 10.224.59.205 with SMTP id m13mr2396682qah.7.1369174697523; Tue, 21 May 2013 15:18:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.62.166 with SMTP id z6ls538530qer.71.gmail; Tue, 21 May 2013 15:18:17 -0700 (PDT) X-Received: by 10.52.165.76 with SMTP id yw12mr1479252vdb.93.1369174697186; Tue, 21 May 2013 15:18:17 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id tq4si2245143vdc.53.2013.05.21.15.18.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 May 2013 15:18:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hf12so867401vcb.3 for ; Tue, 21 May 2013 15:18:17 -0700 (PDT) X-Received: by 10.220.238.4 with SMTP id kq4mr1747553vcb.73.1369174696978; Tue, 21 May 2013 15:18:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp153288vcs; Tue, 21 May 2013 15:18:16 -0700 (PDT) X-Received: by 10.180.9.238 with SMTP id d14mr27745201wib.18.1369174695579; Tue, 21 May 2013 15:18:15 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id d2si8696023wik.54.2013.05.21.15.18.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 21 May 2013 15:18:15 -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; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Ueuso-0006vZ-R0 for ; Tue, 21 May 2013 22:18:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id B26E3E078A for ; Tue, 21 May 2013 22:18:14 +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: 272 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 272: SceneDesktop: RenderObject::init() was creating a zero-sized texture image and Message-Id: <20130521221814.12276.49982.launchpad@ackee.canonical.com> Date: Tue, 21 May 2013 22:18:14 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16626"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 25c3669287a00e51e1959c114c0157255f86d19b X-Gm-Message-State: ALoCoQk9b59kJINuqc9OwRtnkBYcxOfmA0C7O159tGdDP54xZlbhGFXnD7PtGi4RDnQATE2e02Qv X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , ------------------------------------------------------------ revno: 272 committer: Jesse Barker branch nick: trunk timestamp: Tue 2013-05-21 15:15:05 -0700 message: SceneDesktop: RenderObject::init() was creating a zero-sized texture image and attaching it to a framebuffer object. This is not illegal, but it does violate the spec rules for framebuffer completeness. Some implementations are doing the check immediately at attach time rather than deferring to draw time, which is not really "correct", but we can live with it. Defer the image (re)creation to resize time and (re)attach it to the framebuffer object then. modified: src/scene-desktop.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/scene-desktop.cpp' --- src/scene-desktop.cpp 2012-08-15 09:45:06 +0000 +++ src/scene-desktop.cpp 2013-05-21 22:15:05 +0000 @@ -121,14 +121,28 @@ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size_.x(), size_.y(), 0, - GL_RGBA, GL_UNSIGNED_BYTE, 0); /* Create a FBO */ glGenFramebuffers(1, &fbo_); glBindFramebuffer(GL_FRAMEBUFFER, fbo_); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, texture_, 0); + + /* + * Only create the texture image and attach it to the framebuffer + * if the size has been set. Framebuffer completeness depends + * upon non-zero width and height images, and some implementations + * are overly aggressive in checking at attachment time rather than + * at draw time. + */ + if (size_.x() != 0 && size_.y() != 0) { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size_.x(), size_.y(), 0, + GL_RGBA, GL_UNSIGNED_BYTE, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, texture_, 0); + unsigned int status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + Log::error("RenderObject::init: glCheckFramebufferStatus failed (0x%x)\n", status); + } + } glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -182,9 +196,17 @@ /* Recreate the backing texture with correct size */ if (size_.x() != size.x() || size_.y() != size.y()) { size_ = size; + /* If we're resizing the texture, we need to tell the framebuffer*/ glBindTexture(GL_TEXTURE_2D, texture_); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size_.x(), size_.y(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + glBindFramebuffer(GL_FRAMEBUFFER, fbo_); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, texture_, 0); + unsigned int status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) { + Log::error("RenderObject::size: glCheckFramebufferStatus failed (0x%x)\n", status); + } texture_contents_invalid_ = true; }