Bug 2442

Summary: [EASYFIX] glxgears should use sincos(3)
Product: Mesa Reporter: Mike A. Harris <mharris>
Component: DemosAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: high CC: ajax, roland.mainz
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
URL: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=90053
Whiteboard:
i915 platform: i915 features:

Description Mike A. Harris 2005-02-01 01:16:41 UTC
A rather low priority thing for someone to fiddle with when they are
bored perhaps, or something for new developers to tackle, who are new
to X development and looking for a simple item to tackle.

Jakub Jelinek noticed the following:

<jakub> btw: glxgears should be tought about sincos(3)
<jakub> I saw in ltrace lots of sin calls followed by cos calls with the same
arguments
Comment 1 Mike A. Harris 2005-02-01 01:17:12 UTC
Additional Comment #1 From John Ellson (ellson@research.att.com)  on 2003-06-13 

sincos() is not very portable.   Here is the configure test and a sincos
macro that we've used with success in graphviz:

--------------------- configure test -----------------------

AC_MSG_CHECKING(if have working sincos())
AC_TRY_RUN([
        #include <stdio.h>
        #include <assert.h>
        #define PI 3.14159265358979323846
        extern void sincos(double x, double *s, double *c);
        int main () {
                double sinx=0.0, cosx=1.0;
                sincos(PI/2.0,&sinx,&cosx);
                assert(sinx>0.9999999);
                assert(sinx<1.0000001);
                assert(cosx<0.0000001);
                assert(cosx>(-0.0000001));
                return 0;
        }]
        ,
        AC_MSG_RESULT(yes)
        AC_DEFINE_UNQUOTED(HAVE_SINCOS,1,[Define if libm provides a *working*
sincos function])
        ,
        AC_MSG_RESULT(no)
        ,
        AC_MSG_RESULT(no - assumed because cross-compiling)
        )


------------------ macro ---------------------

#ifndef HAVE_SINCOS
void sincos(x,s,c) double x,*s,*c; { *s = sin(x); *c = cos(x); }
#else
extern void sincos(double x, double *s, double *c);
#endif

Comment 2 Mike A. Harris 2005-02-01 01:19:34 UTC
Someone would have to translate the autotool test above to an Imake test
of some sort, if there isn't one already present.  Shouldn't be that
difficult.

We were tracking this in our bugzilla, but it was low priority enough
that we might never get around to doing it, but I figured someone else
in the community might want to take a crack at it, so it'd be useful
to log it here perhaps.

Original bug report:  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=90053
Comment 3 Adam Jackson 2005-02-01 17:13:06 UTC
glxgears properly lives in Mesa, so i wouldn't bother with either the configure
test or the Imake test since Mesa uses neither.
Comment 4 Behdad Esfahbod 2005-09-09 19:08:30 UTC
I suggest closing this bug.  There no /real/ benefit in using sincos().  Why bother?
Comment 5 Adam Jackson 2005-10-21 23:51:37 UTC
last thing we want is people thinking gears is a benchmark.

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.