home *** CD-ROM | disk | FTP | other *** search
/ PC Player 1997 July / PCPL0797.iso / PROGRAMM / VGABENCH / VBENCH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-21  |  2.7 KB  |  91 lines

  1. //-------------------------------VBENCH.H---------------------------------
  2.  
  3. const int desc_maxlen = 30;    // Maximum description string length!
  4.  
  5. //    Enumeration for video mode selection
  6.  
  7. enum vmode {
  8.     mode_13h     = 0,
  9.     tweaked_mode = 1
  10. };
  11.  
  12. //------------------------------------------------------------------------\\
  13. //    struct SharedBenchData
  14. //
  15. //    Simple structure used to hold info on a 'shared' benchmark, i.e. a
  16. //    benchmark which can (and is) performed in both mode 13h and Tweaked
  17. //    mode. The structure holds an array of 2 function pointers, and a
  18. //    description of the benchmark. The 1st function pointer element is
  19. //    for the mode 13h version, the 2nd for the Tweaked mode version.
  20. //------------------------------------------------------------------------\\
  21.  
  22. class SharedBenchData
  23. {
  24.     void (* funcs[2]) (); // array of 2 function pointers
  25.     char * fnc_desc;     // Description of benchmark (up to 30 char's)
  26. public:
  27.     void do_bench(enum vmode v)  // Execute one of the 2 functions
  28.         { (*funcs[v]) (); }
  29.     char * desc()        // Return benchmark description
  30.         { return fnc_desc; }
  31. };
  32.  
  33. //------------------------------------------------------------------------\\
  34. //    struct BenchData
  35. //
  36. //    Simple structure to hold info on mode-specific benchmarks, i.e. a
  37. //    benchmark which works with one video mode (13h or tweaked mode here)
  38. //    The structure holds a pointer to the mode-specific function, and
  39. //    a description of the benchmark.
  40. //------------------------------------------------------------------------\\
  41.  
  42. class BenchData
  43. {
  44.     void (* func) ();   // Mode-specific function
  45.     char * fnc_desc;    // Description of benchmark (up to 30 char's)
  46. public:
  47.     void do_bench()     // Execute mode-specific benchmark
  48.         { func(); }
  49.     char * desc()       // Return benchmark description
  50.         { return fnc_desc; }
  51. };
  52.  
  53.  
  54. //    Mode 13h function prototypes (used below)
  55. extern "C" {
  56.     void M13WriteB();   // straight write-byte
  57.     void M13WriteW1();  // straight write-word
  58.     void M13ReadW1();   // straight read
  59.  
  60.     void M13VTransW1(); // video-to-video transfer,word-aligned
  61. }
  62.  
  63. //    Tweaked mode function prototypes (used below)
  64. extern "C" {
  65.     void TwWriteB(); // planar write-byte
  66.     void TwWriteW1(); // planar write-word
  67.     void TwReadW1();  // planar read-word
  68.  
  69.     void TwVTrans(); // video-to-video hardware transfer
  70. }
  71.  
  72. //    Shared benchmark array
  73. SharedBenchData shared_benches [] =
  74. {
  75.     M13WriteB , TwWriteB , "Byte Blit",
  76.     M13WriteW1, TwWriteW1, "Word Blit,Aligned",
  77.     M13ReadW1 , TwReadW1 , "Word Read,Aligned",
  78. };
  79.  
  80. //    Mode 13h-specific benchmark array
  81. BenchData m13_benches [] =
  82. {
  83.     M13VTransW1, "Word Video Transfer,Aligned",
  84. };
  85.  
  86. //    Tweaked mode-specific benchmark array
  87. BenchData tw_benches [] =
  88. {
  89.     TwVTrans, "Hardware Video Transfer",
  90. };
  91.