~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/shader/arbprogram.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Mesa 3-D graphics library
3
 
 * Version:  6.5
 
3
 * Version:  6.5.2
4
4
 *
5
5
 * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
6
6
 *
36
36
#include "imports.h"
37
37
#include "macros.h"
38
38
#include "mtypes.h"
 
39
#include "program.h"
39
40
 
40
41
 
41
42
void GLAPIENTRY
101
102
   GET_CURRENT_CONTEXT(ctx);
102
103
   ASSERT_OUTSIDE_BEGIN_END(ctx);
103
104
 
104
 
   if (index == 0 || index >= MAX_VERTEX_PROGRAM_ATTRIBS) {
 
105
   if (index >= MAX_VERTEX_PROGRAM_ATTRIBS) {
105
106
      _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribfvARB(index)");
106
107
      return;
107
108
   }
123
124
         params[0] = ctx->Array.ArrayObj->VertexAttrib[index].Normalized;
124
125
         break;
125
126
      case GL_CURRENT_VERTEX_ATTRIB_ARB:
 
127
         if (index == 0) {
 
128
            _mesa_error(ctx, GL_INVALID_OPERATION,
 
129
                        "glGetVertexAttribfvARB(index==0)");
 
130
            return;
 
131
         }
126
132
         FLUSH_CURRENT(ctx, 0);
127
133
         COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]);
128
134
         break;
179
185
}
180
186
 
181
187
 
 
188
/**
 
189
 * Determine if id names a vertex or fragment program.
 
190
 * \note Not compiled into display lists.
 
191
 * \note Called from both glIsProgramNV and glIsProgramARB.
 
192
 * \param id is the program identifier
 
193
 * \return GL_TRUE if id is a program, else GL_FALSE.
 
194
 */
 
195
GLboolean GLAPIENTRY
 
196
_mesa_IsProgramARB(GLuint id)
 
197
{
 
198
   struct gl_program *prog = NULL; 
 
199
   GET_CURRENT_CONTEXT(ctx);
 
200
   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
 
201
 
 
202
   if (id == 0)
 
203
      return GL_FALSE;
 
204
 
 
205
   prog = _mesa_lookup_program(ctx, id);
 
206
   if (prog && (prog != &_mesa_DummyProgram))
 
207
      return GL_TRUE;
 
208
   else
 
209
      return GL_FALSE;
 
210
}
 
211
 
 
212
 
182
213
void GLAPIENTRY
183
214
_mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
184
215
                       const GLvoid *string)
736
767
_mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
737
768
{
738
769
   const struct gl_program *prog;
 
770
   char *dst = (char *) string;
739
771
   GET_CURRENT_CONTEXT(ctx);
740
772
 
741
773
   if (!ctx->_CurrentProgram)
759
791
      return;
760
792
   }
761
793
 
762
 
   _mesa_memcpy(string, prog->String, _mesa_strlen((char *) prog->String));
 
794
   if (prog->String)
 
795
      _mesa_memcpy(dst, prog->String, _mesa_strlen((char *) prog->String));
 
796
   else
 
797
      *dst = '\0';
763
798
}