this repo has no description
0
fork

Configure Feed

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

Fixed incorrect malloc value in renderer-demo. Added AddRenderer and RemoveRenderer declarations in SDL_gpu.c to fix warnings.

+19 -5
+3 -1
SDL_gpu/SDL_gpu.c
··· 22 22 #define CHECK_CONTEXT (current_renderer->current_context_target != NULL) 23 23 #define RETURN_ERROR(code, details) do{ GPU_PushErrorCode(__func__, code, "%s", details); return; } while(0) 24 24 25 - void GPU_InitRendererRegister(void); 25 + void GPU_InitRendererRegister(void); 26 + GPU_Renderer* GPU_AddRenderer(GPU_RendererID id); 27 + void GPU_RemoveRenderer(GPU_RendererID id); 26 28 27 29 static GPU_Renderer* current_renderer = NULL; 28 30
+12 -2
SDL_gpu/SDL_gpu.h
··· 27 27 28 28 /*! 29 29 * \defgroup Initialization Initialization 30 + * SDL_gpu has a fairly simple initialization process. If you need nothing more than the default initialization, call: 31 + * <pre>GPU_Target* screen = GPU_Init(width, height, GPU_DEFAULT_INIT_FLAGS);</pre> 32 + * Then when you're done, clean up with: 33 + * <pre>GPU_Quit();</pre> 34 + * 35 + * Other functions in the Initialization module control how initialization is performed. 36 + * 30 37 * \defgroup Logging Debugging, Logging, and Error Handling 38 + * Use GPU_Log() for normal logging output (e.g. to replace printf). Other logging priorities are handled by GPU_LogWarning() and GPU_LogError(). 39 + * 40 + * SDL_gpu stores an error stack that you can read and manipulate using GPU_PopErrorCode() and GPU_PushErrorCode(). If you set the debug level using GPU_SetDebugLevel(), you can have any errors automatically logged as they are generated. 41 + * 31 42 * \defgroup RendererSetup Renderer Setup 32 43 * \defgroup RendererControls Renderer Controls 33 44 * \defgroup ContextControls Context Controls ··· 635 646 636 647 // Debugging, logging, and error handling 637 648 649 + #define GPU_Log GPU_LogInfo 638 650 /*! \ingroup Logging 639 651 * @{ */ 640 652 ··· 657 669 658 670 /*! Prints an error log message. */ 659 671 void GPU_LogError(const char* format, ...); 660 - 661 - #define GPU_Log GPU_LogInfo 662 672 663 673 /*! Pushes a new error code onto the error stack. If the stack is full, this function does nothing. 664 674 * \param function The name of the function that pushed the error
+1 -1
demos/renderer/main.c
··· 89 89 90 90 if(target == NULL) 91 91 { 92 - target = (GPU_Target*)malloc(sizeof(GPU_Target*)); 92 + target = (GPU_Target*)malloc(sizeof(GPU_Target)); 93 93 memset(target, 0, sizeof(GPU_Target)); 94 94 95 95 target->refcount = 1;
+3 -1
demos/tutorial-space/main.c
··· 103 103 int main(int argc, char* argv[]) 104 104 { 105 105 GPU_Target* screen; 106 - 106 + 107 + GPU_SetDebugLevel(GPU_DEBUG_LEVEL_MAX); 108 + 107 109 screen = GPU_Init(800, 600, GPU_DEFAULT_INIT_FLAGS); 108 110 if(screen == NULL) 109 111 return -1;