/*1* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)2* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* the rights to use, copy, modify, merge, publish, distribute, sublicense,8* and/or sell copies of the Software, and to permit persons to whom the9* Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice including the dates of first publication and12* either this permission notice or a reference to13* http://oss.sgi.com/projects/FreeB/14* shall be included in all copies or substantial portions of the Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS17* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL19* SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,20* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF21* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE22* SOFTWARE.23*24* Except as contained in this notice, the name of Silicon Graphics, Inc.25* shall not be used in advertising or otherwise to promote the sale, use or26* other dealings in this Software without prior written authorization from27* Silicon Graphics, Inc.28*/2930#include "packrender.h"3132/*33** Routines to pack evaluator maps into the transport buffer. Maps are34** allowed to have extra arbitrary data, so these routines extract just35** the information that the GL needs.36*/3738void39__glFillMap1f(GLint k, GLint order, GLint stride,40const GLfloat * points, GLubyte * pc)41{42if (stride == k) {43/* Just copy the data */44__GLX_PUT_FLOAT_ARRAY(0, points, order * k);45}46else {47GLint i;4849for (i = 0; i < order; i++) {50__GLX_PUT_FLOAT_ARRAY(0, points, k);51points += stride;52pc += k * __GLX_SIZE_FLOAT32;53}54}55}5657void58__glFillMap1d(GLint k, GLint order, GLint stride,59const GLdouble * points, GLubyte * pc)60{61if (stride == k) {62/* Just copy the data */63__GLX_PUT_DOUBLE_ARRAY(0, points, order * k);64}65else {66GLint i;67for (i = 0; i < order; i++) {68__GLX_PUT_DOUBLE_ARRAY(0, points, k);69points += stride;70pc += k * __GLX_SIZE_FLOAT64;71}72}73}7475void76__glFillMap2f(GLint k, GLint majorOrder, GLint minorOrder,77GLint majorStride, GLint minorStride,78const GLfloat * points, GLfloat * data)79{80GLint i, j, x;8182if ((minorStride == k) && (majorStride == minorOrder * k)) {83/* Just copy the data */84__GLX_MEM_COPY(data, points, majorOrder * majorStride *85__GLX_SIZE_FLOAT32);86return;87}88for (i = 0; i < majorOrder; i++) {89for (j = 0; j < minorOrder; j++) {90for (x = 0; x < k; x++) {91data[x] = points[x];92}93points += minorStride;94data += k;95}96points += majorStride - minorStride * minorOrder;97}98}99100void101__glFillMap2d(GLint k, GLint majorOrder, GLint minorOrder,102GLint majorStride, GLint minorStride,103const GLdouble * points, GLdouble * data)104{105int i, j, x;106107if ((minorStride == k) && (majorStride == minorOrder * k)) {108/* Just copy the data */109__GLX_MEM_COPY(data, points, majorOrder * majorStride *110__GLX_SIZE_FLOAT64);111return;112}113114#ifdef __GLX_ALIGN64115x = k * __GLX_SIZE_FLOAT64;116#endif117for (i = 0; i < majorOrder; i++) {118for (j = 0; j < minorOrder; j++) {119#ifdef __GLX_ALIGN64120__GLX_MEM_COPY(data, points, x);121#else122for (x = 0; x < k; x++) {123data[x] = points[x];124}125#endif126points += minorStride;127data += k;128}129points += majorStride - minorStride * minorOrder;130}131}132133134