Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

eval.c 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* $XFree86$ */
  2. /*
  3. ** License Applicability. Except to the extent portions of this file are
  4. ** made subject to an alternative license as permitted in the SGI Free
  5. ** Software License B, Version 1.1 (the "License"), the contents of this
  6. ** file are subject only to the provisions of the License. You may not use
  7. ** this file except in compliance with the License. You may obtain a copy
  8. ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
  9. ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
  10. **
  11. ** http://oss.sgi.com/projects/FreeB
  12. **
  13. ** Note that, as provided in the License, the Software is distributed on an
  14. ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
  15. ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
  16. ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
  17. ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  18. **
  19. ** Original Code. The Original Code is: OpenGL Sample Implementation,
  20. ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
  21. ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
  22. ** Copyright in any portions created by third parties is as indicated
  23. ** elsewhere herein. All Rights Reserved.
  24. **
  25. ** Additional Notice Provisions: The application programming interfaces
  26. ** established by SGI in conjunction with the Original Code are The
  27. ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
  28. ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
  29. ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
  30. ** Window System(R) (Version 1.3), released October 19, 1998. This software
  31. ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
  32. ** published by SGI, but has not been independently verified as being
  33. ** compliant with the OpenGL(R) version 1.2.1 Specification.
  34. **
  35. */
  36. #include "packrender.h"
  37. /*
  38. ** Routines to pack evaluator maps into the transport buffer. Maps are
  39. ** allowed to have extra arbitrary data, so these routines extract just
  40. ** the information that the GL needs.
  41. */
  42. void __glFillMap1f(GLint k, GLint order, GLint stride,
  43. const GLfloat *points, GLubyte *pc)
  44. {
  45. if (stride == k) {
  46. /* Just copy the data */
  47. __GLX_PUT_FLOAT_ARRAY(0, points, order * k);
  48. } else {
  49. GLint i;
  50. for (i = 0; i < order; i++) {
  51. __GLX_PUT_FLOAT_ARRAY(0, points, k);
  52. points += stride;
  53. pc += k * __GLX_SIZE_FLOAT32;
  54. }
  55. }
  56. }
  57. void __glFillMap1d(GLint k, GLint order, GLint stride,
  58. const GLdouble *points, GLubyte *pc)
  59. {
  60. if (stride == k) {
  61. /* Just copy the data */
  62. __GLX_PUT_DOUBLE_ARRAY(0, points, order * k);
  63. } else {
  64. GLint i;
  65. for (i = 0; i < order; i++) {
  66. __GLX_PUT_DOUBLE_ARRAY(0, points, k);
  67. points += stride;
  68. pc += k * __GLX_SIZE_FLOAT64;
  69. }
  70. }
  71. }
  72. void __glFillMap2f(GLint k, GLint majorOrder, GLint minorOrder,
  73. GLint majorStride, GLint minorStride,
  74. const GLfloat *points, GLfloat *data)
  75. {
  76. GLint i, j, x;
  77. if ((minorStride == k) && (majorStride == minorOrder*k)) {
  78. /* Just copy the data */
  79. __GLX_MEM_COPY(data, points, majorOrder * majorStride *
  80. __GLX_SIZE_FLOAT32);
  81. return;
  82. }
  83. for (i = 0; i < majorOrder; i++) {
  84. for (j = 0; j < minorOrder; j++) {
  85. for (x = 0; x < k; x++) {
  86. data[x] = points[x];
  87. }
  88. points += minorStride;
  89. data += k;
  90. }
  91. points += majorStride - minorStride * minorOrder;
  92. }
  93. }
  94. void __glFillMap2d(GLint k, GLint majorOrder, GLint minorOrder,
  95. GLint majorStride, GLint minorStride,
  96. const GLdouble *points, GLdouble *data)
  97. {
  98. int i,j,x;
  99. if ((minorStride == k) && (majorStride == minorOrder*k)) {
  100. /* Just copy the data */
  101. __GLX_MEM_COPY(data, points, majorOrder * majorStride *
  102. __GLX_SIZE_FLOAT64);
  103. return;
  104. }
  105. #ifdef __GLX_ALIGN64
  106. x = k * __GLX_SIZE_FLOAT64;
  107. #endif
  108. for (i = 0; i<majorOrder; i++) {
  109. for (j = 0; j<minorOrder; j++) {
  110. #ifdef __GLX_ALIGN64
  111. __GLX_MEM_COPY(data, points, x);
  112. #else
  113. for (x = 0; x<k; x++) {
  114. data[x] = points[x];
  115. }
  116. #endif
  117. points += minorStride;
  118. data += k;
  119. }
  120. points += majorStride - minorStride * minorOrder;
  121. }
  122. }