Bug 41768

Summary: Logic error in mesa/drivers/common/meta.c
Product: Mesa Reporter: Ryan Sleevi <rsleevi>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

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.