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.

191 lines
5.6 KiB

  1. #if _MSC_VER > 1000
  2. #pragma once
  3. #endif // _MSC_VER > 1000
  4. #define RGB_RAST_LIB_NAMESPACE D3D8RGBRast
  5. #if defined(DBG) || defined(_DEBUG)
  6. #define assert(condition) \
  7. do { if(!(condition) && RGB_RAST_LIB_NAMESPACE::Assert(__FILE__, __LINE__, #condition)) DebugBreak(); } while( false)
  8. #else
  9. #define assert(condition) (0)
  10. #endif
  11. // #include <ddrawpr.h>
  12. // Windows
  13. #include <windows.h>
  14. #if !defined(DBG) && !defined(_DEBUG)
  15. #pragma inline_depth( 255)
  16. #endif
  17. #if defined(USE_ICECAP4)
  18. #include <icecap.h>
  19. #endif
  20. #undef max
  21. #undef min
  22. // STL & standard headers.
  23. #include <functional>
  24. #include <algorithm>
  25. #include <iterator>
  26. #include <memory>
  27. #include <limits>
  28. #include <new>
  29. // D3DRGBRast namespace provides shelter from clashing with any customer's
  30. // symbols in their .libs, including any CRT stuff they include. Here, CRT
  31. // pieces can be brought in one by one, assuring there isn't a problem. The
  32. // primary problem found is with bad_alloc. If you look at this CRT header,
  33. // it currently has the class either an inline or a dllimport based on a
  34. // #define. This PCH will pick it up as inline.
  35. // In Debug, or if the compiler chooses not to inline the function, a
  36. // symbol will become present for std::bad_alloc::bad_alloc() in
  37. // d3d8rgb.lib. If someone else links with us and a CRT .lib, which has
  38. // std::bad_alloc::bad_alloc() also as a dllimport, then a conflict occurs.
  39. // Here we can isolate each CRT/ STL piece and provide name mangling
  40. // as neccessary by providing our own namespace.
  41. // We also have to provide private map and set implementations, as CRT has
  42. // a dllimport dependency on _lock. We don't want a thread-safe version
  43. // anyway.
  44. namespace RGB_RAST_LIB_NAMESPACE
  45. {
  46. using std::numeric_limits;
  47. using std::unary_function;
  48. using std::binary_function;
  49. using std::input_iterator_tag;
  50. using std::output_iterator_tag;
  51. using std::forward_iterator_tag;
  52. using std::bidirectional_iterator_tag;
  53. using std::random_access_iterator_tag;
  54. using std::pair;
  55. using std::fill;
  56. using std::copy;
  57. using std::find_if;
  58. using std::auto_ptr;
  59. using std::fill;
  60. using std::less;
  61. using std::bind2nd;
  62. using std::not_equal_to;
  63. using std::equal;
  64. using std::logical_not;
  65. using std::equal_to;
  66. using std::next_permutation;
  67. template< class T>
  68. const T& min( const T& x, const T& y)
  69. { return ( x< y? x: y); }
  70. template< class T>
  71. const T& max( const T& x, const T& y)
  72. { return ( x> y? x: y); }
  73. template< class T>
  74. struct identity:
  75. unary_function< T, T>
  76. {
  77. const result_type& operator()( const argument_type& Arg) const
  78. { return Arg; }
  79. };
  80. template< class Pair>
  81. struct select1st:
  82. unary_function< Pair, typename Pair::first_type>
  83. {
  84. const result_type& operator()( const Pair& p) const
  85. { return p.first; }
  86. };
  87. class exception
  88. {
  89. private:
  90. const char* m_szWhat;
  91. public:
  92. exception() throw()
  93. { m_szWhat= "exception"; }
  94. exception(const char* const& szWhat) throw()
  95. { m_szWhat= szWhat; }
  96. exception(const exception& ex) throw()
  97. { (*this)= ex; }
  98. exception& operator= (const exception& ex) throw()
  99. { m_szWhat= ex.m_szWhat; return *this; }
  100. virtual ~exception() throw()
  101. { }
  102. virtual const char* what() const throw()
  103. { return m_szWhat; }
  104. };
  105. class bad_alloc: public exception
  106. {
  107. public:
  108. bad_alloc(const char *_S = "bad allocation") throw()
  109. : exception(_S) {}
  110. virtual ~bad_alloc() throw()
  111. { }
  112. };
  113. bool Assert(LPCSTR szFile, int nLine, LPCSTR szCondition);
  114. #include "block.h"
  115. #include "allocator.h"
  116. }
  117. using namespace RGB_RAST_LIB_NAMESPACE;
  118. #include <vector>
  119. namespace RGB_RAST_LIB_NAMESPACE
  120. {
  121. // Override the standard vector, in order to provide a change in default
  122. // allocator. std::vector defaults to std::allocator. Should've been able
  123. // to name this "vector", but MSVC seems to have another bug. Keep getting
  124. // errors about std::vector not being defined. So, name it vector2 (which
  125. // compiles fine) and #define vector vector2.
  126. template< class T, class Allocator= allocator< T> >
  127. class vector2:
  128. public std::vector< T, Allocator>
  129. {
  130. public:
  131. typedef std::vector< T, Allocator> std_vector;
  132. explicit vector2( const Allocator& A= Allocator()): std_vector( A)
  133. { }
  134. explicit vector2( typename std_vector::size_type n, const T& x= T(),
  135. const Allocator& A= Allocator()): std_vector( n, x, A)
  136. { }
  137. vector2( const vector2< T, Allocator>& v): std_vector( v)
  138. { }
  139. template< class InputIterator>
  140. vector2( InputIterator f, InputIterator l, const Allocator& A=
  141. Allocator()): std_vector( f, l, A)
  142. { }
  143. ~vector2()
  144. { }
  145. };
  146. #define vector vector2
  147. #include "tree.h"
  148. #include "map.h"
  149. #include "set.h"
  150. #include "list.h"
  151. #include "hash_table.h"
  152. #include "hash_map.h"
  153. }
  154. // DX
  155. // Including d3d8ddi & d3d8sddi makes the pluggable software rasterizer
  156. // a "private" feature as these headers aren't publically available.
  157. #include <ddraw.h>
  158. #include <ddrawi.h>
  159. #include <d3dhal.h>
  160. #include <d3d8p.h>
  161. #include <d3d8ddi.h>
  162. #include <d3d8sddi.h>
  163. #include <DX8SDDIFW.h>
  164. namespace RGB_RAST_LIB_NAMESPACE
  165. {
  166. using namespace DX8SDDIFW;
  167. }
  168. #include "rast.h"
  169. #include "span.h"
  170. #include "setup.hpp"
  171. #include "Surfaces.h"
  172. #include "Driver.h"
  173. #include "Context.h"