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.

107 lines
3.7 KiB

  1. /*
  2. ** Copyright 1995-2095, 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. #include "glslib.h"
  18. GLSopcode __glsMapOpcode(GLSopcode inOpcode) {
  19. GLint i;
  20. const GLint page = __GLS_OPCODE_PAGE(inOpcode);
  21. if (page < __GLS_OPCODE_PAGE_MAPPED0) return inOpcode;
  22. #if __GLS_MAPPED_OPCODE_PAGE_COUNT
  23. for (i = 0 ; i < __GLS_MAPPED_OPCODE_PAGE_COUNT ; ++i) {
  24. if (page == __glsOpPageMap[i]) return (
  25. __GLS_OPCODE(
  26. __GLS_OPCODE_PAGE_MAPPED0 + i,
  27. __GLS_OPCODE_OFFSET(inOpcode)
  28. )
  29. );
  30. }
  31. #endif /* __GLS_MAPPED_OPCODE_PAGE_COUNT */
  32. return GLS_NONE;
  33. }
  34. GLSenum __glsOpcodeAPI(GLSopcode inOpcode) {
  35. switch (__GLS_OPCODE_PAGE(inOpcode)) {
  36. case __GLS_OPCODE_PAGE_GLS0:
  37. case __GLS_OPCODE_PAGE_GLS1:
  38. case __GLS_OPCODE_PAGE_GLS2:
  39. return (
  40. __glsOpcodeString[__glsMapOpcode(inOpcode)] ?
  41. GLS_API_GLS :
  42. GLS_NONE
  43. );
  44. case __GLS_OPCODE_PAGE_GL0:
  45. case __GLS_OPCODE_PAGE_GL1:
  46. case __GLS_OPCODE_PAGE_GL2:
  47. case __GLS_OPCODE_PAGE_GL3:
  48. case __GLS_OPCODE_PAGE_GL4:
  49. case __GLS_OPCODE_PAGE_GL5:
  50. case __GLS_OPCODE_PAGE_GL6:
  51. case __GLS_OPCODE_PAGE_GL7:
  52. case __GLS_OPCODE_PAGE_GL8:
  53. case __GLS_OPCODE_PAGE_GL9:
  54. case __GLS_OPCODE_PAGE_GL10:
  55. case __GLS_OPCODE_PAGE_GL11:
  56. case __GLS_OPCODE_PAGE_GL12:
  57. case __GLS_OPCODE_PAGE_GL13:
  58. case __GLS_OPCODE_PAGE_GL14:
  59. case __GLS_OPCODE_PAGE_GL15:
  60. case __GLS_OPCODE_PAGE_GL16:
  61. case __GLS_OPCODE_PAGE_GL17:
  62. case __GLS_OPCODE_PAGE_GL18:
  63. case __GLS_OPCODE_PAGE_GL19:
  64. // DrewB - 1.1
  65. case __GLS_OPCODE_PAGE_GL20:
  66. case __GLS_OPCODE_PAGE_GL_SGI0:
  67. case __GLS_OPCODE_PAGE_GL_SGI1:
  68. case __GLS_OPCODE_PAGE_GL_SGI2:
  69. case __GLS_OPCODE_PAGE_GL_SGI3:
  70. case __GLS_OPCODE_PAGE_GL_SGI4:
  71. // DrewB - ColorSubTable
  72. case __GLS_OPCODE_PAGE_GL_MSFT0:
  73. return (
  74. __glsOpcodeString[__glsMapOpcode(inOpcode)] ?
  75. GLS_API_GL :
  76. GLS_NONE
  77. );
  78. }
  79. return GLS_NONE;
  80. }
  81. GLSopcode __glsUnmapOpcode(GLSopcode inOpcode) {
  82. GLint i;
  83. const GLint page = __GLS_OPCODE_PAGE(inOpcode);
  84. if (page < __GLS_OPCODE_PAGE_MAPPED0) return inOpcode;
  85. #if __GLS_MAPPED_OPCODE_PAGE_COUNT
  86. for (i = 0 ; i < __GLS_MAPPED_OPCODE_PAGE_COUNT ; ++i) {
  87. if (page == __GLS_OPCODE_PAGE_MAPPED0 + i) return (
  88. __GLS_OPCODE(__glsOpPageMap[i], __GLS_OPCODE_OFFSET(inOpcode))
  89. );
  90. }
  91. #endif /* __GLS_MAPPED_OPCODE_PAGE_COUNT */
  92. return GLS_NONE;
  93. }
  94. GLboolean __glsValidateOpcode(GLSopcode inOpcode) {
  95. if (!__glsOpcodeAPI(inOpcode)) {
  96. __GLS_RAISE_ERROR(GLS_UNSUPPORTED_COMMAND);
  97. return GL_FALSE;
  98. }
  99. return GL_TRUE;
  100. }