From 985a2eff82111e81f70b6dea9d9b3184dd0061d3 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Thu, 22 Mar 2007 14:26:49 +0000 Subject: Ensure we have a valid ReadBuffer for CopyTexSubImage, and if not bail accordingly. Previously we'd only do this test on compressed textures. --- src/mesa/main/teximage.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 543d6efc984..706d3466955 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2061,12 +2061,6 @@ copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions, } if (teximage->IsCompressed) { - if (!_mesa_source_buffer_exists(ctx, teximage->_BaseFormat)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexSubImage%dD(missing readbuffer)", dimensions); - return GL_TRUE; - } - if (target != GL_TEXTURE_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexSubImage%d(target)", dimensions); @@ -2096,6 +2090,12 @@ copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } + if (!_mesa_source_buffer_exists(ctx, teximage->_BaseFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexSubImage%dD(missing readbuffer)", dimensions); + return GL_TRUE; + } + if (teximage->_BaseFormat == GL_DEPTH_COMPONENT) { if (!ctx->ReadBuffer->_DepthBuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, -- cgit v1.2.3 From 1240eb2683043ba81e81378807170d0d7045581d Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 22 Mar 2007 08:50:20 -0600 Subject: use _mesa_copy_instructions() --- src/mesa/main/texenvprogram.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 5038b9b0c36..d1994f76d1b 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1013,7 +1013,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, p.program->NumTexIndirections = 1; /* correct? */ p.program->NumTexInstructions = 0; p.program->NumAluInstructions = 0; - p.program->Base.String = 0; + p.program->Base.String = NULL; p.program->Base.NumInstructions = p.program->Base.NumTemporaries = p.program->Base.NumParameters = @@ -1102,9 +1102,8 @@ create_new_program(GLcontext *ctx, struct state_key *key, "generating tex env program"); return; } - _mesa_memcpy(program->Base.Instructions, instBuffer, - sizeof(struct prog_instruction) - * program->Base.NumInstructions); + _mesa_copy_instructions(program->Base.Instructions, instBuffer, + program->Base.NumInstructions); /* Notify driver the fragment program has (actually) changed. */ -- cgit v1.2.3 From 002762b13aa58ca569a564bb64672e343611c9ed Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 22 Mar 2007 08:51:34 -0600 Subject: use _mesa_alloc_instructions() --- src/mesa/tnl/t_vp_build.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 2663d993049..b1c148a1367 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -1416,9 +1416,8 @@ create_new_program( const struct state_key *key, else p.temp_reserved = ~((1<Base.Instructions - = (struct prog_instruction*) MALLOC(sizeof(struct prog_instruction) * MAX_INSN); - p.program->Base.String = 0; + p.program->Base.Instructions = _mesa_alloc_instructions(MAX_INSN); + p.program->Base.String = NULL; p.program->Base.NumInstructions = p.program->Base.NumTemporaries = p.program->Base.NumParameters = -- cgit v1.2.3