Leaked source code of windows server 2003
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.

119 lines
3.4 KiB

  1. /*
  2. ** Copyright 1991, Silicon Graphics, Inc.
  3. ** All Rights Reserved.
  4. **
  5. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6. ** the contents of this file may not be disclosed to third parties, copied or
  7. ** duplicated in any form, in whole or in part, without the prior written
  8. ** permission of Silicon Graphics, Inc.
  9. **
  10. ** RESTRICTED RIGHTS LEGEND:
  11. ** Use, duplication or disclosure by the Government is subject to restrictions
  12. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15. ** rights reserved under the Copyright Laws of the United States.
  16. **
  17. ** $Revision: 1.26 $
  18. ** $Date: 1993/11/29 01:18:49 $
  19. */
  20. #include "precomp.h"
  21. #pragma hdrstop
  22. #include "attrib.h"
  23. static const
  24. struct defaultMap {
  25. GLint index;
  26. GLint k;
  27. __GLfloat values[4];
  28. } defaultMaps[__GL_MAP_RANGE_COUNT] = {
  29. {__GL_C4, 4, 1.0, 1.0, 1.0, 1.0},
  30. {__GL_I , 1, 1.0, 0.0, 0.0, 0.0},
  31. {__GL_N3, 3, 0.0, 0.0, 1.0, 0.0},
  32. {__GL_T1, 1, 0.0, 0.0, 0.0, 0.0},
  33. {__GL_T2, 2, 0.0, 0.0, 0.0, 0.0},
  34. {__GL_T3, 3, 0.0, 0.0, 0.0, 0.0},
  35. {__GL_T4, 4, 0.0, 0.0, 0.0, 1.0},
  36. {__GL_V3, 3, 0.0, 0.0, 0.0, 0.0},
  37. {__GL_V4, 4, 0.0, 0.0, 0.0, 1.0},
  38. };
  39. void FASTCALL __glInitEvaluatorState(__GLcontext *gc)
  40. {
  41. int i,j;
  42. const struct defaultMap *defMap;
  43. __GLevaluator1 *eval1;
  44. __GLevaluator2 *eval2;
  45. __GLfloat **eval1Data;
  46. __GLfloat **eval2Data;
  47. for (i = 0; i < __GL_MAP_RANGE_COUNT; i++) {
  48. defMap = &(defaultMaps[i]);
  49. eval1 = &(gc->eval.eval1[i]);
  50. eval2 = &(gc->eval.eval2[i]);
  51. eval1Data = &(gc->eval.eval1Data[i]);
  52. eval2Data = &(gc->eval.eval2Data[i]);
  53. eval1->order = 1;
  54. eval1->u1 = __glZero;
  55. eval1->u2 = __glOne;
  56. eval1->k = defMap->k;
  57. eval2->majorOrder = 1;
  58. eval2->minorOrder = 1;
  59. eval2->u1 = __glZero;
  60. eval2->u2 = __glOne;
  61. eval2->v1 = __glZero;
  62. eval2->v2 = __glOne;
  63. eval2->k = defMap->k;
  64. *eval1Data = (__GLfloat *)
  65. GCALLOC(gc, (size_t) (sizeof(__GLfloat) * defMap->k));
  66. #ifdef NT
  67. if (NULL == *eval1Data) {
  68. return;
  69. }
  70. #endif /* NT */
  71. *eval2Data = (__GLfloat *)
  72. GCALLOC(gc, (size_t) (sizeof(__GLfloat) * defMap->k));
  73. #ifdef NT
  74. if (NULL == *eval2Data) {
  75. return;
  76. }
  77. #endif /* NT */
  78. for (j = 0; j < defMap->k; j++) {
  79. (*eval1Data)[j] = defMap->values[j];
  80. (*eval2Data)[j] = defMap->values[j];
  81. }
  82. }
  83. gc->eval.uorder = __glZero;
  84. gc->eval.vorder = __glZero;
  85. gc->eval.evalStackState = __glZero;
  86. gc->state.evaluator.u1.start = __glZero;
  87. gc->state.evaluator.u2.start = __glZero;
  88. gc->state.evaluator.v2.start = __glZero;
  89. gc->state.evaluator.u1.finish = __glOne;
  90. gc->state.evaluator.u2.finish = __glOne;
  91. gc->state.evaluator.v2.finish = __glOne;
  92. gc->state.evaluator.u1.n = 1;
  93. gc->state.evaluator.u2.n = 1;
  94. gc->state.evaluator.v2.n = 1;
  95. }
  96. void FASTCALL __glFreeEvaluatorState(__GLcontext *gc)
  97. {
  98. int i;
  99. __GLevaluatorMachine *evals = &gc->eval;
  100. for (i = 0; i < __GL_MAP_RANGE_COUNT; i++) {
  101. if (evals->eval1Data[i]) {
  102. GCFREE(gc, evals->eval1Data[i]);
  103. evals->eval1Data[i] = 0;
  104. }
  105. if (evals->eval2Data[i]) {
  106. GCFREE(gc, evals->eval2Data[i]);
  107. evals->eval2Data[i] = 0;
  108. }
  109. }
  110. }