Bugs item #1544507, was opened at 2006-08-22 13:47
Message generated for change (Comment added) made by castano
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100003&aid=1544507&group_id=3

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: mesa-core
Group: Fatal Error
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Ignacio Casta�o (castano)
Assigned to: Nobody/Anonymous (nobody)
Summary: crash due to mismatch program target

Initial Comment:
In program.c _mesa_BindProgram, when an error occurs 
the function returns immediately leaving as current a 
possibly deleted program. This crashes when the 
current program has actually been deleted. Attached 
is a quick patch that hopefully fixes the problem.

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

>Comment By: Ignacio Casta�o (castano)
Date: 2006-08-26 08:15

Message:
Logged In: YES 
user_id=583871

Looks much better now. Thanks!

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

Comment By: Brian Paul (brianp)
Date: 2006-08-25 19:14

Message:
Logged In: YES 
user_id=983

OK, I see the problem.  I've rearranged the code a bit so
that all error checking is completed before trying to change
the binding.  That should do it.  Will check in changes soon.


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

Comment By: Ignacio Casta�o (castano)
Date: 2006-08-25 05:40

Message:
Logged In: YES 
user_id=583871

Awesome! 

However, I'm still not convinced that fixes the bug that I
was pointing to. Maybe I'm missing something. I assume that
the errors in lines 1828 and 1834 are possible, and that you
can trigger those errors while there's a program already
bound. Imagine that this program only has one reference
count, the first thing that happens is that the reference
count is decreased and program deleted. After that the error
is produced and the function returns leaving the Current
program pointing to the deleted program. Note that the
current program is only set in lines 1842 & 1845.

The program that I attached obviously produced other errors,
but that was on purpouse, so that I could trigger that
uncommon situation that I described above.

The solution that I proposed was to set the current program
to default, but that's incorrect too. I think that the right
thing to do is to check for the errors first and only
decrease the reference count right before assigning the new
program. I'll be happy to submit a patch with the proposed
solution.

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

Comment By: Brian Paul (brianp)
Date: 2006-08-25 01:32

Message:
Logged In: YES 
user_id=983

OK, I've found a number of issues:

1. There was a bug in the GL_NV_fragment_program parsing
code in Mesa.  I've fixed that.

2. It looks like Mesa's fragment program length limit was
wrong.  It should be 1024, not 128 instructions.  I've fixed
that.

3. Cg is mixing usage of GL_FRAGMENT_PROGRAM_NV and
GL_FRAGMENT_PROGRAM_ARB in glBindProgramARB().  I _guess_
that's OK according to the GL_ARB_fragment_program spec so
I'm fixing Mesa.

I've checked in these fixes.


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

Comment By: Ignacio Casta�o (castano)
Date: 2006-08-25 00:11

Message:
Logged In: YES 
user_id=583871

Sorry, I should have mentioned that I was using the latest beta:

http://developer.nvidia.com/object/cg-toolkit-15beta2.html

In any case I think you can also make that work by replacing
"gl_ModelViewMatrixInverse" with "view".

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

Comment By: Brian Paul (brianp)
Date: 2006-08-24 21:20

Message:
Logged In: YES 
user_id=983

Is a particular version of Cg required?

With Cg 1.4.1 I get:
./cgtest
Cg error: CG ERROR : The compile returned an error.
(197) : error C1008: undefined variable
"gl_ModelViewMatrixInverse"
(197) : error C1011: cannot index a non-array value
(197) : error C1031: swizzle mask element not present in
operand "xyz"
(197) : error C1008: undefined variable
"gl_ModelViewMatrixInverse"
(197) : error C1011: cannot index a non-array value
(197) : error C1031: swizzle mask element not present in
operand "xyz"
(205) : error C1008: undefined variable
"gl_ModelViewMatrixInverse"
(205) : error C1033: cast not allowed
(205) : error C1115: unable to find compatible overloaded
function "mul"
(205) : error C1008: undefined variable
"gl_ModelViewMatrixInverse"
(205) : error C1033: cast not allowed
(205) : error C1115: unable to find compatible overloaded
function "mul"
Unable to create effect!

If I change the code to load cgtest.cgfx instead of
raytracer.cgfx I get a red window and pressing the space bar
does not cause a crash.


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

Comment By: Ignacio Casta�o (castano)
Date: 2006-08-24 11:52

Message:
Logged In: YES 
user_id=583871

I've attached the test, press space after running it and it 
should crash inside of BindProgram. Let me know if you have 
any problem reproducing it.

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

Comment By: Ignacio Casta�o (castano)
Date: 2006-08-24 11:51

Message:
Logged In: YES 
user_id=583871

I've attached the test, press space after running it and it 
should crash inside of BindProgram. Let me know if you have 
any problem reproducing it.

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

Comment By: Brian Paul (brianp)
Date: 2006-08-23 16:30

Message:
Logged In: YES 
user_id=983

A Cg program would be OK.


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

Comment By: Ignacio Casta�o (castano)
Date: 2006-08-23 02:29

Message:
Logged In: YES 
user_id=583871

I cannot do that easily. The error is caused by the Cg
runtime when binding a NV fragment shader after binding an
ARB fragment shader. I'm not sure why the target mismatch
error is produced, might be an incorrect behaviour of Cg,
but mesa should not crash because of that. Is it ok if the
example depends on Cg?

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

Comment By: Brian Paul (brianp)
Date: 2006-08-23 01:18

Message:
Logged In: YES 
user_id=983

I'm not sure I see how this can happen.  Can you provide a
simple GLUT program that illustrates the problem?

BTW, please submit future bug reports on freedesktop.org


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100003&aid=1544507&group_id=3

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to