this repo has no description
0
fork

Configure Feed

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

Added macros to help match struct padding and pointer bitness.

+51 -6
+51 -6
include/SDL_gpu.h
··· 59 59 #define GPU_bool int 60 60 #endif 61 61 62 + #if defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(_WIN32)) 63 + #if defined(_M_X64) 64 + #define SDL_GPU_BITNESS 64 65 + #else 66 + #define SDL_GPU_BITNESS 32 67 + #endif 68 + #define SDL_GPU_LONG_SIZE 4 69 + #elif defined(__clang__) || defined(__INTEL_COMPILER) || defined(__GNUC__) 70 + #if defined(__x86_64) 71 + #define SDL_GPU_BITNESS 64 72 + #else 73 + #define SDL_GPU_BITNESS 32 74 + #endif 75 + #if __LONG_MAX__ == 2147483647L 76 + #define SDL_GPU_LONG_SIZE 4 77 + #else 78 + #define SDL_GPU_LONG_SIZE 8 79 + #endif 80 + #endif 81 + 82 + // Struct padding for 32 or 64 bit alignment 83 + #if SDL_GPU_BITNESS == 32 84 + #define GPU_PAD_1_TO_32 1 85 + #define GPU_PAD_2_TO_32 2 86 + #define GPU_PAD_3_TO_32 3 87 + #define GPU_PAD_1_TO_64 1 88 + #define GPU_PAD_2_TO_64 2 89 + #define GPU_PAD_3_TO_64 3 90 + #define GPU_PAD_4_TO_64 0 91 + #define GPU_PAD_5_TO_64 1 92 + #define GPU_PAD_6_TO_64 2 93 + #define GPU_PAD_7_TO_64 3 94 + #elif SDL_GPU_BITNESS == 64 95 + #define GPU_PAD_1_TO_32 1 96 + #define GPU_PAD_2_TO_32 2 97 + #define GPU_PAD_3_TO_32 3 98 + #define GPU_PAD_1_TO_64 1 99 + #define GPU_PAD_2_TO_64 2 100 + #define GPU_PAD_3_TO_64 3 101 + #define GPU_PAD_4_TO_64 4 102 + #define GPU_PAD_5_TO_64 5 103 + #define GPU_PAD_6_TO_64 6 104 + #define GPU_PAD_7_TO_64 7 105 + #endif 106 + 62 107 #define GPU_FALSE 0 63 108 #define GPU_TRUE 1 64 109 ··· 332 377 float zoom_x, zoom_y; 333 378 float z_near, z_far; // z clipping planes 334 379 GPU_bool use_centered_origin; // move rotation/scaling origin to the center of the camera's view 335 - char _padding[3]; 380 + char _padding[GPU_PAD_7_TO_64]; 336 381 } GPU_Camera; 337 382 338 383 ··· 414 459 GPU_bool failed; 415 460 GPU_bool use_texturing; 416 461 GPU_bool shapes_use_blending; 417 - char _padding[1]; 462 + char _padding[GPU_PAD_5_TO_64]; 418 463 } GPU_Context; 419 464 420 465 ··· 464 509 GPU_bool use_depth_test; 465 510 GPU_bool use_depth_write; 466 511 GPU_bool is_alias; 467 - char _padding[1]; 512 + char _padding[GPU_PAD_1_TO_64]; 468 513 }; 469 514 470 515 /*! \ingroup Initialization ··· 629 674 int offset_bytes; // Number of bytes to skip at the beginning of 'values' 630 675 GPU_bool is_per_sprite; // Per-sprite values are expanded to 4 vertices 631 676 GPU_bool normalize; 632 - char _padding[2]; 677 + char _padding[GPU_PAD_2_TO_32]; 633 678 } GPU_AttributeFormat; 634 679 635 680 /*! \ingroup ShaderInterface */ ··· 652 697 void* per_vertex_storage; // Could point to the attribute's values or to allocated storage 653 698 GPU_Attribute attribute; 654 699 GPU_bool enabled; 655 - char _padding[3]; 700 + char _padding[GPU_PAD_7_TO_64]; 656 701 } GPU_AttributeSource; 657 702 658 703 ··· 733 778 734 779 /*! 0 for inverted, 1 for mathematical */ 735 780 GPU_bool coordinate_mode; 736 - char _padding[3]; 781 + char _padding[GPU_PAD_7_TO_64]; 737 782 }; 738 783 739 784