C_WINAPI 79
Graphics.h Guest on 12th May 2020 10:38:14 AM
  1. /*
  2.  * System Interface Library for games
  3.  * Copyright (c) 2007-2020 Andrew Church <[email protected]>
  4.  * Released under the GNU GPL version 3 or later; NO WARRANTY is provided.
  5.  * See the file COPYING.txt for details.
  6.  *
  7.  * src/graphics.h: Internal header for graphics functionality.
  8.  */
  9.  
  10. #ifndef SIL_SRC_GRAPHICS_H
  11. #define SIL_SRC_GRAPHICS_H
  12.  
  13. #include "SIL/graphics.h"  // Include the public header.
  14.  
  15. /*************************************************************************/
  16. /************************** Internal-use macros **************************/
  17. /*************************************************************************/
  18.  
  19. /**
  20.  * GRAPHICS_VERTEX_FORMAT_TYPE, GRAPHICS_VERTEX_FORMAT_OFFSET:  Return the
  21.  * type or offset value from a vertex format entry constructed by the
  22.  * GRAPHICS_VERTEX_FORMAT() macro.
  23.  */
  24. #define GRAPHICS_VERTEX_FORMAT_TYPE(format) \
  25.     ((GraphicsVertexFormatType)((uint32_t)(format) >> 16))
  26. #define GRAPHICS_VERTEX_FORMAT_OFFSET(format) \
  27.     ((uint32_t)(format) & 0xFFFF)
  28.  
  29. /**
  30.  * GRAPHICS_VERTEX_TYPE_IS_USER:  Return whether the given vertex format
  31.  * type is a user attribute for a generated shader.
  32.  */
  33. #define GRAPHICS_VERTEX_TYPE_IS_USER(type) \
  34.     (((type) & 0xF000) == GRAPHICS_VERTEX_USER(0))
  35.  
  36. /**
  37.  * GRAPHICS_VERTEX_TYPE_IS_ATTRIB:  Return whether the given vertex format
  38.  * type is an attribute for a shader object.
  39.  */
  40. #define GRAPHICS_VERTEX_TYPE_IS_ATTRIB(type)  (((type) & 0xC000) == 0xC000)
  41.  
  42. /**
  43.  * GRAPHICS_VERTEX_ATTRIB_COUNT, GRAPHICS_VERTEX_ATTRIB_TYPE,
  44.  * GRAPHICS_VERTEX_ATTRIB_INDEX:  Return the data count, data type, or
  45.  * attribute index from a vertex format type.
  46.  */
  47. #define GRAPHICS_VERTEX_ATTRIB_COUNT(type)  (((type)>>12 & 3) + 1)
  48. #define GRAPHICS_VERTEX_ATTRIB_TYPE(type) \
  49.     ((GraphicsVertexDataType)((type)>>8 & 0xF))
  50. #define GRAPHICS_VERTEX_ATTRIB_INDEX(type)  ((type) & 0xFF)
  51.  
  52. /*************************************************************************/
  53. /************************** Internal interface ***************************/
  54. /*************************************************************************/
  55.  
  56. /**
  57.  * graphics_init:  Initialize the graphics/rendering subsystem.  This does
  58.  * _not_ prepare the display itself; graphics_set_display_mode() must be
  59.  * called before any rendering operations are performed.
  60.  *
  61.  * It is invalid to call any other graphics/rendering functions except
  62.  * graphics_cleanup() without first successfully calling graphics_init().
  63.  *
  64.  * [Return value]
  65.  *     True on success, false on error.
  66.  */
  67. extern int graphics_init(void);
  68.  
  69. /**
  70.  * graphics_cleanup:  Shut down the graphics/rendering subsystem, closing
  71.  * the display if it is open.
  72.  */
  73. extern void graphics_cleanup(void);
  74.  
  75. /*************************************************************************/
  76. /*************************** Test control data ***************************/
  77. /*************************************************************************/
  78.  
  79. #ifdef SIL_INCLUDE_TESTS
  80.  
  81. /**
  82.  * TEST_graphics_sync_count:  Counter for the number of calls to
  83.  * graphics_sync() (including via debug sync).  Reset to zero by
  84.  * graphics_init().
  85.  */
  86. extern int TEST_graphics_sync_count;
  87.  
  88. #endif
  89.  
  90. /*************************************************************************/
  91. /*************************************************************************/
  92.  
  93. #endif  // SIL_SRC_GRAPHICS_H

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.