⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shaders.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 2 页
字号:
}GLboolean GLAPIENTRY_mesa_IsProgram(GLuint name){   GET_CURRENT_CONTEXT(ctx);   return ctx->Driver.IsProgram(ctx, name);}GLboolean GLAPIENTRY_mesa_IsShader(GLuint name){   GET_CURRENT_CONTEXT(ctx);   return ctx->Driver.IsShader(ctx, name);}void GLAPIENTRY_mesa_LinkProgramARB(GLhandleARB programObj){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.LinkProgram(ctx, programObj);}/** * Called via glShaderSource() and glShaderSourceARB() API functions. * Basically, concatenate the source code strings into one long string * and pass it to ctx->Driver.ShaderSource(). */void GLAPIENTRY_mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,                      const GLcharARB ** string, const GLint * length){   GET_CURRENT_CONTEXT(ctx);   GLint *offsets;   GLsizei i, totalLength;   GLcharARB *source;   if (!shaderObj || string == NULL) {      _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB");      return;   }   /*    * This array holds offsets of where the appropriate string ends, thus the    * last element will be set to the total length of the source code.    */   offsets = (GLint *) _mesa_malloc(count * sizeof(GLint));   if (offsets == NULL) {      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");      return;   }   for (i = 0; i < count; i++) {      if (string[i] == NULL) {         _mesa_free((GLvoid *) offsets);         _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)");         return;      }      if (length == NULL || length[i] < 0)         offsets[i] = _mesa_strlen(string[i]);      else         offsets[i] = length[i];      /* accumulate string lengths */      if (i > 0)         offsets[i] += offsets[i - 1];   }   /* Total length of source string is sum off all strings plus two.    * One extra byte for terminating zero, another extra byte to silence    * valgrind warnings in the parser/grammer code.    */   totalLength = offsets[count - 1] + 2;   source = (GLcharARB *) _mesa_malloc(totalLength * sizeof(GLcharARB));   if (source == NULL) {      _mesa_free((GLvoid *) offsets);      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");      return;   }   for (i = 0; i < count; i++) {      GLint start = (i > 0) ? offsets[i - 1] : 0;      _mesa_memcpy(source + start, string[i],                   (offsets[i] - start) * sizeof(GLcharARB));   }   source[totalLength - 1] = '\0';   source[totalLength - 2] = '\0';   ctx->Driver.ShaderSource(ctx, shaderObj, source);   _mesa_free(offsets);}void GLAPIENTRY_mesa_Uniform1fARB(GLint location, GLfloat v0){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, 1, &v0, GL_FLOAT);}void GLAPIENTRY_mesa_Uniform2fARB(GLint location, GLfloat v0, GLfloat v1){   GET_CURRENT_CONTEXT(ctx);   GLfloat v[2];   v[0] = v0;   v[1] = v1;   ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC2);}void GLAPIENTRY_mesa_Uniform3fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2){   GET_CURRENT_CONTEXT(ctx);   GLfloat v[3];   v[0] = v0;   v[1] = v1;   v[2] = v2;   ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC3);}void GLAPIENTRY_mesa_Uniform4fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,                   GLfloat v3){   GET_CURRENT_CONTEXT(ctx);   GLfloat v[4];   v[0] = v0;   v[1] = v1;   v[2] = v2;   v[3] = v3;   ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC4);}void GLAPIENTRY_mesa_Uniform1iARB(GLint location, GLint v0){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, 1, &v0, GL_INT);}void GLAPIENTRY_mesa_Uniform2iARB(GLint location, GLint v0, GLint v1){   GET_CURRENT_CONTEXT(ctx);   GLint v[2];   v[0] = v0;   v[1] = v1;   ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC2);}void GLAPIENTRY_mesa_Uniform3iARB(GLint location, GLint v0, GLint v1, GLint v2){   GET_CURRENT_CONTEXT(ctx);   GLint v[3];   v[0] = v0;   v[1] = v1;   v[2] = v2;   ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC3);}void GLAPIENTRY_mesa_Uniform4iARB(GLint location, GLint v0, GLint v1, GLint v2, GLint v3){   GET_CURRENT_CONTEXT(ctx);   GLint v[4];   v[0] = v0;   v[1] = v1;   v[2] = v2;   v[3] = v3;   ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC4);}void GLAPIENTRY_mesa_Uniform1fvARB(GLint location, GLsizei count, const GLfloat * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT);}void GLAPIENTRY_mesa_Uniform2fvARB(GLint location, GLsizei count, const GLfloat * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC2);}void GLAPIENTRY_mesa_Uniform3fvARB(GLint location, GLsizei count, const GLfloat * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC3);}void GLAPIENTRY_mesa_Uniform4fvARB(GLint location, GLsizei count, const GLfloat * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC4);}void GLAPIENTRY_mesa_Uniform1ivARB(GLint location, GLsizei count, const GLint * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, count, value, GL_INT);}void GLAPIENTRY_mesa_Uniform2ivARB(GLint location, GLsizei count, const GLint * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC2);}void GLAPIENTRY_mesa_Uniform3ivARB(GLint location, GLsizei count, const GLint * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC3);}void GLAPIENTRY_mesa_Uniform4ivARB(GLint location, GLsizei count, const GLint * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC4);}void GLAPIENTRY_mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,                          const GLfloat * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.UniformMatrix(ctx, 2, 2, GL_FLOAT_MAT2,                             location, count, transpose, value);}void GLAPIENTRY_mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,                          const GLfloat * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.UniformMatrix(ctx, 3, 3, GL_FLOAT_MAT3,                             location, count, transpose, value);}void GLAPIENTRY_mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,                          const GLfloat * value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.UniformMatrix(ctx, 4, 4, GL_FLOAT_MAT4,                             location, count, transpose, value);}/** * Non-square UniformMatrix are OpenGL 2.1 */void GLAPIENTRY_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,                         const GLfloat *value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.UniformMatrix(ctx, 2, 3, GL_FLOAT_MAT2x3,                             location, count, transpose, value);}void GLAPIENTRY_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,                         const GLfloat *value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.UniformMatrix(ctx, 3, 2, GL_FLOAT_MAT3x2,                             location, count, transpose, value);}void GLAPIENTRY_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,                         const GLfloat *value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.UniformMatrix(ctx, 2, 4, GL_FLOAT_MAT2x4,                             location, count, transpose, value);}void GLAPIENTRY_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,                         const GLfloat *value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.UniformMatrix(ctx, 4, 2, GL_FLOAT_MAT4x2,                             location, count, transpose, value);}void GLAPIENTRY_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,                         const GLfloat *value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.UniformMatrix(ctx, 3, 4, GL_FLOAT_MAT3x4,                             location, count, transpose, value);}void GLAPIENTRY_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,                         const GLfloat *value){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.UniformMatrix(ctx, 4, 3, GL_FLOAT_MAT4x3,                             location, count, transpose, value);}void GLAPIENTRY_mesa_UseProgramObjectARB(GLhandleARB program){   GET_CURRENT_CONTEXT(ctx);   FLUSH_VERTICES(ctx, _NEW_PROGRAM);   ctx->Driver.UseProgram(ctx, program);}void GLAPIENTRY_mesa_ValidateProgramARB(GLhandleARB program){   GET_CURRENT_CONTEXT(ctx);   ctx->Driver.ValidateProgram(ctx, program);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -