您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FLUSH_VERTICES函数代码示例

51自学网 2021-06-01 20:42:30
  C++
这篇教程C++ FLUSH_VERTICES函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FLUSH_VERTICES函数的典型用法代码示例。如果您正苦于以下问题:C++ FLUSH_VERTICES函数的具体用法?C++ FLUSH_VERTICES怎么用?C++ FLUSH_VERTICES使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了FLUSH_VERTICES函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _mesa_BeginQueryARB

void GLAPIENTRY_mesa_BeginQueryARB(GLenum target, GLuint id){   struct gl_query_object *q;   GET_CURRENT_CONTEXT(ctx);   ASSERT_OUTSIDE_BEGIN_END(ctx);   FLUSH_VERTICES(ctx, _NEW_DEPTH);   switch (target) {      case GL_SAMPLES_PASSED_ARB:         if (!ctx->Extensions.ARB_occlusion_query) {            _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");            return;         }         if (ctx->Query.CurrentOcclusionObject) {            _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB");            return;         }         break;#if FEATURE_EXT_timer_query      case GL_TIME_ELAPSED_EXT:         if (!ctx->Extensions.EXT_timer_query) {            _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");            return;         }         if (ctx->Query.CurrentTimerObject) {            _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB");            return;         }         break;#endif      default:         _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");         return;   }   if (id == 0) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB(id==0)");      return;   }   q = lookup_query_object(ctx, id);   if (!q) {      /* create new object */      q = ctx->Driver.NewQueryObject(ctx, id);      if (!q) {         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQueryARB");         return;      }      _mesa_HashInsert(ctx->Query.QueryObjects, id, q);   }   else {      /* pre-existing object */      if (q->Active) {         _mesa_error(ctx, GL_INVALID_OPERATION,                     "glBeginQueryARB(query already active)");         return;      }   }   q->Active = GL_TRUE;   q->Result = 0;   q->Ready = GL_FALSE;   if (target == GL_SAMPLES_PASSED_ARB) {      ctx->Query.CurrentOcclusionObject = q;   }#if FEATURE_EXT_timer_query   else if (target == GL_TIME_ELAPSED_EXT) {      ctx->Query.CurrentTimerObject = q;   }#endif   if (ctx->Driver.BeginQuery) {      ctx->Driver.BeginQuery(ctx, target, q);   }}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:78,


示例2: _mesa_uniform_matrix

/** * Called by glUniformMatrix*() functions. * Note: cols=2, rows=4  ==>  array[2] of vec4 */extern "C" void_mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,		     GLuint cols, GLuint rows,                     GLint location, GLsizei count,                     GLboolean transpose, const GLfloat *values){   unsigned loc, offset;   unsigned vectors;   unsigned components;   unsigned elements;   struct gl_uniform_storage *uni;   ASSERT_OUTSIDE_BEGIN_END(ctx);   if (!validate_uniform_parameters(ctx, shProg, location, count,				    &loc, &offset, "glUniformMatrix", false))      return;   uni = &shProg->UniformStorage[loc];   if (!uni->type->is_matrix()) {      _mesa_error(ctx, GL_INVALID_OPERATION,		  "glUniformMatrix(non-matrix uniform)");      return;   }   assert(!uni->type->is_sampler());   vectors = uni->type->matrix_columns;   components = uni->type->vector_elements;   /* Verify that the types are compatible.  This is greatly simplified for    * matrices because they can only have a float base type.    */   if (vectors != cols || components != rows) {      _mesa_error(ctx, GL_INVALID_OPERATION,		  "glUniformMatrix(matrix size mismatch)");      return;   }   if (ctx->Shader.Flags & GLSL_UNIFORMS) {      log_uniform(values, GLSL_TYPE_FLOAT, components, vectors, count,		  bool(transpose), shProg, location, uni);   }   /* Page 82 (page 96 of the PDF) of the OpenGL 2.1 spec says:    *    *     "When loading N elements starting at an arbitrary position k in a    *     uniform declared as an array, elements k through k + N - 1 in the    *     array will be replaced with the new values. Values for any array    *     element that exceeds the highest array element index used, as    *     reported by GetActiveUniform, will be ignored by the GL."    *    * Clamp 'count' to a valid value.  Note that for non-arrays a count > 1    * will have already generated an error.    */   if (uni->array_elements != 0) {      if (offset >= uni->array_elements)	 return;      count = MIN2(count, (int) (uni->array_elements - offset));   }   FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);   /* Store the data in the "actual type" backing storage for the uniform.    */   elements = components * vectors;   if (!transpose) {      memcpy(&uni->storage[elements * offset], values,	     sizeof(uni->storage[0]) * elements * count);   } else {      /* Copy and transpose the matrix.       */      const float *src = values;      float *dst = &uni->storage[elements * offset].f;      for (int i = 0; i < count; i++) {	 for (unsigned r = 0; r < rows; r++) {	    for (unsigned c = 0; c < cols; c++) {	       dst[(c * components) + r] = src[c + (r * vectors)];	    }	 }	 dst += elements;	 src += elements;      }   }   uni->initialized = true;   _mesa_propagate_uniforms_to_driver_storage(uni, offset, count);}
开发者ID:curro,项目名称:mesa,代码行数:96,


示例3: _mesa_uniform

/** * Called via ctx->Driver.Uniform(). */void_mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,              const GLvoid *values, GLenum type){   struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;   GLint elems, i, k;   GLenum uType;   GLsizei maxCount;   if (!shProg || !shProg->LinkStatus) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(program not linked)");      return;   }   if (location == -1)      return;   /* The standard specifies this as a no-op */   /* The spec says this is GL_INVALID_OPERATION, although it seems like it    * ought to be GL_INVALID_VALUE    */   if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(location)");      return;   }   FLUSH_VERTICES(ctx, _NEW_PROGRAM);   uType = shProg->Uniforms->Parameters[location].DataType;   /*    * If we're setting a sampler, we must use glUniformi1()!    */   if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) {      GLint unit;      if (type != GL_INT || count != 1) {         _mesa_error(ctx, GL_INVALID_OPERATION,                     "glUniform(only glUniform1i can be used "                     "to set sampler uniforms)");         return;      }      /* check that the sampler (tex unit index) is legal */      unit = ((GLint *) values)[0];      if (unit >= ctx->Const.MaxTextureImageUnits) {         _mesa_error(ctx, GL_INVALID_VALUE,                     "glUniform1(invalid sampler/tex unit index)");         return;      }   }   if (count < 0) {      _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(count < 0)");      return;   }   switch (type) {   case GL_FLOAT:   case GL_INT:      elems = 1;      break;   case GL_FLOAT_VEC2:   case GL_INT_VEC2:      elems = 2;      break;   case GL_FLOAT_VEC3:   case GL_INT_VEC3:      elems = 3;      break;   case GL_FLOAT_VEC4:   case GL_INT_VEC4:      elems = 4;      break;   default:      _mesa_problem(ctx, "Invalid type in _mesa_uniform");      return;   }   /* OpenGL requires types to match exactly, except that one can convert    * float or int array to boolean array.    */   switch (uType)   {      case GL_BOOL:      case GL_BOOL_VEC2:      case GL_BOOL_VEC3:      case GL_BOOL_VEC4:         if (elems != sizeof_glsl_type(uType)) {            _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count mismatch)");         }         break;      case PROGRAM_SAMPLER:         break;      default:         if (shProg->Uniforms->Parameters[location].Type != PROGRAM_SAMPLER              && uType != type) {            _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)");         }         break;   }//.........这里部分代码省略.........
开发者ID:Starlink,项目名称:mesa,代码行数:101,


示例4: _mesa_Fogfv

void GLAPIENTRY_mesa_Fogfv( GLenum pname, const GLfloat *params ){   GET_CURRENT_CONTEXT(ctx);   GLenum m;   ASSERT_OUTSIDE_BEGIN_END(ctx);   switch (pname) {      case GL_FOG_MODE:         m = (GLenum) (GLint) *params;	 switch (m) {	 case GL_LINEAR:	 case GL_EXP:	 case GL_EXP2:	    break;	 default:	    _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );            return;	 }	 if (ctx->Fog.Mode == m)	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG);	 ctx->Fog.Mode = m;	 break;      case GL_FOG_DENSITY:	 if (*params<0.0) {	    _mesa_error( ctx, GL_INVALID_VALUE, "glFog" );            return;	 }	 if (ctx->Fog.Density == *params)	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG);	 ctx->Fog.Density = *params;	 break;      case GL_FOG_START:         if (ctx->Fog.Start == *params)            return;         FLUSH_VERTICES(ctx, _NEW_FOG);         ctx->Fog.Start = *params;         UPDATE_FOG_SCALE(ctx);         break;      case GL_FOG_END:         if (ctx->Fog.End == *params)            return;         FLUSH_VERTICES(ctx, _NEW_FOG);         ctx->Fog.End = *params;         UPDATE_FOG_SCALE(ctx);         break;      case GL_FOG_INDEX: 	 if (ctx->Fog.Index == *params)	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG); 	 ctx->Fog.Index = *params;	 break;      case GL_FOG_COLOR:	 if (TEST_EQ_4V(ctx->Fog.Color, params))	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG);	 ctx->Fog.Color[0] = CLAMP(params[0], 0.0F, 1.0F);	 ctx->Fog.Color[1] = CLAMP(params[1], 0.0F, 1.0F);	 ctx->Fog.Color[2] = CLAMP(params[2], 0.0F, 1.0F);	 ctx->Fog.Color[3] = CLAMP(params[3], 0.0F, 1.0F);         break;      case GL_FOG_COORDINATE_SOURCE_EXT: {	 GLenum p = (GLenum) (GLint) *params;         if (!ctx->Extensions.EXT_fog_coord ||             (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {	    _mesa_error(ctx, GL_INVALID_ENUM, "glFog");	    return;	 }	 if (ctx->Fog.FogCoordinateSource == p)	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG);	 ctx->Fog.FogCoordinateSource = p;	 break;      }      default:         _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );         return;   }   if (ctx->Driver.Fogfv) {      (*ctx->Driver.Fogfv)( ctx, pname, params );   }}
开发者ID:toastpp,项目名称:toastpp,代码行数:85,


示例5: _mesa_PixelTransferf

/* * Implements glPixelTransfer[fi] whether called immediately or from a * display list. */void GLAPIENTRY_mesa_PixelTransferf( GLenum pname, GLfloat param ){   GET_CURRENT_CONTEXT(ctx);   ASSERT_OUTSIDE_BEGIN_END(ctx);   switch (pname) {      case GL_MAP_COLOR:         if (ctx->Pixel.MapColorFlag == (param ? GL_TRUE : GL_FALSE))	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.MapColorFlag = param ? GL_TRUE : GL_FALSE;	 break;      case GL_MAP_STENCIL:         if (ctx->Pixel.MapStencilFlag == (param ? GL_TRUE : GL_FALSE))	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.MapStencilFlag = param ? GL_TRUE : GL_FALSE;	 break;      case GL_INDEX_SHIFT:         if (ctx->Pixel.IndexShift == (GLint) param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.IndexShift = (GLint) param;	 break;      case GL_INDEX_OFFSET:         if (ctx->Pixel.IndexOffset == (GLint) param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.IndexOffset = (GLint) param;	 break;      case GL_RED_SCALE:         if (ctx->Pixel.RedScale == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.RedScale = param;	 break;      case GL_RED_BIAS:         if (ctx->Pixel.RedBias == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.RedBias = param;	 break;      case GL_GREEN_SCALE:         if (ctx->Pixel.GreenScale == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.GreenScale = param;	 break;      case GL_GREEN_BIAS:         if (ctx->Pixel.GreenBias == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.GreenBias = param;	 break;      case GL_BLUE_SCALE:         if (ctx->Pixel.BlueScale == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.BlueScale = param;	 break;      case GL_BLUE_BIAS:         if (ctx->Pixel.BlueBias == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.BlueBias = param;	 break;      case GL_ALPHA_SCALE:         if (ctx->Pixel.AlphaScale == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.AlphaScale = param;	 break;      case GL_ALPHA_BIAS:         if (ctx->Pixel.AlphaBias == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.AlphaBias = param;	 break;      case GL_DEPTH_SCALE:         if (ctx->Pixel.DepthScale == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.DepthScale = param;	 break;      case GL_DEPTH_BIAS:         if (ctx->Pixel.DepthBias == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.DepthBias = param;	 break;      case GL_POST_COLOR_MATRIX_RED_SCALE:         if (ctx->Pixel.PostColorMatrixScale[0] == param)	    return;	 FLUSH_VERTICES(ctx, _NEW_PIXEL);         ctx->Pixel.PostColorMatrixScale[0] = param;//.........这里部分代码省略.........
开发者ID:toastpp,项目名称:toastpp,代码行数:101,


示例6: use_shader_program

static booluse_shader_program(struct gl_context *ctx, GLenum type,		   struct gl_shader_program *shProg){   struct gl_shader_program **target;   switch (type) {#if FEATURE_ARB_vertex_shader   case GL_VERTEX_SHADER:      target = &ctx->Shader.CurrentVertexProgram;      if ((shProg == NULL)	  || (shProg->_LinkedShaders[MESA_SHADER_VERTEX] == NULL)) {	 shProg = NULL;      }      break;#endif#if FEATURE_ARB_geometry_shader4   case GL_GEOMETRY_SHADER_ARB:      target = &ctx->Shader.CurrentGeometryProgram;      if ((shProg == NULL)	  || (shProg->_LinkedShaders[MESA_SHADER_GEOMETRY] == NULL)) {	 shProg = NULL;      }      break;#endif#if FEATURE_ARB_fragment_shader   case GL_FRAGMENT_SHADER:      target = &ctx->Shader.CurrentFragmentProgram;      if ((shProg == NULL)	  || (shProg->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL)) {	 shProg = NULL;      }      break;#endif   default:      return false;   }   if (*target != shProg) {      FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);      /* If the shader is also bound as the current rendering shader, unbind       * it from that binding point as well.  This ensures that the correct       * semantics of glDeleteProgram are maintained.       */      switch (type) {#if FEATURE_ARB_vertex_shader      case GL_VERTEX_SHADER:	 /* Empty for now. */	 break;#endif#if FEATURE_ARB_geometry_shader4      case GL_GEOMETRY_SHADER_ARB:	 /* Empty for now. */	 break;#endif#if FEATURE_ARB_fragment_shader      case GL_FRAGMENT_SHADER:	 if (*target == ctx->Shader._CurrentFragmentProgram) {	    _mesa_reference_shader_program(ctx,					   &ctx->Shader._CurrentFragmentProgram,					   NULL);	 }	 break;#endif      }      _mesa_reference_shader_program(ctx, target, shProg);      return true;   }   return false;}
开发者ID:stereotype441,项目名称:mesa,代码行数:73,


示例7: _mesa_uniform

//.........这里部分代码省略.........         }      }   }   if (uni->type->is_image()) {      for (int i = 0; i < count; i++) {         const int unit = ((GLint *) values)[i];         /* check that the image unit is legal */         if (unit < 0 || unit >= (int)ctx->Const.MaxImageUnits) {            _mesa_error(ctx, GL_INVALID_VALUE,                        "glUniform1i(invalid image unit index for uniform %d)",                        location);            return;         }      }   }   /* Page 82 (page 96 of the PDF) of the OpenGL 2.1 spec says:    *    *     "When loading N elements starting at an arbitrary position k in a    *     uniform declared as an array, elements k through k + N - 1 in the    *     array will be replaced with the new values. Values for any array    *     element that exceeds the highest array element index used, as    *     reported by GetActiveUniform, will be ignored by the GL."    *    * Clamp 'count' to a valid value.  Note that for non-arrays a count > 1    * will have already generated an error.    */   if (uni->array_elements != 0) {      count = MIN2(count, (int) (uni->array_elements - offset));   }   FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);   /* Store the data in the "actual type" backing storage for the uniform.    */   if (!uni->type->is_boolean()) {      memcpy(&uni->storage[size_mul * components * offset], values,	     sizeof(uni->storage[0]) * components * count * size_mul);   } else {      const union gl_constant_value *src =	 (const union gl_constant_value *) values;      union gl_constant_value *dst = &uni->storage[components * offset];      const unsigned elems = components * count;      for (unsigned i = 0; i < elems; i++) {	 if (basicType == GLSL_TYPE_FLOAT) {            dst[i].i = src[i].f != 0.0f ? ctx->Const.UniformBooleanTrue : 0;	 } else {            dst[i].i = src[i].i != 0    ? ctx->Const.UniformBooleanTrue : 0;	 }      }   }   uni->initialized = true;   _mesa_propagate_uniforms_to_driver_storage(uni, offset, count);   /* If the uniform is a sampler, do the extra magic necessary to propagate    * the changes through.    */   if (uni->type->is_sampler()) {      bool flushed = false;      for (int i = 0; i < MESA_SHADER_STAGES; i++) {	 struct gl_shader *const sh = shProg->_LinkedShaders[i];
开发者ID:alesegdia,项目名称:mesa,代码行数:67,


示例8: _mesa_uniform_matrix

/** * Called by glUniformMatrix*() functions. * Note: cols=2, rows=4  ==>  array[2] of vec4 */extern "C" void_mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,		     GLuint cols, GLuint rows,                     GLint location, GLsizei count,                     GLboolean transpose,                     const GLvoid *values, GLenum type){   unsigned offset;   unsigned vectors;   unsigned components;   unsigned elements;   int size_mul;   struct gl_uniform_storage *const uni =      validate_uniform_parameters(ctx, shProg, location, count,                                  &offset, "glUniformMatrix");   if (uni == NULL)      return;   if (!uni->type->is_matrix()) {      _mesa_error(ctx, GL_INVALID_OPERATION,		  "glUniformMatrix(non-matrix uniform)");      return;   }   assert(type == GL_FLOAT || type == GL_DOUBLE);   size_mul = type == GL_DOUBLE ? 2 : 1;   assert(!uni->type->is_sampler());   vectors = uni->type->matrix_columns;   components = uni->type->vector_elements;   /* Verify that the types are compatible.  This is greatly simplified for    * matrices because they can only have a float base type.    */   if (vectors != cols || components != rows) {      _mesa_error(ctx, GL_INVALID_OPERATION,		  "glUniformMatrix(matrix size mismatch)");      return;   }   /* GL_INVALID_VALUE is generated if `transpose' is not GL_FALSE.    * http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml    */   if (transpose) {      if (ctx->API == API_OPENGLES2 && ctx->Version < 30) {	 _mesa_error(ctx, GL_INVALID_VALUE,		     "glUniformMatrix(matrix transpose is not GL_FALSE)");	 return;      }   }   if (unlikely(ctx->_Shader->Flags & GLSL_UNIFORMS)) {      log_uniform(values, uni->type->base_type, components, vectors, count,		  bool(transpose), shProg, location, uni);   }   /* Page 82 (page 96 of the PDF) of the OpenGL 2.1 spec says:    *    *     "When loading N elements starting at an arbitrary position k in a    *     uniform declared as an array, elements k through k + N - 1 in the    *     array will be replaced with the new values. Values for any array    *     element that exceeds the highest array element index used, as    *     reported by GetActiveUniform, will be ignored by the GL."    *    * Clamp 'count' to a valid value.  Note that for non-arrays a count > 1    * will have already generated an error.    */   if (uni->array_elements != 0) {      count = MIN2(count, (int) (uni->array_elements - offset));   }   FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);   /* Store the data in the "actual type" backing storage for the uniform.    */   elements = components * vectors;   if (!transpose) {      memcpy(&uni->storage[elements * offset], values,	     sizeof(uni->storage[0]) * elements * count * size_mul);   } else if (type == GL_FLOAT) {      /* Copy and transpose the matrix.       */      const float *src = (const float *)values;      float *dst = &uni->storage[elements * offset].f;      for (int i = 0; i < count; i++) {	 for (unsigned r = 0; r < rows; r++) {	    for (unsigned c = 0; c < cols; c++) {	       dst[(c * components) + r] = src[c + (r * vectors)];	    }	 }	 dst += elements;	 src += elements;      }//.........这里部分代码省略.........
开发者ID:alesegdia,项目名称:mesa,代码行数:101,


示例9: _mesa_LoadProgramNV

/** * Load/parse/compile a program. * /note Called from the GL API dispatcher. */void GLAPIENTRY_mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len,                    const GLubyte *program){   struct gl_program *prog;   GET_CURRENT_CONTEXT(ctx);   ASSERT_OUTSIDE_BEGIN_END(ctx);   if (!ctx->Extensions.NV_vertex_program       && !ctx->Extensions.NV_fragment_program) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV()");      return;   }   if (id == 0) {      _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(id)");      return;   }   if (len < 0) {      _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(len)");      return;   }   FLUSH_VERTICES(ctx, _NEW_PROGRAM);   prog = _mesa_lookup_program(ctx, id);   if (prog && prog->Target != 0 && prog->Target != target) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV(target)");      return;   }   if ((target == GL_VERTEX_PROGRAM_NV ||        target == GL_VERTEX_STATE_PROGRAM_NV)       && ctx->Extensions.NV_vertex_program) {      struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog;      if (!vprog || prog == &_mesa_DummyProgram) {         vprog = (struct gl_vertex_program *)            ctx->Driver.NewProgram(ctx, target, id);         if (!vprog) {            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");            return;         }         _mesa_HashInsert(ctx->Shared->Programs, id, vprog);      }      if (ctx->Extensions.ARB_vertex_program	  && (strncmp((char *) program, "!!ARB", 5) == 0)) {	 _mesa_parse_arb_vertex_program(ctx, target, program, len, vprog);      } else {	 _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog);      }   }   else if (target == GL_FRAGMENT_PROGRAM_NV            && ctx->Extensions.NV_fragment_program) {      struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;      if (!fprog || prog == &_mesa_DummyProgram) {         fprog = (struct gl_fragment_program *)            ctx->Driver.NewProgram(ctx, target, id);         if (!fprog) {            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");            return;         }         _mesa_HashInsert(ctx->Shared->Programs, id, fprog);      }      _mesa_parse_nv_fragment_program(ctx, target, program, len, fprog);   }   else if (target == GL_FRAGMENT_PROGRAM_ARB            && ctx->Extensions.ARB_fragment_program) {      struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;      if (!fprog || prog == &_mesa_DummyProgram) {         fprog = (struct gl_fragment_program *)            ctx->Driver.NewProgram(ctx, target, id);         if (!fprog) {            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");            return;         }         _mesa_HashInsert(ctx->Shared->Programs, id, fprog);      }      _mesa_parse_arb_fragment_program(ctx, target, program, len, fprog);   }   else {      _mesa_error(ctx, GL_INVALID_ENUM, "glLoadProgramNV(target)");   }}
开发者ID:GunioRobot,项目名称:mesa-7.10.2-PS3,代码行数:90,


示例10: _mesa_RenderMode

/** * Set rasterization mode. * * /param mode rasterization mode. * * /note this function can't be put in a display list. * * /sa glRenderMode(). *  * Flushes the vertices and do the necessary cleanup according to the previous * rasterization mode, such as writing the hit record or resent the select * buffer index when exiting the select mode. Updates * __struct gl_contextRec::RenderMode and notifies the driver via the * dd_function_table::RenderMode callback. */GLint GLAPIENTRY_mesa_RenderMode( GLenum mode ){   GET_CURRENT_CONTEXT(ctx);   GLint result;   ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);   if (MESA_VERBOSE & VERBOSE_API)      _mesa_debug(ctx, "glRenderMode %s/n", _mesa_lookup_enum_by_nr(mode));   FLUSH_VERTICES(ctx, _NEW_RENDERMODE);   switch (ctx->RenderMode) {      case GL_RENDER:	 result = 0;	 break;      case GL_SELECT:	 if (ctx->Select.HitFlag) {	    write_hit_record( ctx );	 }	 if (ctx->Select.BufferCount > ctx->Select.BufferSize) {	    /* overflow */#ifdef DEBUG            _mesa_warning(ctx, "Feedback buffer overflow");#endif	    result = -1;	 }	 else {	    result = ctx->Select.Hits;	 }	 ctx->Select.BufferCount = 0;	 ctx->Select.Hits = 0;	 ctx->Select.NameStackDepth = 0;	 break;#if _HAVE_FULL_GL      case GL_FEEDBACK:	 if (ctx->Feedback.Count > ctx->Feedback.BufferSize) {	    /* overflow */	    result = -1;	 }	 else {	    result = ctx->Feedback.Count;	 }	 ctx->Feedback.Count = 0;	 break;#endif      default:	 _mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" );	 return 0;   }   switch (mode) {      case GL_RENDER:         break;      case GL_SELECT:	 if (ctx->Select.BufferSize==0) {	    /* haven't called glSelectBuffer yet */	    _mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" );	 }	 break;#if _HAVE_FULL_GL      case GL_FEEDBACK:	 if (ctx->Feedback.BufferSize==0) {	    /* haven't called glFeedbackBuffer yet */	    _mesa_error( ctx, GL_INVALID_OPERATION, "glRenderMode" );	 }	 break;#endif      default:	 _mesa_error( ctx, GL_INVALID_ENUM, "glRenderMode" );	 return 0;   }   ctx->RenderMode = mode;   if (ctx->Driver.RenderMode)      ctx->Driver.RenderMode( ctx, mode );   return result;}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:94,


示例11: _mesa_BeginQueryIndexed

void GLAPIENTRY_mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id){   struct gl_query_object *q, **bindpt;   GET_CURRENT_CONTEXT(ctx);   if (MESA_VERBOSE & VERBOSE_API)      _mesa_debug(ctx, "glBeginQueryIndexed(%s, %u, %u)/n",                  _mesa_lookup_enum_by_nr(target), index, id);   if (!query_error_check_index(ctx, target, index))      return;   FLUSH_VERTICES(ctx, 0);   bindpt = get_query_binding_point(ctx, target);   if (!bindpt) {      _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQuery{Indexed}(target)");      return;   }   /* From the GL_ARB_occlusion_query spec:    *    *     "If BeginQueryARB is called while another query is already in    *      progress with the same target, an INVALID_OPERATION error is    *      generated."    */   if (*bindpt) {      _mesa_error(ctx, GL_INVALID_OPERATION,                  "glBeginQuery{Indexed}(target=%s is active)",                  _mesa_lookup_enum_by_nr(target));      return;   }   if (id == 0) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQuery{Indexed}(id==0)");      return;   }   q = _mesa_lookup_query_object(ctx, id);   if (!q) {      if (ctx->API != API_OPENGL_COMPAT) {         _mesa_error(ctx, GL_INVALID_OPERATION,                     "glBeginQuery{Indexed}(non-gen name)");         return;      } else {         /* create new object */         q = ctx->Driver.NewQueryObject(ctx, id);         if (!q) {            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQuery{Indexed}");            return;         }         _mesa_HashInsert(ctx->Query.QueryObjects, id, q);      }   }   else {      /* pre-existing object */      if (q->Active) {         _mesa_error(ctx, GL_INVALID_OPERATION,                     "glBeginQuery{Indexed}(query already active)");         return;      }   }   q->Target = target;   q->Active = GL_TRUE;   q->Result = 0;   q->Ready = GL_FALSE;   q->EverBound = GL_TRUE;   /* XXX should probably refcount query objects */   *bindpt = q;   ctx->Driver.BeginQuery(ctx, q);}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:75,


示例12: flush

/** * This is called just prior to changing any sampler object state. */static inline voidflush(struct gl_context *ctx){   FLUSH_VERTICES(ctx, _NEW_TEXTURE);}
开发者ID:dumbbell,项目名称:mesa,代码行数:8,


示例13: _mesa_TexGenfv

void GLAPIENTRY_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ){   struct gl_texture_unit *texUnit;   struct gl_texgen *texgen;   GET_CURRENT_CONTEXT(ctx);   ASSERT_OUTSIDE_BEGIN_END(ctx);   if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE))      _mesa_debug(ctx, "glTexGen %s %s %.1f(%s).../n",                  _mesa_lookup_enum_by_nr(coord),                  _mesa_lookup_enum_by_nr(pname),                  *params,		  _mesa_lookup_enum_by_nr((GLenum) (GLint) *params));   if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)");      return;   }   texUnit = _mesa_get_current_tex_unit(ctx);   texgen = get_texgen(ctx, texUnit, coord);   if (!texgen) {      _mesa_error(ctx, GL_INVALID_ENUM, "glTexGen(coord)");      return;   }   switch (pname) {   case GL_TEXTURE_GEN_MODE:      {         GLenum mode = (GLenum) (GLint) params[0];         GLbitfield bit = 0x0;         if (texgen->Mode == mode)            return;         switch (mode) {         case GL_OBJECT_LINEAR:            bit = TEXGEN_OBJ_LINEAR;            break;         case GL_EYE_LINEAR:            bit = TEXGEN_EYE_LINEAR;            break;         case GL_SPHERE_MAP:            if (coord == GL_S || coord == GL_T)               bit = TEXGEN_SPHERE_MAP;            break;         case GL_REFLECTION_MAP_NV:            if (coord != GL_Q)               bit = TEXGEN_REFLECTION_MAP_NV;            break;         case GL_NORMAL_MAP_NV:            if (coord != GL_Q)               bit = TEXGEN_NORMAL_MAP_NV;            break;         default:            ; /* nop */         }         if (!bit) {            _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );            return;         }         if (ctx->API != API_OPENGL             && (bit & (TEXGEN_REFLECTION_MAP_NV | TEXGEN_NORMAL_MAP_NV)) == 0) {            _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );            return;         }         FLUSH_VERTICES(ctx, _NEW_TEXTURE);         texgen->Mode = mode;         texgen->_ModeBit = bit;      }      break;   case GL_OBJECT_PLANE:      {         if (ctx->API != API_OPENGL) {            _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );            return;         }         if (TEST_EQ_4V(texgen->ObjectPlane, params))            return;         FLUSH_VERTICES(ctx, _NEW_TEXTURE);         COPY_4FV(texgen->ObjectPlane, params);      }      break;   case GL_EYE_PLANE:      {         GLfloat tmp[4];         if (ctx->API != API_OPENGL) {            _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );            return;         }         /* Transform plane equation by the inverse modelview matrix */         if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {            _math_matrix_analyse(ctx->ModelviewMatrixStack.Top);         }         _mesa_transform_vector(tmp, params,//.........这里部分代码省略.........
开发者ID:FASTCHIP,项目名称:kernel_3.4.67_lenovo_s939_mtk6592,代码行数:101,


示例14: _mesa_PixelMapusv

void GLAPIENTRY_mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ){   GLfloat fvalues[MAX_PIXEL_MAP_TABLE];   GET_CURRENT_CONTEXT(ctx);   ASSERT_OUTSIDE_BEGIN_END(ctx);   if (mapsize < 1 || mapsize > MAX_PIXEL_MAP_TABLE) {      _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapusv(mapsize)" );      return;   }   if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) {      /* test that mapsize is a power of two */      if (!_mesa_is_pow_two(mapsize)) {	 _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" );         return;      }   }   FLUSH_VERTICES(ctx, _NEW_PIXEL);   if (ctx->Unpack.BufferObj->Name) {      /* unpack pixelmap from PBO */      GLubyte *buf;      /* Note, need to use DefaultPacking and Unpack's buffer object */      ctx->DefaultPacking.BufferObj = ctx->Unpack.BufferObj;      if (!_mesa_validate_pbo_access(1, &ctx->DefaultPacking, mapsize, 1, 1,                                     GL_INTENSITY, GL_UNSIGNED_SHORT,                                     values)) {         _mesa_error(ctx, GL_INVALID_OPERATION,                     "glPixelMapusv(invalid PBO access)");         return;      }      /* restore */      ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj;      buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,                                              GL_READ_ONLY_ARB,                                              ctx->Unpack.BufferObj);      if (!buf) {         /* buffer is already mapped - that's an error */         _mesa_error(ctx, GL_INVALID_OPERATION,                     "glPixelMapusv(PBO is mapped)");         return;      }      values = (const GLushort *) ADD_POINTERS(buf, values);   }   else if (!values) {      return;   }   /* convert to floats */   if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {      GLint i;      for (i = 0; i < mapsize; i++) {         fvalues[i] = (GLfloat) values[i];      }   }   else {      GLint i;      for (i = 0; i < mapsize; i++) {         fvalues[i] = USHORT_TO_FLOAT( values[i] );      }   }   if (ctx->Unpack.BufferObj->Name) {      ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,                              ctx->Unpack.BufferObj);   }   store_pixelmap(ctx, map, mapsize, fvalues);}
开发者ID:toastpp,项目名称:toastpp,代码行数:72,


示例15: _mesa_Fogfv

void GLAPIENTRY_mesa_Fogfv( GLenum pname, const GLfloat *params ){   GET_CURRENT_CONTEXT(ctx);   GLenum m;   switch (pname) {      case GL_FOG_MODE:         m = (GLenum) (GLint) *params;	 switch (m) {	 case GL_LINEAR:	 case GL_EXP:	 case GL_EXP2:	    break;	 default:	    _mesa_error( ctx, GL_INVALID_ENUM, "glFog" );            return;	 }	 if (ctx->Fog.Mode == m)	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG);	 ctx->Fog.Mode = m;	 break;      case GL_FOG_DENSITY:	 if (*params<0.0) {	    _mesa_error( ctx, GL_INVALID_VALUE, "glFog" );            return;	 }	 if (ctx->Fog.Density == *params)	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG);	 ctx->Fog.Density = *params;	 break;      case GL_FOG_START:         if (ctx->Fog.Start == *params)            return;         FLUSH_VERTICES(ctx, _NEW_FOG);         ctx->Fog.Start = *params;         update_fog_scale(ctx);         break;      case GL_FOG_END:         if (ctx->Fog.End == *params)            return;         FLUSH_VERTICES(ctx, _NEW_FOG);         ctx->Fog.End = *params;         update_fog_scale(ctx);         break;      case GL_FOG_INDEX:         if (ctx->API != API_OPENGL_COMPAT)            goto invalid_pname; 	 if (ctx->Fog.Index == *params)	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG); 	 ctx->Fog.Index = *params;	 break;      case GL_FOG_COLOR:	 if (TEST_EQ_4V(ctx->Fog.Color, params))	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG);	 ctx->Fog.ColorUnclamped[0] = params[0];	 ctx->Fog.ColorUnclamped[1] = params[1];	 ctx->Fog.ColorUnclamped[2] = params[2];	 ctx->Fog.ColorUnclamped[3] = params[3];	 ctx->Fog.Color[0] = CLAMP(params[0], 0.0F, 1.0F);	 ctx->Fog.Color[1] = CLAMP(params[1], 0.0F, 1.0F);	 ctx->Fog.Color[2] = CLAMP(params[2], 0.0F, 1.0F);	 ctx->Fog.Color[3] = CLAMP(params[3], 0.0F, 1.0F);         break;      case GL_FOG_COORDINATE_SOURCE_EXT: {	 GLenum p = (GLenum) (GLint) *params;         if (ctx->API != API_OPENGL_COMPAT ||             (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT)) {	    _mesa_error(ctx, GL_INVALID_ENUM, "glFog");	    return;	 }	 if (ctx->Fog.FogCoordinateSource == p)	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG);	 ctx->Fog.FogCoordinateSource = p;	 break;      }      case GL_FOG_DISTANCE_MODE_NV: {	 GLenum p = (GLenum) (GLint) *params;         if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.NV_fog_distance ||             (p != GL_EYE_RADIAL_NV && p != GL_EYE_PLANE && p != GL_EYE_PLANE_ABSOLUTE_NV)) {	    _mesa_error(ctx, GL_INVALID_ENUM, "glFog");	    return;	 }	 if (ctx->Fog.FogDistanceMode == p)	    return;	 FLUSH_VERTICES(ctx, _NEW_FOG);	 ctx->Fog.FogDistanceMode = p;	 break;      }      default:         goto invalid_pname;   }   if (ctx->Driver.Fogfv) {      (*ctx->Driver.Fogfv)( ctx, pname, params );//.........这里部分代码省略.........
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:101,


示例16: _mesa_ReadnPixelsARB

void GLAPIENTRY_mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,		      GLenum format, GLenum type, GLsizei bufSize,                      GLvoid *pixels ){   GLenum err = GL_NO_ERROR;   struct gl_renderbuffer *rb;   struct gl_pixelstore_attrib clippedPacking;   GET_CURRENT_CONTEXT(ctx);   FLUSH_VERTICES(ctx, 0);   FLUSH_CURRENT(ctx, 0);   if (MESA_VERBOSE & VERBOSE_API)      _mesa_debug(ctx, "glReadPixels(%d, %d, %s, %s, %p)/n",                  width, height,                  _mesa_enum_to_string(format),                  _mesa_enum_to_string(type),                  pixels);   if (width < 0 || height < 0) {      _mesa_error( ctx, GL_INVALID_VALUE,                   "glReadPixels(width=%d height=%d)", width, height );      return;   }   if (ctx->NewState)      _mesa_update_state(ctx);   if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {      _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,                  "glReadPixels(incomplete framebuffer)" );      return;   }   rb = _mesa_get_read_renderbuffer_for_format(ctx, format);   if (rb == NULL) {      _mesa_error(ctx, GL_INVALID_OPERATION,                  "glReadPixels(read buffer)");      return;   }   /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the    * combinations of format and type that can be used.    *    * Technically, only two combinations are actually allowed:    * GL_RGBA/GL_UNSIGNED_BYTE, and some implementation-specific internal    * preferred combination.  This code doesn't know what that preferred    * combination is, and Mesa can handle anything valid.  Just work instead.    */   if (_mesa_is_gles(ctx)) {      if (ctx->API == API_OPENGLES2 &&          _mesa_is_color_format(format) &&          _mesa_get_color_read_format(ctx) == format &&          _mesa_get_color_read_type(ctx) == type) {         err = GL_NO_ERROR;      } else if (ctx->Version < 30) {         err = _mesa_es_error_check_format_and_type(ctx, format, type, 2);         if (err == GL_NO_ERROR) {            if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {               err = GL_INVALID_OPERATION;            }         }      } else {         err = read_pixels_es3_error_check(format, type, rb);      }      if (err != GL_NO_ERROR) {         _mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)",                     _mesa_enum_to_string(format),                     _mesa_enum_to_string(type));         return;      }   }   err = _mesa_error_check_format_and_type(ctx, format, type);   if (err != GL_NO_ERROR) {      _mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)",                  _mesa_enum_to_string(format),                  _mesa_enum_to_string(type));      return;   }   if (_mesa_is_user_fbo(ctx->ReadBuffer) &&       ctx->ReadBuffer->Visual.samples > 0) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");      return;   }   if (!_mesa_source_buffer_exists(ctx, format)) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)");      return;   }   /* Check that the destination format and source buffer are both    * integer-valued or both non-integer-valued.    */   if (ctx->Extensions.EXT_texture_integer && _mesa_is_color_format(format)) {      const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;//.........这里部分代码省略.........
开发者ID:airlied,项目名称:mesa,代码行数:101,


示例17: _mesa_PointParameterfv

void GLAPIENTRY_mesa_PointParameterfv( GLenum pname, const GLfloat *params){   GET_CURRENT_CONTEXT(ctx);   ASSERT_OUTSIDE_BEGIN_END(ctx);   switch (pname) {      case GL_DISTANCE_ATTENUATION_EXT:         if (ctx->Extensions.EXT_point_parameters) {            if (TEST_EQ_3V(ctx->Point.Params, params))	       return;	    FLUSH_VERTICES(ctx, _NEW_POINT);            COPY_3V(ctx->Point.Params, params);            ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||                                      ctx->Point.Params[1] != 0.0 ||                                      ctx->Point.Params[2] != 0.0);            if (ctx->Point._Attenuated)               ctx->_TriangleCaps |= DD_POINT_ATTEN;            else               ctx->_TriangleCaps &= ~DD_POINT_ATTEN;         }         else {            _mesa_error(ctx, GL_INVALID_ENUM,                        "glPointParameterf[v]{EXT,ARB}(pname)");            return;         }         break;      case GL_POINT_SIZE_MIN_EXT:         if (ctx->Extensions.EXT_point_parameters) {            if (params[0] < 0.0F) {               _mesa_error( ctx, GL_INVALID_VALUE,                            "glPointParameterf[v]{EXT,ARB}(param)" );               return;            }            if (ctx->Point.MinSize == params[0])               return;            FLUSH_VERTICES(ctx, _NEW_POINT);            ctx->Point.MinSize = params[0];         }         else {            _mesa_error(ctx, GL_INVALID_ENUM,                        "glPointParameterf[v]{EXT,ARB}(pname)");            return;         }         break;      case GL_POINT_SIZE_MAX_EXT:         if (ctx->Extensions.EXT_point_parameters) {            if (params[0] < 0.0F) {               _mesa_error( ctx, GL_INVALID_VALUE,                            "glPointParameterf[v]{EXT,ARB}(param)" );               return;            }            if (ctx->Point.MaxSize == params[0])               return;            FLUSH_VERTICES(ctx, _NEW_POINT);            ctx->Point.MaxSize = params[0];         }         else {            _mesa_error(ctx, GL_INVALID_ENUM,                        "glPointParameterf[v]{EXT,ARB}(pname)");            return;         }         break;      case GL_POINT_FADE_THRESHOLD_SIZE_EXT:         if (ctx->Extensions.EXT_point_parameters) {            if (params[0] < 0.0F) {               _mesa_error( ctx, GL_INVALID_VALUE,                            "glPointParameterf[v]{EXT,ARB}(param)" );               return;            }            if (ctx->Point.Threshold == params[0])               return;            FLUSH_VERTICES(ctx, _NEW_POINT);            ctx->Point.Threshold = params[0];         }         else {            _mesa_error(ctx, GL_INVALID_ENUM,                        "glPointParameterf[v]{EXT,ARB}(pname)");            return;         }         break;      case GL_POINT_SPRITE_R_MODE_NV:         /* This is one area where ARB_point_sprite and NV_point_sprite	  * differ.  In ARB_point_sprite the POINT_SPRITE_R_MODE is	  * always ZERO.  NV_point_sprite adds the S and R modes.	  */         if (ctx->Extensions.NV_point_sprite) {            GLenum value = (GLenum) params[0];            if (value != GL_ZERO && value != GL_S && value != GL_R) {               _mesa_error(ctx, GL_INVALID_VALUE,                           "glPointParameterf[v]{EXT,ARB}(param)");               return;            }            if (ctx->Point.SpriteRMode == value)               return;            FLUSH_VERTICES(ctx, _NEW_POINT);            ctx->Point.SpriteRMode = value;         }         else {//.........这里部分代码省略.........
开发者ID:aljen,项目名称:haiku-opengl,代码行数:101,


示例18: _mesa_BindTexture

/** * Bind a named texture to a texturing target. *  * /param target texture target. * /param texName texture name. *  * /sa glBindTexture(). * * Determines the old texture object bound and returns immediately if rebinding * the same texture.  Get the current texture which is either a default texture * if name is null, a named texture from the hash, or a new texture if the * given texture name is new. Increments its reference count, binds it, and * calls dd_function_table::BindTexture. Decrements the old texture reference * count and deletes it if it reaches zero. */void GLAPIENTRY_mesa_BindTexture( GLenum target, GLuint texName ){   GET_CURRENT_CONTEXT(ctx);   struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);   struct gl_texture_object *newTexObj = NULL;   GLint targetIndex;   ASSERT_OUTSIDE_BEGIN_END(ctx);   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))      _mesa_debug(ctx, "glBindTexture %s %d/n",                  _mesa_lookup_enum_by_nr(target), (GLint) texName);   targetIndex = target_enum_to_index(target);   if (targetIndex < 0) {      _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)");      return;   }   assert(targetIndex < NUM_TEXTURE_TARGETS);   /*    * Get pointer to new texture object (newTexObj)    */   if (texName == 0) {      /* Use a default texture object */      newTexObj = ctx->Shared->DefaultTex[targetIndex];   }   else {      /* non-default texture object */      newTexObj = _mesa_lookup_texture(ctx, texName);      if (newTexObj) {         /* error checking */         if (newTexObj->Target != 0 && newTexObj->Target != target) {            /* the named texture object's target doesn't match the given target */            _mesa_error( ctx, GL_INVALID_OPERATION,                         "glBindTexture(target mismatch)" );            return;         }         if (newTexObj->Target == 0) {            finish_texture_init(ctx, target, newTexObj);         }      }      else {         /* if this is a new texture id, allocate a texture object now */         newTexObj = ctx->Driver.NewTextureObject(ctx, texName, target);         if (!newTexObj) {            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");            return;         }         /* and insert it into hash table */         _glthread_LOCK_MUTEX(ctx->Shared->Mutex);         _mesa_HashInsert(ctx->Shared->TexObjects, texName, newTexObj);         _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);      }      newTexObj->Target = target;   }   assert(valid_texture_object(newTexObj));   /* Check if this texture is only used by this context and is already bound.    * If so, just return.    */   {      GLboolean early_out;      _glthread_LOCK_MUTEX(ctx->Shared->Mutex);      early_out = ((ctx->Shared->RefCount == 1)                   && (newTexObj == texUnit->CurrentTex[targetIndex]));      _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);      if (early_out) {         return;      }   }   /* flush before changing binding */   FLUSH_VERTICES(ctx, _NEW_TEXTURE);   /* Do the actual binding.  The refcount on the previously bound    * texture object will be decremented.  It'll be deleted if the    * count hits zero.    */   _mesa_reference_texobj(&texUnit->CurrentTex[targetIndex], newTexObj);   ASSERT(texUnit->CurrentTex[targetIndex]);   /* Pass BindTexture call to device driver *///.........这里部分代码省略.........
开发者ID:altf4,项目名称:mesa,代码行数:101,


示例19: _mesa_Clear

/** * Clear buffers. *  * /param mask bit-mask indicating the buffers to be cleared. * * Flushes the vertices and verifies the parameter. If __struct gl_contextRec::NewState * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, * etc. If the rasterization mode is set to GL_RENDER then requests the driver * to clear the buffers, via the dd_function_table::Clear callback. */ void GLAPIENTRY_mesa_Clear( GLbitfield mask ){   GET_CURRENT_CONTEXT(ctx);   FLUSH_VERTICES(ctx, 0);   FLUSH_CURRENT(ctx, 0);   if (MESA_VERBOSE & VERBOSE_API)      _mesa_debug(ctx, "glClear 0x%x/n", mask);   if (mask & ~(GL_COLOR_BUFFER_BIT |                GL_DEPTH_BUFFER_BIT |                GL_STENCIL_BUFFER_BIT |                GL_ACCUM_BUFFER_BIT)) {      /* invalid bit set */      _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask);      return;   }   /* Accumulation buffers were removed in core contexts, and they never    * existed in OpenGL ES.    */   if ((mask & GL_ACCUM_BUFFER_BIT) != 0       && (ctx->API == API_OPENGL_CORE || _mesa_is_gles(ctx))) {      _mesa_error( ctx, GL_INVALID_VALUE, "glClear(GL_ACCUM_BUFFER_BIT)");      return;   }   if (ctx->NewState) {      _mesa_update_state( ctx );	/* update _Xmin, etc */   }   if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {      _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,                  "glClear(incomplete framebuffer)");      return;   }   if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0 ||       ctx->DrawBuffer->_Xmin >= ctx->DrawBuffer->_Xmax ||       ctx->DrawBuffer->_Ymin >= ctx->DrawBuffer->_Ymax)      return;   if (ctx->RasterDiscard)      return;   if (ctx->RenderMode == GL_RENDER) {      GLbitfield bufferMask;      /* don't clear depth buffer if depth writing disabled */      if (!ctx->Depth.Mask)         mask &= ~GL_DEPTH_BUFFER_BIT;      /* Build the bitmask to send to device driver's Clear function.       * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4       * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the       * BUFFER_BIT_COLORn flags.       */      bufferMask = 0;      if (mask & GL_COLOR_BUFFER_BIT) {         GLuint i;         for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {            bufferMask |= (1 << ctx->DrawBuffer->_ColorDrawBufferIndexes[i]);         }      }      if ((mask & GL_DEPTH_BUFFER_BIT)          && ctx->DrawBuffer->Visual.haveDepthBuffer) {         bufferMask |= BUFFER_BIT_DEPTH;      }      if ((mask & GL_STENCIL_BUFFER_BIT)          && ctx->DrawBuffer->Visual.haveStencilBuffer) {         bufferMask |= BUFFER_BIT_STENCIL;      }      if ((mask & GL_ACCUM_BUFFER_BIT)          && ctx->DrawBuffer->Visual.haveAccumBuffer) {         bufferMask |= BUFFER_BIT_ACCUM;      }      ASSERT(ctx->Driver.Clear);      ctx->Driver.Clear(ctx, bufferMask);   }}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:96,


示例20: _mesa_uniform_matrix

/** * Called by ctx->Driver.UniformMatrix(). */void_mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,                     GLenum matrixType, GLint location, GLsizei count,                     GLboolean transpose, const GLfloat *values){   GLsizei maxCount, i;   struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;   if (!shProg || !shProg->LinkStatus) {      _mesa_error(ctx, GL_INVALID_OPERATION,         "glUniformMatrix(program not linked)");      return;   }   if (location == -1)      return;   /* The standard specifies this as a no-op */   /* The spec says this is GL_INVALID_OPERATION, although it seems like it    * ought to be GL_INVALID_VALUE    */   if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(location)");      return;   }   if (values == NULL) {      _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix");      return;   }   if (count < 0) {      _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(count < 0)");      return;   }   FLUSH_VERTICES(ctx, _NEW_PROGRAM);   /*    * Note: the _columns_ of a matrix are stored in program registers, not    * the rows.    */   /* XXXX need to test 3x3 and 2x2 matrices... */   maxCount = shProg->Uniforms->Parameters[location].Size / (4 * cols);   if (count > maxCount)      count = maxCount;   for (i = 0; i < count; i++) {      if (transpose) {         GLuint row, col;         for (col = 0; col < cols; col++) {            GLfloat *v = shProg->Uniforms->ParameterValues[location + col];            for (row = 0; row < rows; row++) {               v[row] = values[row * cols + col];            }         }      }      else {         GLuint row, col;         for (col = 0; col < cols; col++) {            GLfloat *v = shProg->Uniforms->ParameterValues[location + col];            for (row = 0; row < rows; row++) {               v[row] = values[col * rows + row];            }         }      }      location += cols;      values += rows * cols;   }}
开发者ID:Starlink,项目名称:mesa,代码行数:66,


示例21: _mesa_ClearBufferuiv

/** * New in GL 3.0 * Clear unsigned integer color buffer (not depth, not stencil). */void GLAPIENTRY_mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value){   GET_CURRENT_CONTEXT(ctx);   FLUSH_VERTICES(ctx, 0);   FLUSH_CURRENT(ctx, 0);   if (ctx->NewState) {      _mesa_update_state( ctx );   }   switch (buffer) {   case GL_COLOR:      {         const GLbitfield mask = make_color_buffer_mask(ctx, drawbuffer);         if (mask == INVALID_MASK) {            _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferuiv(drawbuffer=%d)",                        drawbuffer);            return;         }         else if (mask && !ctx->RasterDiscard) {            union gl_color_union clearSave;            /* save color */            clearSave = ctx->Color.ClearColor;            /* set color */            COPY_4V(ctx->Color.ClearColor.ui, value);            /* clear buffer(s) */            ctx->Driver.Clear(ctx, mask);            /* restore color */            ctx->Color.ClearColor = clearSave;         }      }      break;   case GL_DEPTH:   case GL_STENCIL:      /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:       *       *     "The result of ClearBuffer is undefined if no conversion between       *     the type of the specified value and the type of the buffer being       *     cleared is defined (for example, if ClearBufferiv is called for a       *     fixed- or floating-point buffer, or if ClearBufferfv is called       *     for a signed or unsigned integer buffer). This is not an error."       *       * In this case we take "undefined" and "not an error" to mean "ignore."       * Even though we could do something sensible for GL_STENCIL, page 263       * (page 279 of the PDF) says:       *       *     "Only ClearBufferiv should be used to clear stencil buffers."       *       * Note that we still need to generate an error for the invalid       * drawbuffer case (see the GL_STENCIL case in _mesa_ClearBufferiv).       */      if (drawbuffer != 0) {         _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferuiv(drawbuffer=%d)",                     drawbuffer);         return;      }      return;   default:      _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferuiv(buffer=%s)",                  _mesa_lookup_enum_by_nr(buffer));      return;   }}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:70,


示例22: map2

static voidmap2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,      GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,      const GLvoid *points, GLenum type ){   GET_CURRENT_CONTEXT(ctx);   GLint k;   GLfloat *pnts;   struct gl_2d_map *map = NULL;   ASSERT_OUTSIDE_BEGIN_END(ctx);   ASSERT(type == GL_FLOAT || type == GL_DOUBLE);   if (u1==u2) {      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" );      return;   }   if (v1==v2) {      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(v1,v2)" );      return;   }   if (uorder<1 || uorder>MAX_EVAL_ORDER) {      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(uorder)" );      return;   }   if (vorder<1 || vorder>MAX_EVAL_ORDER) {      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vorder)" );      return;   }   k = _mesa_evaluator_components( target );   if (k==0) {      _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );   }   if (ustride < k) {      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(ustride)" );      return;   }   if (vstride < k) {      _mesa_error( ctx, GL_INVALID_VALUE, "glMap2(vstride)" );      return;   }   map = get_2d_map(ctx, target);   if (!map) {      _mesa_error( ctx, GL_INVALID_ENUM, "glMap2(target)" );      return;   }   /* make copy of the control points */   if (type == GL_FLOAT)      pnts = _mesa_copy_map_points2f(target, ustride, uorder,                                  vstride, vorder, (GLfloat*) points);   else      pnts = _mesa_copy_map_points2d(target, ustride, uorder,                                  vstride, vorder, (GLdouble*) points);   FLUSH_VERTICES(ctx, _NEW_EVAL);   map->Uorder = uorder;   map->u1 = u1;   map->u2 = u2;   map->du = 1.0F / (u2 - u1);   map->Vorder = vorder;   map->v1 = v1;   map->v2 = v2;   map->dv = 1.0F / (v2 - v1);   if (map->Points)      FREE( map->Points );   map->Points = pnts;}
开发者ID:GYGit,项目名称:reactos,代码行数:75,


示例23: _mesa_ClearBufferfv

/** * New in GL 3.0 * Clear fixed-pt or float color buffer or depth buffer (not stencil). */void GLAPIENTRY_mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value){   GET_CURRENT_CONTEXT(ctx);   FLUSH_VERTICES(ctx, 0);   FLUSH_CURRENT(ctx, 0);   if (ctx->NewState) {      _mesa_update_state( ctx );   }   switch (buffer) {   case GL_DEPTH:      /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:       *       *     "ClearBuffer generates an INVALID VALUE error if buffer is       *     COLOR and drawbuffer is less than zero, or greater than the       *     value of MAX DRAW BUFFERS minus one; or if buffer is DEPTH,       *     STENCIL, or DEPTH STENCIL and drawbuffer is not zero."       */      if (drawbuffer != 0) {         _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)",                     drawbuffer);         return;      }      else if (ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer && !ctx->RasterDiscard) {         /* Save current depth clear value, set to 'value', do the          * depth clear and restore the clear value.          * XXX in the future we may have a new ctx->Driver.ClearBuffer()          * hook instead.          */         const GLclampd clearSave = ctx->Depth.Clear;         ctx->Depth.Clear = *value;         ctx->Driver.Clear(ctx, BUFFER_BIT_DEPTH);         ctx->Depth.Clear = clearSave;      }      /* clear depth buffer to value */      break;   case GL_COLOR:      {         const GLbitfield mask = make_color_buffer_mask(ctx, drawbuffer);         if (mask == INVALID_MASK) {            _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)",                        drawbuffer);            return;         }         else if (mask && !ctx->RasterDiscard) {            union gl_color_union clearSave;            /* save color */            clearSave = ctx->Color.ClearColor;            /* set color */            COPY_4V(ctx->Color.ClearColor.f, value);            /* clear buffer(s) */            ctx->Driver.Clear(ctx, mask);            /* restore color */            ctx->Color.ClearColor = clearSave;         }      }      break;   case GL_STENCIL:      /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:       *       *     "The result of ClearBuffer is undefined if no conversion between       *     the type of the specified value and the type of the buffer being       *     cleared is defined (for example, if ClearBufferiv is called for a       *     fixed- or floating-point buffer, or if ClearBufferfv is called       *     for a signed or unsigned integer buffer). This is not an error."       *       * In this case we take "undefined" and "not an error" to mean "ignore."       * Note that we still need to generate an error for the invalid       * drawbuffer case (see the GL_DEPTH case above).       */      if (drawbuffer != 0) {         _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)",                     drawbuffer);         return;      }      return;   default:      _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfv(buffer=%s)",                  _mesa_lookup_enum_by_nr(buffer));      return;   }}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:90,


示例24: _mesa_uniform

//.........这里部分代码省略.........      for (i = 0; i < count; i++) {	 const unsigned texUnit = ((unsigned *) values)[i];         /* check that the sampler (tex unit index) is legal */         if (texUnit >= ctx->Const.MaxCombinedTextureImageUnits) {            _mesa_error(ctx, GL_INVALID_VALUE,                        "glUniform1i(invalid sampler/tex unit index for "			"uniform %d)",                        location);            return;         }      }   }   /* Page 82 (page 96 of the PDF) of the OpenGL 2.1 spec says:    *    *     "When loading N elements starting at an arbitrary position k in a    *     uniform declared as an array, elements k through k + N - 1 in the    *     array will be replaced with the new values. Values for any array    *     element that exceeds the highest array element index used, as    *     reported by GetActiveUniform, will be ignored by the GL."    *    * Clamp 'count' to a valid value.  Note that for non-arrays a count > 1    * will have already generated an error.    */   if (uni->array_elements != 0) {      if (offset >= uni->array_elements)	 return;      count = MIN2(count, (int) (uni->array_elements - offset));   }   FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);   /* Store the data in the "actual type" backing storage for the uniform.    */   if (!uni->type->is_boolean()) {      memcpy(&uni->storage[components * offset], values,	     sizeof(uni->storage[0]) * components * count);   } else {      const union gl_constant_value *src =	 (const union gl_constant_value *) values;      union gl_constant_value *dst = &uni->storage[components * offset];      const unsigned elems = components * count;      unsigned i;      for (i = 0; i < elems; i++) {	 if (basicType == GLSL_TYPE_FLOAT) {	    dst[i].i = src[i].f != 0.0f ? 1 : 0;	 } else {	    dst[i].i = src[i].i != 0    ? 1 : 0;	 }      }   }   uni->initialized = true;   _mesa_propagate_uniforms_to_driver_storage(uni, offset, count);   /* If the uniform is a sampler, do the extra magic necessary to propagate    * the changes through.    */   if (uni->type->is_sampler()) {      int i;
开发者ID:curro,项目名称:mesa,代码行数:66,


示例25: _mesa_BindSamplers

void GLAPIENTRY_mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers){   GET_CURRENT_CONTEXT(ctx);   GLint i;   /* The ARB_multi_bind spec says:    *    *   "An INVALID_OPERATION error is generated if <first> + <count> is    *    greater than the number of texture image units supported by    *    the implementation."    */   if (first + count > ctx->Const.MaxCombinedTextureImageUnits) {      _mesa_error(ctx, GL_INVALID_OPERATION,                  "glBindSamplers(first=%u + count=%d > the value of "                  "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",                  first, count, ctx->Const.MaxCombinedTextureImageUnits);      return;   }   FLUSH_VERTICES(ctx, 0);   if (samplers) {      /* Note that the error semantics for multi-bind commands differ from       * those of other GL commands.       *       * The Issues section in the ARB_multi_bind spec says:       *       *    "(11) Typically, OpenGL specifies that if an error is generated by       *          a command, that command has no effect.  This is somewhat       *          unfortunate for multi-bind commands, because it would require       *          a first pass to scan the entire list of bound objects for       *          errors and then a second pass to actually perform the       *          bindings.  Should we have different error semantics?       *       *       RESOLVED:  Yes.  In this specification, when the parameters for       *       one of the <count> binding points are invalid, that binding       *       point is not updated and an error will be generated.  However,       *       other binding points in the same command will be updated if       *       their parameters are valid and no other error occurs."       */      begin_samplerobj_lookups(ctx);      for (i = 0; i < count; i++) {         const GLuint unit = first + i;         struct gl_sampler_object * const currentSampler =             ctx->Texture.Unit[unit].Sampler;         struct gl_sampler_object *sampObj;         if (samplers[i] != 0) {            if (currentSampler && currentSampler->Name == samplers[i])               sampObj = currentSampler;            else               sampObj = lookup_samplerobj_locked(ctx, samplers[i]);            /* The ARB_multi_bind spec says:             *             *    "An INVALID_OPERATION error is generated if any value             *     in <samplers> is not zero or the name of an existing             *     sampler object (per binding)."             */            if (!sampObj) {               _mesa_error(ctx, GL_INVALID_OPERATION,                           "glBindSamplers(samplers[%d]=%u is not zero or "                           "the name of an existing sampler object)",                           i, samplers[i]);               continue;            }         } else {            sampObj = NULL;         }         /* Bind the new sampler */         if (sampObj != currentSampler) {            _mesa_reference_sampler_object(ctx,                                           &ctx->Texture.Unit[unit].Sampler,                                           sampObj);            ctx->NewState |= _NEW_TEXTURE;         }      }      end_samplerobj_lookups(ctx);   } else {      /* Unbind all samplers in the range <first> through <first>+<count>-1 */      for (i = 0; i < count; i++) {         const GLuint unit = first + i;         if (ctx->Texture.Unit[unit].Sampler) {            _mesa_reference_sampler_object(ctx,                                           &ctx->Texture.Unit[unit].Sampler,                                           NULL);            ctx->NewState |= _NEW_TEXTURE;         }      }   }}
开发者ID:dumbbell,项目名称:mesa,代码行数:97,


示例26: _mesa_Histogram

static void GLAPIENTRY_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink){   GLuint i;   GLboolean error = GL_FALSE;   GET_CURRENT_CONTEXT(ctx);   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */   if (!ctx->Extensions.EXT_histogram && !ctx->Extensions.ARB_imaging) {      _mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram");      return;   }   if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) {      _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(target)");      return;   }   if (width < 0 || width > HISTOGRAM_TABLE_SIZE) {      if (target == GL_PROXY_HISTOGRAM) {         error = GL_TRUE;      }      else {         if (width < 0)            _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)");         else            _mesa_error(ctx, GL_TABLE_TOO_LARGE, "glHistogram(width)");         return;      }   }   if (width != 0 && !_mesa_is_pow_two(width)) {      if (target == GL_PROXY_HISTOGRAM) {         error = GL_TRUE;      }      else {         _mesa_error(ctx, GL_INVALID_VALUE, "glHistogram(width)");         return;      }   }   if (base_histogram_format(internalFormat) < 0) {      if (target == GL_PROXY_HISTOGRAM) {         error = GL_TRUE;      }      else {         _mesa_error(ctx, GL_INVALID_ENUM, "glHistogram(internalFormat)");         return;      }   }   FLUSH_VERTICES(ctx, _NEW_PIXEL);   /* reset histograms */   for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) {      ctx->Histogram.Count[i][0] = 0;      ctx->Histogram.Count[i][1] = 0;      ctx->Histogram.Count[i][2] = 0;      ctx->Histogram.Count[i][3] = 0;   }   if (error) {      ctx->Histogram.Width = 0;      ctx->Histogram.Format = 0;      ctx->Histogram.RedSize       = 0;      ctx->Histogram.GreenSize     = 0;      ctx->Histogram.BlueSize      = 0;      ctx->Histogram.AlphaSize     = 0;      ctx->Histogram.LuminanceSize = 0;   }   else {      ctx->Histogram.Width = width;      ctx->Histogram.Format = internalFormat;      ctx->Histogram.Sink = sink;      ctx->Histogram.RedSize       = 8 * sizeof(GLuint);      ctx->Histogram.GreenSize     = 8 * sizeof(GLuint);      ctx->Histogram.BlueSize      = 8 * sizeof(GLuint);      ctx->Histogram.AlphaSize     = 8 * sizeof(GLuint);      ctx->Histogram.LuminanceSize = 8 * sizeof(GLuint);   }}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:81,


示例27: _mesa_drawbuffers

//.........这里部分代码省略......... * current FBO.  Called via glDrawBuffer(), glDrawBuffersARB() * * All error checking will have been done prior to calling this function * so nothing should go wrong at this point. * * /param ctx  current context * /param n    number of color outputs to set * /param buffers  array[n] of colorbuffer names, like GL_LEFT. * /param destMask  array[n] of BUFFER_BIT_* bitmasks which correspond to the *                  colorbuffer names.  (i.e. GL_FRONT_AND_BACK => *                  BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT). */void_mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,                  const GLbitfield *destMask){   struct gl_framebuffer *fb = ctx->DrawBuffer;   GLbitfield mask[MAX_DRAW_BUFFERS];   GLboolean newState = GL_FALSE;   if (!destMask) {      /* compute destMask values now */      const GLbitfield supportedMask = supported_buffer_bitmask(ctx, fb);      GLuint output;      for (output = 0; output < n; output++) {         mask[output] = draw_buffer_enum_to_bitmask(buffers[output]);         ASSERT(mask[output] != BAD_MASK);         mask[output] &= supportedMask;      }      destMask = mask;   }   /*    * If n==1, destMask[0] may have up to four bits set.    * Otherwise, destMask[x] can only have one bit set.    */   if (n == 1) {      GLuint count = 0, destMask0 = destMask[0];      while (destMask0) {         GLint bufIndex = _mesa_ffs(destMask0) - 1;         if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {            fb->_ColorDrawBufferIndexes[count] = bufIndex;            newState = GL_TRUE;         }         count++;         destMask0 &= ~(1 << bufIndex);      }      fb->ColorDrawBuffer[0] = buffers[0];      if (fb->_NumColorDrawBuffers != count) {         fb->_NumColorDrawBuffers = count;         newState = GL_TRUE;      }   }   else {      GLuint buf, count = 0;      for (buf = 0; buf < n; buf++ ) {         if (destMask[buf]) {            GLint bufIndex = _mesa_ffs(destMask[buf]) - 1;            /* only one bit should be set in the destMask[buf] field */            ASSERT(_mesa_bitcount(destMask[buf]) == 1);            if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) {               fb->_ColorDrawBufferIndexes[buf] = bufIndex;               newState = GL_TRUE;            }            fb->ColorDrawBuffer[buf] = buffers[buf];            count = buf + 1;         }         else {            if (fb->_ColorDrawBufferIndexes[buf] != -1) {               fb->_ColorDrawBufferIndexes[buf] = -1;               newState = GL_TRUE;            }         }      }      /* set remaining outputs to -1 (GL_NONE) */      while (buf < ctx->Const.MaxDrawBuffers) {         if (fb->_ColorDrawBufferIndexes[buf] != -1) {            fb->_ColorDrawBufferIndexes[buf] = -1;            newState = GL_TRUE;         }         fb->ColorDrawBuffer[buf] = GL_NONE;         buf++;      }      fb->_NumColorDrawBuffers = count;   }   if (fb->Name == 0) {      /* also set context drawbuffer state */      GLuint buf;      for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {         if (ctx->Color.DrawBuffer[buf] != fb->ColorDrawBuffer[buf]) {            ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf];            newState = GL_TRUE;         }      }   }   if (newState)      FLUSH_VERTICES(ctx, _NEW_BUFFERS);}
开发者ID:AchironOS,项目名称:chromium.src,代码行数:101,



注:本文中的FLUSH_VERTICES函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ FL_TEST函数代码示例
C++ FLUSH_CURRENT函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。