this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added GPU_bool to make boolean intentions more clear.

+185 -165
+55 -38
include/SDL_gpu.h
··· 24 24 #define SDL_GPU_USE_SDL1 25 25 #endif 26 26 27 + // Use bool type if available 28 + #if defined(_MSC_VER) 29 + // As of 2016, MSVC still doesn't have bool. 30 + #include <WinDef.h> 31 + #define GPU_bool BOOL 32 + #elif defined(__cplusplus) 33 + #define GPU_bool bool 34 + #elif __STDC_VERSION__ >= 199901L 35 + #define GPU_bool _Bool 36 + #else 37 + // Fall back to compatibility with MSVC BOOL 38 + #define GPU_bool int 39 + #endif 40 + 41 + static const GPU_bool GPU_FALSE = 0; 42 + static const GPU_bool GPU_TRUE = 1; 43 + 27 44 typedef struct GPU_Renderer GPU_Renderer; 28 45 typedef struct GPU_Target GPU_Target; 29 46 ··· 223 240 struct GPU_Renderer* renderer; 224 241 GPU_Target* target; 225 242 Uint16 w, h; 226 - Uint8 using_virtual_resolution; 243 + GPU_bool using_virtual_resolution; 227 244 GPU_FormatEnum format; 228 245 int num_layers; 229 246 int bytes_per_pixel; 230 247 Uint16 base_w, base_h; // Original image dimensions 231 248 Uint16 texture_w, texture_h; // Underlying texture dimensions 232 - Uint8 has_mipmaps; 249 + GPU_bool has_mipmaps; 233 250 234 251 float anchor_x; // Normalized coords for the point at which the image is blitted. Default is (0.5, 0.5), that is, the image is drawn centered. 235 252 float anchor_y; // These are interpreted according to GPU_SetCoordinateMode() and range from (0.0 - 1.0) normally. 236 253 237 254 SDL_Color color; 238 - Uint8 use_blending; 255 + GPU_bool use_blending; 239 256 GPU_BlendMode blend_mode; 240 257 GPU_FilterEnum filter_mode; 241 258 GPU_SnapEnum snap_mode; ··· 244 261 245 262 void* data; 246 263 int refcount; 247 - Uint8 is_alias; 264 + GPU_bool is_alias; 248 265 } GPU_Image; 249 266 250 267 ··· 303 320 { 304 321 /*! SDL_GLContext */ 305 322 void* context; 306 - Uint8 failed; 323 + GPU_bool failed; 307 324 308 325 /*! SDL window ID */ 309 326 Uint32 windowID; ··· 325 342 Uint32 default_textured_shader_program; 326 343 Uint32 default_untextured_shader_program; 327 344 328 - Uint8 shapes_use_blending; 345 + GPU_bool shapes_use_blending; 329 346 GPU_BlendMode shapes_blend_mode; 330 347 float line_thickness; 331 - Uint8 use_texturing; 348 + GPU_bool use_texturing; 332 349 333 350 int matrix_mode; 334 351 GPU_MatrixStack projection_matrix; ··· 354 371 GPU_Image* image; 355 372 void* data; 356 373 Uint16 w, h; 357 - Uint8 using_virtual_resolution; 374 + GPU_bool using_virtual_resolution; 358 375 Uint16 base_w, base_h; // The true dimensions of the underlying image or window 359 - Uint8 use_clip_rect; 376 + GPU_bool use_clip_rect; 360 377 GPU_Rect clip_rect; 361 - Uint8 use_color; 378 + GPU_bool use_color; 362 379 SDL_Color color; 363 380 364 381 GPU_Rect viewport; 365 382 366 383 /*! Perspective and object viewing transforms. */ 367 384 GPU_Camera camera; 368 - Uint8 use_camera; 385 + GPU_bool use_camera; 369 386 370 387 /*! Renderer context data. NULL if the target does not represent a window or rendering context. */ 371 388 GPU_Context* context; 372 389 int refcount; 373 - Uint8 is_alias; 390 + GPU_bool is_alias; 374 391 }; 375 392 376 393 /*! \ingroup Initialization ··· 501 518 /*! \ingroup ShaderInterface */ 502 519 typedef struct GPU_AttributeFormat 503 520 { 504 - Uint8 is_per_sprite; // Per-sprite values are expanded to 4 vertices 521 + GPU_bool is_per_sprite; // Per-sprite values are expanded to 4 vertices 505 522 int num_elems_per_value; 506 523 GPU_TypeEnum type; // GPU_TYPE_FLOAT, GPU_TYPE_INT, GPU_TYPE_UNSIGNED_INT, etc. 507 - Uint8 normalize; 524 + GPU_bool normalize; 508 525 int stride_bytes; // Number of bytes between two vertex specifications 509 526 int offset_bytes; // Number of bytes to skip at the beginning of 'values' 510 527 } GPU_AttributeFormat; ··· 520 537 /*! \ingroup ShaderInterface */ 521 538 typedef struct GPU_AttributeSource 522 539 { 523 - Uint8 enabled; 540 + GPU_bool enabled; 524 541 int num_values; 525 542 void* next_value; 526 543 // Automatic storage format ··· 602 619 GPU_Target* current_context_target; 603 620 604 621 /*! 0 for inverted, 1 for mathematical */ 605 - Uint8 coordinate_mode; 622 + GPU_bool coordinate_mode; 606 623 607 624 /*! Default is (0.5, 0.5) - images draw centered. */ 608 625 float default_image_anchor_x; ··· 679 696 * \return 1 if all of the passed features are enabled/supported 680 697 * \return 0 if any of the passed features are disabled/unsupported 681 698 */ 682 - DECLSPEC Uint8 SDLCALL GPU_IsFeatureEnabled(GPU_FeatureEnum feature); 699 + DECLSPEC GPU_bool SDLCALL GPU_IsFeatureEnabled(GPU_FeatureEnum feature); 683 700 684 701 /*! Clean up the renderer state. */ 685 702 DECLSPEC void SDLCALL GPU_CloseCurrentRenderer(void); ··· 798 815 /*! Sets the coordinate mode for this renderer. Target and image coordinates will be either "inverted" (0,0 is the upper left corner, y increases downward) or "mathematical" (0,0 is the bottom-left corner, y increases upward). 799 816 * The default is inverted (0), as this is traditional for 2D graphics. 800 817 * \param inverted 0 is for inverted coordinates, 1 is for mathematical coordinates */ 801 - DECLSPEC void SDLCALL GPU_SetCoordinateMode(Uint8 use_math_coords); 818 + DECLSPEC void SDLCALL GPU_SetCoordinateMode(GPU_bool use_math_coords); 802 819 803 - DECLSPEC Uint8 SDLCALL GPU_GetCoordinateMode(void); 820 + DECLSPEC GPU_bool SDLCALL GPU_GetCoordinateMode(void); 804 821 805 822 /*! Sets the default image blitting anchor for newly created images. 806 823 * \see GPU_SetAnchor ··· 840 857 841 858 /*! Change the actual size of the current context target's window. This resets the virtual resolution and viewport of the context target. 842 859 * Aside from direct resolution changes, this should also be called in response to SDL_WINDOWEVENT_RESIZED window events for resizable windows. */ 843 - DECLSPEC Uint8 SDLCALL GPU_SetWindowResolution(Uint16 w, Uint16 h); 860 + DECLSPEC GPU_bool SDLCALL GPU_SetWindowResolution(Uint16 w, Uint16 h); 844 861 845 862 /*! Enable/disable fullscreen mode for the current context target's window. 846 863 * On some platforms, this may destroy the renderer context and require that textures be reloaded. Unfortunately, SDL does not provide a notification mechanism for this. 847 864 * \param enable_fullscreen If true, make the application go fullscreen. If false, make the application go to windowed mode. 848 865 * \param use_desktop_resolution If true, lets the window change its resolution when it enters fullscreen mode (via SDL_WINDOW_FULLSCREEN_DESKTOP). 849 866 * \return 0 if the new mode is windowed, 1 if the new mode is fullscreen. */ 850 - DECLSPEC Uint8 SDLCALL GPU_SetFullscreen(Uint8 enable_fullscreen, Uint8 use_desktop_resolution); 867 + DECLSPEC GPU_bool SDLCALL GPU_SetFullscreen(GPU_bool enable_fullscreen, GPU_bool use_desktop_resolution); 851 868 852 869 /*! Returns true if the current context target's window is in fullscreen mode. */ 853 - DECLSPEC Uint8 SDLCALL GPU_GetFullscreen(void); 870 + DECLSPEC GPU_bool SDLCALL GPU_GetFullscreen(void); 854 871 855 872 /*! Enables/disables alpha blending for shape rendering on the current window. */ 856 - DECLSPEC void SDLCALL GPU_SetShapeBlending(Uint8 enable); 873 + DECLSPEC void SDLCALL GPU_SetShapeBlending(GPU_bool enable); 857 874 858 875 /*! Translates a blend preset into a blend mode. */ 859 876 DECLSPEC GPU_BlendMode SDLCALL GPU_GetBlendModeFromPreset(GPU_BlendPresetEnum preset); ··· 932 949 DECLSPEC GPU_Camera SDLCALL GPU_SetCamera(GPU_Target* target, GPU_Camera* cam); 933 950 934 951 /*! Enables or disables using the built-in camera matrix transforms. */ 935 - DECLSPEC void SDLCALL GPU_EnableCamera(GPU_Target* target, Uint8 use_camera); 952 + DECLSPEC void SDLCALL GPU_EnableCamera(GPU_Target* target, GPU_bool use_camera); 936 953 937 954 /*! Returns 1 if the camera transforms are enabled, 0 otherwise. */ 938 - DECLSPEC Uint8 SDLCALL GPU_IsCameraEnabled(GPU_Target* target); 955 + DECLSPEC GPU_bool SDLCALL GPU_IsCameraEnabled(GPU_Target* target); 939 956 940 957 /*! \return The RGBA color of a pixel. */ 941 958 DECLSPEC SDL_Color SDLCALL GPU_GetPixel(GPU_Target* target, Sint16 x, Sint16 y); ··· 987 1004 DECLSPEC SDL_Surface* SDLCALL GPU_LoadSurface(const char* filename); 988 1005 989 1006 /*! Load surface from an image file in memory. Don't forget to SDL_FreeSurface() it. */ 990 - DECLSPEC SDL_Surface* SDLCALL GPU_LoadSurface_RW(SDL_RWops* rwops, Uint8 free_rwops); 1007 + DECLSPEC SDL_Surface* SDLCALL GPU_LoadSurface_RW(SDL_RWops* rwops, GPU_bool free_rwops); 991 1008 992 1009 /*! Save surface to a file. 993 1010 * With a format of GPU_FILE_AUTO, the file type is deduced from the extension. Supported formats are: png, bmp, tga. 994 1011 * Returns 0 on failure. */ 995 - DECLSPEC Uint8 SDLCALL GPU_SaveSurface(SDL_Surface* surface, const char* filename, GPU_FileFormatEnum format); 1012 + DECLSPEC GPU_bool SDLCALL GPU_SaveSurface(SDL_Surface* surface, const char* filename, GPU_FileFormatEnum format); 996 1013 997 1014 // End of SurfaceControls 998 1015 /*! @} */ ··· 1011 1028 DECLSPEC GPU_Image* SDLCALL GPU_CreateImage(Uint16 w, Uint16 h, GPU_FormatEnum format); 1012 1029 1013 1030 /*! Create a new image that uses the given native texture handle as the image texture. */ 1014 - DECLSPEC GPU_Image* SDLCALL GPU_CreateImageUsingTexture(Uint32 handle, Uint8 take_ownership); 1031 + DECLSPEC GPU_Image* SDLCALL GPU_CreateImageUsingTexture(Uint32 handle, GPU_bool take_ownership); 1015 1032 1016 1033 /*! Load image from an image file that is supported by this renderer. Don't forget to GPU_FreeImage() it. */ 1017 1034 DECLSPEC GPU_Image* SDLCALL GPU_LoadImage(const char* filename); 1018 1035 1019 1036 /*! Load image from an image file in memory. Don't forget to GPU_FreeImage() it. */ 1020 - DECLSPEC GPU_Image* SDLCALL GPU_LoadImage_RW(SDL_RWops* rwops, Uint8 free_rwops); 1037 + DECLSPEC GPU_Image* SDLCALL GPU_LoadImage_RW(SDL_RWops* rwops, GPU_bool free_rwops); 1021 1038 1022 1039 /*! Creates an image that aliases the given image. Aliases can be used to store image settings (e.g. modulation color) for easy switching. 1023 1040 * GPU_FreeImage() frees the alias's memory, but does not affect the original. */ ··· 1042 1059 DECLSPEC void SDLCALL GPU_UpdateImageBytes(GPU_Image* image, const GPU_Rect* image_rect, const unsigned char* bytes, int bytes_per_row); 1043 1060 1044 1061 /*! Update an image from surface data, replacing its underlying texture to allow for size changes. Ignores virtual resolution on the image so the number of pixels needed from the surface is known. */ 1045 - DECLSPEC Uint8 SDLCALL GPU_ReplaceImage(GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect); 1062 + DECLSPEC GPU_bool SDLCALL GPU_ReplaceImage(GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect); 1046 1063 1047 1064 /*! Save image to a file. 1048 1065 * With a format of GPU_FILE_AUTO, the file type is deduced from the extension. Supported formats are: png, bmp, tga. 1049 1066 * Returns 0 on failure. */ 1050 - DECLSPEC Uint8 SDLCALL GPU_SaveImage(GPU_Image* image, const char* filename, GPU_FileFormatEnum format); 1067 + DECLSPEC GPU_bool SDLCALL GPU_SaveImage(GPU_Image* image, const char* filename, GPU_FileFormatEnum format); 1051 1068 1052 1069 /*! Loads mipmaps for the given image, if supported by the renderer. */ 1053 1070 DECLSPEC void SDLCALL GPU_GenerateMipmaps(GPU_Image* image); ··· 1066 1083 DECLSPEC void SDLCALL GPU_UnsetColor(GPU_Image* image); 1067 1084 1068 1085 /*! Gets the current alpha blending setting. */ 1069 - DECLSPEC Uint8 SDLCALL GPU_GetBlending(GPU_Image* image); 1086 + DECLSPEC GPU_bool SDLCALL GPU_GetBlending(GPU_Image* image); 1070 1087 1071 1088 /*! Enables/disables alpha blending for the given image. */ 1072 - DECLSPEC void SDLCALL GPU_SetBlending(GPU_Image* image, Uint8 enable); 1089 + DECLSPEC void SDLCALL GPU_SetBlending(GPU_Image* image, GPU_bool enable); 1073 1090 1074 1091 /*! Sets the blending component functions. */ 1075 1092 DECLSPEC void SDLCALL GPU_SetBlendFunction(GPU_Image* image, GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha); ··· 1578 1595 DECLSPEC void SDLCALL GPU_FreeShaderProgram(Uint32 program_object); 1579 1596 1580 1597 /*! Loads shader source from an SDL_RWops, compiles it, and returns the new shader object. */ 1581 - DECLSPEC Uint32 SDLCALL GPU_CompileShader_RW(GPU_ShaderEnum shader_type, SDL_RWops* shader_source, Uint8 free_rwops); 1598 + DECLSPEC Uint32 SDLCALL GPU_CompileShader_RW(GPU_ShaderEnum shader_type, SDL_RWops* shader_source, GPU_bool free_rwops); 1582 1599 1583 1600 /*! Compiles shader source and returns the new shader object. */ 1584 1601 DECLSPEC Uint32 SDLCALL GPU_CompileShader(GPU_ShaderEnum shader_type, const char* shader_source); ··· 1602 1619 DECLSPEC void SDLCALL GPU_DetachShader(Uint32 program_object, Uint32 shader_object); 1603 1620 1604 1621 /*! Links a shader program with any attached shader objects. */ 1605 - DECLSPEC Uint8 SDLCALL GPU_LinkShaderProgram(Uint32 program_object); 1622 + DECLSPEC GPU_bool SDLCALL GPU_LinkShaderProgram(Uint32 program_object); 1606 1623 1607 1624 /*! \return The current shader program */ 1608 1625 DECLSPEC Uint32 SDLCALL GPU_GetCurrentShaderProgram(void); 1609 1626 1610 1627 /*! Returns 1 if the given shader program is a default shader for the current context, 0 otherwise. */ 1611 - DECLSPEC Uint8 SDLCALL GPU_IsDefaultShaderProgram(Uint32 program_object); 1628 + DECLSPEC GPU_bool SDLCALL GPU_IsDefaultShaderProgram(Uint32 program_object); 1612 1629 1613 1630 /*! Activates the given shader program. Passing NULL for 'block' will disable the built-in shader variables for custom shaders until a GPU_ShaderBlock is set again. */ 1614 1631 DECLSPEC void SDLCALL GPU_ActivateShaderProgram(Uint32 program_object, GPU_ShaderBlock* block); ··· 1623 1640 DECLSPEC int SDLCALL GPU_GetAttributeLocation(Uint32 program_object, const char* attrib_name); 1624 1641 1625 1642 /*! Returns a filled GPU_AttributeFormat object. */ 1626 - DECLSPEC GPU_AttributeFormat SDLCALL GPU_MakeAttributeFormat(int num_elems_per_vertex, GPU_TypeEnum type, Uint8 normalize, int stride_bytes, int offset_bytes); 1643 + DECLSPEC GPU_AttributeFormat SDLCALL GPU_MakeAttributeFormat(int num_elems_per_vertex, GPU_TypeEnum type, GPU_bool normalize, int stride_bytes, int offset_bytes); 1627 1644 1628 1645 /*! Returns a filled GPU_Attribute object. */ 1629 1646 DECLSPEC GPU_Attribute SDLCALL GPU_MakeAttribute(int location, void* values, GPU_AttributeFormat format); ··· 1677 1694 DECLSPEC void SDLCALL GPU_GetUniformMatrixfv(Uint32 program_object, int location, float* values); 1678 1695 1679 1696 /*! Sets the value of the matrix uniform shader variable at the given location. The size of the matrices sent is specified by num_rows and num_columns. Rows and columns must be between 2 and 4. */ 1680 - DECLSPEC void SDLCALL GPU_SetUniformMatrixfv(int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float* values); 1697 + DECLSPEC void SDLCALL GPU_SetUniformMatrixfv(int location, int num_matrices, int num_rows, int num_columns, GPU_bool transpose, float* values); 1681 1698 1682 1699 /*! Sets a constant-value shader attribute that will be used for each rendered vertex. */ 1683 1700 DECLSPEC void SDLCALL GPU_SetAttributef(int location, float value);
+4 -4
include/SDL_gpu_GLES_1.h
··· 59 59 typedef struct ContextData_GLES_1 60 60 { 61 61 SDL_Color last_color; 62 - Uint8 last_use_texturing; 62 + GPU_bool last_use_texturing; 63 63 unsigned int last_shape; 64 - Uint8 last_use_blending; 64 + GPU_bool last_use_blending; 65 65 GPU_BlendMode last_blend_mode; 66 66 GPU_Rect last_viewport; 67 67 GPU_Camera last_camera; 68 - Uint8 last_camera_inverted; 68 + GPU_bool last_camera_inverted; 69 69 70 70 GPU_Image* last_image; 71 71 GPU_Target* last_target; ··· 80 80 typedef struct ImageData_GLES_1 81 81 { 82 82 int refcount; 83 - Uint8 owns_handle; 83 + GPU_bool owns_handle; 84 84 Uint32 handle; 85 85 Uint32 format; 86 86 } ImageData_GLES_1;
+5 -5
include/SDL_gpu_GLES_2.h
··· 106 106 typedef struct ContextData_GLES_2 107 107 { 108 108 SDL_Color last_color; 109 - Uint8 last_use_texturing; 109 + GPU_bool last_use_texturing; 110 110 unsigned int last_shape; 111 - Uint8 last_use_blending; 111 + GPU_bool last_use_blending; 112 112 GPU_BlendMode last_blend_mode; 113 113 GPU_Rect last_viewport; 114 114 GPU_Camera last_camera; 115 - Uint8 last_camera_inverted; 115 + GPU_bool last_camera_inverted; 116 116 117 117 GPU_Image* last_image; 118 118 GPU_Target* last_target; ··· 126 126 // Tier 3 rendering 127 127 unsigned int blit_VBO[2]; // For double-buffering 128 128 unsigned int blit_IBO; 129 - Uint8 blit_VBO_flop; 129 + GPU_bool blit_VBO_flop; 130 130 GPU_ShaderBlock shader_block[2]; 131 131 GPU_ShaderBlock current_shader_block; 132 132 ··· 137 137 typedef struct ImageData_GLES_2 138 138 { 139 139 int refcount; 140 - Uint8 owns_handle; 140 + GPU_bool owns_handle; 141 141 Uint32 handle; 142 142 Uint32 format; 143 143 } ImageData_GLES_2;
+5 -5
include/SDL_gpu_GLES_3.h
··· 108 108 typedef struct ContextData_GLES_3 109 109 { 110 110 SDL_Color last_color; 111 - Uint8 last_use_texturing; 111 + GPU_bool last_use_texturing; 112 112 unsigned int last_shape; 113 - Uint8 last_use_blending; 113 + GPU_bool last_use_blending; 114 114 GPU_BlendMode last_blend_mode; 115 115 GPU_Rect last_viewport; 116 116 GPU_Camera last_camera; 117 - Uint8 last_camera_inverted; 117 + GPU_bool last_camera_inverted; 118 118 119 119 GPU_Image* last_image; 120 120 GPU_Target* last_target; ··· 129 129 unsigned int blit_VAO; 130 130 unsigned int blit_VBO[2]; // For double-buffering 131 131 unsigned int blit_IBO; 132 - Uint8 blit_VBO_flop; 132 + GPU_bool blit_VBO_flop; 133 133 GPU_ShaderBlock shader_block[2]; 134 134 GPU_ShaderBlock current_shader_block; 135 135 ··· 140 140 typedef struct ImageData_GLES_3 141 141 { 142 142 int refcount; 143 - Uint8 owns_handle; 143 + GPU_bool owns_handle; 144 144 Uint32 handle; 145 145 Uint32 format; 146 146 } ImageData_GLES_3;
+5 -5
include/SDL_gpu_OpenGL_1.h
··· 224 224 typedef struct ContextData_OpenGL_1 225 225 { 226 226 SDL_Color last_color; 227 - Uint8 last_use_texturing; 227 + GPU_bool last_use_texturing; 228 228 unsigned int last_shape; 229 - Uint8 last_use_blending; 229 + GPU_bool last_use_blending; 230 230 GPU_BlendMode last_blend_mode; 231 231 GPU_Rect last_viewport; 232 232 GPU_Camera last_camera; 233 - Uint8 last_camera_inverted; 233 + GPU_bool last_camera_inverted; 234 234 235 235 GPU_Image* last_image; 236 236 GPU_Target* last_target; ··· 244 244 245 245 unsigned int blit_VBO[2]; // For double-buffering 246 246 unsigned int blit_IBO; 247 - Uint8 blit_VBO_flop; 247 + GPU_bool blit_VBO_flop; 248 248 GPU_ShaderBlock shader_block[2]; 249 249 GPU_ShaderBlock current_shader_block; 250 250 ··· 255 255 typedef struct ImageData_OpenGL_1 256 256 { 257 257 int refcount; 258 - Uint8 owns_handle; 258 + GPU_bool owns_handle; 259 259 Uint32 handle; 260 260 Uint32 format; 261 261 } ImageData_OpenGL_1;
+4 -4
include/SDL_gpu_OpenGL_1_BASE.h
··· 39 39 typedef struct ContextData_OpenGL_1_BASE 40 40 { 41 41 SDL_Color last_color; 42 - Uint8 last_use_texturing; 42 + GPU_bool last_use_texturing; 43 43 unsigned int last_shape; 44 - Uint8 last_use_blending; 44 + GPU_bool last_use_blending; 45 45 GPU_BlendMode last_blend_mode; 46 46 GPU_Rect last_viewport; 47 47 GPU_Camera last_camera; 48 - Uint8 last_camera_inverted; 48 + GPU_bool last_camera_inverted; 49 49 50 50 GPU_Image* last_image; 51 51 GPU_Target* last_target; ··· 60 60 typedef struct ImageData_OpenGL_1_BASE 61 61 { 62 62 int refcount; 63 - Uint8 owns_handle; 63 + GPU_bool owns_handle; 64 64 Uint32 handle; 65 65 Uint32 format; 66 66 } ImageData_OpenGL_1_BASE;
+5 -5
include/SDL_gpu_OpenGL_2.h
··· 95 95 typedef struct ContextData_OpenGL_2 96 96 { 97 97 SDL_Color last_color; 98 - Uint8 last_use_texturing; 98 + GPU_bool last_use_texturing; 99 99 unsigned int last_shape; 100 - Uint8 last_use_blending; 100 + GPU_bool last_use_blending; 101 101 GPU_BlendMode last_blend_mode; 102 102 GPU_Rect last_viewport; 103 103 GPU_Camera last_camera; 104 - Uint8 last_camera_inverted; 104 + GPU_bool last_camera_inverted; 105 105 106 106 GPU_Image* last_image; 107 107 GPU_Target* last_target; ··· 115 115 116 116 unsigned int blit_VBO[2]; // For double-buffering 117 117 unsigned int blit_IBO; 118 - Uint8 blit_VBO_flop; 118 + GPU_bool blit_VBO_flop; 119 119 GPU_ShaderBlock shader_block[2]; 120 120 GPU_ShaderBlock current_shader_block; 121 121 ··· 126 126 typedef struct ImageData_OpenGL_2 127 127 { 128 128 int refcount; 129 - Uint8 owns_handle; 129 + GPU_bool owns_handle; 130 130 Uint32 handle; 131 131 Uint32 format; 132 132 } ImageData_OpenGL_2;
+5 -5
include/SDL_gpu_OpenGL_3.h
··· 158 158 typedef struct ContextData_OpenGL_3 159 159 { 160 160 SDL_Color last_color; 161 - Uint8 last_use_texturing; 161 + GPU_bool last_use_texturing; 162 162 unsigned int last_shape; 163 - Uint8 last_use_blending; 163 + GPU_bool last_use_blending; 164 164 GPU_BlendMode last_blend_mode; 165 165 GPU_Rect last_viewport; 166 166 GPU_Camera last_camera; 167 - Uint8 last_camera_inverted; 167 + GPU_bool last_camera_inverted; 168 168 169 169 GPU_Image* last_image; 170 170 GPU_Target* last_target; ··· 179 179 unsigned int blit_VAO; 180 180 unsigned int blit_VBO[2]; // For double-buffering 181 181 unsigned int blit_IBO; 182 - Uint8 blit_VBO_flop; 182 + GPU_bool blit_VBO_flop; 183 183 GPU_ShaderBlock shader_block[2]; 184 184 GPU_ShaderBlock current_shader_block; 185 185 ··· 190 190 typedef struct ImageData_OpenGL_3 191 191 { 192 192 int refcount; 193 - Uint8 owns_handle; 193 + GPU_bool owns_handle; 194 194 Uint32 handle; 195 195 Uint32 format; 196 196 } ImageData_OpenGL_3;
+5 -5
include/SDL_gpu_OpenGL_4.h
··· 96 96 typedef struct ContextData_OpenGL_4 97 97 { 98 98 SDL_Color last_color; 99 - Uint8 last_use_texturing; 99 + GPU_bool last_use_texturing; 100 100 unsigned int last_shape; 101 - Uint8 last_use_blending; 101 + GPU_bool last_use_blending; 102 102 GPU_BlendMode last_blend_mode; 103 103 GPU_Rect last_viewport; 104 104 GPU_Camera last_camera; 105 - Uint8 last_camera_inverted; 105 + GPU_bool last_camera_inverted; 106 106 107 107 GPU_Image* last_image; 108 108 GPU_Target* last_target; ··· 117 117 unsigned int blit_VAO; 118 118 unsigned int blit_VBO[2]; // For double-buffering 119 119 unsigned int blit_IBO; 120 - Uint8 blit_VBO_flop; 120 + GPU_bool blit_VBO_flop; 121 121 GPU_ShaderBlock shader_block[2]; 122 122 GPU_ShaderBlock current_shader_block; 123 123 ··· 128 128 typedef struct ImageData_OpenGL_4 129 129 { 130 130 int refcount; 131 - Uint8 owns_handle; 131 + GPU_bool owns_handle; 132 132 Uint32 handle; 133 133 Uint32 format; 134 134 } ImageData_OpenGL_4;
+8 -8
include/SDL_gpu_RendererImpl.h
··· 38 38 void (SDLCALL *ResetRendererState)(GPU_Renderer* renderer); 39 39 40 40 /*! \see GPU_SetWindowResolution() */ 41 - Uint8 (SDLCALL *SetWindowResolution)(GPU_Renderer* renderer, Uint16 w, Uint16 h); 41 + GPU_bool (SDLCALL *SetWindowResolution)(GPU_Renderer* renderer, Uint16 w, Uint16 h); 42 42 43 43 /*! \see GPU_SetVirtualResolution() */ 44 44 void (SDLCALL *SetVirtualResolution)(GPU_Renderer* renderer, GPU_Target* target, Uint16 w, Uint16 h); ··· 50 50 void (SDLCALL *Quit)(GPU_Renderer* renderer); 51 51 52 52 /*! \see GPU_SetFullscreen() */ 53 - Uint8 (SDLCALL *SetFullscreen)(GPU_Renderer* renderer, Uint8 enable_fullscreen, Uint8 use_desktop_resolution); 53 + GPU_bool (SDLCALL *SetFullscreen)(GPU_Renderer* renderer, GPU_bool enable_fullscreen, GPU_bool use_desktop_resolution); 54 54 55 55 /*! \see GPU_SetCamera() */ 56 56 GPU_Camera (SDLCALL *SetCamera)(GPU_Renderer* renderer, GPU_Target* target, GPU_Camera* cam); ··· 59 59 GPU_Image* (SDLCALL *CreateImage)(GPU_Renderer* renderer, Uint16 w, Uint16 h, GPU_FormatEnum format); 60 60 61 61 /*! \see GPU_CreateImageUsingTexture() */ 62 - GPU_Image* (SDLCALL *CreateImageUsingTexture)(GPU_Renderer* renderer, Uint32 handle, Uint8 take_ownership); 62 + GPU_Image* (SDLCALL *CreateImageUsingTexture)(GPU_Renderer* renderer, Uint32 handle, GPU_bool take_ownership); 63 63 64 64 /*! \see GPU_CreateAliasImage() */ 65 65 GPU_Image* (SDLCALL *CreateAliasImage)(GPU_Renderer* renderer, GPU_Image* image); 66 66 67 67 /*! \see GPU_SaveImage() */ 68 - Uint8 (SDLCALL *SaveImage)(GPU_Renderer* renderer, GPU_Image* image, const char* filename, GPU_FileFormatEnum format); 68 + GPU_bool (SDLCALL *SaveImage)(GPU_Renderer* renderer, GPU_Image* image, const char* filename, GPU_FileFormatEnum format); 69 69 70 70 /*! \see GPU_CopyImage() */ 71 71 GPU_Image* (SDLCALL *CopyImage)(GPU_Renderer* renderer, GPU_Image* image); ··· 77 77 void (SDLCALL *UpdateImageBytes)(GPU_Renderer* renderer, GPU_Image* image, const GPU_Rect* image_rect, const unsigned char* bytes, int bytes_per_row); 78 78 79 79 /*! \see GPU_ReplaceImage */ 80 - Uint8 (SDLCALL *ReplaceImage)(GPU_Renderer* renderer, GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect); 80 + GPU_bool (SDLCALL *ReplaceImage)(GPU_Renderer* renderer, GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect); 81 81 82 82 /*! \see GPU_CopyImageFromSurface() */ 83 83 GPU_Image* (SDLCALL *CopyImageFromSurface)(GPU_Renderer* renderer, SDL_Surface* surface); ··· 151 151 void (SDLCALL *FreeShaderProgram)(GPU_Renderer* renderer, Uint32 program_object); 152 152 153 153 /*! \see GPU_CompileShader_RW() */ 154 - Uint32 (SDLCALL *CompileShader_RW)(GPU_Renderer* renderer, GPU_ShaderEnum shader_type, SDL_RWops* shader_source, Uint8 free_rwops); 154 + Uint32 (SDLCALL *CompileShader_RW)(GPU_Renderer* renderer, GPU_ShaderEnum shader_type, SDL_RWops* shader_source, GPU_bool free_rwops); 155 155 156 156 /*! \see GPU_CompileShader() */ 157 157 Uint32 (SDLCALL *CompileShader)(GPU_Renderer* renderer, GPU_ShaderEnum shader_type, const char* shader_source); ··· 166 166 void (SDLCALL *DetachShader)(GPU_Renderer* renderer, Uint32 program_object, Uint32 shader_object); 167 167 168 168 /*! \see GPU_LinkShaderProgram() */ 169 - Uint8 (SDLCALL *LinkShaderProgram)(GPU_Renderer* renderer, Uint32 program_object); 169 + GPU_bool (SDLCALL *LinkShaderProgram)(GPU_Renderer* renderer, Uint32 program_object); 170 170 171 171 /*! \see GPU_ActivateShaderProgram() */ 172 172 void (SDLCALL *ActivateShaderProgram)(GPU_Renderer* renderer, Uint32 program_object, GPU_ShaderBlock* block); ··· 220 220 void (SDLCALL *SetUniformfv)(GPU_Renderer* renderer, int location, int num_elements_per_value, int num_values, float* values); 221 221 222 222 /*! \see GPU_SetUniformMatrixfv() */ 223 - void (SDLCALL *SetUniformMatrixfv)(GPU_Renderer* renderer, int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float* values); 223 + void (SDLCALL *SetUniformMatrixfv)(GPU_Renderer* renderer, int location, int num_matrices, int num_rows, int num_columns, GPU_bool transpose, float* values); 224 224 225 225 /*! \see GPU_SetAttributef() */ 226 226 void (SDLCALL *SetAttributef)(GPU_Renderer* renderer, int location, float value);
+27 -27
src/SDL_gpu.c
··· 67 67 static GPU_InitFlagEnum _gpu_preinit_flags = GPU_DEFAULT_INIT_FLAGS; 68 68 static GPU_InitFlagEnum _gpu_required_features = 0; 69 69 70 - static Uint8 _gpu_initialized_SDL_core = 0; 71 - static Uint8 _gpu_initialized_SDL = 0; 70 + static GPU_bool _gpu_initialized_SDL_core = 0; 71 + static GPU_bool _gpu_initialized_SDL = 0; 72 72 73 73 static int (*_gpu_print)(GPU_LogLevelEnum log_level, const char* format, va_list args) = &gpu_default_print; 74 74 ··· 94 94 _gpu_current_renderer->impl->ResetRendererState(_gpu_current_renderer); 95 95 } 96 96 97 - void GPU_SetCoordinateMode(Uint8 use_math_coords) 97 + void GPU_SetCoordinateMode(GPU_bool use_math_coords) 98 98 { 99 99 if(_gpu_current_renderer == NULL) 100 100 return; ··· 102 102 _gpu_current_renderer->coordinate_mode = use_math_coords; 103 103 } 104 104 105 - Uint8 GPU_GetCoordinateMode(void) 105 + GPU_bool GPU_GetCoordinateMode(void) 106 106 { 107 107 if(_gpu_current_renderer == NULL) 108 108 return 0; ··· 181 181 } 182 182 183 183 184 - static Uint8 gpu_init_SDL(void) 184 + static GPU_bool gpu_init_SDL(void) 185 185 { 186 186 if(!_gpu_initialized_SDL) 187 187 { ··· 469 469 return screen; 470 470 } 471 471 472 - Uint8 GPU_IsFeatureEnabled(GPU_FeatureEnum feature) 472 + GPU_bool GPU_IsFeatureEnabled(GPU_FeatureEnum feature) 473 473 { 474 474 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL) 475 475 return 0; ··· 504 504 _gpu_current_renderer->impl->MakeCurrent(_gpu_current_renderer, target, windowID); 505 505 } 506 506 507 - Uint8 GPU_SetFullscreen(Uint8 enable_fullscreen, Uint8 use_desktop_resolution) 507 + GPU_bool GPU_SetFullscreen(GPU_bool enable_fullscreen, GPU_bool use_desktop_resolution) 508 508 { 509 509 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL) 510 510 return 0; ··· 512 512 return _gpu_current_renderer->impl->SetFullscreen(_gpu_current_renderer, enable_fullscreen, use_desktop_resolution); 513 513 } 514 514 515 - Uint8 GPU_GetFullscreen(void) 515 + GPU_bool GPU_GetFullscreen(void) 516 516 { 517 517 #ifdef SDL_GPU_USE_SDL2 518 518 GPU_Target* target = GPU_GetContextTarget(); 519 519 if(target == NULL) 520 520 return 0; 521 - return (Uint8)(SDL_GetWindowFlags(SDL_GetWindowFromID(target->context->windowID)) 521 + return (GPU_bool)(SDL_GetWindowFlags(SDL_GetWindowFromID(target->context->windowID)) 522 522 & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP)); 523 523 #else 524 524 SDL_Surface* surf = SDL_GetVideoSurface(); ··· 528 528 #endif 529 529 } 530 530 531 - Uint8 GPU_SetWindowResolution(Uint16 w, Uint16 h) 531 + GPU_bool GPU_SetWindowResolution(Uint16 w, Uint16 h) 532 532 { 533 533 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL || w == 0 || h == 0) 534 534 return 0; ··· 890 890 return _gpu_current_renderer->impl->SetCamera(_gpu_current_renderer, target, cam); 891 891 } 892 892 893 - void GPU_EnableCamera(GPU_Target* target, Uint8 use_camera) 893 + void GPU_EnableCamera(GPU_Target* target, GPU_bool use_camera) 894 894 { 895 895 if (target == NULL) 896 896 return; ··· 898 898 target->use_camera = use_camera; 899 899 } 900 900 901 - Uint8 GPU_IsCameraEnabled(GPU_Target* target) 901 + GPU_bool GPU_IsCameraEnabled(GPU_Target* target) 902 902 { 903 903 if (target == NULL) 904 904 return 0; ··· 913 913 return _gpu_current_renderer->impl->CreateImage(_gpu_current_renderer, w, h, format); 914 914 } 915 915 916 - GPU_Image* GPU_CreateImageUsingTexture(Uint32 handle, Uint8 take_ownership) 916 + GPU_Image* GPU_CreateImageUsingTexture(Uint32 handle, GPU_bool take_ownership) 917 917 { 918 918 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL) 919 919 return NULL; ··· 926 926 return GPU_LoadImage_RW(SDL_RWFromFile(filename, "r"), 1); 927 927 } 928 928 929 - GPU_Image* GPU_LoadImage_RW(SDL_RWops* rwops, Uint8 free_rwops) 929 + GPU_Image* GPU_LoadImage_RW(SDL_RWops* rwops, GPU_bool free_rwops) 930 930 { 931 931 GPU_Image* result; 932 932 SDL_Surface* surface; ··· 954 954 return _gpu_current_renderer->impl->CreateAliasImage(_gpu_current_renderer, image); 955 955 } 956 956 957 - Uint8 GPU_SaveImage(GPU_Image* image, const char* filename, GPU_FileFormatEnum format) 957 + GPU_bool GPU_SaveImage(GPU_Image* image, const char* filename, GPU_FileFormatEnum format) 958 958 { 959 959 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL) 960 960 return 0; ··· 986 986 _gpu_current_renderer->impl->UpdateImageBytes(_gpu_current_renderer, image, image_rect, bytes, bytes_per_row); 987 987 } 988 988 989 - Uint8 GPU_ReplaceImage(GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect) 989 + GPU_bool GPU_ReplaceImage(GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect) 990 990 { 991 991 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL) 992 992 return 0; ··· 1076 1076 return result; 1077 1077 } 1078 1078 1079 - SDL_Surface* GPU_LoadSurface_RW(SDL_RWops* rwops, Uint8 free_rwops) 1079 + SDL_Surface* GPU_LoadSurface_RW(SDL_RWops* rwops, GPU_bool free_rwops) 1080 1080 { 1081 1081 int width, height, channels; 1082 1082 unsigned char* data; ··· 1136 1136 return dot + 1; 1137 1137 } 1138 1138 1139 - Uint8 GPU_SaveSurface(SDL_Surface* surface, const char* filename, GPU_FileFormatEnum format) 1139 + GPU_bool GPU_SaveSurface(SDL_Surface* surface, const char* filename, GPU_FileFormatEnum format) 1140 1140 { 1141 - Uint8 result; 1141 + GPU_bool result; 1142 1142 unsigned char* data; 1143 1143 1144 1144 if(surface == NULL || filename == NULL || ··· 1571 1571 target->color = c; 1572 1572 } 1573 1573 1574 - Uint8 GPU_GetBlending(GPU_Image* image) 1574 + GPU_bool GPU_GetBlending(GPU_Image* image) 1575 1575 { 1576 1576 if(image == NULL) 1577 1577 return 0; ··· 1580 1580 } 1581 1581 1582 1582 1583 - void GPU_SetBlending(GPU_Image* image, Uint8 enable) 1583 + void GPU_SetBlending(GPU_Image* image, GPU_bool enable) 1584 1584 { 1585 1585 if(image == NULL) 1586 1586 return; ··· 1588 1588 image->use_blending = enable; 1589 1589 } 1590 1590 1591 - void GPU_SetShapeBlending(Uint8 enable) 1591 + void GPU_SetShapeBlending(GPU_bool enable) 1592 1592 { 1593 1593 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL) 1594 1594 return; ··· 1910 1910 // Shader API 1911 1911 1912 1912 1913 - Uint32 GPU_CompileShader_RW(GPU_ShaderEnum shader_type, SDL_RWops* shader_source, Uint8 free_rwops) 1913 + Uint32 GPU_CompileShader_RW(GPU_ShaderEnum shader_type, SDL_RWops* shader_source, GPU_bool free_rwops) 1914 1914 { 1915 1915 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL) 1916 1916 { ··· 1950 1950 return _gpu_current_renderer->impl->CompileShader(_gpu_current_renderer, shader_type, shader_source); 1951 1951 } 1952 1952 1953 - Uint8 GPU_LinkShaderProgram(Uint32 program_object) 1953 + GPU_bool GPU_LinkShaderProgram(Uint32 program_object) 1954 1954 { 1955 1955 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL) 1956 1956 return 0; ··· 2029 2029 _gpu_current_renderer->impl->DetachShader(_gpu_current_renderer, program_object, shader_object); 2030 2030 } 2031 2031 2032 - Uint8 GPU_IsDefaultShaderProgram(Uint32 program_object) 2032 + GPU_bool GPU_IsDefaultShaderProgram(Uint32 program_object) 2033 2033 { 2034 2034 GPU_Context* context; 2035 2035 ··· 2072 2072 return _gpu_current_renderer->impl->GetAttributeLocation(_gpu_current_renderer, program_object, attrib_name); 2073 2073 } 2074 2074 2075 - GPU_AttributeFormat GPU_MakeAttributeFormat(int num_elems_per_vertex, GPU_TypeEnum type, Uint8 normalize, int stride_bytes, int offset_bytes) 2075 + GPU_AttributeFormat GPU_MakeAttributeFormat(int num_elems_per_vertex, GPU_TypeEnum type, GPU_bool normalize, int stride_bytes, int offset_bytes) 2076 2076 { 2077 2077 GPU_AttributeFormat f; 2078 2078 f.is_per_sprite = 0; ··· 2215 2215 _gpu_current_renderer->impl->GetUniformfv(_gpu_current_renderer, program_object, location, values); 2216 2216 } 2217 2217 2218 - void GPU_SetUniformMatrixfv(int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float* values) 2218 + void GPU_SetUniformMatrixfv(int location, int num_matrices, int num_rows, int num_columns, GPU_bool transpose, float* values) 2219 2219 { 2220 2220 if(_gpu_current_renderer == NULL || _gpu_current_renderer->current_context_target == NULL) 2221 2221 return;
+1 -1
src/SDL_gpu_renderer.c
··· 21 21 void (*freeFn)(GPU_Renderer*); 22 22 } GPU_RendererRegistration; 23 23 24 - static Uint8 _gpu_renderer_register_is_initialized = 0; 24 + static GPU_bool _gpu_renderer_register_is_initialized = 0; 25 25 26 26 static GPU_Renderer* _gpu_renderer_map[GPU_MAX_ACTIVE_RENDERERS]; 27 27 static GPU_RendererRegistration _gpu_renderer_register[GPU_MAX_REGISTERED_RENDERERS];
+54 -51
src/renderer_GL_common.inl
··· 121 121 SDL_SetWindowSize(SDL_GetWindowFromID(target->context->windowID), w, h); 122 122 } 123 123 124 - static_inline Uint8 get_fullscreen_state(SDL_Window* window) 124 + static_inline GPU_bool get_fullscreen_state(SDL_Window* window) 125 125 { 126 126 return (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN); 127 127 } 128 128 129 - static_inline Uint8 has_colorkey(SDL_Surface* surface) 129 + static_inline GPU_bool has_colorkey(SDL_Surface* surface) 130 130 { 131 131 return (SDL_GetColorKey(surface, NULL) == 0); 132 132 } ··· 169 169 screen = SDL_SetVideoMode(w, h, 0, flags); 170 170 } 171 171 172 - static_inline Uint8 get_fullscreen_state(SDL_Window* window) 172 + static_inline GPU_bool get_fullscreen_state(SDL_Window* window) 173 173 { 174 174 return (window->flags & SDL_FULLSCREEN); 175 175 } 176 176 177 - static_inline Uint8 has_colorkey(SDL_Surface* surface) 177 + static_inline GPU_bool has_colorkey(SDL_Surface* surface) 178 178 { 179 179 return (surface->flags & SDL_SRCCOLORKEY); 180 180 } ··· 214 214 // Workaround for Intel HD glVertexAttrib() bug. 215 215 #ifdef SDL_GPU_USE_OPENGL 216 216 // FIXME: This should probably exist in context storage, as I expect it to be a problem across contexts. 217 - static Uint8 apply_Intel_attrib_workaround = 0; 218 - static Uint8 vendor_is_Intel = 0; 217 + static GPU_bool apply_Intel_attrib_workaround = 0; 218 + static GPU_bool vendor_is_Intel = 0; 219 219 #endif 220 220 221 221 ··· 228 228 229 229 230 230 231 - static Uint8 isExtensionSupported(const char* extension_str) 231 + static GPU_bool isExtensionSupported(const char* extension_str) 232 232 { 233 233 #ifdef SDL_GPU_USE_OPENGL 234 234 return glewIsExtensionSupported(extension_str); ··· 237 237 char* p = (char*)glGetString(GL_EXTENSIONS); 238 238 char* end; 239 239 unsigned long extNameLen; 240 - 240 + 241 + if(p == NULL) 242 + return 0; 243 + 241 244 extNameLen = strlen(extension_str); 242 245 end = p + strlen(p); 243 246 ··· 408 411 } 409 412 410 413 411 - static_inline Uint8 isPowerOfTwo(unsigned int x) 414 + static_inline GPU_bool isPowerOfTwo(unsigned int x) 412 415 { 413 416 return ((x != 0) && !(x & (x - 1))); 414 417 } ··· 446 449 } 447 450 448 451 // Returns false if it can't be bound 449 - static Uint8 bindFramebuffer(GPU_Renderer* renderer, GPU_Target* target) 452 + static GPU_bool bindFramebuffer(GPU_Renderer* renderer, GPU_Target* target) 450 453 { 451 454 if(renderer->enabled_features & GPU_FEATURE_RENDER_TARGETS) 452 455 { ··· 502 505 } 503 506 } 504 507 505 - static_inline Uint8 isCurrentTarget(GPU_Renderer* renderer, GPU_Target* target) 508 + static_inline GPU_bool isCurrentTarget(GPU_Renderer* renderer, GPU_Target* target) 506 509 { 507 510 return (target == ((GPU_CONTEXT_DATA*)renderer->current_context_target->context->data)->last_target 508 511 || ((GPU_CONTEXT_DATA*)renderer->current_context_target->context->data)->last_target == NULL); ··· 518 521 } 519 522 } 520 523 521 - static Uint8 growBlitBuffer(GPU_CONTEXT_DATA* cdata, unsigned int minimum_vertices_needed) 524 + static GPU_bool growBlitBuffer(GPU_CONTEXT_DATA* cdata, unsigned int minimum_vertices_needed) 522 525 { 523 526 unsigned int new_max_num_vertices; 524 527 float* new_buffer; ··· 563 566 return 1; 564 567 } 565 568 566 - static Uint8 growIndexBuffer(GPU_CONTEXT_DATA* cdata, unsigned int minimum_vertices_needed) 569 + static GPU_bool growIndexBuffer(GPU_CONTEXT_DATA* cdata, unsigned int minimum_vertices_needed) 567 570 { 568 571 unsigned int new_max_num_vertices; 569 572 unsigned short* new_indices; ··· 678 681 #endif 679 682 } 680 683 681 - static void changeBlending(GPU_Renderer* renderer, Uint8 enable) 684 + static void changeBlending(GPU_Renderer* renderer, GPU_bool enable) 682 685 { 683 686 GPU_CONTEXT_DATA* cdata = (GPU_CONTEXT_DATA*)renderer->current_context_target->context->data; 684 687 if(cdata->last_use_blending == enable) ··· 777 780 } 778 781 } 779 782 780 - static void changeTexturing(GPU_Renderer* renderer, Uint8 enable) 783 + static void changeTexturing(GPU_Renderer* renderer, GPU_bool enable) 781 784 { 782 785 GPU_Context* context = renderer->current_context_target->context; 783 786 if(enable != ((GPU_CONTEXT_DATA*)context->data)->last_use_texturing) ··· 908 911 cdata->last_camera_inverted = (target->image != NULL); 909 912 } 910 913 911 - static Uint8 equal_cameras(GPU_Camera a, GPU_Camera b) 914 + static GPU_bool equal_cameras(GPU_Camera a, GPU_Camera b) 912 915 { 913 916 return (a.x == b.x && a.y == b.y && a.z == b.z && a.angle == b.angle && a.zoom == b.zoom); 914 917 } ··· 927 930 { 928 931 GPU_CONTEXT_DATA* cdata = (GPU_CONTEXT_DATA*)GPU_GetContextTarget()->context->data; 929 932 GPU_Target* target = cdata->last_target; 930 - Uint8 invert = cdata->last_camera_inverted; 933 + GPU_bool invert = cdata->last_camera_inverted; 931 934 float offsetX, offsetY; 932 935 933 936 GPU_MatrixIdentity(result); ··· 1118 1121 } 1119 1122 1120 1123 1121 - static Uint8 IsFeatureEnabled(GPU_Renderer* renderer, GPU_FeatureEnum feature) 1124 + static GPU_bool IsFeatureEnabled(GPU_Renderer* renderer, GPU_FeatureEnum feature) 1122 1125 { 1123 1126 return ((renderer->enabled_features & feature) == feature); 1124 1127 } 1125 1128 1126 - static Uint8 get_GL_version(int* major, int* minor) 1129 + static GPU_bool get_GL_version(int* major, int* minor) 1127 1130 { 1128 1131 const char* version_string; 1129 1132 #ifdef SDL_GPU_USE_OPENGL ··· 1168 1171 #endif 1169 1172 } 1170 1173 1171 - static Uint8 get_GLSL_version(int* version) 1174 + static GPU_bool get_GLSL_version(int* version) 1172 1175 { 1173 1176 #ifndef SDL_GPU_DISABLE_SHADERS 1174 1177 const char* version_string; ··· 1202 1205 return 1; 1203 1206 } 1204 1207 1205 - static Uint8 get_API_versions(GPU_Renderer* renderer) 1208 + static GPU_bool get_API_versions(GPU_Renderer* renderer) 1206 1209 { 1207 1210 return (get_GL_version(&renderer->id.major_version, &renderer->id.minor_version) 1208 1211 && get_GLSL_version(&renderer->max_shader_version)); ··· 1211 1214 1212 1215 static void update_stored_dimensions(GPU_Target* target) 1213 1216 { 1214 - Uint8 is_fullscreen; 1217 + GPU_bool is_fullscreen; 1215 1218 SDL_Window* window; 1216 1219 1217 1220 if(target->context == NULL) ··· 1230 1233 1231 1234 static GPU_Target* CreateTargetFromWindow(GPU_Renderer* renderer, Uint32 windowID, GPU_Target* target) 1232 1235 { 1233 - Uint8 created = 0; // Make a new one or repurpose an existing target? 1236 + GPU_bool created = 0; // Make a new one or repurpose an existing target? 1234 1237 GPU_CONTEXT_DATA* cdata; 1235 1238 SDL_Window* window; 1236 1239 ··· 1727 1730 extBindFramebuffer(renderer, ((GPU_TARGET_DATA*)target->data)->handle); 1728 1731 } 1729 1732 1730 - static Uint8 SetWindowResolution(GPU_Renderer* renderer, Uint16 w, Uint16 h) 1733 + static GPU_bool SetWindowResolution(GPU_Renderer* renderer, Uint16 w, Uint16 h) 1731 1734 { 1732 1735 GPU_Target* target = renderer->current_context_target; 1733 1736 1734 - Uint8 isCurrent = isCurrentTarget(renderer, target); 1737 + GPU_bool isCurrent = isCurrentTarget(renderer, target); 1735 1738 if(isCurrent) 1736 1739 renderer->impl->FlushBlitBuffer(renderer); 1737 1740 ··· 1788 1791 1789 1792 static void SetVirtualResolution(GPU_Renderer* renderer, GPU_Target* target, Uint16 w, Uint16 h) 1790 1793 { 1791 - Uint8 isCurrent; 1794 + GPU_bool isCurrent; 1792 1795 1793 1796 if(target == NULL) 1794 1797 return; ··· 1807 1810 1808 1811 static void UnsetVirtualResolution(GPU_Renderer* renderer, GPU_Target* target) 1809 1812 { 1810 - Uint8 isCurrent; 1813 + GPU_bool isCurrent; 1811 1814 1812 1815 if(target == NULL) 1813 1816 return; ··· 1833 1836 1834 1837 1835 1838 1836 - static Uint8 SetFullscreen(GPU_Renderer* renderer, Uint8 enable_fullscreen, Uint8 use_desktop_resolution) 1839 + static GPU_bool SetFullscreen(GPU_Renderer* renderer, GPU_bool enable_fullscreen, GPU_bool use_desktop_resolution) 1837 1840 { 1838 1841 GPU_Target* target = renderer->current_context_target; 1839 1842 1840 1843 #ifdef SDL_GPU_USE_SDL2 1841 1844 SDL_Window* window = SDL_GetWindowFromID(target->context->windowID); 1842 1845 Uint32 old_flags = SDL_GetWindowFlags(window); 1843 - Uint8 was_fullscreen = (old_flags & SDL_WINDOW_FULLSCREEN); 1844 - Uint8 is_fullscreen = was_fullscreen; 1846 + GPU_bool was_fullscreen = (old_flags & SDL_WINDOW_FULLSCREEN); 1847 + GPU_bool is_fullscreen = was_fullscreen; 1845 1848 1846 1849 Uint32 flags = 0; 1847 1850 ··· 1874 1877 1875 1878 #else 1876 1879 SDL_Surface* surf = SDL_GetVideoSurface(); 1877 - Uint8 was_fullscreen = (surf->flags & SDL_FULLSCREEN); 1878 - Uint8 is_fullscreen = was_fullscreen; 1880 + GPU_bool was_fullscreen = (surf->flags & SDL_FULLSCREEN); 1881 + GPU_bool is_fullscreen = was_fullscreen; 1879 1882 1880 1883 if(was_fullscreen ^ enable_fullscreen) 1881 1884 { ··· 2149 2152 } 2150 2153 2151 2154 2152 - static GPU_Image* CreateImageUsingTexture(GPU_Renderer* renderer, Uint32 handle, Uint8 take_ownership) 2155 + static GPU_Image* CreateImageUsingTexture(GPU_Renderer* renderer, Uint32 handle, GPU_bool take_ownership) 2153 2156 { 2154 2157 #ifdef SDL_GPU_DISABLE_TEXTURE_GETS 2155 2158 GPU_PushErrorCode("GPU_CreateImageUsingTexture", GPU_ERROR_UNSUPPORTED_FUNCTION, "Renderer %s does not support this function", renderer->id.name); ··· 2353 2356 } 2354 2357 2355 2358 2356 - static Uint8 readTargetPixels(GPU_Renderer* renderer, GPU_Target* source, GLint format, GLubyte* pixels) 2359 + static GPU_bool readTargetPixels(GPU_Renderer* renderer, GPU_Target* source, GLint format, GLubyte* pixels) 2357 2360 { 2358 2361 if(source == NULL) 2359 2362 return 0; ··· 2369 2372 return 0; 2370 2373 } 2371 2374 2372 - static Uint8 readImagePixels(GPU_Renderer* renderer, GPU_Image* source, GLint format, GLubyte* pixels) 2375 + static GPU_bool readImagePixels(GPU_Renderer* renderer, GPU_Image* source, GLint format, GLubyte* pixels) 2373 2376 { 2374 2377 #ifdef SDL_GPU_USE_GLES 2375 - Uint8 created_target; 2376 - Uint8 result; 2378 + GPU_bool created_target; 2379 + GPU_bool result; 2377 2380 #endif 2378 2381 2379 2382 if(source == NULL) ··· 2467 2470 return data; 2468 2471 } 2469 2472 2470 - static Uint8 SaveImage(GPU_Renderer* renderer, GPU_Image* image, const char* filename, GPU_FileFormatEnum format) 2473 + static GPU_bool SaveImage(GPU_Renderer* renderer, GPU_Image* image, const char* filename, GPU_FileFormatEnum format) 2471 2474 { 2472 - Uint8 result; 2475 + GPU_bool result; 2473 2476 SDL_Surface* surface; 2474 2477 2475 2478 if(image == NULL || filename == NULL || ··· 3004 3007 { 3005 3008 // Clear the color, blending, and filter mode 3006 3009 SDL_Color color = image->color; 3007 - Uint8 use_blending = image->use_blending; 3010 + GPU_bool use_blending = image->use_blending; 3008 3011 GPU_FilterEnum filter_mode = image->filter_mode; 3009 - Uint8 use_virtual = image->using_virtual_resolution; 3012 + GPU_bool use_virtual = image->using_virtual_resolution; 3010 3013 Uint16 w = 0, h = 0; 3011 3014 GPU_UnsetColor(image); 3012 3015 GPU_SetBlending(image, 0); ··· 3323 3326 3324 3327 3325 3328 3326 - static Uint8 ReplaceImage(GPU_Renderer* renderer, GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect) 3329 + static GPU_bool ReplaceImage(GPU_Renderer* renderer, GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect) 3327 3330 { 3328 3331 GPU_IMAGE_DATA* data; 3329 3332 GPU_Rect sourceRect; ··· 4503 4506 int stride, offset_texcoords, offset_colors; 4504 4507 int size_vertices, size_texcoords, size_colors; 4505 4508 4506 - Uint8 using_texture = (image != NULL); 4507 - Uint8 use_vertices = (flags & (GPU_BATCH_XY | GPU_BATCH_XYZ)); 4508 - Uint8 use_texcoords = (flags & GPU_BATCH_ST); 4509 - Uint8 use_colors = (flags & (GPU_BATCH_RGB | GPU_BATCH_RGBA)); 4510 - Uint8 use_z = (flags & GPU_BATCH_XYZ); 4511 - Uint8 use_a = (flags & GPU_BATCH_RGBA); 4509 + GPU_bool using_texture = (image != NULL); 4510 + GPU_bool use_vertices = (flags & (GPU_BATCH_XY | GPU_BATCH_XYZ)); 4511 + GPU_bool use_texcoords = (flags & GPU_BATCH_ST); 4512 + GPU_bool use_colors = (flags & (GPU_BATCH_RGB | GPU_BATCH_RGBA)); 4513 + GPU_bool use_z = (flags & GPU_BATCH_XYZ); 4514 + GPU_bool use_a = (flags & GPU_BATCH_RGBA); 4512 4515 4513 4516 if(num_vertices == 0) 4514 4517 return; ··· 5637 5640 } 5638 5641 5639 5642 5640 - static Uint32 CompileShader_RW(GPU_Renderer* renderer, GPU_ShaderEnum shader_type, SDL_RWops* shader_source, Uint8 free_rwops) 5643 + static Uint32 CompileShader_RW(GPU_Renderer* renderer, GPU_ShaderEnum shader_type, SDL_RWops* shader_source, GPU_bool free_rwops) 5641 5644 { 5642 5645 // Read in the shader source code 5643 5646 Uint32 size = GetShaderSourceSize_RW(shader_source); ··· 5690 5693 #endif 5691 5694 } 5692 5695 5693 - static Uint8 LinkShaderProgram(GPU_Renderer* renderer, Uint32 program_object) 5696 + static GPU_bool LinkShaderProgram(GPU_Renderer* renderer, Uint32 program_object) 5694 5697 { 5695 5698 #ifndef SDL_GPU_DISABLE_SHADERS 5696 5699 int linked; ··· 6154 6157 #endif 6155 6158 } 6156 6159 6157 - static void SetUniformMatrixfv(GPU_Renderer* renderer, int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float* values) 6160 + static void SetUniformMatrixfv(GPU_Renderer* renderer, int location, int num_matrices, int num_rows, int num_columns, GPU_bool transpose, float* values) 6158 6161 { 6159 6162 (void)renderer; 6160 6163 (void)location;
+2 -2
src/renderer_shapes_GL_common.inl
··· 503 503 504 504 static void Sector(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color) 505 505 { 506 - Uint8 circled; 506 + GPU_bool circled; 507 507 float dx1, dy1, dx2, dy2, dx3, dy3, dx4, dy4; 508 508 509 509 if(inner_radius < 0.0f) ··· 607 607 608 608 { 609 609 int i; 610 - Uint8 use_inner; 610 + GPU_bool use_inner; 611 611 BEGIN_UNTEXTURED("GPU_SectorFilled", GL_TRIANGLES, 3 + (numSegments - 1) + 1, 3 + (numSegments - 1) * 3 + 3); 612 612 613 613 use_inner = 0; // Switches between the radii for the next point