bugzilla-daemon | 1 May 2007 01:05

[Bug 10783] Missing ArcSine and ArcCosine capability in GLSL

http://bugs.freedesktop.org/show_bug.cgi?id=10783

------- Comment #2 from idr <at> us.ibm.com  2007-04-30 16:05 PST -------
I did a bit of research on the net, and I think asin, acos, and atan can be
approcimated pretty easilly.  This should make the GLSL to
GL_ARB_{fragment,vertex}_program conversion pretty simple:

asin(x) = pi/2 - sqrt(1 - x)(a0 + a1*x + a2*x^2 + a3*x^3)
acos(x) =        sqrt(1 - x)(a0 + a1*x + a2*x^2 + a3*x^3)

where

   a0 = 1.5707288
   a1 = -0.2121144
   a2 = 0.0742610
   a3 = -0.0187293

atan(y, x) = s * ( pi/4 - (pi / 4) * ((x - |y|) / (x + |y|)))    for x >= 0
             s * (3pi/4 - (pi / 4) * ((x + |y|) / (|y| - x)))    for x < 0

where
   s = -1  for y < 0
   s =  1  otherwise

References:

http://mathforum.org/library/drmath/view/54137.html
http://dspguru.com/comp.dsp/tricks/alg/fxdatan2.htm
http://en.wikipedia.org/wiki/Arcsin#Recommended_method_of_calculation

(Continue reading)

bugzilla-daemon | 1 May 2007 04:08

[Bug 10821] New: GLSL built-in mix functions takes arguments in wrong order.

http://bugs.freedesktop.org/show_bug.cgi?id=10821

           Summary: GLSL built-in mix functions takes arguments in wrong
                    order.
           Product: Mesa
           Version: 6.5
          Platform: All
        OS/Version: Linux (All)
            Status: NEW
          Severity: critical
          Priority: high
         Component: Mesa core
        AssignedTo: mesa3d-dev <at> lists.sourceforge.net
        ReportedBy: James.Burns <at> amrdec.army.mil

OpenGL spec indicates that mix has the following prototype:

genType mix(genType x, genType y, genType);

And performs the following function:

return = x*(1-a) + y*a;

-----------------------------------------

Mesa seems to want to take the arguments in reverse order to get the proper
result. To get a shader that works for an NVidia card in other contexts - I
might have a line that looks like:
float color = clamp(mix(x,y,a), 0.0, 1.0);

(Continue reading)

bugzilla-daemon | 1 May 2007 04:11

[Bug 10783] Missing ArcSine and ArcCosine capability in GLSL

http://bugs.freedesktop.org/show_bug.cgi?id=10783

------- Comment #3 from James.Burns <at> amrdec.army.mil  2007-04-30 19:11 PST -------
(In reply to comment #1)
> Hmmm, I don't think I have time to implement acos/asin() today, but I can at
> least fix the crash.
> I'll mark it as a known issue and fix it properly for Mesa 7.0.  How's that?
> 
I've fixed this in my own version of Mesa, so I will be fine waiting for Mesa
7.0 on this.  I surely would like to see this fixed in the next release.  

--

-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
bugzilla-daemon | 1 May 2007 04:16

[Bug 10783] Missing ArcSine and ArcCosine capability in GLSL

http://bugs.freedesktop.org/show_bug.cgi?id=10783

------- Comment #4 from James.Burns <at> amrdec.army.mil  2007-04-30 19:16 PST -------
(In reply to comment #2)
> I did a bit of research on the net, and I think asin, acos, and atan can be
> approcimated pretty easilly.  This should make the GLSL to
> GL_ARB_{fragment,vertex}_program conversion pretty simple:
> 
> asin(x) = pi/2 - sqrt(1 - x)(a0 + a1*x + a2*x^2 + a3*x^3)
> acos(x) =        sqrt(1 - x)(a0 + a1*x + a2*x^2 + a3*x^3)
> 
> where
> 
>    a0 = 1.5707288
>    a1 = -0.2121144
>    a2 = 0.0742610
>    a3 = -0.0187293
> 
> atan(y, x) = s * ( pi/4 - (pi / 4) * ((x - |y|) / (x + |y|)))    for x >= 0
>              s * (3pi/4 - (pi / 4) * ((x + |y|) / (|y| - x)))    for x < 0
> 
> where
>    s = -1  for y < 0
>    s =  1  otherwise
> 
> References:
> 
> http://mathforum.org/library/drmath/view/54137.html
> http://dspguru.com/comp.dsp/tricks/alg/fxdatan2.htm
> http://en.wikipedia.org/wiki/Arcsin#Recommended_method_of_calculation
(Continue reading)

bugzilla-daemon | 1 May 2007 15:54

[Bug 10783] Missing ArcSine and ArcCosine capability in GLSL

http://bugs.freedesktop.org/show_bug.cgi?id=10783

------- Comment #5 from brian.paul <at> tungstengraphics.com  2007-05-01 06:54 PST -------
If I were to follow the pattern of the other trigonometry functions in Mesa's
GLSL, I'd add OPCODE_ACOS/ASIN instructions and simply call acos/asin() in the
program interpreter.

I doubt, however, that any target GPUs will have native ACOS/ASIN instructions
so those Mesa instructions would have to be expanded into code to compute an
approximation.  That'll probably be needed for sin/cos as-is.

I believe Ian's code is meant to go into the GLSL acos/asin functions so that
it gets compiled into Mesa GPU instructions.  I'll give that a try.

--

-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
bugzilla-daemon | 1 May 2007 16:02

[Bug 10783] Missing ArcSine and ArcCosine capability in GLSL

http://bugs.freedesktop.org/show_bug.cgi?id=10783

------- Comment #6 from James.Burns <at> amrdec.army.mil  2007-05-01 07:02 PST -------
(In reply to comment #5)
> If I were to follow the pattern of the other trigonometry functions in Mesa's
> GLSL, I'd add OPCODE_ACOS/ASIN instructions and simply call acos/asin() in the
> program interpreter.
> 
> I doubt, however, that any target GPUs will have native ACOS/ASIN instructions
> so those Mesa instructions would have to be expanded into code to compute an
> approximation.  That'll probably be needed for sin/cos as-is.
> 
> I believe Ian's code is meant to go into the GLSL acos/asin functions so that
> it gets compiled into Mesa GPU instructions.  I'll give that a try.
> 

That's probably a good point.  I'm a rare bird living in the land of OSMesa.

--

-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
bugzilla-daemon | 1 May 2007 16:40

[Bug 10821] GLSL built-in mix functions takes arguments in wrong order.

http://bugs.freedesktop.org/show_bug.cgi?id=10821

------- Comment #1 from brian.paul <at> tungstengraphics.com  2007-05-01 07:40 PST -------
Hmmm, I just did some testing of mix() and it seems correct and agrees with the
NVIDIA driver that I have (v. 97.46).

Here's a test case I'm adding to Glean:

void main()
{
   vec4 v0 = vec4(0.0, 1.0, -4.8, 0.0);
   vec4 v1 = vec4(1.0, 0.0, 15.2, 0.0);
   gl_FragColor = mix(v0, v1, 0.25);
}

The expected result color is (0.25, 0.75, 0.2, 0.0).  That's what I get with
Mesa and NVIDIA here.

--

-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
bugzilla-daemon | 1 May 2007 16:56

[Bug 10821] GLSL built-in mix functions takes arguments in wrong order.

http://bugs.freedesktop.org/show_bug.cgi?id=10821

------- Comment #2 from brian.paul <at> tungstengraphics.com  2007-05-01 07:56 PST -------
Hold on, the vec4 case works, but the float-valued mix function is broken.  I'm
looking into it...

--

-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
bugzilla-daemon | 1 May 2007 17:04

[Bug 10821] GLSL built-in mix functions takes arguments in wrong order.

http://bugs.freedesktop.org/show_bug.cgi?id=10821

------- Comment #3 from James.Burns <at> amrdec.army.mil  2007-05-01 08:04 PST -------
(In reply to comment #2)
> Hold on, the vec4 case works, but the float-valued mix function is broken.  I'm
> looking into it...
> 

(In reply to comment #2)
> Hold on, the vec4 case works, but the float-valued mix function is broken.  I'm
> looking into it...
> 
Good - I just built a case showing failure in that case.  Thanks!

--

-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
bugzilla-daemon | 1 May 2007 18:23

[Bug 10821] GLSL built-in mix functions takes arguments in wrong order.

http://bugs.freedesktop.org/show_bug.cgi?id=10821

brian.paul <at> tungstengraphics.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

------- Comment #4 from brian.paul <at> tungstengraphics.com  2007-05-01 09:23 PST -------
Fixed in git for the 7.0 release.

--

-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Gmane