this repo has no description
0
fork

Configure Feed

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

Added SDL_GPU_VERSION_* defines. Added GPU_GetCompiledVersion() and GPU_GetLinkedVersion(). Removed SDL_GPU_ENABLE_LOG checks where it stopped logging from working.

+37 -14
+6 -4
SDL_gpu/SDL_gpu.c
··· 28 28 static GPU_ErrorObject error_code_stack[GPU_MAX_NUM_ERRORS]; 29 29 static int num_error_codes = 0; 30 30 31 + 32 + SDL_version GPU_GetLinkedVersion(void) 33 + { 34 + return GPU_GetCompiledVersion(); 35 + } 36 + 31 37 void GPU_SetCurrentRenderer(GPU_RendererID id) 32 38 { 33 39 current_renderer = GPU_GetRendererByID(id); ··· 53 59 54 60 void GPU_LogInfo(const char* format, ...) 55 61 { 56 - #ifdef SDL_GPU_ENABLE_LOG 57 62 va_list args; 58 63 va_start(args, format); 59 64 #ifdef __ANDROID__ ··· 62 67 vfprintf((GPU_GetDebugLevel() >= GPU_DEBUG_LEVEL_3? stderr : stdout), format, args); 63 68 #endif 64 69 va_end(args); 65 - #endif 66 70 } 67 71 68 72 void GPU_LogWarning(const char* format, ...) 69 73 { 70 - #ifdef SDL_GPU_ENABLE_LOG 71 74 va_list args; 72 75 va_start(args, format); 73 76 #ifdef __ANDROID__ ··· 76 79 vfprintf((GPU_GetDebugLevel() >= GPU_DEBUG_LEVEL_2? stderr : stdout), format, args); 77 80 #endif 78 81 va_end(args); 79 - #endif 80 82 } 81 83 82 84 void GPU_LogError(const char* format, ...)
+18 -5
SDL_gpu/SDL_gpu.h
··· 5 5 #include <stdio.h> 6 6 #include <stdarg.h> 7 7 8 + 9 + #ifdef __cplusplus 10 + extern "C" { 11 + #endif 12 + 13 + // Compile-time versions 14 + #define SDL_GPU_VERSION_MAJOR 0 15 + #define SDL_GPU_VERSION_MINOR 6 16 + #define SDL_GPU_VERSION_PATCH 0 17 + 8 18 /* Auto-detect if we're using the SDL2 API by the headers available. */ 9 19 #if SDL_VERSION_ATLEAST(2,0,0) 10 20 #define SDL_GPU_USE_SDL2 11 - #endif 12 - 13 - 14 - #ifdef __cplusplus 15 - extern "C" { 16 21 #endif 17 22 18 23 ··· 714 719 715 720 716 721 // Setup calls 722 + 723 + static inline SDL_version GPU_GetCompiledVersion(void) 724 + { 725 + SDL_version v = {SDL_GPU_VERSION_MAJOR, SDL_GPU_VERSION_MINOR, SDL_GPU_VERSION_PATCH}; 726 + return v; 727 + } 728 + 729 + SDL_version GPU_GetLinkedVersion(void); 717 730 718 731 /*! The window corresponding to 'windowID' will be used to create the rendering context instead of creating a new window. */ 719 732 void GPU_SetInitWindow(Uint32 windowID);
+13 -5
demos/common/common.c
··· 3 3 void printRenderers(void) 4 4 { 5 5 GPU_SetDebugLevel(GPU_DEBUG_LEVEL_MAX); 6 + 7 + SDL_version compiled = GPU_GetCompiledVersion(); 8 + SDL_version linked = GPU_GetLinkedVersion(); 9 + if(compiled.major != linked.major || compiled.minor != linked.minor || compiled.patch != linked.patch) 10 + GPU_Log("SDL_gpu v%d.%d.%d (compiled with v%d.%d.%d)\n", linked.major, linked.minor, linked.patch, compiled.major, compiled.minor, compiled.patch); 11 + else 12 + GPU_Log("SDL_gpu v%d.%d.%d\n", linked.major, linked.minor, linked.patch); 6 13 7 14 GPU_RendererID renderers[GPU_GetNumRegisteredRenderers()]; 8 15 GPU_GetRegisteredRendererList(renderers); 9 16 10 - printf("Available renderers:\n"); 17 + GPU_Log("\nAvailable renderers:\n"); 11 18 int i; 12 19 for(i = 0; i < GPU_GetNumRegisteredRenderers(); i++) 13 20 { 14 - printf("* %s (%d.%d)\n", GPU_GetRendererEnumString(renderers[i].id), renderers[i].major_version, renderers[i].minor_version); 21 + GPU_Log("* %s (%d.%d)\n", GPU_GetRendererEnumString(renderers[i].id), renderers[i].major_version, renderers[i].minor_version); 15 22 } 16 - printf("Renderer order:\n"); 23 + GPU_Log("Renderer init order:\n"); 17 24 18 25 int order_size; 19 26 GPU_RendererID order[GPU_RENDERER_ORDER_MAX]; 20 27 GPU_GetRendererOrder(&order_size, order); 21 28 for(i = 0; i < order_size; i++) 22 29 { 23 - printf("%d) %s (%d.%d)\n", i+1, GPU_GetRendererEnumString(order[i].id), order[i].major_version, order[i].minor_version); 30 + GPU_Log("%d) %s (%d.%d)\n", i+1, GPU_GetRendererEnumString(order[i].id), order[i].major_version, order[i].minor_version); 24 31 } 32 + GPU_Log("\n"); 25 33 } 26 34 27 35 void printCurrentRenderer(void) ··· 29 37 GPU_RendererID id = GPU_GetCurrentRenderer()->id; 30 38 const char* renderer_string = GPU_GetRendererEnumString(id.id); 31 39 32 - printf("Using renderer: %s (%d.%d)\n", renderer_string, id.major_version, id.minor_version); 40 + GPU_Log("Using renderer: %s (%d.%d)\n\n", renderer_string, id.major_version, id.minor_version); 33 41 }