this repo has no description
0
fork

Configure Feed

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

Added an ownership argument to GPU_CreateImageUsingTexture() so it is clear whether SDL_gpu will free the handle or not.

+15 -6
+1
SDL_gpu/GLES_1/SDL_gpu_GLES_1.h
··· 70 70 typedef struct ImageData_GLES_1 71 71 { 72 72 int refcount; 73 + Uint8 owns_handle; 73 74 Uint32 handle; 74 75 Uint32 format; 75 76 } ImageData_GLES_1;
+1
SDL_gpu/GLES_2/SDL_gpu_GLES_2.h
··· 136 136 typedef struct ImageData_GLES_2 137 137 { 138 138 int refcount; 139 + Uint8 owns_handle; 139 140 Uint32 handle; 140 141 Uint32 format; 141 142 } ImageData_GLES_2;
+5 -2
SDL_gpu/GL_common/SDL_gpu_GL_common.inl
··· 1788 1788 result->data = data; 1789 1789 result->is_alias = 0; 1790 1790 data->handle = handle; 1791 + data->owns_handle = 1; 1791 1792 data->format = gl_format; 1792 1793 1793 1794 result->w = w; ··· 1865 1866 } 1866 1867 1867 1868 1868 - static GPU_Image* CreateImageUsingTexture(GPU_Renderer* renderer, Uint32 handle) 1869 + static GPU_Image* CreateImageUsingTexture(GPU_Renderer* renderer, Uint32 handle, Uint8 take_ownership) 1869 1870 { 1870 1871 GLint w, h; 1871 1872 GLuint num_layers, bytes_per_pixel; ··· 1994 1995 data = (GPU_IMAGE_DATA*)malloc(sizeof(GPU_IMAGE_DATA)); 1995 1996 data->refcount = 1; 1996 1997 data->handle = handle; 1998 + data->owns_handle = take_ownership; 1997 1999 data->format = gl_format; 1998 2000 1999 2001 ··· 3150 3152 } 3151 3153 else 3152 3154 { 3153 - glDeleteTextures( 1, &data->handle); 3155 + if(data->owns_handle) 3156 + glDeleteTextures( 1, &data->handle); 3154 3157 free(data); 3155 3158 } 3156 3159
+1
SDL_gpu/OpenGL_1/SDL_gpu_OpenGL_1.h
··· 254 254 typedef struct ImageData_OpenGL_1 255 255 { 256 256 int refcount; 257 + Uint8 owns_handle; 257 258 Uint32 handle; 258 259 Uint32 format; 259 260 } ImageData_OpenGL_1;
+1
SDL_gpu/OpenGL_1_BASE/SDL_gpu_OpenGL_1_BASE.h
··· 60 60 typedef struct ImageData_OpenGL_1_BASE 61 61 { 62 62 int refcount; 63 + Uint8 owns_handle; 63 64 Uint32 handle; 64 65 Uint32 format; 65 66 } ImageData_OpenGL_1_BASE;
+1
SDL_gpu/OpenGL_2/SDL_gpu_OpenGL_2.h
··· 125 125 typedef struct ImageData_OpenGL_2 126 126 { 127 127 int refcount; 128 + Uint8 owns_handle; 128 129 Uint32 handle; 129 130 Uint32 format; 130 131 } ImageData_OpenGL_2;
+1
SDL_gpu/OpenGL_3/SDL_gpu_OpenGL_3.h
··· 123 123 typedef struct ImageData_OpenGL_3 124 124 { 125 125 int refcount; 126 + Uint8 owns_handle; 126 127 Uint32 handle; 127 128 Uint32 format; 128 129 } ImageData_OpenGL_3;
+2 -2
SDL_gpu/SDL_gpu.c
··· 691 691 return current_renderer->impl->CreateImage(current_renderer, w, h, format); 692 692 } 693 693 694 - GPU_Image* GPU_CreateImageUsingTexture(Uint32 handle) 694 + GPU_Image* GPU_CreateImageUsingTexture(Uint32 handle, Uint8 take_ownership) 695 695 { 696 696 if(current_renderer == NULL || current_renderer->current_context_target == NULL) 697 697 return NULL; 698 698 699 - return current_renderer->impl->CreateImageUsingTexture(current_renderer, handle); 699 + return current_renderer->impl->CreateImageUsingTexture(current_renderer, handle, take_ownership); 700 700 } 701 701 702 702 GPU_Image* GPU_LoadImage(const char* filename)
+1 -1
SDL_gpu/SDL_gpu.h
··· 913 913 GPU_Image* GPU_CreateImage(Uint16 w, Uint16 h, GPU_FormatEnum format); 914 914 915 915 /*! Create a new image that uses the given native texture handle as the image texture. */ 916 - GPU_Image* GPU_CreateImageUsingTexture(Uint32 handle); 916 + GPU_Image* GPU_CreateImageUsingTexture(Uint32 handle, Uint8 take_ownership); 917 917 918 918 /*! Load image from an image file that is supported by this renderer. Don't forget to GPU_FreeImage() it. */ 919 919 GPU_Image* GPU_LoadImage(const char* filename);
+1 -1
SDL_gpu/SDL_gpu_RendererImpl.h
··· 53 53 GPU_Image* (*CreateImage)(GPU_Renderer* renderer, Uint16 w, Uint16 h, GPU_FormatEnum format); 54 54 55 55 /*! \see GPU_CreateImageUsingTexture() */ 56 - GPU_Image* (*CreateImageUsingTexture)(GPU_Renderer* renderer, Uint32 handle); 56 + GPU_Image* (*CreateImageUsingTexture)(GPU_Renderer* renderer, Uint32 handle, Uint8 take_ownership); 57 57 58 58 /*! \see GPU_LoadImage() */ 59 59 GPU_Image* (*LoadImage)(GPU_Renderer* renderer, const char* filename);