/** * Set a program parameter register. * \note Called from the GL API dispatcher. */ void _mesa_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_VERTEX_PROGRAM_NV) { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameter4fNV"); return; } if (index >= VP_NUM_PROG_REGS) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameter4fNV"); return; } index += VP_PROG_REG_START; COPY_4V(ctx->VertexProgram.Machine.Registers[index], params); }
void GLAPIENTRY _mesa_ClipControl(GLenum origin, GLenum depth) { GET_CURRENT_CONTEXT(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClipControl(%s, %s)\n", _mesa_enum_to_string(origin), _mesa_enum_to_string(depth)); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ARB_clip_control) { _mesa_error(ctx, GL_INVALID_OPERATION, "glClipControl"); return; } clip_control(ctx, origin, depth, false); }
/** * Set separate blend source/dest factors for one color buffer/target. */ void GLAPIENTRY _mesa_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.ARB_draw_buffers_blend) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBlendFunc[Separate]i()"); return; } if (buf >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glBlendFuncSeparatei(buffer=%u)", buf); return; } if (!validate_blend_factors(ctx, "glBlendFuncSeparatei", sfactorRGB, dfactorRGB, sfactorA, dfactorA)) { return; } if (ctx->Color.Blend[buf].SrcRGB == sfactorRGB && ctx->Color.Blend[buf].DstRGB == dfactorRGB && ctx->Color.Blend[buf].SrcA == sfactorA && ctx->Color.Blend[buf].DstA == dfactorA) return; /* no change */ FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.Blend[buf].SrcRGB = sfactorRGB; ctx->Color.Blend[buf].DstRGB = dfactorRGB; ctx->Color.Blend[buf].SrcA = sfactorA; ctx->Color.Blend[buf].DstA = dfactorA; ctx->Color._BlendFuncPerBuffer = GL_TRUE; if (ctx->Driver.BlendFuncSeparatei) { ctx->Driver.BlendFuncSeparatei(ctx, buf, sfactorRGB, dfactorRGB, sfactorA, dfactorA); } }
/** * Generate texture names. * * \param n number of texture names to be generated. * \param textures an array in which will hold the generated texture names. * * \sa glGenTextures(). * * Calls _mesa_HashFindFreeKeyBlock() to find a block of free texture * IDs which are stored in \p textures. Corresponding empty texture * objects are also generated. */ void GLAPIENTRY _mesa_GenTextures( GLsizei n, GLuint *textures ) { GET_CURRENT_CONTEXT(ctx); GLuint first; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glGenTextures" ); return; } if (!textures) return; /* * This must be atomic (generation and allocation of texture IDs) */ _glthread_LOCK_MUTEX(ctx->Shared->Mutex); first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); /* Allocate new, empty texture objects */ for (i = 0; i < n; i++) { struct gl_texture_object *texObj; GLuint name = first + i; GLenum target = 0; texObj = ctx->Driver.NewTextureObject(ctx, name, target); if (!texObj) { _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures"); return; } /* insert into hash table */ _mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj); textures[i] = name; } _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); }
static void GLAPIENTRY _mesa_GetPixelMapfv( GLenum map, GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); GLuint mapsize, i; const struct gl_pixelmap *pm; ASSERT_OUTSIDE_BEGIN_END(ctx); pm = get_pixelmap(ctx, map); if (!pm) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapfv(map)"); return; } mapsize = pm->Size; if (!validate_pbo_access(ctx, &ctx->Pack, mapsize, GL_INTENSITY, GL_FLOAT, values)) { return; } values = (GLfloat *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values); if (!values) { if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetPixelMapfv(PBO is mapped)"); } return; } if (map == GL_PIXEL_MAP_S_TO_S) { /* special case */ for (i = 0; i < mapsize; i++) { values[i] = (GLfloat) ctx->PixelMaps.StoS.Map[i]; } } else { memcpy(values, pm->Map, mapsize * sizeof(GLfloat)); } _mesa_unmap_pbo_dest(ctx, &ctx->Pack); }
/** * Set the line stipple pattern. * * \param factor pattern scale factor. * \param pattern bit pattern. * * \sa glLineStipple(). * * Updates gl_line_attrib::StippleFactor and gl_line_attrib::StipplePattern. On * change flushes the vertices and notifies the driver via * the dd_function_table::LineStipple callback. */ void GLAPIENTRY _mesa_LineStipple( GLint factor, GLushort pattern ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); factor = CLAMP( factor, 1, 256 ); if (ctx->Line.StippleFactor == factor && ctx->Line.StipplePattern == pattern) return; FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.StippleFactor = factor; ctx->Line.StipplePattern = pattern; if (ctx->Driver.LineStipple) ctx->Driver.LineStipple( ctx, factor, pattern ); }
void GLAPIENTRY _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) { struct gl_texture_unit *texUnit; struct gl_texgen *texgen; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)"); return; } texUnit = _mesa_get_current_tex_unit(ctx); texgen = get_texgen(ctx, texUnit, coord); if (!texgen) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)"); return; } switch (pname) { case GL_TEXTURE_GEN_MODE: params[0] = ENUM_TO_FLOAT(texgen->Mode); break; case GL_OBJECT_PLANE: if (ctx->API != API_OPENGL) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" ); return; } COPY_4V(params, texgen->ObjectPlane); break; case GL_EYE_PLANE: if (ctx->API != API_OPENGL) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" ); return; } COPY_4V(params, texgen->EyePlane); break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); } }
void GLAPIENTRY _mesa_ClearDepth( GLclampd depth ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClearDepth(%f)\n", depth); depth = CLAMP( depth, 0.0, 1.0 ); if (ctx->Depth.Clear == depth) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.Clear = depth; if (ctx->Driver.ClearDepth) (*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear ); }
void GLAPIENTRY _mesa_DisableVertexAttribArrayARB(GLuint index) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.VertexProgram.MaxAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, "glEnableVertexAttribArrayARB(index)"); return; } ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_FALSE; ctx->Array.ArrayObj->_Enabled &= ~_NEW_ARRAY_ATTRIB(index); ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); }
/** New in GL 3.0 */ void GLAPIENTRY _mesa_GetTexParameterIiv(GLenum target, GLenum pname, GLint *params) { struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_TRUE); if (!texObj) return; switch (pname) { case GL_TEXTURE_BORDER_COLOR: COPY_4V(params, texObj->Sampler.BorderColor.i); break; default: _mesa_GetTexParameteriv(target, pname, params); } }
/** * Establish a buffer for selection mode values. * * \param size buffer size. * \param buffer buffer. * * \sa glSelectBuffer(). * * \note this function can't be put in a display list. * * Verifies we're not in selection mode, flushes the vertices and initialize * the fields in __struct gl_contextRec::Select with the given buffer. */ static void GLAPIENTRY _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode==GL_SELECT) { _mesa_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" ); return; /* KW: added return */ } FLUSH_VERTICES(ctx, _NEW_RENDERMODE); ctx->Select.Buffer = buffer; ctx->Select.BufferSize = size; ctx->Select.BufferCount = 0; ctx->Select.HitFlag = GL_FALSE; ctx->Select.HitMinZ = 1.0; ctx->Select.HitMaxZ = 0.0; }
void GLAPIENTRY _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) { struct gl_query_object *q = NULL; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (id) q = lookup_query_object(ctx, id); if (!q || q->Active) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetQueryObjectuivARB(id=%d is invalid or active)", id); return; } switch (pname) { case GL_QUERY_RESULT_ARB: while (!q->Ready) { /* Wait for the query to finish! */ /* If using software rendering, the result will always be ready * by time we get here. Otherwise, we must be using hardware! */ ASSERT(ctx->Driver.EndQuery); } /* if result is too large for returned type, clamp to max value */ if (q->Result > 0xffffffff) { *params = 0xffffffff; } else { *params = q->Result; } break; case GL_QUERY_RESULT_AVAILABLE_ARB: /* XXX revisit when we have a hardware implementation! */ *params = q->Ready; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectuivARB(pname)"); return; } }
static 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 (!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] ); } } store_pixelmap(ctx, map, mapsize, fvalues); }
void GLAPIENTRY _mesa_EndQueryARB(GLenum target) { 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, "glEndQueryARB(target)"); return; } q = ctx->Query.CurrentOcclusionObject; ctx->Query.CurrentOcclusionObject = NULL; break; #if FEATURE_EXT_timer_query case GL_TIME_ELAPSED_EXT: if (!ctx->Extensions.EXT_timer_query) { _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); return; } q = ctx->Query.CurrentTimerObject; ctx->Query.CurrentTimerObject = NULL; break; #endif default: _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); return; } if (!q || !q->Active) { _mesa_error(ctx, GL_INVALID_OPERATION, "glEndQueryARB(no matching glBeginQueryARB)"); return; } q->Active = GL_FALSE; ctx->Driver.EndQuery(ctx, q); }
void GLAPIENTRY _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) { GLboolean need_update; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); texObj = get_texobj(ctx, target, GL_FALSE); if (!texObj) return; switch (pname) { case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_PRIORITY: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: { GLfloat fparam[4]; fparam[0] = (GLfloat) param; fparam[1] = fparam[2] = fparam[3] = 0.0F; /* convert int param to float */ need_update = set_tex_parameterf(ctx, texObj, pname, fparam); } break; default: /* this will generate an error if pname is illegal */ { GLint iparam[4]; iparam[0] = param; iparam[1] = iparam[2] = iparam[3] = 0; need_update = set_tex_parameteri(ctx, texObj, pname, iparam); } } if (ctx->Driver.TexParameter && need_update) { GLfloat fparam = (GLfloat) param; ctx->Driver.TexParameter(ctx, target, texObj, pname, &fparam); } }
void GLAPIENTRY _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); GLint i; GLfloat * dest; ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); if (count <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(count)"); } if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { if ((index + count) > ctx->Const.FragmentProgram.MaxEnvParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(index + count)"); return; } dest = ctx->FragmentProgram.Parameters[index]; } else if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { if ((index + count) > ctx->Const.VertexProgram.MaxEnvParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameters4fv(index + count)"); return; } dest = ctx->VertexProgram.Parameters[index]; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramEnvParameters4fv(target)"); return; } for ( i = 0 ; i < count ; i++ ) { COPY_4V(dest, params); params += 4; dest += 4; } }
void GLAPIENTRY _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); struct gl_program *prog; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); if (count <= 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fv(count)"); } if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { if ((index + count) > ctx->Const.FragmentProgram.MaxLocalParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fvEXT(index + count)"); return; } prog = &(ctx->FragmentProgram.Current->Base); } else if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) { if ((index + count) > ctx->Const.VertexProgram.MaxLocalParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fvEXT(index + count)"); return; } prog = &(ctx->VertexProgram.Current->Base); } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramLocalParameters4fvEXT(target)"); return; } for (i = 0; i < count; i++) { ASSERT((index + i) < MAX_PROGRAM_LOCAL_PARAMS); COPY_4V(prog->LocalParams[index + i], params); params += 4; } }
/** * Push a name into the name stack. * * \param name name. * * Verifies we are in selection mode and that the name stack is not full. * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), * and adds the name to the top of the name stack. * * sa __struct gl_contextRec::Select. */ static void GLAPIENTRY _mesa_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode != GL_SELECT) { return; } FLUSH_VERTICES(ctx, _NEW_RENDERMODE); if (ctx->Select.HitFlag) { write_hit_record( ctx ); } if (ctx->Select.NameStackDepth >= MAX_NAME_STACK_DEPTH) { _mesa_error( ctx, GL_STACK_OVERFLOW, "glPushName" ); } else ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name; }
void GLAPIENTRY _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object *bufObj; ASSERT_OUTSIDE_BEGIN_END(ctx); bufObj = buffer_object_subdata_range_good( ctx, target, offset, size, "glBufferSubDataARB" ); if (!bufObj) { /* error already recorded */ return; } bufObj->Written = GL_TRUE; ASSERT(ctx->Driver.BufferSubData); ctx->Driver.BufferSubData( ctx, target, offset, size, data, bufObj ); }
/** * Set the line width. * * \param width line width in pixels. * * \sa glLineWidth(). */ void GLAPIENTRY _mesa_LineWidth( GLfloat width ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (width<=0.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glLineWidth" ); return; } if (ctx->Line.Width == width) return; FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.Width = width; if (ctx->Driver.LineWidth) ctx->Driver.LineWidth(ctx, width); }
void GLAPIENTRY _mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (index >= ctx->Const.VertexProgram.MaxAttribs) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)"); return; } if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerARB(pname)"); return; } ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr; }
void GLAPIENTRY _mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params) { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object * bufObj; ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname != GL_BUFFER_MAP_POINTER_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)"); return; } bufObj = buffer_object_get_target( ctx, target, "GetBufferPointervARB" ); if (!bufObj || bufObj->Name == 0) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferPointervARB" ); return; } *params = bufObj->Pointer; }
void glDepthFunc(GLenum func) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); switch (func) { case GL_NEVER: case GL_LESS: case GL_EQUAL: case GL_LEQUAL: case GL_GREATER: case GL_NOTEQUAL: case GL_GEQUAL: case GL_ALWAYS: break; default: _sgl_error(ctx, GL_INVALID_ENUM, "glDepthFunc(): Invalid mode\n"); return; } ctx->depth.clear = depth; }
void GLAPIENTRY _mesa_PolygonOffset( GLfloat factor, GLfloat units ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units); if (ctx->Polygon.OffsetFactor == factor && ctx->Polygon.OffsetUnits == units) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.OffsetFactor = factor; ctx->Polygon.OffsetUnits = units; if (ctx->Driver.PolygonOffset) ctx->Driver.PolygonOffset( ctx, factor, units ); }
/** * Called by glPolygonStipple. */ void GLAPIENTRY _mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glGetPolygonStipple\n"); dest = _mesa_map_validate_pbo_dest(ctx, 2, &ctx->Pack, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, bufSize, dest, "glGetPolygonStipple"); if (!dest) return; _mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &ctx->Pack); _mesa_unmap_pbo_dest(ctx, &ctx->Pack); }
void GLAPIENTRY _mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { const GLfloat *v = get_current_attrib(ctx, index, "glGetVertexAttribdv"); if (v != NULL) { params[0] = (GLdouble) v[0]; params[1] = (GLdouble) v[1]; params[2] = (GLdouble) v[2]; params[3] = (GLdouble) v[3]; } } else { params[0] = (GLdouble) get_vertex_array_attrib(ctx, index, pname, "glGetVertexAttribdv"); } }
/** * Pop a name into the name stack. * * Verifies we are in selection mode and that the name stack is not empty. * Flushes vertices. If there is a hit flag writes it (via write_hit_record()), * and removes top-most name in the name stack. * * sa __struct gl_contextRec::Select. */ static void GLAPIENTRY _mesa_PopName( void ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode != GL_SELECT) { return; } FLUSH_VERTICES(ctx, _NEW_RENDERMODE); if (ctx->Select.HitFlag) { write_hit_record( ctx ); } if (ctx->Select.NameStackDepth == 0) { _mesa_error( ctx, GL_STACK_UNDERFLOW, "glPopName" ); } else ctx->Select.NameStackDepth--; }
/** * Set current point size. * \param size point diameter in pixels * \sa glPointSize(). */ void GLAPIENTRY _mesa_PointSize( GLfloat size ) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (size <= 0.0) { _mesa_error( ctx, GL_INVALID_VALUE, "glPointSize" ); return; } if (ctx->Point.Size == size) return; FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.Size = size; if (ctx->Driver.PointSize) ctx->Driver.PointSize(ctx, size); }
/** * Set a program parameter register. * \note Called from the GL API dispatcher. */ void _mesa_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_VERTEX_PROGRAM_NV) { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameter4dNV"); return; } if (index >= VP_NUM_PROG_REGS) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameter4dNV"); return; } index += VP_PROG_REG_START; ASSIGN_4V(ctx->VertexProgram.Machine.Registers[index], (GLfloat)x, (GLfloat)y, (GLfloat)z, (GLfloat)w); }
/** * Set the stencil writing mask. * * \param mask bit-mask to enable/disable writing of individual bits in the * stencil planes. * * \sa glStencilMask(). * * Updates gl_stencil_attrib::WriteMask. On change flushes the vertices and * notifies the driver via the dd_function_table::StencilMask callback. */ void GLAPIENTRY _mesa_StencilMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); const GLint face = ctx->Stencil.ActiveFace; if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glStencilMask()\n"); ASSERT_OUTSIDE_BEGIN_END(ctx); if (face != 0) { /* Only modify the EXT_stencil_two_side back-face state. */ if (ctx->Stencil.WriteMask[face] == mask) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.WriteMask[face] = mask; /* Only propagate the change to the driver if EXT_stencil_two_side * is enabled. */ if (ctx->Driver.StencilMaskSeparate && ctx->Stencil.TestTwoSide) { ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, mask); } } else { /* set both front and back state */ if (ctx->Stencil.WriteMask[0] == mask && ctx->Stencil.WriteMask[1] == mask) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask; if (ctx->Driver.StencilMaskSeparate) { ctx->Driver.StencilMaskSeparate(ctx, ((ctx->Stencil.TestTwoSide) ? GL_FRONT : GL_FRONT_AND_BACK), mask); } } }