On 12/27/06, Tilman Sauerbeck <[EMAIL PROTECTED]> wrote:
Jerome Glisse [2006-12-26 18:21]:
> Since modification in vertex program handling in r300 there is
> a segfault occuring while trying to access Parameters ptr in
> gl_program struct, thus i am wondering if Parameters ptr shouldn't
> be initialized to NULL in
> _mesa_init_program_struct (shader/program.c line 201), but i still
I don't think that would help:
r300 only calls _mesa_init_vertex_program() on CALLOC'ed memory
(r300_shader.c:114), which in turn calls _mesa_init_program_struct().
Ditto for fragment programs.
There's no other way _mesa_init_program_struct() could be called in r300
either, AFAICS.
Still something like the attached patch might be good to actually
initialize all of the gl_program struct.
Regards,
Tilman
Yes, after real investigation this doesn't change anythings but, we should
definitly zero structure. Anyway my issue is related with
VertexProgram._Current i am wondering if when a program is unbind (or
a new program is bind) the VertexProgram._Current field should be updated
if not than driver should never rely on _Current because you can end up
with _Current still pointing to a deleted program.
I attach a patch which update ._Current along with Current but this might
be the wrong things to do. Comment on this are more then welcome :)
Btw in the patch i also add a check for NULL ptr in DeletePrograms i think
this is a good thing to test.
best,
Jerome Glisse
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index ddfad47..3e604a4 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -1948,6 +1948,7 @@ _mesa_BindProgram(GLenum target, GLuint id)
/* bind newProg */
if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */
ctx->VertexProgram.Current = (struct gl_vertex_program *) newProg;
+ ctx->VertexProgram._Current = (struct gl_vertex_program *) newProg;
}
else if (target == GL_FRAGMENT_PROGRAM_NV ||
target == GL_FRAGMENT_PROGRAM_ARB) {
@@ -1969,14 +1970,14 @@ _mesa_BindProgram(GLenum target, GLuint id)
* \note Not compiled into display lists.
* \note Called by both glDeleteProgramsNV and glDeleteProgramsARB.
*/
-void GLAPIENTRY
+void GLAPIENTRY
_mesa_DeletePrograms(GLsizei n, const GLuint *ids)
{
GLint i;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (n < 0) {
+ if (n < 0 || ids == NULL) {
_mesa_error( ctx, GL_INVALID_VALUE, "glDeleteProgramsNV" );
return;
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev