Bug 73934 - Function roundf undeclared in textparam.c when building with MSVC11
Summary: Function roundf undeclared in textparam.c when building with MSVC11
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 10.0
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-22 15:21 UTC by Zachary Greve
Modified: 2014-09-22 19:18 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Zachary Greve 2014-01-22 15:21:07 UTC
I am trying to build Mesa for x86 using Scons on Windows 8.1 x64 with MSVC11, and I am getting a message stating that 'roundf' is undeclared in the file textparam.c (in the function _mesa_GetTexParameteriv). I tried adding math.h to the included headers for that file, but that didn't work.

I don't do much native development (I am building Mesa for use in a Game Development Studio I am working on using SharpGL) so I have no other idea on what could be causing this error.
Comment 1 Grigori Goronzy 2014-01-22 15:56:26 UTC
MSVC has bad C99 support. roundf was introduced by C99. You can easily implement roundf yourself, though. Calling floorf or ceilf according to sign of the number should do it.
Comment 2 Roland Scheidegger 2014-01-22 16:48:16 UTC
The stable branches and hence the tarballs are missing commit bba8f10598866776ae198b363b3752c2e3bbb126 from master at the moment which fixes this. You can just manually replace
*params = (GLint) roundf(obj->Sampler.LodBias);
with
*params = IROUND(obj->Sampler.LodBias);
to fix this.
Comment 3 Matt Turner 2014-01-22 23:41:27 UTC
(In reply to comment #2)
> The stable branches and hence the tarballs are missing commit
> bba8f10598866776ae198b363b3752c2e3bbb126 from master at the moment which
> fixes this. You can just manually replace
> *params = (GLint) roundf(obj->Sampler.LodBias);
> with
> *params = IROUND(obj->Sampler.LodBias);
> to fix this.

Cherry-pick it to the stable branch since you use MSVC?
Comment 4 Emil Velikov 2014-09-22 19:18:09 UTC
AFAICS the fix is part of the latest two branches (10.2 and 10.3) + master.

commit bba8f10598866776ae198b363b3752c2e3bbb126
Author: José Fonseca <jfonseca@vmware.com>
Date:   Thu Nov 21 13:56:00 2013 +0000

    mesa: Use IROUND instead of roundf.

    roundf is not available on MSVC.


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.