this repo has no description
0
fork

Configure Feed

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

More VS warning fixes.

+384 -179
+160 -19
SDL_gpu/GL_common/SDL_gpu_GL_common.inl
··· 482 482 483 483 static void unsetClipRect(GPU_Renderer* renderer, GPU_Target* target) 484 484 { 485 + (void)renderer; 485 486 if(target->use_clip_rect) 486 487 glDisable(GL_SCISSOR_TEST); 487 488 } ··· 499 500 static void changeColor(GPU_Renderer* renderer, SDL_Color color) 500 501 { 501 502 #ifdef SDL_GPU_USE_BUFFER_PIPELINE 503 + (void)renderer; 504 + (void)color; 502 505 return; 503 506 #else 504 507 GPU_CONTEXT_DATA* cdata = (GPU_CONTEXT_DATA*)renderer->current_context_target->context->data; ··· 650 653 651 654 #define MIX_COLOR_COMPONENT_NORMALIZED_RESULT(a, b) ((a)/255.0f * (b)/255.0f) 652 655 #define MIX_COLOR_COMPONENT(a, b) (((a)/255.0f * (b)/255.0f)*255) 653 - #define MIX_COLORS(color1, color2) {MIX_COLOR_COMPONENT(color1.r, color2.r), MIX_COLOR_COMPONENT(color1.g, color2.g), MIX_COLOR_COMPONENT(color1.b, color2.b), MIX_COLOR_COMPONENT(GET_ALPHA(color1), GET_ALPHA(color2))} 654 656 655 657 static void prepareToRenderImage(GPU_Renderer* renderer, GPU_Target* target, GPU_Image* image) 656 658 { ··· 666 668 // Blitting 667 669 if(target->use_color) 668 670 { 669 - SDL_Color color = MIX_COLORS(target->color, image->color); 671 + SDL_Color color; 672 + color.r = MIX_COLOR_COMPONENT(target->color.r, image->color.r); 673 + color.g = MIX_COLOR_COMPONENT(target->color.g, image->color.g); 674 + color.b = MIX_COLOR_COMPONENT(target->color.b, image->color.b); 675 + GET_ALPHA(color) = MIX_COLOR_COMPONENT(GET_ALPHA(target->color), GET_ALPHA(image->color)); 676 + 670 677 changeColor(renderer, color); 671 678 } 672 679 else ··· 1312 1319 static GPU_Target* CreateAliasTarget(GPU_Renderer* renderer, GPU_Target* target) 1313 1320 { 1314 1321 GPU_Target* result; 1322 + (void)renderer; 1315 1323 1316 1324 if(target == NULL) 1317 1325 return NULL; ··· 1846 1854 } 1847 1855 1848 1856 // Initialize texture using a blank buffer 1849 - if(zero_buffer_size < w*h*result->bytes_per_pixel) 1857 + if(zero_buffer_size < (unsigned int)(w*h*result->bytes_per_pixel)) 1850 1858 { 1851 1859 free(zero_buffer); 1852 1860 zero_buffer_size = w*h*result->bytes_per_pixel; ··· 2057 2065 static GPU_Image* CreateAliasImage(GPU_Renderer* renderer, GPU_Image* image) 2058 2066 { 2059 2067 GPU_Image* result; 2068 + (void)renderer; 2060 2069 2061 2070 if(image == NULL) 2062 2071 return NULL; ··· 3412 3421 3413 3422 static void Blit(GPU_Renderer* renderer, GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y) 3414 3423 { 3415 - Uint16 tex_w, tex_h; 3424 + Uint32 tex_w, tex_h; 3416 3425 float w; 3417 3426 float h; 3418 3427 float x1, y1, x2, y2; ··· 3624 3633 3625 3634 static void BlitTransformX(GPU_Renderer* renderer, 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) 3626 3635 { 3627 - Uint16 tex_w, tex_h; 3636 + Uint32 tex_w, tex_h; 3628 3637 float x1, y1, x2, y2; 3629 3638 float dx1, dy1, dx2, dy2, dx3, dy3, dx4, dy4; 3630 3639 float w, h; ··· 3863 3872 // column-major 3x3 to column-major 4x4 (and scooting the 2D translations to the homogeneous column) 3864 3873 // FIXME: Should index 8 replace the homogeneous 1? This looks like it adjusts the z-value... 3865 3874 { 3866 - float matrix[16] = {matrix3x3[0], matrix3x3[1], matrix3x3[2], 0, 3867 - matrix3x3[3], matrix3x3[4], matrix3x3[5], 0, 3868 - 0, 0, matrix3x3[8], 0, 3869 - matrix3x3[6], matrix3x3[7], 0, 1 3870 - }; 3875 + float matrix[16]; 3876 + matrix[0] = matrix3x3[0]; 3877 + matrix[1] = matrix3x3[1]; 3878 + matrix[2] = matrix3x3[2]; 3879 + matrix[3] = 0; 3880 + 3881 + matrix[4] = matrix3x3[3]; 3882 + matrix[5] = matrix3x3[4]; 3883 + matrix[6] = matrix3x3[5]; 3884 + matrix[7] = 0; 3885 + 3886 + matrix[8] = 0; 3887 + matrix[9] = 0; 3888 + matrix[10] = matrix3x3[8]; 3889 + matrix[11] = 0; 3890 + 3891 + matrix[12] = matrix3x3[6]; 3892 + matrix[13] = matrix3x3[7]; 3893 + matrix[14] = 0; 3894 + matrix[15] = 1; 3895 + 3871 3896 GPU_Translate(x, y, 0); 3872 3897 GPU_MultMatrix(matrix); 3873 3898 } ··· 4024 4049 GPU_CONTEXT_DATA* cdata; 4025 4050 unsigned short* index_buffer; 4026 4051 unsigned int i; 4052 + (void)flags; 4027 4053 4028 4054 if(image == NULL) 4029 4055 { ··· 4238 4264 { 4239 4265 GPU_CONTEXT_DATA* cdata; 4240 4266 int stride; 4241 - Uint8 using_texture = (image != NULL); 4267 + Uint8 using_texture = (image != NULL); 4268 + (void)flags; 4242 4269 4243 4270 if(num_vertices == 0) 4244 4271 return; ··· 4363 4390 { 4364 4391 if(values != NULL) 4365 4392 { 4366 - int i; 4393 + unsigned int i; 4367 4394 unsigned int index; 4368 4395 float* vertex_pointer = values; 4369 4396 float* texcoord_pointer = values + 2; ··· 4702 4729 4703 4730 static void DoPartialFlush(GPU_Renderer* renderer, GPU_CONTEXT_DATA* cdata, unsigned short num_vertices, float* blit_buffer, unsigned int num_indices, unsigned short* index_buffer) 4704 4731 { 4705 - 4732 + (void)renderer; 4706 4733 #ifdef SDL_GPU_USE_ARRAY_PIPELINE 4707 4734 glEnableClientState(GL_VERTEX_ARRAY); 4708 4735 glEnableClientState(GL_TEXTURE_COORD_ARRAY); ··· 4812 4839 4813 4840 static void DoUntexturedFlush(GPU_Renderer* renderer, GPU_CONTEXT_DATA* cdata, unsigned short num_vertices, float* blit_buffer, unsigned int num_indices, unsigned short* index_buffer) 4814 4841 { 4842 + (void)renderer; 4815 4843 4816 4844 #ifdef SDL_GPU_USE_ARRAY_PIPELINE 4817 4845 glEnableClientState(GL_VERTEX_ARRAY); ··· 5218 5246 { 5219 5247 // Create the proper new shader object 5220 5248 GLuint shader_object = 0; 5249 + (void)shader_type; 5250 + (void)shader_source; 5221 5251 5222 5252 #ifndef SDL_GPU_DISABLE_SHADERS 5223 5253 GLint compiled; ··· 5276 5306 char* source_string = (char*)malloc(size+1); 5277 5307 int result = GetShaderSource_RW(shader_source, source_string); 5278 5308 Uint32 result2; 5309 + (void)renderer; 5279 5310 5280 5311 if(!result) 5281 5312 { ··· 5315 5346 5316 5347 return p; 5317 5348 #else 5349 + (void)renderer; 5318 5350 return 0; 5319 5351 #endif 5320 5352 } ··· 5342 5374 return 1; 5343 5375 5344 5376 #else 5345 - 5377 + (void)renderer; 5378 + (void)program_object; 5346 5379 return 0; 5347 5380 5348 5381 #endif ··· 5350 5383 5351 5384 static void FreeShader(GPU_Renderer* renderer, Uint32 shader_object) 5352 5385 { 5386 + (void)renderer; 5387 + (void)shader_object; 5353 5388 #ifndef SDL_GPU_DISABLE_SHADERS 5354 5389 if(IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5355 5390 glDeleteShader(shader_object); ··· 5358 5393 5359 5394 static void FreeShaderProgram(GPU_Renderer* renderer, Uint32 program_object) 5360 5395 { 5396 + (void)renderer; 5397 + (void)program_object; 5361 5398 #ifndef SDL_GPU_DISABLE_SHADERS 5362 5399 if(IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5363 5400 glDeleteProgram(program_object); ··· 5366 5403 5367 5404 static void AttachShader(GPU_Renderer* renderer, Uint32 program_object, Uint32 shader_object) 5368 5405 { 5406 + (void)renderer; 5407 + (void)program_object; 5408 + (void)shader_object; 5369 5409 #ifndef SDL_GPU_DISABLE_SHADERS 5370 5410 if(IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5371 5411 glAttachShader(program_object, shader_object); ··· 5374 5414 5375 5415 static void DetachShader(GPU_Renderer* renderer, Uint32 program_object, Uint32 shader_object) 5376 5416 { 5417 + (void)renderer; 5418 + (void)program_object; 5419 + (void)shader_object; 5377 5420 #ifndef SDL_GPU_DISABLE_SHADERS 5378 5421 if(IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5379 5422 glDetachShader(program_object, shader_object); ··· 5382 5425 5383 5426 static void ActivateShaderProgram(GPU_Renderer* renderer, Uint32 program_object, GPU_ShaderBlock* block) 5384 5427 { 5385 - GPU_Target* target = renderer->current_context_target; 5428 + GPU_Target* target = renderer->current_context_target; 5429 + (void)block; 5386 5430 #ifndef SDL_GPU_DISABLE_SHADERS 5387 5431 if(IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5388 5432 { ··· 5434 5478 5435 5479 static const char* GetShaderMessage(GPU_Renderer* renderer) 5436 5480 { 5481 + (void)renderer; 5437 5482 return shader_message; 5438 5483 } 5439 5484 ··· 5446 5491 if(program_object == 0) 5447 5492 return -1; 5448 5493 return glGetAttribLocation(program_object, attrib_name); 5449 - #else 5494 + #else 5495 + (void)renderer; 5496 + (void)program_object; 5497 + (void)attrib_name; 5450 5498 return -1; 5451 5499 #endif 5452 5500 } ··· 5460 5508 if(program_object == 0) 5461 5509 return -1; 5462 5510 return glGetUniformLocation(program_object, uniform_name); 5463 - #else 5511 + #else 5512 + (void)renderer; 5513 + (void)program_object; 5514 + (void)uniform_name; 5464 5515 return -1; 5465 5516 #endif 5466 5517 } ··· 5503 5554 5504 5555 static void SetShaderBlock(GPU_Renderer* renderer, GPU_ShaderBlock block) 5505 5556 { 5557 + (void)renderer; 5558 + (void)block; 5506 5559 #ifndef SDL_GPU_DISABLE_SHADERS 5507 5560 ((GPU_CONTEXT_DATA*)renderer->current_context_target->context->data)->current_shader_block = block; 5508 5561 #endif ··· 5533 5586 if(image_unit != 0) 5534 5587 glActiveTexture(GL_TEXTURE0); 5535 5588 5536 - #endif 5589 + #endif 5590 + 5591 + (void)renderer; 5592 + (void)image; 5593 + (void)location; 5594 + (void)image_unit; 5537 5595 } 5538 5596 5539 5597 5540 5598 static void GetUniformiv(GPU_Renderer* renderer, Uint32 program_object, int location, int* values) 5541 5599 { 5600 + (void)renderer; 5601 + (void)program_object; 5602 + (void)location; 5603 + (void)values; 5604 + 5542 5605 #ifndef SDL_GPU_DISABLE_SHADERS 5543 5606 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5544 5607 return; ··· 5550 5613 5551 5614 static void SetUniformi(GPU_Renderer* renderer, int location, int value) 5552 5615 { 5616 + (void)renderer; 5617 + (void)location; 5618 + (void)value; 5619 + 5553 5620 #ifndef SDL_GPU_DISABLE_SHADERS 5554 5621 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5555 5622 return; ··· 5562 5629 5563 5630 static void SetUniformiv(GPU_Renderer* renderer, int location, int num_elements_per_value, int num_values, int* values) 5564 5631 { 5632 + (void)renderer; 5633 + (void)location; 5634 + (void)num_elements_per_value; 5635 + (void)num_values; 5636 + (void)values; 5637 + 5565 5638 #ifndef SDL_GPU_DISABLE_SHADERS 5566 5639 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5567 5640 return; ··· 5589 5662 5590 5663 static void GetUniformuiv(GPU_Renderer* renderer, Uint32 program_object, int location, unsigned int* values) 5591 5664 { 5665 + (void)renderer; 5666 + (void)program_object; 5667 + (void)location; 5668 + (void)values; 5669 + 5592 5670 #ifndef SDL_GPU_DISABLE_SHADERS 5593 5671 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5594 5672 return; ··· 5604 5682 5605 5683 static void SetUniformui(GPU_Renderer* renderer, int location, unsigned int value) 5606 5684 { 5685 + (void)renderer; 5686 + (void)location; 5687 + (void)value; 5688 + 5607 5689 #ifndef SDL_GPU_DISABLE_SHADERS 5608 5690 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5609 5691 return; ··· 5620 5702 5621 5703 static void SetUniformuiv(GPU_Renderer* renderer, int location, int num_elements_per_value, int num_values, unsigned int* values) 5622 5704 { 5705 + (void)renderer; 5706 + (void)location; 5707 + (void)num_elements_per_value; 5708 + (void)num_values; 5709 + (void)values; 5710 + 5623 5711 #ifndef SDL_GPU_DISABLE_SHADERS 5624 5712 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5625 5713 return; ··· 5665 5753 5666 5754 static void GetUniformfv(GPU_Renderer* renderer, Uint32 program_object, int location, float* values) 5667 5755 { 5756 + (void)renderer; 5757 + (void)program_object; 5758 + (void)location; 5759 + (void)values; 5760 + 5668 5761 #ifndef SDL_GPU_DISABLE_SHADERS 5669 5762 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5670 5763 return; ··· 5676 5769 5677 5770 static void SetUniformf(GPU_Renderer* renderer, int location, float value) 5678 5771 { 5772 + (void)renderer; 5773 + (void)location; 5774 + (void)value; 5775 + 5679 5776 #ifndef SDL_GPU_DISABLE_SHADERS 5680 5777 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5681 5778 return; ··· 5688 5785 5689 5786 static void SetUniformfv(GPU_Renderer* renderer, int location, int num_elements_per_value, int num_values, float* values) 5690 5787 { 5788 + (void)renderer; 5789 + (void)location; 5790 + (void)num_elements_per_value; 5791 + (void)num_values; 5792 + (void)values; 5793 + 5691 5794 #ifndef SDL_GPU_DISABLE_SHADERS 5692 5795 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5693 5796 return; ··· 5714 5817 5715 5818 static void SetUniformMatrixfv(GPU_Renderer* renderer, int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float* values) 5716 5819 { 5820 + (void)renderer; 5821 + (void)location; 5822 + (void)num_matrices; 5823 + (void)num_rows; 5824 + (void)num_columns; 5825 + (void)transpose; 5826 + (void)values; 5827 + 5717 5828 #ifndef SDL_GPU_DISABLE_SHADERS 5718 5829 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5719 5830 return; ··· 5773 5884 5774 5885 static void SetAttributef(GPU_Renderer* renderer, int location, float value) 5775 5886 { 5887 + (void)renderer; 5888 + (void)location; 5889 + (void)value; 5890 + 5776 5891 #ifndef SDL_GPU_DISABLE_SHADERS 5777 5892 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5778 5893 return; ··· 5796 5911 5797 5912 static void SetAttributei(GPU_Renderer* renderer, int location, int value) 5798 5913 { 5914 + (void)renderer; 5915 + (void)location; 5916 + (void)value; 5917 + 5799 5918 #ifndef SDL_GPU_DISABLE_SHADERS 5800 5919 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5801 5920 return; ··· 5819 5938 5820 5939 static void SetAttributeui(GPU_Renderer* renderer, int location, unsigned int value) 5821 5940 { 5941 + (void)renderer; 5942 + (void)location; 5943 + (void)value; 5944 + 5822 5945 #ifndef SDL_GPU_DISABLE_SHADERS 5823 5946 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5824 5947 return; ··· 5843 5966 5844 5967 static void SetAttributefv(GPU_Renderer* renderer, int location, int num_elements, float* value) 5845 5968 { 5969 + (void)renderer; 5970 + (void)location; 5971 + (void)num_elements; 5972 + (void)value; 5973 + 5846 5974 #ifndef SDL_GPU_DISABLE_SHADERS 5847 5975 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5848 5976 return; ··· 5880 6008 5881 6009 static void SetAttributeiv(GPU_Renderer* renderer, int location, int num_elements, int* value) 5882 6010 { 6011 + (void)renderer; 6012 + (void)location; 6013 + (void)num_elements; 6014 + (void)value; 5883 6015 #ifndef SDL_GPU_DISABLE_SHADERS 5884 6016 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5885 6017 return; ··· 5917 6049 5918 6050 static void SetAttributeuiv(GPU_Renderer* renderer, int location, int num_elements, unsigned int* value) 5919 6051 { 6052 + (void)renderer; 6053 + (void)location; 6054 + (void)num_elements; 6055 + (void)value; 6056 + 5920 6057 #ifndef SDL_GPU_DISABLE_SHADERS 5921 6058 if(!IsFeatureEnabled(renderer, GPU_FEATURE_BASIC_SHADERS)) 5922 6059 return; ··· 6001 6138 6002 6139 a->next_value = a->per_vertex_storage; 6003 6140 6004 - #endif 6141 + #endif 6142 + 6143 + (void)renderer; 6144 + (void)num_values; 6145 + (void)source; 6005 6146 } 6006 6147 6007 6148
+9 -1
SDL_gpu/SDL_gpu.c
··· 8 8 9 9 #ifdef _MSC_VER 10 10 #define __func__ __FUNCTION__ 11 + #pragma warning(push) 12 + // Visual Studio wants to complain about while(0) 13 + #pragma warning(disable: 4127) 11 14 #endif 12 15 13 16 #include "stb_image.h" ··· 454 457 GPU_Target* target = GPU_GetContextTarget(); 455 458 if(target == NULL) 456 459 return 0; 457 - return (SDL_GetWindowFlags(SDL_GetWindowFromID(target->context->windowID)) 460 + return (Uint8)(SDL_GetWindowFlags(SDL_GetWindowFromID(target->context->windowID)) 458 461 & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP)); 459 462 #else 460 463 SDL_Surface* surf = SDL_GetVideoSurface(); ··· 2645 2648 current_renderer->impl->SetAttributeSource(current_renderer, num_values, source); 2646 2649 } 2647 2650 2651 + 2652 + #ifdef _MSC_VER 2653 + #pragma warning(pop) 2654 + #endif 2655 +
+1 -1
SDL_gpu/SDL_gpu.h
··· 227 227 GPU_FormatEnum format; 228 228 int num_layers; 229 229 int bytes_per_pixel; 230 - Uint32 base_w, base_h; // Underlying texture dimensions 230 + Uint16 base_w, base_h; // Underlying texture dimensions 231 231 Uint8 has_mipmaps; 232 232 233 233 SDL_Color color;
+123 -118
SDL_gpu/SDL_gpuShapes.c
··· 1 1 #include "SDL_gpu.h" 2 - #include "SDL_gpu_RendererImpl.h" 3 - #include <string.h> 4 - 5 - #define CHECK_RENDERER(ret) \ 6 - GPU_Renderer* renderer = GPU_GetCurrentRenderer(); \ 2 + #include "SDL_gpu_RendererImpl.h" 3 + #include <string.h> 4 + 5 + #define CHECK_RENDERER() \ 6 + GPU_Renderer* renderer = GPU_GetCurrentRenderer(); \ 7 7 if(renderer == NULL) \ 8 - return ret; 9 - 10 - 11 - float GPU_SetLineThickness(float thickness) 12 - { 13 - CHECK_RENDERER(1.0f); 14 - return renderer->impl->SetLineThickness(renderer, thickness); 15 - } 16 - 17 - float GPU_GetLineThickness(void) 18 - { 19 - CHECK_RENDERER(1.0f); 20 - return renderer->impl->GetLineThickness(renderer); 21 - } 22 - 23 - void GPU_Pixel(GPU_Target* target, float x, float y, SDL_Color color) 24 - { 25 - CHECK_RENDERER(); 26 - renderer->impl->Pixel(renderer, target, x, y, color); 27 - } 28 - 29 - void GPU_Line(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color) 30 - { 31 - CHECK_RENDERER(); 32 - renderer->impl->Line(renderer, target, x1, y1, x2, y2, color); 33 - } 34 - 35 - 36 - void GPU_Arc(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color) 37 - { 38 - CHECK_RENDERER(); 39 - renderer->impl->Arc(renderer, target, x, y, radius, start_angle, end_angle, color); 40 - } 41 - 42 - 43 - void GPU_ArcFilled(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color) 44 - { 45 - CHECK_RENDERER(); 46 - renderer->impl->ArcFilled(renderer, target, x, y, radius, start_angle, end_angle, color); 47 - } 48 - 49 - void GPU_Circle(GPU_Target* target, float x, float y, float radius, SDL_Color color) 50 - { 51 - CHECK_RENDERER(); 52 - renderer->impl->Circle(renderer, target, x, y, radius, color); 53 - } 54 - 55 - void GPU_CircleFilled(GPU_Target* target, float x, float y, float radius, SDL_Color color) 56 - { 57 - CHECK_RENDERER(); 58 - renderer->impl->CircleFilled(renderer, target, x, y, radius, color); 8 + return; 9 + 10 + #define CHECK_RENDERER_1(ret) \ 11 + GPU_Renderer* renderer = GPU_GetCurrentRenderer(); \ 12 + if(renderer == NULL) \ 13 + return ret; 14 + 15 + 16 + float GPU_SetLineThickness(float thickness) 17 + { 18 + CHECK_RENDERER_1(1.0f); 19 + return renderer->impl->SetLineThickness(renderer, thickness); 20 + } 21 + 22 + float GPU_GetLineThickness(void) 23 + { 24 + CHECK_RENDERER_1(1.0f); 25 + return renderer->impl->GetLineThickness(renderer); 26 + } 27 + 28 + void GPU_Pixel(GPU_Target* target, float x, float y, SDL_Color color) 29 + { 30 + CHECK_RENDERER(); 31 + renderer->impl->Pixel(renderer, target, x, y, color); 32 + } 33 + 34 + void GPU_Line(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color) 35 + { 36 + CHECK_RENDERER(); 37 + renderer->impl->Line(renderer, target, x1, y1, x2, y2, color); 38 + } 39 + 40 + 41 + void GPU_Arc(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color) 42 + { 43 + CHECK_RENDERER(); 44 + renderer->impl->Arc(renderer, target, x, y, radius, start_angle, end_angle, color); 45 + } 46 + 47 + 48 + void GPU_ArcFilled(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color) 49 + { 50 + CHECK_RENDERER(); 51 + renderer->impl->ArcFilled(renderer, target, x, y, radius, start_angle, end_angle, color); 52 + } 53 + 54 + void GPU_Circle(GPU_Target* target, float x, float y, float radius, SDL_Color color) 55 + { 56 + CHECK_RENDERER(); 57 + renderer->impl->Circle(renderer, target, x, y, radius, color); 58 + } 59 + 60 + void GPU_CircleFilled(GPU_Target* target, float x, float y, float radius, SDL_Color color) 61 + { 62 + CHECK_RENDERER(); 63 + renderer->impl->CircleFilled(renderer, target, x, y, radius, color); 59 64 } 60 65 61 66 void GPU_Ellipse(GPU_Target* target, float x, float y, float rx, float ry, float degrees, SDL_Color color) 62 - { 63 - CHECK_RENDERER(); 67 + { 68 + CHECK_RENDERER(); 64 69 renderer->impl->Ellipse(renderer, target, x, y, rx, ry, degrees, color); 65 70 } 66 71 67 72 void GPU_EllipseFilled(GPU_Target* target, float x, float y, float rx, float ry, float degrees, SDL_Color color) 68 - { 69 - CHECK_RENDERER(); 73 + { 74 + CHECK_RENDERER(); 70 75 renderer->impl->EllipseFilled(renderer, target, x, y, rx, ry, degrees, color); 71 76 } 72 77 73 - void GPU_Sector(GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color) 74 - { 75 - CHECK_RENDERER(); 76 - renderer->impl->Sector(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color); 78 + void GPU_Sector(GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color) 79 + { 80 + CHECK_RENDERER(); 81 + renderer->impl->Sector(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color); 77 82 } 78 83 79 - void GPU_SectorFilled(GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color) 80 - { 81 - CHECK_RENDERER(); 82 - renderer->impl->SectorFilled(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color); 83 - } 84 - 85 - void GPU_Tri(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color) 86 - { 87 - CHECK_RENDERER(); 88 - renderer->impl->Tri(renderer, target, x1, y1, x2, y2, x3, y3, color); 89 - } 90 - 91 - void GPU_TriFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color) 92 - { 93 - CHECK_RENDERER(); 94 - renderer->impl->TriFilled(renderer, target, x1, y1, x2, y2, x3, y3, color); 95 - } 96 - 97 - void GPU_Rectangle(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color) 98 - { 99 - CHECK_RENDERER(); 100 - renderer->impl->Rectangle(renderer, target, x1, y1, x2, y2, color); 101 - } 102 - 103 - void GPU_RectangleFilled(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color) 104 - { 105 - CHECK_RENDERER(); 106 - renderer->impl->RectangleFilled(renderer, target, x1, y1, x2, y2, color); 107 - } 108 - 109 - void GPU_RectangleRound(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color) 110 - { 111 - CHECK_RENDERER(); 112 - renderer->impl->RectangleRound(renderer, target, x1, y1, x2, y2, radius, color); 113 - } 114 - 115 - void GPU_RectangleRoundFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color) 116 - { 117 - CHECK_RENDERER(); 118 - renderer->impl->RectangleRoundFilled(renderer, target, x1, y1, x2, y2, radius, color); 119 - } 120 - 121 - void GPU_Polygon(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color) 122 - { 123 - CHECK_RENDERER(); 124 - renderer->impl->Polygon(renderer, target, num_vertices, vertices, color); 125 - } 126 - 127 - void GPU_PolygonFilled(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color) 128 - { 129 - CHECK_RENDERER(); 130 - renderer->impl->PolygonFilled(renderer, target, num_vertices, vertices, color); 131 - } 132 - 84 + void GPU_SectorFilled(GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color) 85 + { 86 + CHECK_RENDERER(); 87 + renderer->impl->SectorFilled(renderer, target, x, y, inner_radius, outer_radius, start_angle, end_angle, color); 88 + } 89 + 90 + void GPU_Tri(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color) 91 + { 92 + CHECK_RENDERER(); 93 + renderer->impl->Tri(renderer, target, x1, y1, x2, y2, x3, y3, color); 94 + } 95 + 96 + void GPU_TriFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color) 97 + { 98 + CHECK_RENDERER(); 99 + renderer->impl->TriFilled(renderer, target, x1, y1, x2, y2, x3, y3, color); 100 + } 101 + 102 + void GPU_Rectangle(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color) 103 + { 104 + CHECK_RENDERER(); 105 + renderer->impl->Rectangle(renderer, target, x1, y1, x2, y2, color); 106 + } 107 + 108 + void GPU_RectangleFilled(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color) 109 + { 110 + CHECK_RENDERER(); 111 + renderer->impl->RectangleFilled(renderer, target, x1, y1, x2, y2, color); 112 + } 113 + 114 + void GPU_RectangleRound(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color) 115 + { 116 + CHECK_RENDERER(); 117 + renderer->impl->RectangleRound(renderer, target, x1, y1, x2, y2, radius, color); 118 + } 119 + 120 + void GPU_RectangleRoundFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color) 121 + { 122 + CHECK_RENDERER(); 123 + renderer->impl->RectangleRoundFilled(renderer, target, x1, y1, x2, y2, radius, color); 124 + } 125 + 126 + void GPU_Polygon(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color) 127 + { 128 + CHECK_RENDERER(); 129 + renderer->impl->Polygon(renderer, target, num_vertices, vertices, color); 130 + } 131 + 132 + void GPU_PolygonFilled(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color) 133 + { 134 + CHECK_RENDERER(); 135 + renderer->impl->PolygonFilled(renderer, target, num_vertices, vertices, color); 136 + } 137 +
+8 -2
SDL_gpu/SDL_gpu_Renderer.c
··· 27 27 28 28 static GPU_RendererID makeRendererID(const char* name, GPU_RendererEnum renderer, int major_version, int minor_version, int index) 29 29 { 30 - GPU_RendererID r = {name, renderer, major_version, minor_version, index}; 30 + GPU_RendererID r; 31 + r.name = name; 32 + r.renderer = renderer; 33 + r.major_version = major_version; 34 + r.minor_version = minor_version; 35 + r.index = index; 36 + 31 37 return r; 32 38 } 33 39 ··· 160 166 rendererRegister[i].freeFn = free_renderer; 161 167 } 162 168 163 - void GPU_RegisterRenderers() 169 + void GPU_RegisterRenderers(void) 164 170 { 165 171 #ifndef SDL_GPU_DISABLE_OPENGL 166 172 #ifndef SDL_GPU_DISABLE_OPENGL_1_BASE
+83 -38
SDL_gpu/SDL_gpu_matrix.c
··· 55 55 // Column-major 56 56 #define INDEX(row,col) ((col)*4 + (row)) 57 57 58 + #define FILL_MATRIX_4x4(A, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) \ 59 + A[0] = a0; \ 60 + A[1] = a1; \ 61 + A[2] = a2; \ 62 + A[3] = a3; \ 63 + A[4] = a4; \ 64 + A[5] = a5; \ 65 + A[6] = a6; \ 66 + A[7] = a7; \ 67 + A[8] = a8; \ 68 + A[9] = a9; \ 69 + A[10] = a10; \ 70 + A[11] = a11; \ 71 + A[12] = a12; \ 72 + A[13] = a13; \ 73 + A[14] = a14; \ 74 + A[15] = a15; 75 + 58 76 void GPU_MatrixCopy(float* result, const float* A) 59 77 { 60 78 memcpy(result, A, 16*sizeof(float)); ··· 168 186 return stack->matrix[stack->size-1]; 169 187 } 170 188 171 - void GPU_PushMatrix() 189 + void GPU_PushMatrix(void) 172 190 { 173 191 GPU_Target* target = GPU_GetContextTarget(); 174 192 GPU_MatrixStack* stack; ··· 186 204 stack->size++; 187 205 } 188 206 189 - void GPU_PopMatrix() 207 + void GPU_PopMatrix(void) 190 208 { 191 209 GPU_Target* target = GPU_GetContextTarget(); 192 210 GPU_MatrixStack* stack; ··· 219 237 220 238 { 221 239 #ifdef ROW_MAJOR 222 - float A[16] = {2/(right - left), 0, 0, -(right + left)/(right - left), 223 - 0, 2/(top - bottom), 0, -(top + bottom)/(top - bottom), 224 - 0, 0, -2/(far - near), -(far + near)/(far - near), 225 - 0, 0, 0, 1}; 240 + float A[16]; 241 + FILL_MATRIX_4x4(A, 242 + 2/(right - left), 0, 0, -(right + left)/(right - left), 243 + 0, 2/(top - bottom), 0, -(top + bottom)/(top - bottom), 244 + 0, 0, -2/(far - near), -(far + near)/(far - near), 245 + 0, 0, 0, 1 246 + ); 226 247 #else 227 - float A[16] = { 2 / (right - left), 0, 0, 0, 228 - 0, 2 / (top - bottom), 0, 0, 229 - 0, 0, -2 / (far - near), 0, 230 - -(right + left) / (right - left), -(top + bottom) / (top - bottom), -(far + near) / (far - near), 1 }; 248 + float A[16]; 249 + FILL_MATRIX_4x4(A, 250 + 2 / (right - left), 0, 0, 0, 251 + 0, 2 / (top - bottom), 0, 0, 252 + 0, 0, -2 / (far - near), 0, 253 + -(right + left) / (right - left), -(top + bottom) / (top - bottom), -(far + near) / (far - near), 1 254 + ); 231 255 #endif 232 256 233 257 GPU_MultiplyAndAssign(result, A); ··· 242 266 243 267 { 244 268 #ifdef ROW_MAJOR 245 - float A[16] = {2 * near / (right - left), 0, 0, 0, 246 - 0, 2 * near / (top - bottom), 0, 0, 247 - (right + left) / (right - left), (top + bottom) / (top - bottom), -(far + near) / (far - near), -1, 248 - 0, 0, -(2 * far * near) / (far - near), 0}; 269 + float A[16]; 270 + FILL_MATRIX_4x4(A, 271 + 2 * near / (right - left), 0, 0, 0, 272 + 0, 2 * near / (top - bottom), 0, 0, 273 + (right + left) / (right - left), (top + bottom) / (top - bottom), -(far + near) / (far - near), -1, 274 + 0, 0, -(2 * far * near) / (far - near), 0 275 + ); 249 276 #else 250 - float A[16] = { 2 * near / (right - left), 0, (right + left) / (right - left), 0, 251 - 0, 2 * near / (top - bottom), (top + bottom) / (top - bottom), 0, 252 - 0, 0, -(far + near) / (far - near), -(2 * far * near) / (far - near), 253 - 0, 0, -1, 0 }; 277 + float A[16]; 278 + FILL_MATRIX_4x4(A, 279 + 2 * near / (right - left), 0, (right + left) / (right - left), 0, 280 + 0, 2 * near / (top - bottom), (top + bottom) / (top - bottom), 0, 281 + 0, 0, -(far + near) / (far - near), -(2 * far * near) / (far - near), 282 + 0, 0, -1, 0 283 + ); 254 284 #endif 255 285 256 286 GPU_MultiplyAndAssign(result, A); ··· 265 295 266 296 { 267 297 #ifdef ROW_MAJOR 268 - float A[16] = {1, 0, 0, x, 269 - 0, 1, 0, y, 270 - 0, 0, 1, z, 271 - 0, 0, 0, 1}; 298 + float A[16]; 299 + FILL_MATRIX_4x4(A, 300 + 1, 0, 0, x, 301 + 0, 1, 0, y, 302 + 0, 0, 1, z, 303 + 0, 0, 0, 1 304 + ); 272 305 #else 273 - float A[16] = { 1, 0, 0, 0, 274 - 0, 1, 0, 0, 275 - 0, 0, 1, 0, 276 - x, y, z, 1 }; 306 + float A[16]; 307 + FILL_MATRIX_4x4(A, 308 + 1, 0, 0, 0, 309 + 0, 1, 0, 0, 310 + 0, 0, 1, 0, 311 + x, y, z, 1 312 + ); 277 313 #endif 278 314 279 315 GPU_MultiplyAndAssign(result, A); ··· 287 323 return; 288 324 289 325 { 290 - float A[16] = { sx, 0, 0, 0, 291 - 0, sy, 0, 0, 292 - 0, 0, sz, 0, 293 - 0, 0, 0, 1 }; 326 + float A[16]; 327 + FILL_MATRIX_4x4(A, 328 + sx, 0, 0, 0, 329 + 0, sy, 0, 0, 330 + 0, 0, sz, 0, 331 + 0, 0, 0, 1 332 + ); 294 333 295 334 GPU_MultiplyAndAssign(result, A); 296 335 } ··· 322 361 323 362 { 324 363 #ifdef ROW_MAJOR 325 - float A[16] = {x*x*c_ + c, xyc_ - zs, xzc_ + ys, 0, 326 - xyc_ + zs, y*yc_ + c, yzc_ - xs, 0, 327 - xzc_ - ys, yzc_ + xs, z*zc_ + c, 0, 328 - 0, 0, 0, 1}; 364 + float A[16]; 365 + FILL_MATRIX_4x4(A, 366 + x*x*c_ + c, xyc_ - zs, xzc_ + ys, 0, 367 + xyc_ + zs, y*yc_ + c, yzc_ - xs, 0, 368 + xzc_ - ys, yzc_ + xs, z*zc_ + c, 0, 369 + 0, 0, 0, 1 370 + ); 329 371 #else 330 - float A[16] = { x*x*c_ + c, xyc_ + zs, xzc_ - ys, 0, 331 - xyc_ - zs, y*yc_ + c, yzc_ + xs, 0, 332 - xzc_ + ys, yzc_ - xs, z*zc_ + c, 0, 333 - 0, 0, 0, 1 }; 372 + float A[16]; 373 + FILL_MATRIX_4x4(A, 374 + x*x*c_ + c, xyc_ + zs, xzc_ - ys, 0, 375 + xyc_ - zs, y*yc_ + c, yzc_ + xs, 0, 376 + xzc_ + ys, yzc_ - xs, z*zc_ + c, 0, 377 + 0, 0, 0, 1 378 + ); 334 379 #endif 335 380 336 381 GPU_MultiplyAndAssign(result, A);