Bug 41768 - Logic error in mesa/drivers/common/meta.c
Summary: Logic error in mesa/drivers/common/meta.c
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-13 15:53 UTC by Ryan Sleevi
Modified: 2011-10-13 16:13 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Ryan Sleevi 2011-10-13 15:53:32 UTC
This was reported upstream to Chromium by way of http://www.viva64.com/en/b/0113/ (Item N6)

http://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/common/meta.c#n2934

Lines 2943 - 2948
      if (ctx->DrawBuffer->Visual.redBits <= 8)
         return GL_UNSIGNED_BYTE;
      else if (ctx->DrawBuffer->Visual.redBits <= 8)
         return GL_UNSIGNED_SHORT;
      else
         return GL_FLOAT;

The logic appears incorrect, in that GL_UNSIGNED_SHORT will never be returned - instead, it will return GL_FLOAT.

Cursory inspection of the Mesa sources indicates it supports 16bpp, so should this be written instead as:
      if (ctx->DrawBuffer->Visual.redBits <= 8)
         return GL_UNSIGNED_BYTE;
      else if (ctx->DrawBuffer->Visual.redBits <= 16)
         return GL_UNSIGNED_SHORT;
      else
         return GL_FLOAT;
Comment 1 Brian Paul 2011-10-13 16:13:43 UTC
Thanks.  Fixed with commit 6fc6d5a09e36c56f4debd17bbbed15f732403619


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.