3 #include "SDL_platform.h" 5 #include "stb_image_write.h" 10 #include <android/log.h> 14 #define __func__ __FUNCTION__ 17 #pragma warning(disable: 4127) 20 #include "stb_image.h" 22 #ifdef SDL_GPU_USE_SDL2 23 #define GET_ALPHA(sdl_color) ((sdl_color).a) 25 #define GET_ALPHA(sdl_color) ((sdl_color).unused) 28 #define CHECK_RENDERER (_gpu_current_renderer != NULL) 29 #define MAKE_CURRENT_IF_NONE(target) do{ if(_gpu_current_renderer->current_context_target == NULL && target != NULL && target->context != NULL) GPU_MakeCurrent(target, target->context->windowID); } while(0) 30 #define CHECK_CONTEXT (_gpu_current_renderer->current_context_target != NULL) 31 #define RETURN_ERROR(code, details) do{ GPU_PushErrorCode(__func__, code, "%s", details); return; } while(0) 52 #define GPU_DEFAULT_MAX_NUM_ERRORS 20 53 #define GPU_ERROR_FUNCTION_STRING_MAX 128 54 #define GPU_ERROR_DETAILS_STRING_MAX 512 56 static unsigned int _gpu_num_error_codes = 0;
60 #define GPU_INITIAL_WINDOW_MAPPINGS_SIZE 10 62 static int _gpu_window_mappings_size = 0;
63 static int _gpu_num_window_mappings = 0;
65 static Uint32 _gpu_init_windowID = 0;
78 return GPU_GetCompiledVersion();
85 if(_gpu_current_renderer != NULL)
86 _gpu_current_renderer->
impl->SetAsCurrent(_gpu_current_renderer);
94 _gpu_current_renderer->
impl->ResetRendererState(_gpu_current_renderer);
99 if(_gpu_current_renderer == NULL)
107 if(_gpu_current_renderer == NULL)
115 return _gpu_current_renderer;
137 return __android_log_vprint(ANDROID_LOG_ERROR,
"APPLICATION", format, args);
144 return vfprintf(stderr, format, args);
156 _gpu_print = callback;
162 va_start(args, format);
170 va_start(args, format);
178 va_start(args, format);
186 if(!_gpu_initialized_SDL)
188 if(!_gpu_initialized_SDL_core && !SDL_WasInit(SDL_INIT_EVERYTHING))
191 if(SDL_Init(SDL_INIT_VIDEO) < 0)
196 _gpu_initialized_SDL_core =
GPU_TRUE;
200 if(SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
217 return _gpu_init_windowID;
222 _gpu_preinit_flags = GPU_flags;
227 return _gpu_preinit_flags;
232 _gpu_required_features = features;
237 return _gpu_required_features;
240 static void gpu_init_error_queue(
void)
242 if(_gpu_error_code_queue == NULL)
247 for(i = 0; i < _gpu_error_code_queue_size; i++)
253 _gpu_num_error_codes = 0;
261 static void gpu_init_window_mappings(
void)
263 if(_gpu_window_mappings == NULL)
267 _gpu_num_window_mappings = 0;
276 if(_gpu_window_mappings == NULL)
277 gpu_init_window_mappings();
279 if(target == NULL || target->
context == NULL)
287 for(i = 0; i < _gpu_num_window_mappings; i++)
289 if(_gpu_window_mappings[i].windowID == windowID)
291 if(_gpu_window_mappings[i].target != target)
299 if(_gpu_num_window_mappings >= _gpu_window_mappings_size)
302 _gpu_window_mappings_size *= 2;
304 memcpy(new_array, _gpu_window_mappings, _gpu_num_window_mappings *
sizeof(
GPU_WindowMapping));
305 SDL_free(_gpu_window_mappings);
306 _gpu_window_mappings = new_array;
314 _gpu_window_mappings[_gpu_num_window_mappings] = m;
316 _gpu_num_window_mappings++;
323 if(_gpu_window_mappings == NULL)
324 gpu_init_window_mappings();
330 for(i = 0; i < _gpu_num_window_mappings; i++)
332 if(_gpu_window_mappings[i].windowID == windowID)
340 _gpu_num_window_mappings--;
341 num_to_move = _gpu_num_window_mappings - i;
343 memmove(&_gpu_window_mappings[i], &_gpu_window_mappings[i+1], num_to_move *
sizeof(
GPU_WindowMapping));
355 if(_gpu_window_mappings == NULL)
356 gpu_init_window_mappings();
358 if(target == NULL || target->
context == NULL)
369 for(i = 0; i < _gpu_num_window_mappings; ++i)
371 if(_gpu_window_mappings[i].target == target)
375 _gpu_num_window_mappings--;
376 num_to_move = _gpu_num_window_mappings - i;
378 memmove(&_gpu_window_mappings[i], &_gpu_window_mappings[i+1], num_to_move *
sizeof(
GPU_WindowMapping));
389 if(_gpu_window_mappings == NULL)
390 gpu_init_window_mappings();
396 for(i = 0; i < _gpu_num_window_mappings; ++i)
398 if(_gpu_window_mappings[i].windowID == windowID)
399 return _gpu_window_mappings[i].
target;
407 int renderer_order_size;
411 gpu_init_error_queue();
418 renderer_order_size = 0;
422 for(i = 0; i < renderer_order_size; i++)
444 gpu_init_error_queue();
456 screen = renderer->
impl->
Init(renderer, renderer_request, w, h, SDL_flags);
462 _gpu_num_window_mappings = 0;
480 if(_gpu_current_renderer == NULL)
499 if(_gpu_current_renderer == NULL)
502 _gpu_current_renderer->
impl->MakeCurrent(_gpu_current_renderer, target, windowID);
510 return _gpu_current_renderer->
impl->SetFullscreen(_gpu_current_renderer, enable_fullscreen, use_desktop_resolution);
515 #ifdef SDL_GPU_USE_SDL2 519 return (SDL_GetWindowFlags(SDL_GetWindowFromID(target->
context->
windowID))
520 & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0;
522 SDL_Surface* surf = SDL_GetVideoSurface();
525 return (surf->flags & SDL_FULLSCREEN) != 0;
531 if(_gpu_current_renderer == NULL || _gpu_current_renderer->
current_context_target == NULL || w == 0 || h == 0)
534 return _gpu_current_renderer->
impl->SetWindowResolution(_gpu_current_renderer, w, h);
562 _gpu_current_renderer->
impl->SetVirtualResolution(_gpu_current_renderer, target, w, h);
573 _gpu_current_renderer->
impl->UnsetVirtualResolution(_gpu_current_renderer, target);
578 if(_gpu_current_renderer == NULL || _gpu_current_renderer->
current_context_target == NULL || w == 0 || h == 0)
606 for(i = 0; i < _gpu_error_code_queue_size; i++)
608 SDL_free(_gpu_error_code_queue[i].
function);
609 _gpu_error_code_queue[i].
function = NULL;
610 SDL_free(_gpu_error_code_queue[i].details);
611 _gpu_error_code_queue[i].
details = NULL;
613 SDL_free(_gpu_error_code_queue);
614 _gpu_error_code_queue = NULL;
615 _gpu_num_error_codes = 0;
617 SDL_free(_gpu_error_code_result.
function);
618 _gpu_error_code_result.
function = NULL;
619 SDL_free(_gpu_error_code_result.
details);
620 _gpu_error_code_result.
details = NULL;
629 _gpu_error_code_queue_size = max;
630 gpu_init_error_queue();
635 if(_gpu_current_renderer == NULL)
638 _gpu_current_renderer->
impl->Quit(_gpu_current_renderer);
645 GPU_LogError(
"GPU_Quit: %d uncleared error%s.\n", _gpu_num_error_codes, (_gpu_num_error_codes > 1?
"s" :
""));
649 if(_gpu_current_renderer == NULL)
652 _gpu_current_renderer->
impl->Quit(_gpu_current_renderer);
655 _gpu_current_renderer = NULL;
657 _gpu_init_windowID = 0;
660 SDL_free(_gpu_window_mappings);
661 _gpu_window_mappings = NULL;
662 _gpu_window_mappings_size = 0;
663 _gpu_num_window_mappings = 0;
667 if(_gpu_initialized_SDL)
669 SDL_QuitSubSystem(SDL_INIT_VIDEO);
670 _gpu_initialized_SDL = 0;
672 if(_gpu_initialized_SDL_core)
675 _gpu_initialized_SDL_core = 0;
684 _gpu_debug_level =
level;
689 return _gpu_debug_level;
694 gpu_init_error_queue();
703 va_start(lst, details);
713 if(_gpu_num_error_codes < _gpu_error_code_queue_size)
716 _gpu_error_code_queue[_gpu_num_error_codes].
function[0] =
'\0';
722 _gpu_error_code_queue[_gpu_num_error_codes].
error = error;
724 _gpu_error_code_queue[_gpu_num_error_codes].
details[0] =
'\0';
728 va_start(lst, details);
732 _gpu_num_error_codes++;
741 gpu_init_error_queue();
743 if(_gpu_num_error_codes <= 0)
748 _gpu_error_code_result.
error = _gpu_error_code_queue[0].
error;
749 strcpy(_gpu_error_code_result.
details, _gpu_error_code_queue[0].
details);
752 result = _gpu_error_code_result;
755 _gpu_num_error_codes--;
756 for(i = 0; i < _gpu_num_error_codes; i++)
758 strcpy(_gpu_error_code_queue[i].
function, _gpu_error_code_queue[i+1].
function);
759 _gpu_error_code_queue[i].
error = _gpu_error_code_queue[i+1].
error;
760 strcpy(_gpu_error_code_queue[i].details, _gpu_error_code_queue[i+1].details);
772 return "BACKEND ERROR";
778 return "UNSUPPORTED FUNCTION";
780 return "NULL ARGUMENT";
782 return "FILE NOT FOUND";
784 return "UNKNOWN ERROR";
790 if(target == NULL || _gpu_current_renderer == NULL)
801 else if(target->
image != NULL)
804 *x = (displayX*target->
w)/target->
image->
w;
806 *y = (displayY*target->
h)/target->
image->
h;
869 GPU_Camera cam = {0.0f, 0.0f, -10.0f, 0.0f, 1.0f};
882 if(_gpu_current_renderer == NULL)
888 return _gpu_current_renderer->
impl->SetCamera(_gpu_current_renderer, target, cam);
911 return _gpu_current_renderer->
impl->
CreateImage(_gpu_current_renderer, w, h, format);
930 SDL_Surface* surface;
942 SDL_FreeSurface(surface);
960 return _gpu_current_renderer->
impl->SaveImage(_gpu_current_renderer, image, filename, format);
971 SDL_FreeSurface(surface);
980 return _gpu_current_renderer->
impl->
CopyImage(_gpu_current_renderer, image);
988 _gpu_current_renderer->
impl->UpdateImage(_gpu_current_renderer, image, image_rect, surface, surface_rect);
996 _gpu_current_renderer->
impl->UpdateImageBytes(_gpu_current_renderer, image, image_rect, bytes, bytes_per_row);
1004 return _gpu_current_renderer->
impl->ReplaceImage(_gpu_current_renderer, image, surface, surface_rect);
1007 static SDL_Surface* gpu_copy_raw_surface_data(
unsigned char* data,
int width,
int height,
int channels)
1010 Uint32 Rmask, Gmask, Bmask, Amask = 0;
1011 SDL_Surface* result;
1022 Rmask = Gmask = Bmask = 0;
1025 Rmask = Gmask = Bmask = 0;
1029 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 1046 Rmask = Gmask = Bmask = 0;
1052 result = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, channels*8, Rmask, Gmask, Bmask, Amask);
1060 for(i = 0; i < height; ++i)
1062 memcpy((Uint8*)result->pixels + i*result->pitch, data + channels*width*i, channels*width);
1065 if(result != NULL && result->format->palette != NULL)
1070 SDL_Color colors[256];
1073 for(i = 0; i < 256; i++)
1075 colors[i].r = colors[i].g = colors[i].b = (Uint8)i;
1079 #ifdef SDL_GPU_USE_SDL2 1080 SDL_SetPaletteColors(result->format->palette, colors, 0, 256);
1082 SDL_SetPalette(result, SDL_LOGPAL, colors, 0, 256);
1091 int width, height, channels;
1092 unsigned char* data;
1093 SDL_Surface* result;
1096 unsigned char* c_data;
1105 SDL_RWseek(rwops, 0, SEEK_SET);
1106 data_bytes = SDL_RWseek(rwops, 0, SEEK_END);
1107 SDL_RWseek(rwops, 0, SEEK_SET);
1110 c_data = (
unsigned char*)SDL_malloc(data_bytes);
1111 SDL_RWread(rwops, c_data, 1, data_bytes);
1114 data = stbi_load_from_memory(c_data, data_bytes, &width, &height, &channels, 0);
1128 result = gpu_copy_raw_surface_data(data, width, height, channels);
1130 stbi_image_free(data);
1141 static const char *get_filename_ext(
const char *filename)
1143 const char *dot = strrchr(filename,
'.');
1144 if(!dot || dot == filename)
1152 unsigned char* data;
1154 if(surface == NULL || filename == NULL ||
1155 surface->w < 1 || surface->h < 1)
1161 data = surface->pixels;
1165 const char* extension = get_filename_ext(filename);
1182 result = (stbi_write_png(filename, surface->w, surface->h, surface->format->BytesPerPixel, (
const unsigned char *
const)data, 0) > 0);
1185 result = (stbi_write_bmp(filename, surface->w, surface->h, surface->format->BytesPerPixel, (
void*)data) > 0);
1188 result = (stbi_write_tga(filename, surface->w, surface->h, surface->format->BytesPerPixel, (
void*)data) > 0);
1199 static void write_func(
void *context,
void *data,
int size)
1201 SDL_RWwrite((SDL_RWops*)context, data, 1, size);
1207 unsigned char* data;
1209 if(surface == NULL || rwops == NULL ||
1210 surface->w < 1 || surface->h < 1)
1215 data = surface->pixels;
1227 result = (stbi_write_png_to_func(write_func, rwops, surface->w, surface->h, surface->format->BytesPerPixel, (
const unsigned char *
const)data, surface->pitch) > 0);
1230 result = (stbi_write_bmp_to_func(write_func, rwops, surface->w, surface->h, surface->format->BytesPerPixel, (
const unsigned char *
const)data) > 0);
1233 result = (stbi_write_tga_to_func(write_func, rwops, surface->w, surface->h, surface->format->BytesPerPixel, (
const unsigned char *
const)data) > 0);
1241 if(result && free_rwops)
1256 if(_gpu_current_renderer == NULL)
1267 if(_gpu_current_renderer == NULL)
1289 _gpu_current_renderer->
impl->FreeImage(_gpu_current_renderer, image);
1295 if(_gpu_current_renderer == NULL)
1318 return _gpu_current_renderer->
impl->
GetTarget(_gpu_current_renderer, image);
1325 if(_gpu_current_renderer == NULL)
1328 _gpu_current_renderer->
impl->FreeTarget(_gpu_current_renderer, target);
1346 _gpu_current_renderer->
impl->Blit(_gpu_current_renderer, image, src_rect, target, x, y);
1363 _gpu_current_renderer->
impl->BlitRotate(_gpu_current_renderer, image, src_rect, target, x, y, degrees);
1379 _gpu_current_renderer->
impl->BlitScale(_gpu_current_renderer, image, src_rect, target, x, y, scaleX, scaleY);
1395 _gpu_current_renderer->
impl->BlitTransform(_gpu_current_renderer, image, src_rect, target, x, y, degrees, scaleX, scaleY);
1411 _gpu_current_renderer->
impl->BlitTransformX(_gpu_current_renderer, image, src_rect, target, x, y, pivot_x, pivot_y, degrees, scaleX, scaleY);
1422 if(src_rect == NULL)
1433 GPU_BlitRectX(image, src_rect, target, dest_rect, 0.0f, w*0.5f, h*0.5f, GPU_FLIP_NONE);
1441 float scale_x, scale_y;
1443 if(image == NULL || target == NULL)
1446 if(src_rect == NULL)
1457 if(dest_rect == NULL)
1475 if(flip_direction & GPU_FLIP_HORIZONTAL)
1479 pivot_x = w - pivot_x;
1481 if(flip_direction & GPU_FLIP_VERTICAL)
1485 pivot_y = h - pivot_y;
1488 GPU_BlitTransformX(image, src_rect, target, dx + pivot_x * scale_x, dy + pivot_y * scale_y, pivot_x, pivot_y, degrees, scale_x, scale_y);
1493 GPU_TriangleBatchX(image, target, num_vertices, (
void*)values, num_indices, indices, flags);
1507 if(num_vertices == 0)
1511 _gpu_current_renderer->
impl->TriangleBatchX(_gpu_current_renderer, image, target, num_vertices, values, num_indices, indices, flags);
1522 _gpu_current_renderer->
impl->GenerateMipmaps(_gpu_current_renderer, image);
1530 if(target == NULL || _gpu_current_renderer == NULL || _gpu_current_renderer->
current_context_target == NULL)
1536 return _gpu_current_renderer->
impl->SetClip(_gpu_current_renderer, target, (Sint16)rect.
x, (Sint16)rect.
y, (Uint16)rect.
w, (Uint16)rect.
h);
1541 if(target == NULL || _gpu_current_renderer == NULL || _gpu_current_renderer->
current_context_target == NULL)
1547 return _gpu_current_renderer->
impl->SetClip(_gpu_current_renderer, target, x, y, w, h);
1552 if(target == NULL || _gpu_current_renderer == NULL || _gpu_current_renderer->
current_context_target == NULL)
1555 _gpu_current_renderer->
impl->UnsetClip(_gpu_current_renderer, target);
1562 float Amin, Amax, Bmin, Bmax;
1566 if (A.
w <= 0.0f || A.
h <= 0.0f || B.
w <= 0.0f || B.
h <= 0.0f)
1579 intersection.
x = Amin;
1580 intersection.
w = Amax - Amin;
1582 has_horiz_intersection = (Amax > Amin);
1594 intersection.
y = Amin;
1595 intersection.
h = Amax - Amin;
1597 if(has_horiz_intersection && Amax > Amin)
1600 *result = intersection;
1628 image->
color = color;
1661 SDL_Color c = {255, 255, 255, 255};
1674 target->
color = color;
1688 target->
use_color = !(r == 255 && g == 255 && b == 255);
1703 target->
use_color = !(r == 255 && g == 255 && b == 255 && a == 255);
1709 SDL_Color c = {255, 255, 255, 255};
1902 _gpu_current_renderer->
impl->SetImageFilter(_gpu_current_renderer, image, filter);
1908 if(_gpu_current_renderer == NULL)
1917 if(_gpu_current_renderer == NULL)
1920 if(anchor_x != NULL)
1923 if(anchor_y != NULL)
1941 if(anchor_x != NULL)
1944 if(anchor_y != NULL)
1971 _gpu_current_renderer->
impl->SetWrapMode(_gpu_current_renderer, image, wrap_mode_x, wrap_mode_y);
1979 SDL_Color c = {0,0,0,0};
1983 return _gpu_current_renderer->
impl->GetPixel(_gpu_current_renderer, target, x, y);
2000 _gpu_current_renderer->
impl->ClearRGBA(_gpu_current_renderer, target, 0, 0, 0, 0);
2011 _gpu_current_renderer->
impl->ClearRGBA(_gpu_current_renderer, target, color.r, color.g, color.b,
GET_ALPHA(color));
2022 _gpu_current_renderer->
impl->ClearRGBA(_gpu_current_renderer, target, r, g, b, 255);
2033 _gpu_current_renderer->
impl->ClearRGBA(_gpu_current_renderer, target, r, g, b, a);
2041 _gpu_current_renderer->
impl->FlushBlitBuffer(_gpu_current_renderer);
2049 if(target != NULL && target->
context == NULL)
2051 _gpu_current_renderer->
impl->FlushBlitBuffer(_gpu_current_renderer);
2059 _gpu_current_renderer->
impl->Flip(_gpu_current_renderer, target);
2074 SDL_RWclose(shader_source);
2078 return _gpu_current_renderer->
impl->CompileShader_RW(_gpu_current_renderer, shader_type, shader_source, free_rwops);
2085 if(filename == NULL)
2091 rwops = SDL_RWFromFile(filename,
"r");
2106 return _gpu_current_renderer->
impl->CompileShader(_gpu_current_renderer, shader_type, shader_source);
2114 return _gpu_current_renderer->
impl->LinkShaderProgram(_gpu_current_renderer, program_object);
2122 return _gpu_current_renderer->
impl->CreateShaderProgram(_gpu_current_renderer);
2128 shaders[0] = shader_object1;
2129 shaders[1] = shader_object2;
2144 p = _gpu_current_renderer->
impl->CreateShaderProgram(_gpu_current_renderer);
2146 for (i = 0; i < count; i++)
2147 _gpu_current_renderer->
impl->AttachShader(_gpu_current_renderer, p, shader_objects[i]);
2149 if(_gpu_current_renderer->
impl->LinkShaderProgram(_gpu_current_renderer, p))
2152 _gpu_current_renderer->
impl->FreeShaderProgram(_gpu_current_renderer, p);
2161 _gpu_current_renderer->
impl->FreeShader(_gpu_current_renderer, shader_object);
2169 _gpu_current_renderer->
impl->FreeShaderProgram(_gpu_current_renderer, program_object);
2177 _gpu_current_renderer->
impl->AttachShader(_gpu_current_renderer, program_object, shader_object);
2185 _gpu_current_renderer->
impl->DetachShader(_gpu_current_renderer, program_object, shader_object);
2204 _gpu_current_renderer->
impl->ActivateShaderProgram(_gpu_current_renderer, program_object, block);
2212 _gpu_current_renderer->
impl->DeactivateShaderProgram(_gpu_current_renderer);
2228 return _gpu_current_renderer->
impl->GetAttributeLocation(_gpu_current_renderer, program_object, attrib_name);
2257 return _gpu_current_renderer->
impl->GetUniformLocation(_gpu_current_renderer, program_object, uniform_name);
2272 return _gpu_current_renderer->
impl->LoadShaderBlock(_gpu_current_renderer, program_object, position_name, texcoord_name, color_name, modelViewMatrix_name);
2303 _gpu_current_renderer->
impl->SetShaderImage(_gpu_current_renderer, image, location, image_unit);
2311 _gpu_current_renderer->
impl->GetUniformiv(_gpu_current_renderer, program_object, location, values);
2319 _gpu_current_renderer->
impl->SetUniformi(_gpu_current_renderer, location, value);
2327 _gpu_current_renderer->
impl->SetUniformiv(_gpu_current_renderer, location, num_elements_per_value, num_values, values);
2336 _gpu_current_renderer->
impl->GetUniformuiv(_gpu_current_renderer, program_object, location, values);
2344 _gpu_current_renderer->
impl->SetUniformui(_gpu_current_renderer, location, value);
2347 void GPU_SetUniformuiv(
int location,
int num_elements_per_value,
int num_values,
unsigned int* values)
2352 _gpu_current_renderer->
impl->SetUniformuiv(_gpu_current_renderer, location, num_elements_per_value, num_values, values);
2361 _gpu_current_renderer->
impl->GetUniformfv(_gpu_current_renderer, program_object, location, values);
2369 _gpu_current_renderer->
impl->SetUniformf(_gpu_current_renderer, location, value);
2377 _gpu_current_renderer->
impl->SetUniformfv(_gpu_current_renderer, location, num_elements_per_value, num_values, values);
2386 _gpu_current_renderer->
impl->GetUniformfv(_gpu_current_renderer, program_object, location, values);
2394 _gpu_current_renderer->
impl->SetUniformMatrixfv(_gpu_current_renderer, location, num_matrices, num_rows, num_columns, transpose, values);
2403 _gpu_current_renderer->
impl->SetAttributef(_gpu_current_renderer, location, value);
2411 _gpu_current_renderer->
impl->SetAttributei(_gpu_current_renderer, location, value);
2419 _gpu_current_renderer->
impl->SetAttributeui(_gpu_current_renderer, location, value);
2427 _gpu_current_renderer->
impl->SetAttributefv(_gpu_current_renderer, location, num_elements, value);
2435 _gpu_current_renderer->
impl->SetAttributeiv(_gpu_current_renderer, location, num_elements, value);
2443 _gpu_current_renderer->
impl->SetAttributeuiv(_gpu_current_renderer, location, num_elements, value);
2451 _gpu_current_renderer->
impl->SetAttributeSource(_gpu_current_renderer, num_values, source);
2476 static const unsigned char caseless_charmap[] =
2478 '\000',
'\001',
'\002',
'\003',
'\004',
'\005',
'\006',
'\007',
2479 '\010',
'\011',
'\012',
'\013',
'\014',
'\015',
'\016',
'\017',
2480 '\020',
'\021',
'\022',
'\023',
'\024',
'\025',
'\026',
'\027',
2481 '\030',
'\031',
'\032',
'\033',
'\034',
'\035',
'\036',
'\037',
2482 '\040',
'\041',
'\042',
'\043',
'\044',
'\045',
'\046',
'\047',
2483 '\050',
'\051',
'\052',
'\053',
'\054',
'\055',
'\056',
'\057',
2484 '\060',
'\061',
'\062',
'\063',
'\064',
'\065',
'\066',
'\067',
2485 '\070',
'\071',
'\072',
'\073',
'\074',
'\075',
'\076',
'\077',
2486 '\100',
'\141',
'\142',
'\143',
'\144',
'\145',
'\146',
'\147',
2487 '\150',
'\151',
'\152',
'\153',
'\154',
'\155',
'\156',
'\157',
2488 '\160',
'\161',
'\162',
'\163',
'\164',
'\165',
'\166',
'\167',
2489 '\170',
'\171',
'\172',
'\133',
'\134',
'\135',
'\136',
'\137',
2490 '\140',
'\141',
'\142',
'\143',
'\144',
'\145',
'\146',
'\147',
2491 '\150',
'\151',
'\152',
'\153',
'\154',
'\155',
'\156',
'\157',
2492 '\160',
'\161',
'\162',
'\163',
'\164',
'\165',
'\166',
'\167',
2493 '\170',
'\171',
'\172',
'\173',
'\174',
'\175',
'\176',
'\177',
2494 '\200',
'\201',
'\202',
'\203',
'\204',
'\205',
'\206',
'\207',
2495 '\210',
'\211',
'\212',
'\213',
'\214',
'\215',
'\216',
'\217',
2496 '\220',
'\221',
'\222',
'\223',
'\224',
'\225',
'\226',
'\227',
2497 '\230',
'\231',
'\232',
'\233',
'\234',
'\235',
'\236',
'\237',
2498 '\240',
'\241',
'\242',
'\243',
'\244',
'\245',
'\246',
'\247',
2499 '\250',
'\251',
'\252',
'\253',
'\254',
'\255',
'\256',
'\257',
2500 '\260',
'\261',
'\262',
'\263',
'\264',
'\265',
'\266',
'\267',
2501 '\270',
'\271',
'\272',
'\273',
'\274',
'\275',
'\276',
'\277',
2502 '\300',
'\341',
'\342',
'\343',
'\344',
'\345',
'\346',
'\347',
2503 '\350',
'\351',
'\352',
'\353',
'\354',
'\355',
'\356',
'\357',
2504 '\360',
'\361',
'\362',
'\363',
'\364',
'\365',
'\366',
'\367',
2505 '\370',
'\371',
'\372',
'\333',
'\334',
'\335',
'\336',
'\337',
2506 '\340',
'\341',
'\342',
'\343',
'\344',
'\345',
'\346',
'\347',
2507 '\350',
'\351',
'\352',
'\353',
'\354',
'\355',
'\356',
'\357',
2508 '\360',
'\361',
'\362',
'\363',
'\364',
'\365',
'\366',
'\367',
2509 '\370',
'\371',
'\372',
'\373',
'\374',
'\375',
'\376',
'\377',
2514 unsigned char u1, u2;
2518 u1 = (
unsigned char) *s1++;
2519 u2 = (
unsigned char) *s2++;
2520 if (caseless_charmap[u1] != caseless_charmap[u2])
2521 return caseless_charmap[u1] - caseless_charmap[u2];
2530 #pragma warning(pop) GPU_bool GPU_SaveSurface_RW(SDL_Surface *surface, SDL_RWops *rwops, GPU_bool free_rwops, GPU_FileFormatEnum format)
GPU_Image *SDLCALL * CopyImageFromSurface(GPU_Renderer *renderer, SDL_Surface *surface)
const char * GPU_GetErrorString(GPU_ErrorEnum error)
void GPU_SetAttributeiv(int location, int num_elements, int *value)
void GPU_SetTargetColor(GPU_Target *target, SDL_Color color)
GPU_Image * GPU_CopyImage(GPU_Image *image)
void GPU_SetBlending(GPU_Image *image, GPU_bool enable)
void GPU_LogInfo(const char *format,...)
GPU_bool GPU_IsCameraEnabled(GPU_Target *target)
GPU_Camera GPU_GetDefaultCamera(void)
void GPU_SetAttributefv(int location, int num_elements, float *value)
GPU_Target *SDLCALL * CreateTargetFromWindow(GPU_Renderer *renderer, Uint32 windowID, GPU_Target *target)
void GPU_UnsetTargetColor(GPU_Target *target)
void GPU_GetUniformuiv(Uint32 program_object, int location, unsigned int *values)
void GPU_SetShapeBlendMode(GPU_BlendPresetEnum preset)
GPU_BlendFuncEnum dest_alpha
GPU_BlendEqEnum color_equation
SDL_Surface * GPU_LoadSurface(const char *filename)
GPU_bool GPU_GetCoordinateMode(void)
void gpu_init_renderer_register(void)
void GPU_SetRequiredFeatures(GPU_FeatureEnum features)
SDL_Surface * GPU_CopySurfaceFromTarget(GPU_Target *target)
Uint32 GPU_CompileShader_RW(GPU_ShaderEnum shader_type, SDL_RWops *shader_source, GPU_bool free_rwops)
void GPU_FreeTarget(GPU_Target *target)
GPU_Target * GPU_Init(Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
GPU_Image *SDLCALL * CreateImage(GPU_Renderer *renderer, Uint16 w, Uint16 h, GPU_FormatEnum format)
GPU_Image * GPU_CreateAliasImage(GPU_Image *image)
SDL_version GPU_GetLinkedVersion(void)
void GPU_UnsetVirtualResolution(GPU_Target *target)
void GPU_AttachShader(Uint32 program_object, Uint32 shader_object)
void GPU_GetUniformfv(Uint32 program_object, int location, float *values)
void GPU_SetUniformMatrixfv(int location, int num_matrices, int num_rows, int num_columns, GPU_bool transpose, float *values)
void GPU_CloseCurrentRenderer(void)
void GPU_RemoveWindowMapping(Uint32 windowID)
Uint32 current_shader_program
#define GPU_ERROR_DETAILS_STRING_MAX
void GPU_TriangleBatchX(GPU_Image *image, GPU_Target *target, unsigned short num_vertices, void *values, unsigned int num_indices, unsigned short *indices, GPU_BatchFlagEnum flags)
GPU_FeatureEnum GPU_GetRequiredFeatures(void)
void GPU_DetachShader(Uint32 program_object, Uint32 shader_object)
GPU_Image * GPU_CopyImageFromTarget(GPU_Target *target)
void GPU_LogWarning(const char *format,...)
#define GPU_FEATURE_BASIC_SHADERS
int modelViewProjection_loc
const char *SDLCALL * GetShaderMessage(GPU_Renderer *renderer)
void GPU_BlitTransform(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float degrees, float scaleX, float scaleY)
#define GPU_ERROR_FUNCTION_STRING_MAX
void GPU_SetShapeBlendFunction(GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha)
void GPU_Flip(GPU_Target *target)
GPU_Target * GPU_CreateAliasTarget(GPU_Target *target)
GPU_BlendMode shapes_blend_mode
GPU_bool shapes_use_blending
#define GPU_DEFAULT_INIT_FLAGS
GPU_Target * GPU_GetContextTarget(void)
void GPU_LogError(const char *format,...)
void GPU_SetShaderImage(GPU_Image *image, int location, int image_unit)
GPU_BlendFuncEnum source_color
void GPU_SetBlendFunction(GPU_Image *image, GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha)
void GPU_SetAttributeSource(int num_values, GPU_Attribute source)
GPU_Image * GPU_CreateImage(Uint16 w, Uint16 h, GPU_FormatEnum format)
void GPU_GetUniformiv(Uint32 program_object, int location, int *values)
GPU_bool using_virtual_resolution
void GPU_GetVirtualCoords(GPU_Target *target, float *x, float *y, float displayX, float displayY)
void GPU_SetBlendEquation(GPU_Image *image, GPU_BlendEqEnum color_equation, GPU_BlendEqEnum alpha_equation)
GPU_Target * current_context_target
void GPU_SetRGB(GPU_Image *image, Uint8 r, Uint8 g, Uint8 b)
void GPU_SetViewport(GPU_Target *target, GPU_Rect viewport)
GPU_bool GPU_LinkShaderProgram(Uint32 program_object)
void gpu_free_error_queue(void)
void GPU_FreeShaderProgram(Uint32 program_object)
SDL_Surface * GPU_LoadSurface_RW(SDL_RWops *rwops, GPU_bool free_rwops)
GPU_bool GPU_SetWindowResolution(Uint16 w, Uint16 h)
void GPU_SetUniformfv(int location, int num_elements_per_value, int num_values, float *values)
void GPU_BlitRectX(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, GPU_Rect *dest_rect, float degrees, float pivot_x, float pivot_y, GPU_FlipEnum flip_direction)
GPU_DebugLevelEnum GPU_GetDebugLevel(void)
Uint32 GPU_LinkManyShaders(Uint32 *shader_objects, int count)
void GPU_SetPreInitFlags(GPU_InitFlagEnum GPU_flags)
void GPU_RemoveWindowMappingByTarget(GPU_Target *target)
void GPU_SetAttributeui(int location, unsigned int value)
void GPU_SetSnapMode(GPU_Image *image, GPU_SnapEnum mode)
void GPU_UnsetViewport(GPU_Target *target)
GPU_Target * GPU_GetWindowTarget(Uint32 windowID)
SDL_Color GPU_GetPixel(GPU_Target *target, Sint16 x, Sint16 y)
void GPU_FreeImage(GPU_Image *image)
GPU_Camera GPU_GetCamera(GPU_Target *target)
const char * GPU_GetShaderMessage(void)
void GPU_SetRGBA(GPU_Image *image, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
GPU_Target *SDLCALL * CreateAliasTarget(GPU_Renderer *renderer, GPU_Target *target)
void GPU_SetUniformiv(int location, int num_elements_per_value, int num_values, int *values)
void GPU_SetUniformuiv(int location, int num_elements_per_value, int num_values, unsigned int *values)
void GPU_MakeCurrent(GPU_Target *target, Uint32 windowID)
void GPU_SetUniformf(int location, float value)
static GLenum GLenum GLuint GLint level
Uint32 GPU_CreateShaderProgram(void)
void GPU_ClearRGB(GPU_Target *target, Uint8 r, Uint8 g, Uint8 b)
void GPU_SetAttributei(int location, int value)
GPU_Renderer * gpu_create_and_add_renderer(GPU_RendererID id)
GPU_Target *SDLCALL * Init(GPU_Renderer *renderer, GPU_RendererID renderer_request, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
GPU_bool GPU_SaveImage(GPU_Image *image, const char *filename, GPU_FileFormatEnum format)
GPU_AttributeFormat format
void GPU_SetBlendMode(GPU_Image *image, GPU_BlendPresetEnum preset)
void GPU_BlitRotate(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float degrees)
#define MAKE_CURRENT_IF_NONE(target)
void GPU_SetImageVirtualResolution(GPU_Image *image, Uint16 w, Uint16 h)
GPU_bool GPU_ReplaceImage(GPU_Image *image, SDL_Surface *surface, const GPU_Rect *surface_rect)
void GPU_PushErrorCode(const char *function, GPU_ErrorEnum error, const char *details,...)
int GPU_GetAttributeLocation(Uint32 program_object, const char *attrib_name)
Uint32 GPU_LinkShaders(Uint32 shader_object1, Uint32 shader_object2)
void GPU_SetAttributef(int location, float value)
SDL_Surface *SDLCALL * CopySurfaceFromImage(GPU_Renderer *renderer, GPU_Image *image)
#define GPU_DEFAULT_MAX_NUM_ERRORS
void GPU_SetColor(GPU_Image *image, SDL_Color color)
void GPU_UnsetClip(GPU_Target *target)
GPU_Image *SDLCALL * CopyImageFromTarget(GPU_Renderer *renderer, GPU_Target *target)
GPU_Camera GPU_SetCamera(GPU_Target *target, GPU_Camera *cam)
void GPU_ResetRendererState(void)
Uint32 GPU_WindowFlagEnum
void GPU_SetShaderBlock(GPU_ShaderBlock block)
GPU_ShaderBlock current_shader_block
GPU_InitFlagEnum GPU_GetPreInitFlags(void)
GPU_Target *SDLCALL * GetTarget(GPU_Renderer *renderer, GPU_Image *image)
void GPU_GetAnchor(GPU_Image *image, float *anchor_x, float *anchor_y)
void GPU_BlitRect(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, GPU_Rect *dest_rect)
GPU_bool GPU_IntersectClipRect(GPU_Target *target, GPU_Rect B, GPU_Rect *result)
GPU_Target * GPU_LoadTarget(GPU_Image *image)
GPU_Attribute GPU_MakeAttribute(int location, void *values, GPU_AttributeFormat format)
void GPU_SetTargetRGBA(GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
void GPU_Clear(GPU_Target *target)
GPU_Image *SDLCALL * CopyImage(GPU_Renderer *renderer, GPU_Image *image)
GPU_BlendMode GPU_GetBlendModeFromPreset(GPU_BlendPresetEnum preset)
Uint32 GPU_LoadShader(GPU_ShaderEnum shader_type, const char *filename)
GPU_bool GPU_IsFeatureEnabled(GPU_FeatureEnum feature)
void GPU_UnsetImageVirtualResolution(GPU_Image *image)
void GPU_SetImageFilter(GPU_Image *image, GPU_FilterEnum filter)
void GPU_SetInitWindow(Uint32 windowID)
void GPU_Blit(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y)
GPU_SnapEnum GPU_GetSnapMode(GPU_Image *image)
GPU_Target * GPU_GetTarget(GPU_Image *image)
#define GET_ALPHA(sdl_color)
Uint32 default_untextured_shader_program
void GPU_ActivateShaderProgram(Uint32 program_object, GPU_ShaderBlock *block)
Uint32 GPU_CompileShader(GPU_ShaderEnum shader_type, const char *shader_source)
GPU_bool GPU_SetFullscreen(GPU_bool enable_fullscreen, GPU_bool use_desktop_resolution)
GPU_ShaderBlock GPU_LoadShaderBlock(Uint32 program_object, const char *position_name, const char *texcoord_name, const char *color_name, const char *modelViewMatrix_name)
float default_image_anchor_y
SDL_Color GPU_MakeColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
GPU_Target * GPU_InitRendererByID(GPU_RendererID renderer_request, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
void GPU_UpdateImageBytes(GPU_Image *image, const GPU_Rect *image_rect, const unsigned char *bytes, int bytes_per_row)
GPU_Rect GPU_SetClip(GPU_Target *target, Sint16 x, Sint16 y, Uint16 w, Uint16 h)
DECLSPEC GPU_Renderer *SDLCALL GPU_GetRenderer(GPU_RendererID id)
Uint32 GPU_GetCurrentShaderProgram(void)
GPU_Image * GPU_LoadImage(const char *filename)
void GPU_BlitTransformX(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float pivot_x, float pivot_y, float degrees, float scaleX, float scaleY)
GPU_Image *SDLCALL * CreateImageUsingTexture(GPU_Renderer *renderer, Uint32 handle, GPU_bool take_ownership)
void gpu_free_renderer_register(void)
GPU_Image *SDLCALL * CreateAliasImage(GPU_Renderer *renderer, GPU_Image *image)
GPU_RendererID GPU_MakeRendererID(const char *name, GPU_RendererEnum renderer, int major_version, int minor_version)
SDL_Surface * GPU_CopySurfaceFromImage(GPU_Image *image)
SDL_Surface *SDLCALL * CopySurfaceFromTarget(GPU_Renderer *renderer, GPU_Target *target)
void GPU_SetAttributeuiv(int location, int num_elements, unsigned int *value)
void GPU_SetCoordinateMode(GPU_bool use_math_coords)
Uint32 GPU_GetInitWindow(void)
int gpu_strcasecmp(const char *s1, const char *s2)
void GPU_GetVirtualResolution(GPU_Target *target, Uint16 *w, Uint16 *h)
void GPU_DeactivateShaderProgram(void)
void GPU_SetTargetRGB(GPU_Target *target, Uint8 r, Uint8 g, Uint8 b)
GPU_Rect GPU_MakeRect(float x, float y, float w, float h)
GPU_BlendEqEnum alpha_equation
void GPU_FreeShader(Uint32 shader_object)
void GPU_ClearColor(GPU_Target *target, SDL_Color color)
int GPU_GetUniformLocation(Uint32 program_object, const char *uniform_name)
void GPU_SetErrorQueueMax(unsigned int max)
#define GPU_INITIAL_WINDOW_MAPPINGS_SIZE
void GPU_SetShapeBlending(GPU_bool enable)
void GPU_UnsetColor(GPU_Image *image)
void GPU_ClearRGBA(GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
struct GPU_RendererImpl * impl
void GPU_UpdateImage(GPU_Image *image, const GPU_Rect *image_rect, SDL_Surface *surface, const GPU_Rect *surface_rect)
GPU_bool GPU_GetFullscreen(void)
GPU_BlendFuncEnum source_alpha
GPU_bool GPU_IntersectRect(GPU_Rect A, GPU_Rect B, GPU_Rect *result)
void GPU_SetAnchor(GPU_Image *image, float anchor_x, float anchor_y)
void GPU_SetVirtualResolution(GPU_Target *target, Uint16 w, Uint16 h)
void GPU_GenerateMipmaps(GPU_Image *image)
GPU_BlendFuncEnum dest_color
GPU_bool GPU_SaveSurface(SDL_Surface *surface, const char *filename, GPU_FileFormatEnum format)
void GPU_SetShapeBlendEquation(GPU_BlendEqEnum color_equation, GPU_BlendEqEnum alpha_equation)
GPU_Target * GPU_CreateTargetFromWindow(Uint32 windowID)
GPU_bool GPU_GetBlending(GPU_Image *image)
float default_image_anchor_x
void GPU_EnableCamera(GPU_Target *target, GPU_bool use_camera)
GPU_RendererEnum renderer
void GPU_SetUniformui(int location, unsigned int value)
void GPU_TriangleBatch(GPU_Image *image, GPU_Target *target, unsigned short num_vertices, float *values, unsigned int num_indices, unsigned short *indices, GPU_BatchFlagEnum flags)
int gpu_default_print(GPU_LogLevelEnum log_level, const char *format, va_list args)
GPU_bool GPU_IsDefaultShaderProgram(Uint32 program_object)
DECLSPEC void SDLCALL GPU_GetRendererOrder(int *order_size, GPU_RendererID *order)
void GPU_SetLogCallback(int(*callback)(GPU_LogLevelEnum log_level, const char *format, va_list args))
void GPU_FlushBlitBuffer(void)
void GPU_AddWindowMapping(GPU_Target *target)
#define RETURN_ERROR(code, details)
GPU_FeatureEnum enabled_features
void GPU_SetDefaultAnchor(float anchor_x, float anchor_y)
GPU_Rect GPU_SetClipRect(GPU_Target *target, GPU_Rect rect)
GPU_Image * GPU_CopyImageFromSurface(SDL_Surface *surface)
GPU_Image * GPU_LoadImage_RW(SDL_RWops *rwops, GPU_bool free_rwops)
GPU_Target * GPU_InitRenderer(GPU_RendererEnum renderer_enum, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
void GPU_GetUniformMatrixfv(Uint32 program_object, int location, float *values)
GPU_ShaderBlock GPU_GetShaderBlock(void)
void GPU_BlitScale(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float scaleX, float scaleY)
DECLSPEC GPU_RendererID SDLCALL GPU_GetRendererID(GPU_RendererEnum renderer)
DECLSPEC void SDLCALL GPU_FreeRenderer(GPU_Renderer *renderer)
void GPU_SetDebugLevel(GPU_DebugLevelEnum level)
#define GPU_RENDERER_ORDER_MAX
Uint32 default_textured_shader_program
void GPU_SetUniformi(int location, int value)
void GPU_SetCurrentRenderer(GPU_RendererID id)
void GPU_SetWrapMode(GPU_Image *image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y)
GPU_Image * GPU_CreateImageUsingTexture(Uint32 handle, GPU_bool take_ownership)
GPU_Renderer * GPU_GetCurrentRenderer(void)
GPU_bool GPU_SaveImage_RW(GPU_Image *image, SDL_RWops *rwops, GPU_bool free_rwops, GPU_FileFormatEnum format)
GPU_ErrorObject GPU_PopErrorCode(void)
void GPU_GetDefaultAnchor(float *anchor_x, float *anchor_y)
GPU_AttributeFormat GPU_MakeAttributeFormat(int num_elems_per_vertex, GPU_TypeEnum type, GPU_bool normalize, int stride_bytes, int offset_bytes)