The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SDL_gpu.h
Go to the documentation of this file.
1 #ifndef _SDL_GPU_H__
2 #define _SDL_GPU_H__
3 
4 #include "SDL.h"
5 #include <stdio.h>
6 #include <stdarg.h>
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 9
16 #define SDL_GPU_VERSION_PATCH 0
17 
18 /* Auto-detect if we're using the SDL2 API by the headers available. */
19  #define SDL_GPU_USE_SDL2
20 
21 typedef struct GPU_Renderer GPU_Renderer;
22 typedef struct GPU_Target GPU_Target;
23 
24 /*! A struct representing a rectangular area with floating point precision.
25  * \see GPU_MakeRect()
26  */
27 typedef struct GPU_Rect
28 {
29  float x, y;
30  float w, h;
31 } GPU_Rect;
32 
33 #define GPU_RENDERER_ORDER_MAX 10
34 
35 typedef Uint32 GPU_RendererEnum;
36 static const GPU_RendererEnum GPU_RENDERER_UNKNOWN = 0x0; // invalid value
37 static const GPU_RendererEnum GPU_RENDERER_OPENGL_1_BASE = 0x1;
38 static const GPU_RendererEnum GPU_RENDERER_OPENGL_1 = 0x2;
39 static const GPU_RendererEnum GPU_RENDERER_OPENGL_2 = 0x4;
40 static const GPU_RendererEnum GPU_RENDERER_OPENGL_3 = 0x8;
41 static const GPU_RendererEnum GPU_RENDERER_OPENGL_4 = 0x10;
42 static const GPU_RendererEnum GPU_RENDERER_GLES_1 = 0x100;
43 static const GPU_RendererEnum GPU_RENDERER_GLES_2 = 0x200;
44 static const GPU_RendererEnum GPU_RENDERER_GLES_3 = 0x400;
45 static const GPU_RendererEnum GPU_RENDERER_D3D9 = 0x10000;
46 static const GPU_RendererEnum GPU_RENDERER_D3D10 = 0x20000;
47 static const GPU_RendererEnum GPU_RENDERER_D3D11 = 0x40000;
48 
49 /*! Renderer ID object for identifying a specific renderer.
50  * \see GPU_MakeRendererID()
51  * \see GPU_InitRendererByID()
52  */
53 typedef struct GPU_RendererID
54 {
55  GPU_RendererEnum id;
58 
59  int index;
61 
62 
63 /*! Blend component functions
64  * \see GPU_SetBlendFunction()
65  * Values chosen for direct OpenGL compatibility.
66  */
67 typedef enum {
79 
80 /*! Blend component equations
81  * \see GPU_SetBlendEquation()
82  * Values chosen for direct OpenGL compatibility.
83  */
84 typedef enum {
85  GPU_EQ_ADD = 0x8006,
86  GPU_EQ_SUBTRACT = 0x800A,
89 
90 /*! Blend mode storage struct */
91 typedef struct GPU_BlendMode
92 {
97 
100 } GPU_BlendMode;
101 
102 /*! Blend mode presets
103  * \see GPU_SetBlendMode()
104  * \see GPU_GetBlendModeFromPreset()
105  */
106 typedef enum {
118 
119 /*! Image filtering options. These affect the quality/interpolation of colors when images are scaled.
120  * \see GPU_SetImageFilter()
121  */
122 typedef enum {
127 
128 /*! Snap modes. Blitting with these modes will align the sprite with the target's pixel grid.
129  * \see GPU_SetSnapMode()
130  * \see GPU_GetSnapMode()
131  */
132 typedef enum {
137 } GPU_SnapEnum;
138 
139 
140 /*! Image wrapping options. These affect how images handle src_rect coordinates beyond their dimensions when blitted.
141  * \see GPU_SetWrapMode()
142  */
143 typedef enum {
147 } GPU_WrapEnum;
148 
149 /*! Image format enum
150  * \see GPU_CreateImage()
151  */
152 typedef enum {
162 
163 
164 
165 /*! Image object for containing pixel/texture data.
166  * A GPU_Image can be created with GPU_CreateImage(), GPU_LoadImage(), GPU_CopyImage(), or GPU_CopyImageFromSurface().
167  * Free the memory with GPU_FreeImage() when you're done.
168  * \see GPU_CreateImage()
169  * \see GPU_LoadImage()
170  * \see GPU_CopyImage()
171  * \see GPU_CopyImageFromSurface()
172  * \see GPU_Target
173  */
174 typedef struct GPU_Image
175 {
178  Uint16 w, h;
182  Uint32 texture_w, texture_h; // Underlying texture dimensions
183  Uint8 has_mipmaps;
184 
185  SDL_Color color;
192 
193  void* data;
194  int refcount;
195  Uint8 is_alias;
196 } GPU_Image;
197 
198 
199 /*! Camera object that determines viewing transform.
200  * \see GPU_SetCamera()
201  * \see GPU_GetDefaultCamera()
202  * \see GPU_GetCamera()
203  */
204 typedef struct GPU_Camera
205 {
206  float x, y, z;
207  float angle;
208  float zoom;
209 } GPU_Camera;
210 
211 
212 /*! Container for the built-in shader attribute and uniform locations (indices).
213  * \see GPU_LoadShaderBlock()
214  * \see GPU_SetShaderBlock()
215  */
216 typedef struct GPU_ShaderBlock
217 {
218  // Attributes
222  // Uniforms
225 
226 
227 
228 
229 #ifndef GPU_MATRIX_STACK_MAX
230 #define GPU_MATRIX_STACK_MAX 5
231 #endif
232 
233 /*! Matrix stack data structure for replacing the old OpenGL matrix stack. */
234 typedef struct GPU_MatrixStack
235 {
236  unsigned int size;
239 
240 
241 /*! Rendering context data. Only GPU_Targets which represent windows will store this. */
242 typedef struct GPU_Context
243 {
244  /*! SDL_GLContext */
245  void* context;
246  Uint8 failed;
247 
248  /*! SDL window ID */
249  Uint32 windowID;
250 
251  /*! Actual window dimensions */
252  int window_w;
253  int window_h;
254 
255  /*! Window dimensions for restoring windowed mode after GPU_ToggleFullscreen(1). */
258 
259  /*! Internal state */
263 
268 
272 
273  void* data;
274 } GPU_Context;
275 
276 
277 /*! Render target object for use as a blitting destination.
278  * A GPU_Target can be created from a GPU_Image with GPU_LoadTarget().
279  * A GPU_Target can also represent a separate window with GPU_CreateTargetFromWindow(). In that case, 'context' is allocated and filled in.
280  * Note: You must have passed the SDL_WINDOW_OPENGL flag to SDL_CreateWindow() for OpenGL renderers to work with new windows.
281  * Free the memory with GPU_FreeTarget() when you're done.
282  * \see GPU_LoadTarget()
283  * \see GPU_CreateTargetFromWindow()
284  * \see GPU_FreeTarget()
285  */
287 {
290  void* data;
291  Uint16 w, h;
294  Uint8 use_color;
295  SDL_Color color;
296 
298 
299  /*! Perspective and object viewing transforms. */
301 
302  /*! Renderer context data. NULL if the target does not represent a window or rendering context. */
304  int refcount;
305  Uint8 is_alias;
306 };
307 
308 /*! Important GPU features which may not be supported depending on a device's extension support. Can be OR'd together.
309  * \see GPU_IsFeatureEnabled()
310  * \see GPU_SetPreInitFlags()
311  * \see GPU_GetPreInitFlags()
312  */
313 typedef Uint32 GPU_FeatureEnum;
314 static const GPU_FeatureEnum GPU_FEATURE_NON_POWER_OF_TWO = 0x1;
315 static const GPU_FeatureEnum GPU_FEATURE_RENDER_TARGETS = 0x2;
316 static const GPU_FeatureEnum GPU_FEATURE_BLEND_EQUATIONS = 0x4;
317 static const GPU_FeatureEnum GPU_FEATURE_BLEND_FUNC_SEPARATE = 0x8;
318 static const GPU_FeatureEnum GPU_FEATURE_BLEND_EQUATIONS_SEPARATE = 0x10;
319 static const GPU_FeatureEnum GPU_FEATURE_GL_BGR = 0x20;
320 static const GPU_FeatureEnum GPU_FEATURE_GL_BGRA = 0x40;
321 static const GPU_FeatureEnum GPU_FEATURE_GL_ABGR = 0x80;
322 static const GPU_FeatureEnum GPU_FEATURE_VERTEX_SHADER = 0x100;
323 static const GPU_FeatureEnum GPU_FEATURE_FRAGMENT_SHADER = 0x200;
324 static const GPU_FeatureEnum GPU_FEATURE_PIXEL_SHADER = 0x200;
325 static const GPU_FeatureEnum GPU_FEATURE_GEOMETRY_SHADER = 0x400;
326 static const GPU_FeatureEnum GPU_FEATURE_WRAP_REPEAT_MIRRORED = 0x800;
327 
328 /*! Combined feature flags */
329 #define GPU_FEATURE_ALL_BASE GPU_FEATURE_RENDER_TARGETS
330 #define GPU_FEATURE_ALL_BLEND_PRESETS (GPU_FEATURE_BLEND_EQUATIONS | GPU_FEATURE_BLEND_FUNC_SEPARATE)
331 #define GPU_FEATURE_ALL_GL_FORMATS (GPU_FEATURE_GL_BGR | GPU_FEATURE_GL_BGRA | GPU_FEATURE_GL_ABGR)
332 #define GPU_FEATURE_BASIC_SHADERS (GPU_FEATURE_FRAGMENT_SHADER | GPU_FEATURE_PIXEL_SHADER)
333 #define GPU_FEATURE_ALL_SHADERS (GPU_FEATURE_FRAGMENT_SHADER | GPU_FEATURE_PIXEL_SHADER | GPU_FEATURE_GEOMETRY_SHADER)
334 
335 /*! For separating combined feature flags from init flags. */
336 #define GPU_FEATURE_MASK 0x00FFFF
337 #define GPU_INIT_MASK 0xFF0000
338 
339 typedef Uint32 GPU_WindowFlagEnum;
340 
341 /*! Initialization flags for changing default init parameters. Can be bitwise OR'ed together with GPU_FeatureEnums.
342  * Default (0) is to use late swap vsync and double buffering.
343  * \see GPU_SetPreInitFlags()
344  * \see GPU_GetPreInitFlags()
345  */
346 typedef Uint32 GPU_InitFlagEnum;
347 static const GPU_InitFlagEnum GPU_INIT_ENABLE_VSYNC = 0x10000;
348 static const GPU_InitFlagEnum GPU_INIT_DISABLE_VSYNC = 0x20000;
349 static const GPU_InitFlagEnum GPU_INIT_DISABLE_DOUBLE_BUFFER = 0x40000;
350 
351 #define GPU_DEFAULT_INIT_FLAGS 0
352 
353 
354 static const Uint32 GPU_NONE = 0x0;
355 
356 /*! Bit flags for the blit batch functions.
357  * \see GPU_BlitBatch()
358  * \see GPU_BlitBatchSeparate()
359  */
360 typedef Uint32 GPU_BlitFlagEnum;
361 static const GPU_BlitFlagEnum GPU_PASSTHROUGH_VERTICES = 0x1;
362 static const GPU_BlitFlagEnum GPU_PASSTHROUGH_TEXCOORDS = 0x2;
363 static const GPU_BlitFlagEnum GPU_PASSTHROUGH_COLORS = 0x4;
364 static const GPU_BlitFlagEnum GPU_USE_DEFAULT_POSITIONS = 0x8;
365 static const GPU_BlitFlagEnum GPU_USE_DEFAULT_SRC_RECTS = 0x10;
366 static const GPU_BlitFlagEnum GPU_USE_DEFAULT_COLORS = 0x20;
367 
368 #define GPU_PASSTHROUGH_ALL (GPU_PASSTHROUGH_VERTICES | GPU_PASSTHROUGH_TEXCOORDS | GPU_PASSTHROUGH_COLORS)
369 
370 /*! Type enumeration for GPU_AttributeFormat specifications. */
371 typedef Uint32 GPU_TypeEnum;
372 // Use OpenGL's values for simpler translation
373 static const GPU_TypeEnum GPU_TYPE_BYTE = 0x1400;
374 static const GPU_TypeEnum GPU_TYPE_UNSIGNED_BYTE = 0x1401;
375 static const GPU_TypeEnum GPU_TYPE_SHORT = 0x1402;
376 static const GPU_TypeEnum GPU_TYPE_UNSIGNED_SHORT = 0x1403;
377 static const GPU_TypeEnum GPU_TYPE_INT = 0x1404;
378 static const GPU_TypeEnum GPU_TYPE_UNSIGNED_INT = 0x1405;
379 static const GPU_TypeEnum GPU_TYPE_FLOAT = 0x1406;
380 static const GPU_TypeEnum GPU_TYPE_DOUBLE = 0x140A;
381 
382 
383 
384 
385 
386 
387 /*! Shader type enum.
388  * \see GPU_LoadShader()
389  * \see GPU_CompileShader()
390  * \see GPU_CompileShader_RW()
391  */
392 typedef enum {
398 
399 
400 
401 /*! Type enumeration for the shader language used by the renderer. */
402 typedef enum {
410 
411 typedef struct GPU_AttributeFormat
412 {
413  Uint8 is_per_sprite; // Per-sprite values are expanded to 4 vertices
415  GPU_TypeEnum type; // GPU_TYPE_FLOAT, GPU_TYPE_INT, GPU_TYPE_UNSIGNED_INT, etc.
416  Uint8 normalize;
417  int stride_bytes; // Number of bytes between two vertex specifications
418  int offset_bytes; // Number of bytes to skip at the beginning of 'values'
420 
421 typedef struct GPU_Attribute
422 {
423  int location;
424  void* values; // Expect 4 values for each sprite
426 } GPU_Attribute;
427 
428 typedef struct GPU_AttributeSource
429 {
430  Uint8 enabled;
432  void* next_value;
433  // Automatic storage format
436  int per_vertex_storage_size; // Over 0 means that the per-vertex storage has been automatically allocated
437  void* per_vertex_storage; // Could point to the attribute's values or to allocated storage
440 
441 
442 /*! Type enumeration for error codes.
443  * \see GPU_PushErrorCode()
444  * \see GPU_PopErrorCode()
445  */
446 typedef enum {
454 } GPU_ErrorEnum;
455 
456 
457 typedef struct GPU_ErrorObject
458 {
459  char* function;
461  char* details;
463 
464 
465 /*! Type enumeration for debug levels.
466  * \see GPU_SetDebugLevel()
467  * \see GPU_GetDebugLevel()
468  */
469 typedef enum {
476 
477 
478 
479 
480 /*! Renderer object which specializes the API to a particular backend. */
482 {
483  /*! Struct identifier of the renderer. */
486  GPU_WindowFlagEnum SDL_init_flags;
487  GPU_InitFlagEnum GPU_init_flags;
488 
491  GPU_FeatureEnum enabled_features;
492 
493  /*! Current display target */
495 
496 
497  /*! \see GPU_Init()
498  * \see GPU_InitRenderer()
499  * \see GPU_InitRendererByID()
500  */
501  GPU_Target* (*Init)(GPU_Renderer* renderer, GPU_RendererID renderer_request, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags);
502 
503  /*! \see GPU_IsFeatureEnabled() */
504  Uint8 (*IsFeatureEnabled)(GPU_Renderer* renderer, GPU_FeatureEnum feature);
505 
506  /*! \see GPU_CreateTargetFromWindow
507  * The extra parameter is used internally to reuse/reinit a target. */
508  GPU_Target* (*CreateTargetFromWindow)(GPU_Renderer* renderer, Uint32 windowID, GPU_Target* target);
509 
510  /*! \see GPU_CreateAliasTarget() */
511  GPU_Target* (*CreateAliasTarget)(GPU_Renderer* renderer, GPU_Target* target);
512 
513  /*! \see GPU_MakeCurrent */
514  void (*MakeCurrent)(GPU_Renderer* renderer, GPU_Target* target, Uint32 windowID);
515 
516  /*! Sets up this renderer to act as the current renderer. Called automatically by GPU_SetCurrentRenderer(). */
518 
519  /*! \see GPU_SetWindowResolution() */
520  Uint8 (*SetWindowResolution)(GPU_Renderer* renderer, Uint16 w, Uint16 h);
521 
522  /*! \see GPU_SetVirtualResolution() */
523  void (*SetVirtualResolution)(GPU_Renderer* renderer, GPU_Target* target, Uint16 w, Uint16 h);
524 
525  /*! \see GPU_UnsetVirtualResolution() */
527 
528  /*! Clean up the renderer state. */
529  void (*Quit)(GPU_Renderer* renderer);
530 
531  /*! \see GPU_ToggleFullscreen() */
532  Uint8 (*ToggleFullscreen)(GPU_Renderer* renderer, Uint8 use_desktop_resolution);
533 
534  /*! \see GPU_SetCamera() */
536 
537  /*! \see GPU_CreateImage() */
538  GPU_Image* (*CreateImage)(GPU_Renderer* renderer, Uint16 w, Uint16 h, GPU_FormatEnum format);
539 
540  /*! \see GPU_LoadImage() */
541  GPU_Image* (*LoadImage)(GPU_Renderer* renderer, const char* filename);
542 
543  /*! \see GPU_CreateAliasImage() */
544  GPU_Image* (*CreateAliasImage)(GPU_Renderer* renderer, GPU_Image* image);
545 
546  /*! \see GPU_SaveImage() */
547  Uint8 (*SaveImage)(GPU_Renderer* renderer, GPU_Image* image, const char* filename);
548 
549  /*! \see GPU_CopyImage() */
550  GPU_Image* (*CopyImage)(GPU_Renderer* renderer, GPU_Image* image);
551 
552  /*! \see GPU_UpdateImage */
553  void (*UpdateImage)(GPU_Renderer* renderer, GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect);
554 
555  /*! \see GPU_UpdateSubImage */
556  void (*UpdateSubImage)(GPU_Renderer* renderer, GPU_Image* image, const GPU_Rect* image_rect, SDL_Surface* surface, const GPU_Rect* surface_rect);
557 
558  /*! \see GPU_UpdateImageBytes */
559  void (*UpdateImageBytes)(GPU_Renderer* renderer, GPU_Image* image, const GPU_Rect* image_rect, const unsigned char* bytes, int bytes_per_row);
560 
561  /*! \see GPU_CopyImageFromSurface() */
562  GPU_Image* (*CopyImageFromSurface)(GPU_Renderer* renderer, SDL_Surface* surface);
563 
564  /*! \see GPU_CopyImageFromTarget() */
565  GPU_Image* (*CopyImageFromTarget)(GPU_Renderer* renderer, GPU_Target* target);
566 
567  /*! \see GPU_CopySurfaceFromTarget() */
568  SDL_Surface* (*CopySurfaceFromTarget)(GPU_Renderer* renderer, GPU_Target* target);
569 
570  /*! \see GPU_CopySurfaceFromImage() */
571  SDL_Surface* (*CopySurfaceFromImage)(GPU_Renderer* renderer, GPU_Image* image);
572 
573  /*! \see GPU_FreeImage() */
575 
576  /*! \see GPU_LoadTarget() */
577  GPU_Target* (*LoadTarget)(GPU_Renderer* renderer, GPU_Image* image);
578 
579  /*! \see GPU_FreeTarget() */
581 
582  /*! \see GPU_Blit() */
583  void (*Blit)(GPU_Renderer* renderer, GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y);
584 
585  /*! \see GPU_BlitRotate() */
586  void (*BlitRotate)(GPU_Renderer* renderer, GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y, float degrees);
587 
588  /*! \see GPU_BlitScale() */
589  void (*BlitScale)(GPU_Renderer* renderer, GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y, float scaleX, float scaleY);
590 
591  /*! \see GPU_BlitTransform */
592  void (*BlitTransform)(GPU_Renderer* renderer, GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y, float degrees, float scaleX, float scaleY);
593 
594  /*! \see GPU_BlitTransformX() */
595  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);
596 
597  /*! \see GPU_BlitTransformMatrix() */
598  void (*BlitTransformMatrix)(GPU_Renderer* renderer, GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y, float* matrix3x3);
599 
600  /*! \see GPU_BlitBatch() */
601  void (*BlitBatch)(GPU_Renderer* renderer, GPU_Image* image, GPU_Target* target, unsigned int num_sprites, float* values, GPU_BlitFlagEnum flags);
602 
603  /*! \see GPU_TriangleBatch() */
604  void (*TriangleBatch)(GPU_Renderer* renderer, GPU_Image* image, GPU_Target* target, unsigned short num_vertices, float* values, unsigned int num_indices, unsigned short* indices, GPU_BlitFlagEnum flags);
605 
606  /*! \see GPU_GenerateMipmaps() */
608 
609  /*! \see GPU_SetClip() */
610  GPU_Rect (*SetClip)(GPU_Renderer* renderer, GPU_Target* target, Sint16 x, Sint16 y, Uint16 w, Uint16 h);
611 
612  /*! \see GPU_UnsetClip() */
614 
615  /*! \see GPU_GetPixel() */
616  SDL_Color (*GetPixel)(GPU_Renderer* renderer, GPU_Target* target, Sint16 x, Sint16 y);
617 
618  /*! \see GPU_SetImageFilter() */
620 
621  /*! \see GPU_SetWrapMode() */
622  void (*SetWrapMode)(GPU_Renderer* renderer, GPU_Image* image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y);
623 
624  /*! \see GPU_Clear() */
626  /*! \see GPU_ClearRGBA() */
627  void (*ClearRGBA)(GPU_Renderer* renderer, GPU_Target* target, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
628  /*! \see GPU_FlushBlitBuffer() */
630  /*! \see GPU_Flip() */
632 
633 
634  /*! \see GPU_CompileShader_RW() */
635  Uint32 (*CompileShader_RW)(GPU_Renderer* renderer, GPU_ShaderEnum shader_type, SDL_RWops* shader_source);
636 
637  /*! \see GPU_CompileShader() */
638  Uint32 (*CompileShader)(GPU_Renderer* renderer, GPU_ShaderEnum shader_type, const char* shader_source);
639 
640  /*! \see GPU_LinkShaderProgram() */
641  Uint32 (*LinkShaderProgram)(GPU_Renderer* renderer, Uint32 program_object);
642 
643  /*! \see GPU_LinkShaders() */
644  Uint32 (*LinkShaders)(GPU_Renderer* renderer, Uint32 shader_object1, Uint32 shader_object2);
645 
646  /*! \see GPU_FreeShader() */
647  void (*FreeShader)(GPU_Renderer* renderer, Uint32 shader_object);
648 
649  /*! \see GPU_FreeShaderProgram() */
650  void (*FreeShaderProgram)(GPU_Renderer* renderer, Uint32 program_object);
651 
652  /*! \see GPU_AttachShader() */
653  void (*AttachShader)(GPU_Renderer* renderer, Uint32 program_object, Uint32 shader_object);
654 
655  /*! \see GPU_DetachShader() */
656  void (*DetachShader)(GPU_Renderer* renderer, Uint32 program_object, Uint32 shader_object);
657 
658  /*! \see GPU_IsDefaultShaderProgram() */
659  Uint8 (*IsDefaultShaderProgram)(GPU_Renderer* renderer, Uint32 program_object);
660 
661  /*! \see GPU_ActivateShaderProgram() */
662  void (*ActivateShaderProgram)(GPU_Renderer* renderer, Uint32 program_object, GPU_ShaderBlock* block);
663 
664  /*! \see GPU_DeactivateShaderProgram() */
666 
667  /*! \see GPU_GetShaderMessage() */
668  const char* (*GetShaderMessage)(GPU_Renderer* renderer);
669 
670  /*! \see GPU_GetAttribLocation() */
671  int (*GetAttributeLocation)(GPU_Renderer* renderer, Uint32 program_object, const char* attrib_name);
672 
673  /*! \see GPU_GetUniformLocation() */
674  int (*GetUniformLocation)(GPU_Renderer* renderer, Uint32 program_object, const char* uniform_name);
675 
676  /*! \see GPU_LoadShaderBlock() */
677  GPU_ShaderBlock (*LoadShaderBlock)(GPU_Renderer* renderer, Uint32 program_object, const char* position_name, const char* texcoord_name, const char* color_name, const char* modelViewMatrix_name);
678 
679  /*! \see GPU_SetShaderBlock() */
681 
682  /*! \see GPU_SetShaderImage() */
683  void (*SetShaderImage)(GPU_Renderer* renderer, GPU_Image* image, int location, int image_unit);
684 
685  /*! \see GPU_GetUniformiv() */
686  void (*GetUniformiv)(GPU_Renderer* renderer, Uint32 program_object, int location, int* values);
687 
688  /*! \see GPU_SetUniformi() */
689  void (*SetUniformi)(GPU_Renderer* renderer, int location, int value);
690 
691  /*! \see GPU_SetUniformiv() */
692  void (*SetUniformiv)(GPU_Renderer* renderer, int location, int num_elements_per_value, int num_values, int* values);
693 
694  /*! \see GPU_GetUniformuiv() */
695  void (*GetUniformuiv)(GPU_Renderer* renderer, Uint32 program_object, int location, unsigned int* values);
696 
697  /*! \see GPU_SetUniformui() */
698  void (*SetUniformui)(GPU_Renderer* renderer, int location, unsigned int value);
699 
700  /*! \see GPU_SetUniformuiv() */
701  void (*SetUniformuiv)(GPU_Renderer* renderer, int location, int num_elements_per_value, int num_values, unsigned int* values);
702 
703  /*! \see GPU_GetUniformfv() */
704  void (*GetUniformfv)(GPU_Renderer* renderer, Uint32 program_object, int location, float* values);
705 
706  /*! \see GPU_SetUniformf() */
707  void (*SetUniformf)(GPU_Renderer* renderer, int location, float value);
708 
709  /*! \see GPU_SetUniformfv() */
710  void (*SetUniformfv)(GPU_Renderer* renderer, int location, int num_elements_per_value, int num_values, float* values);
711 
712  /*! \see GPU_SetUniformMatrixfv() */
713  void (*SetUniformMatrixfv)(GPU_Renderer* renderer, int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float* values);
714 
715  /*! \see GPU_SetAttributef() */
716  void (*SetAttributef)(GPU_Renderer* renderer, int location, float value);
717 
718  /*! \see GPU_SetAttributei() */
719  void (*SetAttributei)(GPU_Renderer* renderer, int location, int value);
720 
721  /*! \see GPU_SetAttributeui() */
722  void (*SetAttributeui)(GPU_Renderer* renderer, int location, unsigned int value);
723 
724  /*! \see GPU_SetAttributefv() */
725  void (*SetAttributefv)(GPU_Renderer* renderer, int location, int num_elements, float* value);
726 
727  /*! \see GPU_SetAttributeiv() */
728  void (*SetAttributeiv)(GPU_Renderer* renderer, int location, int num_elements, int* value);
729 
730  /*! \see GPU_SetAttributeuiv() */
731  void (*SetAttributeuiv)(GPU_Renderer* renderer, int location, int num_elements, unsigned int* value);
732 
733  /*! \see GPU_SetAttributeSource() */
734  void (*SetAttributeSource)(GPU_Renderer* renderer, int num_values, GPU_Attribute source);
735 
736 
737  // Shapes
738 
739  /*! \see GPU_SetLineThickness() */
740  float (*SetLineThickness)(GPU_Renderer* renderer, float thickness);
741 
742  /*! \see GPU_GetLineThickness() */
743  float (*GetLineThickness)(GPU_Renderer* renderer);
744 
745  /*! \see GPU_Pixel() */
746  void (*Pixel)(GPU_Renderer* renderer, GPU_Target* target, float x, float y, SDL_Color color);
747 
748  /*! \see GPU_Line() */
749  void (*Line)(GPU_Renderer* renderer, GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color);
750 
751  /*! \see GPU_Arc() */
752  void (*Arc)(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color);
753 
754  /*! \see GPU_ArcFilled() */
755  void (*ArcFilled)(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color);
756 
757  /*! \see GPU_Circle() */
758  void (*Circle)(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float radius, SDL_Color color);
759 
760  /*! \see GPU_CircleFilled() */
761  void (*CircleFilled)(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float radius, SDL_Color color);
762 
763  /*! \see GPU_Sector() */
764  void (*Sector)(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color);
765 
766  /*! \see GPU_SectorFilled() */
767  void (*SectorFilled)(GPU_Renderer* renderer, GPU_Target* target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color);
768 
769  /*! \see GPU_Tri() */
770  void (*Tri)(GPU_Renderer* renderer, GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color);
771 
772  /*! \see GPU_TriFilled() */
773  void (*TriFilled)(GPU_Renderer* renderer, GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color);
774 
775  /*! \see GPU_Rectangle() */
776  void (*Rectangle)(GPU_Renderer* renderer, GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color);
777 
778  /*! \see GPU_RectangleFilled() */
779  void (*RectangleFilled)(GPU_Renderer* renderer, GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color);
780 
781  /*! \see GPU_RectangleRound() */
782  void (*RectangleRound)(GPU_Renderer* renderer, GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color);
783 
784  /*! \see GPU_RectangleRoundFilled() */
785  void (*RectangleRoundFilled)(GPU_Renderer* renderer, GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color);
786 
787  /*! \see GPU_Polygon() */
788  void (*Polygon)(GPU_Renderer* renderer, GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color);
789 
790  /*! \see GPU_PolygonFilled() */
791  void (*PolygonFilled)(GPU_Renderer* renderer, GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color);
792 };
793 
794 
795 
796 
797 
798 
799 // Setup calls
800 
801 // static inline only supported in Visual C++ from version 2015 but can use static __inline instead for older versions
802 #ifdef _MSC_VER
803 #if _MSC_VER < 1900
804 static __inline SDL_version GPU_GetCompiledVersion(void)
805 #else
806 static inline SDL_version GPU_GetCompiledVersion(void)
807 #endif
808 #else
809 static inline SDL_version GPU_GetCompiledVersion(void)
810 #endif
811 {
813  return v;
814 }
815 
816 SDL_version GPU_GetLinkedVersion(void);
817 
818 /*! The window corresponding to 'windowID' will be used to create the rendering context instead of creating a new window. */
819 void GPU_SetInitWindow(Uint32 windowID);
820 
821 /*! Returns the window ID that has been set via GPU_SetInitWindow(). */
822 Uint32 GPU_GetInitWindow(void);
823 
824 /*! Set special flags to use for initialization. Set these before calling GPU_Init().
825  * \param GPU_flags An OR'ed combination of GPU_InitFlagEnum flags and GPU_FeatureEnum flags. GPU_FeatureEnum flags will force GPU_Init() to create a renderer that supports all of the given flags or else fail. Default flags (0) enable late swap vsync and double buffering. */
826 void GPU_SetPreInitFlags(GPU_InitFlagEnum GPU_flags);
827 
828 /*! Returns the current special flags to use for initialization. */
829 GPU_InitFlagEnum GPU_GetPreInitFlags(void);
830 
831 /*! Gets the default initialization renderer IDs for the current platform copied into the 'order' array and the number of renderer IDs into 'order_size'. Pass NULL for 'order' to just get the size of the renderer order array. Will return at most GPU_RENDERER_ORDER_MAX renderers. */
832 void GPU_GetDefaultRendererOrder(int* order_size, GPU_RendererID* order);
833 
834 /*! Gets the current renderer ID order for initialization copied into the 'order' array and the number of renderer IDs into 'order_size'. Pass NULL for 'order' to just get the size of the renderer order array. */
835 void GPU_GetRendererOrder(int* order_size, GPU_RendererID* order);
836 
837 /*! Sets the renderer ID order to use for initialization. If 'order' is NULL, it will restore the default order. */
838 void GPU_SetRendererOrder(int order_size, GPU_RendererID* order);
839 
840 /*! Initializes SDL and SDL_gpu. Creates a window and goes through the renderer order to create a renderer context.
841  * \see GPU_SetRendererOrder()
842  */
843 GPU_Target* GPU_Init(Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags);
844 
845 /*! Initializes SDL and SDL_gpu. Creates a window and the requested renderer context. */
846 GPU_Target* GPU_InitRenderer(GPU_RendererEnum renderer_enum, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags);
847 
848 /*! Initializes SDL and SDL_gpu. Creates a window and the requested renderer context.
849  * By requesting a renderer via ID, you can specify the major and minor versions of an individual renderer backend.
850  * \see GPU_MakeRendererID
851  */
852 GPU_Target* GPU_InitRendererByID(GPU_RendererID renderer_request, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags);
853 
854 /*! Checks for important GPU features which may not be supported depending on a device's extension support. Feature flags (GPU_FEATURE_*) can be bitwise OR'd together.
855  * \return 1 if all of the passed features are enabled/supported
856  * \return 0 if any of the passed features are disabled/unsupported
857  */
858 Uint8 GPU_IsFeatureEnabled(GPU_FeatureEnum feature);
859 
860 /*! Clean up the renderer state. */
861 void GPU_CloseCurrentRenderer(void);
862 
863 /*! Clean up the renderer state and shut down SDL_gpu. */
864 void GPU_Quit(void);
865 
866 
867 
868 
869 // Debugging, logging, and error handling
870 
871 /*! Sets the global debug level.
872  * GPU_DEBUG_LEVEL_0: Normal
873  * GPU_DEBUG_LEVEL_1: Prints messages when errors are pushed via GPU_PushErrorCode()
874  * GPU_DEBUG_LEVEL_2: Elevates warning logs to error priority
875  * GPU_DEBUG_LEVEL_3: Elevates info logs to error priority
876  */
878 
879 /*! Returns the current global debug level. */
881 
882 /*! Prints an informational log message. */
883 void GPU_LogInfo(const char* format, ...);
884 
885 /*! Prints a warning log message. */
886 void GPU_LogWarning(const char* format, ...);
887 
888 /*! Prints an error log message. */
889 void GPU_LogError(const char* format, ...);
890 
891 #define GPU_Log GPU_LogInfo
892 
893 /*! Pushes a new error code onto the error stack. If the stack is full, this function does nothing.
894  * \param function The name of the function that pushed the error
895  * \param error The error code to push on the error stack
896  * \param details Additional information string, can be NULL.
897  */
898 void GPU_PushErrorCode(const char* function, GPU_ErrorEnum error, const char* details, ...);
899 
900 /*! Pops an error object from the error stack and returns it. If the error stack is empty, it returns an error object with NULL function, GPU_ERROR_NONE error, and NULL details. */
902 
903 /*! Gets the string representation of an error code. */
905 
906 
907 
908 
909 
910 
911 
912 
913 // Renderer setup controls
914 
915 /*! Translates a GPU_RendererEnum into a string. */
916 const char* GPU_GetRendererEnumString(GPU_RendererEnum id);
917 
918 /*! Returns an initialized GPU_RendererID. */
919 GPU_RendererID GPU_MakeRendererID(GPU_RendererEnum id, int major_version, int minor_version);
920 
921 /*! Gets the renderer identifier for the given registration index. */
923 
924 /*! Gets the number of registered (available) renderers. */
926 
927 /*! Gets an array of identifiers for the registered (available) renderers. */
928 void GPU_GetRegisteredRendererList(GPU_RendererID* renderers_array);
929 
930 /*! Creates a new renderer matching the given identifier. */
932 
933 /*! Deletes the renderer matching the given identifier. */
935 
936 
937 
938 // Renderer controls
939 
940 /*! Gets the number of active (created) renderers. */
941 int GPU_GetNumActiveRenderers(void);
942 
943 /*! Gets an array of identifiers for the active renderers. */
944 void GPU_GetActiveRendererList(GPU_RendererID* renderers_array);
945 
946 /*! Gets the renderer for the given renderer index. */
947 GPU_Renderer* GPU_GetRenderer(unsigned int index);
948 
949 /*! \return The renderer matching the given identifier. */
951 
952 /*! \return The current renderer */
954 
955 /*! Switches the current renderer to the renderer matching the given identifier. */
957 
958 
959 
960 
961 
962 // Context / window controls
963 
964 /*! \return The renderer's current context target. */
966 
967 /*! \return The target that is associated with the given windowID. */
968 GPU_Target* GPU_GetWindowTarget(Uint32 windowID);
969 
970 /*! Creates a separate context for the given window using the current renderer and returns a GPU_Target that represents it. */
971 GPU_Target* GPU_CreateTargetFromWindow(Uint32 windowID);
972 
973 /*! Makes the given window the current rendering destination for the given context target.
974  * This also makes the target the current context for image loading and window operations.
975  * If the target does not represent a window, this does nothing.
976  */
977 void GPU_MakeCurrent(GPU_Target* target, Uint32 windowID);
978 
979 /*! Change the actual size of the current context target's window. This resets the virtual resolution and viewport of the context target.
980  * Aside from direct resolution changes, this should also be called in response to SDL_WINDOWEVENT_RESIZED window events for resizable windows. */
981 Uint8 GPU_SetWindowResolution(Uint16 w, Uint16 h);
982 
983 /*! Enable/disable fullscreen mode for the current context target's window.
984  * On some platforms, this may destroy the renderer context and require that textures be reloaded. Unfortunately, SDL does not provide a notification mechanism for this.
985  * \param use_desktop_resolution If true, lets the window change its resolution when it enters fullscreen mode (via SDL_WINDOW_FULLSCREEN_DESKTOP).
986  * \return 0 if the new mode is windowed, 1 if the new mode is fullscreen. */
987 Uint8 GPU_ToggleFullscreen(Uint8 use_desktop_resolution);
988 
989 /*! Enables/disables alpha blending for shape rendering on the current window. */
990 void GPU_SetShapeBlending(Uint8 enable);
991 
992 /*! Translates a blend preset into a blend mode. */
994 
995 /*! Sets the blending component functions for shape rendering. */
996 void GPU_SetShapeBlendFunction(GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha);
997 
998 /*! Sets the blending component equations for shape rendering. */
999 void GPU_SetShapeBlendEquation(GPU_BlendEqEnum color_equation, GPU_BlendEqEnum alpha_equation);
1000 
1001 /*! Sets the blending mode for shape rendering on the current window, if supported by the renderer. */
1003 
1004 /*! Sets the thickness of lines for the current context.
1005  * \param thickness New line thickness in pixels measured across the line. Default is 1.0f.
1006  * \return The old thickness value
1007  */
1008 float GPU_SetLineThickness(float thickness);
1009 
1010 /*! Returns the current line thickness value. */
1011 float GPU_GetLineThickness(void);
1012 
1013 
1014 
1015 
1016 
1017 // Target controls
1018 
1019 /*! Creates a target that aliases the given target. Aliases can be used to store target settings (e.g. viewports) for easy switching.
1020  * GPU_FreeTarget() frees the alias's memory, but does not affect the original. */
1022 
1023 /*! Creates a new render target from the given image. It can then be accessed from image->target. */
1025 
1026 /*! Deletes a render target in the proper way for this renderer. */
1028 
1029 /*! Change the logical size of the given target. Rendering to this target will be scaled as if the dimensions were actually the ones given. */
1030 void GPU_SetVirtualResolution(GPU_Target* target, Uint16 w, Uint16 h);
1031 
1032 /*! Converts screen space coordinates (such as from mouse input) to logical drawing coordinates. */
1033 void GPU_GetVirtualCoords(GPU_Target* target, float* x, float* y, float displayX, float displayY);
1034 
1035 /*! Reset the logical size of the given target to its original value. */
1037 
1038 /*! \return A GPU_Rect with the given values. */
1039 GPU_Rect GPU_MakeRect(float x, float y, float w, float h);
1040 
1041 /*! \return An SDL_Color with the given values. */
1042 SDL_Color GPU_MakeColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1043 
1044 /*! Sets the given target's viewport. */
1045 void GPU_SetViewport(GPU_Target* target, GPU_Rect viewport);
1046 
1047 /*! \return A GPU_Camera with position (0, 0, -10), angle of 0, and zoom of 1. */
1049 
1050 /*! \return The camera of the given render target. If target is NULL, returns the default camera. */
1052 
1053 /*! Sets the current render target's current camera.
1054  * \param target A pointer to the target that will copy this camera.
1055  * \param cam A pointer to the camera data to use or NULL to use the default camera.
1056  * \return The old camera. */
1058 
1059 /*! \return The RGBA color of a pixel. */
1060 SDL_Color GPU_GetPixel(GPU_Target* target, Sint16 x, Sint16 y);
1061 
1062 /*! Sets the clipping rect for the given render target. */
1064 
1065 /*! Sets the clipping rect for the given render target. */
1066 GPU_Rect GPU_SetClip(GPU_Target* target, Sint16 x, Sint16 y, Uint16 w, Uint16 h);
1067 
1068 /*! Turns off clipping for the given target. */
1070 
1071 /*! Sets the modulation color for subsequent drawing of images and shapes on the given target.
1072  * This has a cumulative effect with the image coloring functions.
1073  * e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128);
1074  * Would make the image draw with color of roughly (128, 64, 0).
1075  */
1076 void GPU_SetTargetColor(GPU_Target* target, SDL_Color* color);
1077 
1078 /*! Sets the modulation color for subsequent drawing of images and shapes on the given target.
1079  * This has a cumulative effect with the image coloring functions.
1080  * e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128);
1081  * Would make the image draw with color of roughly (128, 64, 0).
1082  */
1083 void GPU_SetTargetRGB(GPU_Target* target, Uint8 r, Uint8 g, Uint8 b);
1084 
1085 /*! Sets the modulation color for subsequent drawing of images and shapes on the given target.
1086  * This has a cumulative effect with the image coloring functions.
1087  * e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128);
1088  * Would make the image draw with color of roughly (128, 64, 0).
1089  */
1090 void GPU_SetTargetRGBA(GPU_Target* target, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1091 
1092 
1093 
1094 
1095 // Surface controls
1096 
1097 /*! Load surface from an image file that is supported by this renderer. Don't forget to SDL_FreeSurface() it. */
1098 SDL_Surface* GPU_LoadSurface(const char* filename);
1099 
1100 /*! Save surface to a file. The file type is deduced from the extension. Supported formats are: png, bmp, tga. Returns 0 on failure. */
1101 Uint8 GPU_SaveSurface(SDL_Surface* surface, const char* filename);
1102 
1103 
1104 
1105 
1106 
1107 // Image controls
1108 
1109 /*! Create a new, blank image with the given format. Don't forget to GPU_FreeImage() it.
1110  * \param w Image width in pixels
1111  * \param h Image height in pixels
1112  * \param format Format of color channels.
1113  */
1114 GPU_Image* GPU_CreateImage(Uint16 w, Uint16 h, GPU_FormatEnum format);
1115 
1116 /*! Load image from an image file that is supported by this renderer. Don't forget to GPU_FreeImage() it. */
1117 GPU_Image* GPU_LoadImage(const char* filename);
1118 
1119 /*! Creates an image that aliases the given image. Aliases can be used to store image settings (e.g. modulation color) for easy switching.
1120  * GPU_FreeImage() frees the alias's memory, but does not affect the original. */
1122 
1123 /*! Copy an image to a new image. Don't forget to GPU_FreeImage() both. */
1125 
1126 /*! Deletes an image in the proper way for this renderer. Also deletes the corresponding GPU_Target if applicable. Be careful not to use that target afterward! */
1128 
1129 /*! Update an image from surface data. */
1130 void GPU_UpdateImage(GPU_Image* image, SDL_Surface* surface, const GPU_Rect* surface_rect);
1131 
1132 /*! Update an image from surface data. */
1133 void GPU_UpdateSubImage(GPU_Image* image, const GPU_Rect* image_rect, SDL_Surface* surface, const GPU_Rect* surface_rect);
1134 
1135 /*! Update an image from an array of pixel data. */
1136 void GPU_UpdateImageBytes(GPU_Image* image, const GPU_Rect* image_rect, const unsigned char* bytes, int bytes_per_row);
1137 
1138 /*! Save image to a file. The file type is deduced from the extension. Supported formats are: png, bmp, tga. Returns 0 on failure. */
1139 Uint8 GPU_SaveImage(GPU_Image* image, const char* filename);
1140 
1141 /*! Loads mipmaps for the given image, if supported by the renderer. */
1143 
1144 /*! Sets the modulation color for subsequent drawing of the given image. */
1145 void GPU_SetColor(GPU_Image* image, SDL_Color* color);
1146 
1147 /*! Sets the modulation color for subsequent drawing of the given image. */
1148 void GPU_SetRGB(GPU_Image* image, Uint8 r, Uint8 g, Uint8 b);
1149 
1150 /*! Sets the modulation color for subsequent drawing of the given image. */
1151 void GPU_SetRGBA(GPU_Image* image, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1152 
1153 /*! Gets the current alpha blending setting. */
1155 
1156 /*! Enables/disables alpha blending for the given image. */
1157 void GPU_SetBlending(GPU_Image* image, Uint8 enable);
1158 
1159 /*! Sets the blending component functions. */
1160 void GPU_SetBlendFunction(GPU_Image* image, GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha);
1161 
1162 /*! Sets the blending component equations. */
1163 void GPU_SetBlendEquation(GPU_Image* image, GPU_BlendEqEnum color_equation, GPU_BlendEqEnum alpha_equation);
1164 
1165 /*! Sets the blending mode, if supported by the renderer. */
1167 
1168 /*! Sets the image filtering mode, if supported by the renderer. */
1170 
1171 /*! Gets the current pixel snap setting. The default value is GPU_SNAP_POSITION_AND_DIMENSIONS. */
1173 
1174 /*! Sets the pixel grid snapping mode for the given image. */
1176 
1177 /*! Sets the image wrapping mode, if supported by the renderer. */
1178 void GPU_SetWrapMode(GPU_Image* image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y);
1179 
1180 
1181 
1182 // Surface / Image / Target conversions
1183 
1184 /*! Copy SDL_Surface data into a new GPU_Image. Don't forget to SDL_FreeSurface() the surface and GPU_FreeImage() the image.*/
1186 
1187 /*! Copy GPU_Target data into a new GPU_Image. Don't forget to GPU_FreeImage() the image.*/
1189 
1190 /*! Copy GPU_Target data into a new SDL_Surface. Don't forget to SDL_FreeSurface() the surface.*/
1192 
1193 /*! Copy GPU_Image data into a new SDL_Surface. Don't forget to SDL_FreeSurface() the surface and GPU_FreeImage() the image.*/
1195 
1196 
1197 
1198 // Rendering
1199 
1200 /*! Clears the contents of the given render target. Fills the target with color {0, 0, 0, 0}. */
1201 void GPU_Clear(GPU_Target* target);
1202 
1203 /*! Fills the given render target with a color. If 'color' is NULL, {0, 0, 0, 0} is used. */
1204 void GPU_ClearColor(GPU_Target* target, SDL_Color* color);
1205 
1206 /*! Fills the given render target with a color. */
1207 void GPU_ClearRGBA(GPU_Target* target, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1208 
1209 /*! Draws the given image to the given render target.
1210  * \param src_rect The region of the source image to use.
1211  * \param x Destination x-position
1212  * \param y Destination y-position */
1213 void GPU_Blit(GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y);
1214 
1215 /*! Rotates and draws the given image to the given render target.
1216  * \param src_rect The region of the source image to use.
1217  * \param x Destination x-position
1218  * \param y Destination y-position
1219  * \param degrees Rotation angle (in degrees) */
1220 void GPU_BlitRotate(GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y, float degrees);
1221 
1222 /*! Scales and draws the given image to the given render target.
1223  * \param src_rect The region of the source image to use.
1224  * \param x Destination x-position
1225  * \param y Destination y-position
1226  * \param scaleX Horizontal stretch factor
1227  * \param scaleY Vertical stretch factor */
1228 void GPU_BlitScale(GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y, float scaleX, float scaleY);
1229 
1230 /*! Scales, rotates, and draws the given image to the given render target.
1231  * \param src_rect The region of the source image to use.
1232  * \param x Destination x-position
1233  * \param y Destination y-position
1234  * \param degrees Rotation angle (in degrees)
1235  * \param scaleX Horizontal stretch factor
1236  * \param scaleY Vertical stretch factor */
1237 void GPU_BlitTransform(GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y, float degrees, float scaleX, float scaleY);
1238 
1239 /*! Scales, rotates around a pivot point, and draws the given image to the given render target. The drawing point (x, y) coincides with the pivot point on the src image (pivot_x, pivot_y).
1240  * \param src_rect The region of the source image to use.
1241  * \param x Destination x-position
1242  * \param y Destination y-position
1243  * \param pivot_x Pivot x-position (in image coordinates)
1244  * \param pivot_y Pivot y-position (in image coordinates)
1245  * \param degrees Rotation angle (in degrees)
1246  * \param scaleX Horizontal stretch factor
1247  * \param scaleY Vertical stretch factor */
1248 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);
1249 
1250 /*! Transforms and draws the given image to the given render target.
1251  * \param src_rect The region of the source image to use.
1252  * \param x Destination x-position
1253  * \param y Destination y-position
1254  * \param matrix3x3 3x3 matrix in column-major order (index = row + column*numColumns) */
1255 void GPU_BlitTransformMatrix(GPU_Image* image, GPU_Rect* src_rect, GPU_Target* target, float x, float y, float* matrix3x3);
1256 
1257 /*! Performs 'num_sprites' blits of the given image to the given target.
1258  * Note: GPU_BlitBatch() cannot interpret a mix of normal values and "passthrough" values due to format ambiguity.
1259  * \param values A tightly-packed array of position (x,y), src_rect (x,y,w,h) values in image coordinates, and color (r,g,b,a) values with a range from 0-255. Pass NULL to render with only custom shader attributes.
1260  * \param flags Bit flags to control the interpretation of the array parameters. The only passthrough option accepted is GPU_PASSTHROUGH_ALL.
1261  */
1262 void GPU_BlitBatch(GPU_Image* image, GPU_Target* target, unsigned int num_sprites, float* values, GPU_BlitFlagEnum flags);
1263 
1264 /*! Performs 'num_sprites' blits of the given image to the given target.
1265  * \param positions A tightly-packed array of (x,y) values
1266  * \param src_rects A tightly-packed array of (x,y,w,h) values in image coordinates
1267  * \param colors A tightly-packed array of (r,g,b,a) values with a range from 0-255
1268  * \param flags Bit flags to control the interpretation of the array parameters
1269  */
1270 void GPU_BlitBatchSeparate(GPU_Image* image, GPU_Target* target, unsigned int num_sprites, float* positions, float* src_rects, float* colors, GPU_BlitFlagEnum flags);
1271 
1272 /*! Renders triangles from the given set of vertices. This lets you render arbitrary 2D geometry.
1273  * \param values A tightly-packed array of vertex position (x,y), image coordinates (s,t), and color (r,g,b,a) values with a range from 0-255. Pass NULL to render with only custom shader attributes.
1274  * \param indices If not NULL, this is used to specify which vertices to use and in what order (i.e. it indexes the vertices in the 'values' array).
1275  * \param flags Bit flags to control the interpretation of the array parameters. Since 'values' contains per-vertex data, GPU_PASSTHROUGH_VERTICES is ignored. Texture coordinates are scaled down using the image dimensions and color components are normalized to [0.0, 1.0].
1276  */
1277 void GPU_TriangleBatch(GPU_Image* image, GPU_Target* target, unsigned short num_vertices, float* values, unsigned int num_indices, unsigned short* indices, GPU_BlitFlagEnum flags);
1278 
1279 /*! Send all buffered blitting data to the current context target. */
1280 void GPU_FlushBlitBuffer(void);
1281 
1282 /*! Updates the given target's associated window. */
1283 void GPU_Flip(GPU_Target* target);
1284 
1285 
1286 
1287 
1288 
1289 
1290 // Shapes
1291 
1292 /*! Renders a colored point.
1293  * \param target The destination render target
1294  * \param x x-coord of the point
1295  * \param y y-coord of the point
1296  * \param color The color of the shape to render
1297  */
1298 void GPU_Pixel(GPU_Target* target, float x, float y, SDL_Color color);
1299 
1300 /*! Renders a colored line.
1301  * \param target The destination render target
1302  * \param x1 x-coord of starting point
1303  * \param y1 y-coord of starting point
1304  * \param x2 x-coord of ending point
1305  * \param y2 y-coord of ending point
1306  * \param color The color of the shape to render
1307  */
1308 void GPU_Line(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color);
1309 
1310 /*! Renders a colored arc curve (circle segment).
1311  * \param target The destination render target
1312  * \param x x-coord of center point
1313  * \param y y-coord of center point
1314  * \param radius The radius of the circle / distance from the center point that rendering will occur
1315  * \param start_angle The angle to start from, in degrees. Measured clockwise from the positive x-axis.
1316  * \param end_angle The angle to end at, in degrees. Measured clockwise from the positive x-axis.
1317  * \param color The color of the shape to render
1318  */
1319 void GPU_Arc(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color);
1320 
1321 /*! Renders a colored filled arc (circle segment / pie piece).
1322  * \param target The destination render target
1323  * \param x x-coord of center point
1324  * \param y y-coord of center point
1325  * \param radius The radius of the circle / distance from the center point that rendering will occur
1326  * \param start_angle The angle to start from, in degrees. Measured clockwise from the positive x-axis.
1327  * \param end_angle The angle to end at, in degrees. Measured clockwise from the positive x-axis.
1328  * \param color The color of the shape to render
1329  */
1330 void GPU_ArcFilled(GPU_Target* target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color);
1331 
1332 /*! Renders a colored circle outline.
1333  * \param target The destination render target
1334  * \param x x-coord of center point
1335  * \param y y-coord of center point
1336  * \param radius The radius of the circle / distance from the center point that rendering will occur
1337  * \param color The color of the shape to render
1338  */
1339 void GPU_Circle(GPU_Target* target, float x, float y, float radius, SDL_Color color);
1340 
1341 /*! Renders a colored filled circle.
1342  * \param target The destination render target
1343  * \param x x-coord of center point
1344  * \param y y-coord of center point
1345  * \param radius The radius of the circle / distance from the center point that rendering will occur
1346  * \param color The color of the shape to render
1347  */
1348 void GPU_CircleFilled(GPU_Target* target, float x, float y, float radius, SDL_Color color);
1349 
1350 /*! Renders a colored annular sector outline (ring segment).
1351  * \param target The destination render target
1352  * \param x x-coord of center point
1353  * \param y y-coord of center point
1354  * \param inner_radius The inner radius of the ring
1355  * \param outer_radius The outer radius of the ring
1356  * \param start_angle The angle to start from, in degrees. Measured clockwise from the positive x-axis.
1357  * \param end_angle The angle to end at, in degrees. Measured clockwise from the positive x-axis.
1358  * \param color The color of the shape to render
1359  */
1360 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);
1361 
1362 /*! Renders a colored filled annular sector (ring segment).
1363  * \param target The destination render target
1364  * \param x x-coord of center point
1365  * \param y y-coord of center point
1366  * \param inner_radius The inner radius of the ring
1367  * \param outer_radius The outer radius of the ring
1368  * \param start_angle The angle to start from, in degrees. Measured clockwise from the positive x-axis.
1369  * \param end_angle The angle to end at, in degrees. Measured clockwise from the positive x-axis.
1370  * \param color The color of the shape to render
1371  */
1372 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);
1373 
1374 /*! Renders a colored triangle outline.
1375  * \param target The destination render target
1376  * \param x1 x-coord of first point
1377  * \param y1 y-coord of first point
1378  * \param x2 x-coord of second point
1379  * \param y2 y-coord of second point
1380  * \param x3 x-coord of third point
1381  * \param y3 y-coord of third point
1382  * \param color The color of the shape to render
1383  */
1384 void GPU_Tri(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color);
1385 
1386 /*! Renders a colored filled triangle.
1387  * \param target The destination render target
1388  * \param x1 x-coord of first point
1389  * \param y1 y-coord of first point
1390  * \param x2 x-coord of second point
1391  * \param y2 y-coord of second point
1392  * \param x3 x-coord of third point
1393  * \param y3 y-coord of third point
1394  * \param color The color of the shape to render
1395  */
1396 void GPU_TriFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color);
1397 
1398 /*! Renders a colored rectangle outline.
1399  * \param target The destination render target
1400  * \param x1 x-coord of top-left corner
1401  * \param y1 y-coord of top-left corner
1402  * \param x2 x-coord of bottom-right corner
1403  * \param y2 y-coord of bottom-right corner
1404  * \param color The color of the shape to render
1405  */
1406 void GPU_Rectangle(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color);
1407 
1408 /*! Renders a colored filled rectangle.
1409  * \param target The destination render target
1410  * \param x1 x-coord of top-left corner
1411  * \param y1 y-coord of top-left corner
1412  * \param x2 x-coord of bottom-right corner
1413  * \param y2 y-coord of bottom-right corner
1414  * \param color The color of the shape to render
1415  */
1416 void GPU_RectangleFilled(GPU_Target* target, float x1, float y1, float x2, float y2, SDL_Color color);
1417 
1418 /*! Renders a colored rounded (filleted) rectangle outline.
1419  * \param target The destination render target
1420  * \param x1 x-coord of top-left corner
1421  * \param y1 y-coord of top-left corner
1422  * \param x2 x-coord of bottom-right corner
1423  * \param y2 y-coord of bottom-right corner
1424  * \param radius The radius of the corners
1425  * \param color The color of the shape to render
1426  */
1427 void GPU_RectangleRound(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color);
1428 
1429 /*! Renders a colored filled rounded (filleted) rectangle.
1430  * \param target The destination render target
1431  * \param x1 x-coord of top-left corner
1432  * \param y1 y-coord of top-left corner
1433  * \param x2 x-coord of bottom-right corner
1434  * \param y2 y-coord of bottom-right corner
1435  * \param radius The radius of the corners
1436  * \param color The color of the shape to render
1437  */
1438 void GPU_RectangleRoundFilled(GPU_Target* target, float x1, float y1, float x2, float y2, float radius, SDL_Color color);
1439 
1440 /*! Renders a colored polygon outline. The vertices are expected to define a convex polygon.
1441  * \param target The destination render target
1442  * \param num_vertices Number of vertices (x and y pairs)
1443  * \param vertices An array of vertex positions stored as interlaced x and y coords, e.g. {x1, y1, x2, y2, ...}
1444  * \param color The color of the shape to render
1445  */
1446 void GPU_Polygon(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color);
1447 
1448 /*! Renders a colored filled polygon. The vertices are expected to define a convex polygon.
1449  * \param target The destination render target
1450  * \param num_vertices Number of vertices (x and y pairs)
1451  * \param vertices An array of vertex positions stored as interlaced x and y coords, e.g. {x1, y1, x2, y2, ...}
1452  * \param color The color of the shape to render
1453  */
1454 void GPU_PolygonFilled(GPU_Target* target, unsigned int num_vertices, float* vertices, SDL_Color color);
1455 
1456 
1457 
1458 
1459 
1460 
1461 // Shaders
1462 
1463 /*! Loads shader source from an SDL_RWops, compiles it, and returns the new shader object. */
1464 Uint32 GPU_CompileShader_RW(GPU_ShaderEnum shader_type, SDL_RWops* shader_source);
1465 
1466 /*! Loads shader source from a file, compiles it, and returns the new shader object. */
1467 Uint32 GPU_LoadShader(GPU_ShaderEnum shader_type, const char* filename);
1468 
1469 /*! Compiles shader source and returns the new shader object. */
1470 Uint32 GPU_CompileShader(GPU_ShaderEnum shader_type, const char* shader_source);
1471 
1472 /*! Links a shader program with any attached shader objects. */
1473 Uint32 GPU_LinkShaderProgram(Uint32 program_object);
1474 
1475 /*! Creates and links a shader program with the given shader objects. */
1476 Uint32 GPU_LinkShaders(Uint32 shader_object1, Uint32 shader_object2);
1477 
1478 /*! Deletes a shader object. */
1479 void GPU_FreeShader(Uint32 shader_object);
1480 
1481 /*! Deletes a shader program. */
1482 void GPU_FreeShaderProgram(Uint32 program_object);
1483 
1484 /*! Attaches a shader object to a shader program for future linking. */
1485 void GPU_AttachShader(Uint32 program_object, Uint32 shader_object);
1486 
1487 /*! Detaches a shader object from a shader program. */
1488 void GPU_DetachShader(Uint32 program_object, Uint32 shader_object);
1489 
1490 /*! \return The current shader program */
1491 Uint32 GPU_GetCurrentShaderProgram(void);
1492 
1493 /*! Returns 1 if the given shader program is a default shader for the current context, 0 otherwise. */
1494 Uint8 GPU_IsDefaultShaderProgram(Uint32 program_object);
1495 
1496 /*! Activates the given shader program. Passing NULL for 'block' will disable the built-in shader variables for custom shaders until a GPU_ShaderBlock is set again. */
1497 void GPU_ActivateShaderProgram(Uint32 program_object, GPU_ShaderBlock* block);
1498 
1499 /*! Deactivates the current shader program (activates program 0). */
1500 void GPU_DeactivateShaderProgram(void);
1501 
1502 /*! Returns the last shader log message. */
1503 const char* GPU_GetShaderMessage(void);
1504 
1505 /*! Returns an integer representing the location of the specified attribute shader variable. */
1506 int GPU_GetAttributeLocation(Uint32 program_object, const char* attrib_name);
1507 
1508 /*! Returns a filled GPU_AttributeFormat object. */
1509 GPU_AttributeFormat GPU_MakeAttributeFormat(int num_elems_per_vertex, GPU_TypeEnum type, Uint8 normalize, int stride_bytes, int offset_bytes);
1510 
1511 /*! Returns a filled GPU_Attribute object. */
1513 
1514 /*! Returns an integer representing the location of the specified uniform shader variable. */
1515 int GPU_GetUniformLocation(Uint32 program_object, const char* uniform_name);
1516 
1517 /*! Loads the given shader program's built-in attribute and uniform locations. */
1518 GPU_ShaderBlock GPU_LoadShaderBlock(Uint32 program_object, const char* position_name, const char* texcoord_name, const char* color_name, const char* modelViewMatrix_name);
1519 
1520 /*! Sets the current shader block to use the given attribute and uniform locations. */
1522 
1523 /*! Sets the given image unit to the given image so that a custom shader can sample multiple textures.
1524  \param image The source image/texture. Pass NULL to disable the image unit.
1525  \param location The uniform location of a texture sampler
1526  \param image_unit The index of the texture unit to set. 0 is the first unit, which is used by SDL_gpu's blitting functions. 1 would be the second unit. */
1527 void GPU_SetShaderImage(GPU_Image* image, int location, int image_unit);
1528 
1529 /*! Fills "values" with the value of the uniform shader variable at the given location. */
1530 void GPU_GetUniformiv(Uint32 program_object, int location, int* values);
1531 
1532 /*! Sets the value of the integer uniform shader variable at the given location.
1533  This is equivalent to calling GPU_SetUniformiv(location, 1, 1, &value). */
1534 void GPU_SetUniformi(int location, int value);
1535 
1536 /*! Sets the value of the integer uniform shader variable at the given location. */
1537 void GPU_SetUniformiv(int location, int num_elements_per_value, int num_values, int* values);
1538 
1539 /*! Fills "values" with the value of the uniform shader variable at the given location. */
1540 void GPU_GetUniformuiv(Uint32 program_object, int location, unsigned int* values);
1541 
1542 /*! Sets the value of the unsigned integer uniform shader variable at the given location.
1543  This is equivalent to calling GPU_SetUniformuiv(location, 1, 1, &value). */
1544 void GPU_SetUniformui(int location, unsigned int value);
1545 
1546 /*! Sets the value of the unsigned integer uniform shader variable at the given location. */
1547 void GPU_SetUniformuiv(int location, int num_elements_per_value, int num_values, unsigned int* values);
1548 
1549 /*! Fills "values" with the value of the uniform shader variable at the given location. */
1550 void GPU_GetUniformfv(Uint32 program_object, int location, float* values);
1551 
1552 /*! Sets the value of the floating point uniform shader variable at the given location.
1553  This is equivalent to calling GPU_SetUniformfv(location, 1, 1, &value). */
1554 void GPU_SetUniformf(int location, float value);
1555 
1556 /*! Sets the value of the floating point uniform shader variable at the given location. */
1557 void GPU_SetUniformfv(int location, int num_elements_per_value, int num_values, float* values);
1558 
1559 /*! Fills "values" with the value of the uniform shader variable at the given location. The results are identical to calling GPU_GetUniformfv(). Matrices are gotten in column-major order. */
1560 void GPU_GetUniformMatrixfv(Uint32 program_object, int location, float* values);
1561 
1562 /*! Sets the value of the matrix uniform shader variable at the given location. The size of the matrices sent is specified by num_rows and num_columns. Rows and columns must be between 2 and 4. */
1563 void GPU_SetUniformMatrixfv(int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float* values);
1564 
1565 /*! Sets a constant-value shader attribute that will be used for each rendered vertex. */
1566 void GPU_SetAttributef(int location, float value);
1567 
1568 /*! Sets a constant-value shader attribute that will be used for each rendered vertex. */
1569 void GPU_SetAttributei(int location, int value);
1570 
1571 /*! Sets a constant-value shader attribute that will be used for each rendered vertex. */
1572 void GPU_SetAttributeui(int location, unsigned int value);
1573 
1574 /*! Sets a constant-value shader attribute that will be used for each rendered vertex. */
1575 void GPU_SetAttributefv(int location, int num_elements, float* value);
1576 
1577 /*! Sets a constant-value shader attribute that will be used for each rendered vertex. */
1578 void GPU_SetAttributeiv(int location, int num_elements, int* value);
1579 
1580 /*! Sets a constant-value shader attribute that will be used for each rendered vertex. */
1581 void GPU_SetAttributeuiv(int location, int num_elements, unsigned int* value);
1582 
1583 /*! Enables a shader attribute and sets its source data. */
1584 void GPU_SetAttributeSource(int num_values, GPU_Attribute source);
1585 
1586 
1587 
1588 
1589 #ifdef __cplusplus
1590 }
1591 #endif
1592 
1593 
1594 
1595 #endif
1596 
void GPU_RectangleFilled(GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
static const GPU_TypeEnum GPU_TYPE_INT
Definition: SDL_gpu.h:377
void GPU_GetUniformMatrixfv(Uint32 program_object, int location, float *values)
Definition: SDL_gpu.c:2452
void GPU_Rectangle(GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
void(* Tri)(GPU_Renderer *renderer, GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
Definition: SDL_gpu.h:770
GPU_Rect viewport
Definition: SDL_gpu.h:297
SDL_Color color
Definition: SDL_gpu.h:295
int(* GetAttributeLocation)(GPU_Renderer *renderer, Uint32 program_object, const char *attrib_name)
Definition: SDL_gpu.h:671
void(* RectangleFilled)(GPU_Renderer *renderer, GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
Definition: SDL_gpu.h:779
void GPU_SetViewport(GPU_Target *target, GPU_Rect viewport)
Definition: SDL_gpu.c:625
GPU_SnapEnum snap_mode
Definition: SDL_gpu.h:189
float angle
Definition: SDL_gpu.h:207
void GPU_SetBlendFunction(GPU_Image *image, GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha)
Definition: SDL_gpu.c:2026
void(* SetShaderImage)(GPU_Renderer *renderer, GPU_Image *image, int location, int image_unit)
Definition: SDL_gpu.h:683
GLboolean enable
Definition: glew.h:2589
GLsizei GLboolean transpose
Definition: glew.h:1832
struct GPU_MatrixStack GPU_MatrixStack
Uint32 texture_w
Definition: SDL_gpu.h:182
GPU_SnapEnum GPU_GetSnapMode(GPU_Image *image)
Definition: SDL_gpu.c:2104
int bytes_per_pixel
Definition: SDL_gpu.h:181
void(* FreeShaderProgram)(GPU_Renderer *renderer, Uint32 program_object)
Definition: SDL_gpu.h:650
GPU_Target * target
Definition: SDL_gpu.h:177
Uint32 GPU_BlitFlagEnum
Definition: SDL_gpu.h:360
GPU_Target * GPU_Init(Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
Definition: SDL_gpu.c:325
Uint32 GPU_CompileShader(GPU_ShaderEnum shader_type, const char *shader_source)
Definition: SDL_gpu.c:2227
void GPU_UnsetClip(GPU_Target *target)
Definition: SDL_gpu.c:1833
GPU_Camera GPU_GetCamera(GPU_Target *target)
Definition: SDL_gpu.c:637
void GPU_SetInitWindow(Uint32 windowID)
Definition: SDL_gpu.c:145
static const GPU_RendererEnum GPU_RENDERER_OPENGL_2
Definition: SDL_gpu.h:39
void(* SetAttributef)(GPU_Renderer *renderer, int location, float value)
Definition: SDL_gpu.h:716
GLuint GLdouble GLdouble GLint GLint order
Definition: glew.h:2972
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1806
static const GPU_InitFlagEnum GPU_INIT_DISABLE_DOUBLE_BUFFER
Definition: SDL_gpu.h:349
void GPU_FreeTarget(GPU_Target *target)
Definition: SDL_gpu.c:901
int minor_version
Definition: SDL_gpu.h:57
Uint32 default_untextured_shader_program
Definition: SDL_gpu.h:262
const char * GPU_GetErrorString(GPU_ErrorEnum error)
Definition: SDL_gpu.c:556
const char * GPU_GetShaderMessage(void)
Definition: SDL_gpu.c:2307
static const GPU_RendererEnum GPU_RENDERER_D3D9
Definition: SDL_gpu.h:45
struct GPU_Attribute GPU_Attribute
static const GPU_BlitFlagEnum GPU_PASSTHROUGH_VERTICES
Definition: SDL_gpu.h:361
GLint level
Definition: glew.h:1220
int modelViewProjection_loc
Definition: SDL_gpu.h:223
static const GPU_TypeEnum GPU_TYPE_DOUBLE
Definition: SDL_gpu.h:380
void(* SetShaderBlock)(GPU_Renderer *renderer, GPU_ShaderBlock block)
Definition: SDL_gpu.h:680
GPU_BlendMode GPU_GetBlendModeFromPreset(GPU_BlendPresetEnum preset)
Definition: SDL_gpu.c:1948
void(* BlitTransformMatrix)(GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float *matrix3x3)
Definition: SDL_gpu.h:598
void GPU_SetShaderBlock(GPU_ShaderBlock block)
Definition: SDL_gpu.c:2361
GPU_ErrorObject GPU_PopErrorCode(void)
Definition: SDL_gpu.c:545
void GPU_Quit(void)
Definition: SDL_gpu.c:463
Uint32 GPU_RendererEnum
Definition: SDL_gpu.h:35
void GPU_Arc(GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
Definition: SDL_gpuShapes.c:47
static const GPU_BlitFlagEnum GPU_PASSTHROUGH_COLORS
Definition: SDL_gpu.h:363
#define SDL_GPU_VERSION_PATCH
Definition: SDL_gpu.h:16
GPU_FormatEnum
Definition: SDL_gpu.h:152
void(* BlitRotate)(GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float degrees)
Definition: SDL_gpu.h:586
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
Uint32 GPU_LoadShader(GPU_ShaderEnum shader_type, const char *filename)
Definition: SDL_gpu.c:2206
void(* FreeImage)(GPU_Renderer *renderer, GPU_Image *image)
Definition: SDL_gpu.h:574
static l_noret error(LoadState *S, const char *why)
Definition: lundump.cpp:29
void GPU_FreeShader(Uint32 shader_object)
Definition: SDL_gpu.c:2251
GPU_Rect GPU_SetClip(GPU_Target *target, Sint16 x, Sint16 y, Uint16 w, Uint16 h)
Definition: SDL_gpu.c:1822
void GPU_SetUniformui(int location, unsigned int value)
Definition: SDL_gpu.c:2410
void GPU_MakeCurrent(GPU_Target *target, Uint32 windowID)
Definition: SDL_gpu.c:411
void(* TriangleBatch)(GPU_Renderer *renderer, GPU_Image *image, GPU_Target *target, unsigned short num_vertices, float *values, unsigned int num_indices, unsigned short *indices, GPU_BlitFlagEnum flags)
Definition: SDL_gpu.h:604
Uint32 GPU_WindowFlagEnum
Definition: SDL_gpu.h:339
struct GPU_AttributeSource GPU_AttributeSource
GPU_MatrixStack projection_matrix
Definition: SDL_gpu.h:270
GPU_DebugLevelEnum GPU_GetDebugLevel(void)
Definition: SDL_gpu.c:498
GPU_Renderer * GPU_GetRenderer(unsigned int index)
void(* BlitScale)(GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float scaleX, float scaleY)
Definition: SDL_gpu.h:589
void GPU_SetBlending(GPU_Image *image, Uint8 enable)
Definition: SDL_gpu.c:1931
GPU_Renderer * GPU_GetCurrentRenderer(void)
Definition: SDL_gpu.c:64
void GPU_SetBlendEquation(GPU_Image *image, GPU_BlendEqEnum color_equation, GPU_BlendEqEnum alpha_equation)
Definition: SDL_gpu.c:2037
GPU_RendererID GPU_MakeRendererID(GPU_RendererEnum id, int major_version, int minor_version)
Definition: SDL_gpu.c:619
GPU_Target * GPU_CreateAliasTarget(GPU_Target *target)
Definition: SDL_gpu.c:403
GPU_ShaderBlock(* LoadShaderBlock)(GPU_Renderer *renderer, Uint32 program_object, const char *position_name, const char *texcoord_name, const char *color_name, const char *modelViewMatrix_name)
Definition: SDL_gpu.h:677
SDL_version GPU_GetLinkedVersion(void)
Definition: SDL_gpu.c:51
void GPU_GetActiveRendererList(GPU_RendererID *renderers_array)
GPU_WrapEnum wrap_mode_x
Definition: SDL_gpu.h:190
struct GPU_Context GPU_Context
void(* AttachShader)(GPU_Renderer *renderer, Uint32 program_object, Uint32 shader_object)
Definition: SDL_gpu.h:653
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: glew.h:3783
float y
Definition: SDL_gpu.h:29
static const GPU_FeatureEnum GPU_FEATURE_RENDER_TARGETS
Definition: SDL_gpu.h:315
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)
Definition: SDL_gpu.c:980
static const GPU_FeatureEnum GPU_FEATURE_BLEND_FUNC_SEPARATE
Definition: SDL_gpu.h:317
struct GPU_ShaderBlock GPU_ShaderBlock
void GPU_PolygonFilled(GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
void(* SetUniformi)(GPU_Renderer *renderer, int location, int value)
Definition: SDL_gpu.h:689
static const GPU_RendererEnum GPU_RENDERER_D3D11
Definition: SDL_gpu.h:47
void(* MakeCurrent)(GPU_Renderer *renderer, GPU_Target *target, Uint32 windowID)
Definition: SDL_gpu.h:514
void(* ActivateShaderProgram)(GPU_Renderer *renderer, Uint32 program_object, GPU_ShaderBlock *block)
Definition: SDL_gpu.h:662
static const GPU_BlitFlagEnum GPU_USE_DEFAULT_COLORS
Definition: SDL_gpu.h:366
void(* BlitBatch)(GPU_Renderer *renderer, GPU_Image *image, GPU_Target *target, unsigned int num_sprites, float *values, GPU_BlitFlagEnum flags)
Definition: SDL_gpu.h:601
#define h
void(* BlitTransform)(GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float degrees, float scaleX, float scaleY)
Definition: SDL_gpu.h:592
GLboolean GLboolean g
Definition: glew.h:7319
int(* GetUniformLocation)(GPU_Renderer *renderer, Uint32 program_object, const char *uniform_name)
Definition: SDL_gpu.h:674
void(* UnsetClip)(GPU_Renderer *renderer, GPU_Target *target)
Definition: SDL_gpu.h:613
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
void(* SectorFilled)(GPU_Renderer *renderer, GPU_Target *target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
Definition: SDL_gpu.h:767
GPU_ErrorEnum
Definition: SDL_gpu.h:446
GPU_Image * GPU_LoadImage(const char *filename)
Definition: SDL_gpu.c:660
void GPU_SetUniformMatrixfv(int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float *values)
Definition: SDL_gpu.c:2460
void GPU_GetUniformiv(Uint32 program_object, int location, int *values)
Definition: SDL_gpu.c:2377
GPU_FilterEnum
Definition: SDL_gpu.h:122
static const GPU_FeatureEnum GPU_FEATURE_GL_BGR
Definition: SDL_gpu.h:319
GPU_Rect(* SetClip)(GPU_Renderer *renderer, GPU_Target *target, Sint16 x, Sint16 y, Uint16 w, Uint16 h)
Definition: SDL_gpu.h:610
float GPU_GetLineThickness(void)
Definition: SDL_gpuShapes.c:19
void GPU_BlitTransformMatrix(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float *matrix3x3)
Definition: SDL_gpu.c:997
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)
Definition: SDL_gpuShapes.c:84
GPU_Camera camera
Definition: SDL_gpu.h:300
void(* FlushBlitBuffer)(GPU_Renderer *renderer)
Definition: SDL_gpu.h:629
void GPU_SetAttributefv(int location, int num_elements, float *value)
Definition: SDL_gpu.c:2493
GPU_BlendFuncEnum
Definition: SDL_gpu.h:67
Uint32 GPU_LinkShaderProgram(Uint32 program_object)
Definition: SDL_gpu.c:2235
void(* SetAttributeSource)(GPU_Renderer *renderer, int num_values, GPU_Attribute source)
Definition: SDL_gpu.h:734
GPU_Camera GPU_SetCamera(GPU_Target *target, GPU_Camera *cam)
Definition: SDL_gpu.c:644
SDL_Color GPU_GetPixel(GPU_Target *target, Sint16 x, Sint16 y)
Definition: SDL_gpu.c:2131
GLenum mode
Definition: glew.h:2390
Uint32 GPU_GetInitWindow(void)
Definition: SDL_gpu.c:150
GPU_Target * GPU_LoadTarget(GPU_Image *image)
Definition: SDL_gpu.c:891
static const GPU_FeatureEnum GPU_FEATURE_BLEND_EQUATIONS_SEPARATE
Definition: SDL_gpu.h:318
GPU_Rect GPU_SetClipRect(GPU_Target *target, GPU_Rect rect)
Definition: SDL_gpu.c:1811
void GPU_ActivateShaderProgram(Uint32 program_object, GPU_ShaderBlock *block)
Definition: SDL_gpu.c:2291
Uint8 use_texturing
Definition: SDL_gpu.h:267
Uint8(* SetWindowResolution)(GPU_Renderer *renderer, Uint16 w, Uint16 h)
Definition: SDL_gpu.h:520
void GPU_FreeShaderProgram(Uint32 program_object)
Definition: SDL_gpu.c:2259
Uint16 h
Definition: SDL_gpu.h:291
void(* SetAsCurrent)(GPU_Renderer *renderer)
Definition: SDL_gpu.h:517
char * details
Definition: SDL_gpu.h:461
void GPU_SetWrapMode(GPU_Image *image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y)
Definition: SDL_gpu.c:2120
void GPU_SetColor(GPU_Image *image, SDL_Color *color)
Definition: SDL_gpu.c:1844
void(* Quit)(GPU_Renderer *renderer)
Definition: SDL_gpu.h:529
int per_vertex_storage_size
Definition: SDL_gpu.h:436
GPU_Target * GPU_InitRendererByID(GPU_RendererID renderer_request, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
Definition: SDL_gpu.c:357
GLboolean GLenum GLenum GLvoid * values
Definition: glew.h:3799
const char * GPU_GetRendererEnumString(GPU_RendererEnum id)
void(* FreeShader)(GPU_Renderer *renderer, Uint32 shader_object)
Definition: SDL_gpu.h:647
static const GPU_FeatureEnum GPU_FEATURE_FRAGMENT_SHADER
Definition: SDL_gpu.h:323
Uint32(* LinkShaders)(GPU_Renderer *renderer, Uint32 shader_object1, Uint32 shader_object2)
Definition: SDL_gpu.h:644
GPU_Attribute attribute
Definition: SDL_gpu.h:438
Uint8 is_alias
Definition: SDL_gpu.h:195
void(* Blit)(GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y)
Definition: SDL_gpu.h:583
float GPU_SetLineThickness(float thickness)
Definition: SDL_gpuShapes.c:10
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
Uint32 texture_h
Definition: SDL_gpu.h:182
GPU_FormatEnum format
Definition: SDL_gpu.h:179
void(* Flip)(GPU_Renderer *renderer, GPU_Target *target)
Definition: SDL_gpu.h:631
static const GPU_InitFlagEnum GPU_INIT_DISABLE_VSYNC
Definition: SDL_gpu.h:348
static const GPU_FeatureEnum GPU_FEATURE_VERTEX_SHADER
Definition: SDL_gpu.h:322
void GPU_TriFilled(GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
void GPU_SetRendererOrder(int order_size, GPU_RendererID *order)
SDL_Color GPU_MakeColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_gpu.c:613
static const GPU_BlitFlagEnum GPU_PASSTHROUGH_TEXCOORDS
Definition: SDL_gpu.h:362
GPU_BlendEqEnum alpha_equation
Definition: SDL_gpu.h:99
void GPU_CircleFilled(GPU_Target *target, float x, float y, float radius, SDL_Color color)
Definition: SDL_gpuShapes.c:75
int location
Definition: SDL_gpu.h:423
GPU_Renderer * GPU_GetRendererByID(GPU_RendererID id)
static const GPU_FeatureEnum GPU_FEATURE_WRAP_REPEAT_MIRRORED
Definition: SDL_gpu.h:326
static const GPU_TypeEnum GPU_TYPE_UNSIGNED_INT
Definition: SDL_gpu.h:378
void GPU_FlushBlitBuffer(void)
Definition: SDL_gpu.c:2175
void GPU_UpdateImageBytes(GPU_Image *image, const GPU_Rect *image_rect, const unsigned char *bytes, int bytes_per_row)
Definition: SDL_gpu.c:708
GPU_Renderer * GPU_AddRenderer(GPU_RendererID id)
GPU_TypeEnum type
Definition: SDL_gpu.h:415
void GPU_SetImageFilter(GPU_Image *image, GPU_FilterEnum filter)
Definition: SDL_gpu.c:2094
Uint32 windowID
Definition: SDL_gpu.h:249
void(* ClearRGBA)(GPU_Renderer *renderer, GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_gpu.h:627
void GPU_GetRendererOrder(int *order_size, GPU_RendererID *order)
void(* SetAttributeuiv)(GPU_Renderer *renderer, int location, int num_elements, unsigned int *value)
Definition: SDL_gpu.h:731
GPU_BlendMode blend_mode
Definition: SDL_gpu.h:187
static const GPU_FeatureEnum GPU_FEATURE_GEOMETRY_SHADER
Definition: SDL_gpu.h:325
struct GPU_Renderer * renderer
Definition: SDL_gpu.h:176
void GPU_RectangleRound(GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
void GPU_SetVirtualResolution(GPU_Target *target, Uint16 w, Uint16 h)
Definition: SDL_gpu.c:436
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)
Definition: SDL_gpu.h:595
GPU_Target * current_context_target
Definition: SDL_gpu.h:494
Uint8 GPU_IsDefaultShaderProgram(Uint32 program_object)
Definition: SDL_gpu.c:2283
Uint8 use_clip_rect
Definition: SDL_gpu.h:292
float x
Definition: SDL_gpu.h:206
void GPU_SetTargetColor(GPU_Target *target, SDL_Color *color)
Definition: SDL_gpu.c:1878
void GPU_SetUniformi(int location, int value)
Definition: SDL_gpu.c:2385
int GPU_GetUniformLocation(Uint32 program_object, const char *uniform_name)
Definition: SDL_gpu.c:2338
GPU_BlendEqEnum color_equation
Definition: SDL_gpu.h:98
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1858
const GLdouble * v
Definition: glew.h:1359
GLsizei const GLfloat * value
Definition: glew.h:1817
void GPU_GetVirtualCoords(GPU_Target *target, float *x, float *y, float displayX, float displayY)
Definition: SDL_gpu.c:579
static const GPU_TypeEnum GPU_TYPE_UNSIGNED_SHORT
Definition: SDL_gpu.h:376
static const GPU_RendererEnum GPU_RENDERER_GLES_3
Definition: SDL_gpu.h:44
GPU_BlendMode shapes_blend_mode
Definition: SDL_gpu.h:265
GPU_BlendFuncEnum dest_alpha
Definition: SDL_gpu.h:96
GPU_InitFlagEnum GPU_GetPreInitFlags(void)
Definition: SDL_gpu.c:162
static const GPU_FeatureEnum GPU_FEATURE_BLEND_EQUATIONS
Definition: SDL_gpu.h:316
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:7319
GPU_Image * GPU_CreateImage(Uint16 w, Uint16 h, GPU_FormatEnum format)
Definition: SDL_gpu.c:652
Uint8 GPU_ToggleFullscreen(Uint8 use_desktop_resolution)
Definition: SDL_gpu.c:419
void * context
Definition: SDL_gpu.h:245
void(* SetVirtualResolution)(GPU_Renderer *renderer, GPU_Target *target, Uint16 w, Uint16 h)
Definition: SDL_gpu.h:523
static const GPU_RendererEnum GPU_RENDERER_GLES_1
Definition: SDL_gpu.h:42
int window_w
Definition: SDL_gpu.h:252
void GPU_UpdateImage(GPU_Image *image, SDL_Surface *surface, const GPU_Rect *surface_rect)
Definition: SDL_gpu.c:692
void(* SetUniformMatrixfv)(GPU_Renderer *renderer, int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float *values)
Definition: SDL_gpu.h:713
int position_loc
Definition: SDL_gpu.h:219
Uint8 use_color
Definition: SDL_gpu.h:294
Uint8 failed
Definition: SDL_gpu.h:246
Uint32 GPU_CompileShader_RW(GPU_ShaderEnum shader_type, SDL_RWops *shader_source)
Definition: SDL_gpu.c:2198
void(* SetAttributefv)(GPU_Renderer *renderer, int location, int num_elements, float *value)
Definition: SDL_gpu.h:725
int per_vertex_storage_offset_bytes
Definition: SDL_gpu.h:435
void * data
Definition: SDL_gpu.h:290
Uint8(* ToggleFullscreen)(GPU_Renderer *renderer, Uint8 use_desktop_resolution)
Definition: SDL_gpu.h:532
static const GPU_BlitFlagEnum GPU_USE_DEFAULT_SRC_RECTS
Definition: SDL_gpu.h:365
GPU_Image * image
Definition: SDL_gpu.h:289
static const GPU_RendererEnum GPU_RENDERER_OPENGL_4
Definition: SDL_gpu.h:41
void GPU_BlitBatchSeparate(GPU_Image *image, GPU_Target *target, unsigned int num_sprites, float *positions, float *src_rects, float *colors, GPU_BlitFlagEnum flags)
Definition: SDL_gpu.c:1349
GPU_BlendFuncEnum source_color
Definition: SDL_gpu.h:93
GPU_RendererEnum id
Definition: SDL_gpu.h:55
void(* ArcFilled)(GPU_Renderer *renderer, GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
Definition: SDL_gpu.h:755
void(* SetUniformui)(GPU_Renderer *renderer, int location, unsigned int value)
Definition: SDL_gpu.h:698
void GPU_DetachShader(Uint32 program_object, Uint32 shader_object)
Definition: SDL_gpu.c:2275
Uint32 GPU_GetCurrentShaderProgram(void)
Definition: SDL_gpu.c:69
void(* SetAttributei)(GPU_Renderer *renderer, int location, int value)
Definition: SDL_gpu.h:719
int major_version
Definition: SDL_gpu.h:56
struct GPU_Renderer * renderer
Definition: SDL_gpu.h:288
static const GPU_TypeEnum GPU_TYPE_SHORT
Definition: SDL_gpu.h:375
void(* GetUniformuiv)(GPU_Renderer *renderer, Uint32 program_object, int location, unsigned int *values)
Definition: SDL_gpu.h:695
void GPU_AttachShader(Uint32 program_object, Uint32 shader_object)
Definition: SDL_gpu.c:2267
int stored_window_w
Definition: SDL_gpu.h:256
Uint16 h
Definition: SDL_gpu.h:178
void GPU_SetUniformfv(int location, int num_elements_per_value, int num_values, float *values)
Definition: SDL_gpu.c:2443
#define SDL_GPU_VERSION_MINOR
Definition: SDL_gpu.h:15
Uint8 GPU_IsFeatureEnabled(GPU_FeatureEnum feature)
Definition: SDL_gpu.c:387
Uint32 GPU_InitFlagEnum
Definition: SDL_gpu.h:346
int GPU_GetNumRegisteredRenderers(void)
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
Uint16 w
Definition: SDL_gpu.h:291
SDL_Surface * GPU_LoadSurface(const char *filename)
Definition: SDL_gpu.c:716
static const GPU_FeatureEnum GPU_FEATURE_PIXEL_SHADER
Definition: SDL_gpu.h:324
Uint8 shapes_use_blending
Definition: SDL_gpu.h:264
float(* SetLineThickness)(GPU_Renderer *renderer, float thickness)
Definition: SDL_gpu.h:740
cl_event GLbitfield flags
Definition: glew.h:3070
void GPU_GetDefaultRendererOrder(int *order_size, GPU_RendererID *order)
int num_layers
Definition: SDL_gpu.h:180
GLuint color
Definition: glew.h:5801
GPU_RendererID requested_id
Definition: SDL_gpu.h:485
void GPU_SetAttributef(int location, float value)
Definition: SDL_gpu.c:2469
SDL_Surface * GPU_CopySurfaceFromImage(GPU_Image *image)
Definition: SDL_gpu.c:865
Uint32 GPU_LinkShaders(Uint32 shader_object1, Uint32 shader_object2)
Definition: SDL_gpu.c:2243
SDL_Color(* GetPixel)(GPU_Renderer *renderer, GPU_Target *target, Sint16 x, Sint16 y)
Definition: SDL_gpu.h:616
void(* Pixel)(GPU_Renderer *renderer, GPU_Target *target, float x, float y, SDL_Color color)
Definition: SDL_gpu.h:746
void GPU_BlitRotate(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float degrees)
Definition: SDL_gpu.c:929
static const GPU_TypeEnum GPU_TYPE_BYTE
Definition: SDL_gpu.h:373
GPU_FilterEnum filter_mode
Definition: SDL_gpu.h:188
Encapsulates the map of the game.
Definition: location.hpp:38
Uint8(* IsFeatureEnabled)(GPU_Renderer *renderer, GPU_FeatureEnum feature)
Definition: SDL_gpu.h:504
GPU_SnapEnum
Definition: SDL_gpu.h:132
GPU_RendererID id
Definition: SDL_gpu.h:484
void GPU_Line(GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
Definition: SDL_gpuShapes.c:37
SDL_Surface * GPU_CopySurfaceFromTarget(GPU_Target *target)
Definition: SDL_gpu.c:857
static const GPU_BlitFlagEnum GPU_USE_DEFAULT_POSITIONS
Definition: SDL_gpu.h:364
void(* PolygonFilled)(GPU_Renderer *renderer, GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
Definition: SDL_gpu.h:791
struct GPU_ErrorObject GPU_ErrorObject
void(* Line)(GPU_Renderer *renderer, GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
Definition: SDL_gpu.h:749
static void block(LexState *ls)
Definition: lparser.cpp:1081
void GPU_Tri(GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
void GPU_SetBlendMode(GPU_Image *image, GPU_BlendPresetEnum mode)
Definition: SDL_gpu.c:2046
void(* RectangleRound)(GPU_Renderer *renderer, GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
Definition: SDL_gpu.h:782
GPU_Target * GPU_GetContextTarget(void)
Definition: SDL_gpu.c:882
GPU_BlendEqEnum
Definition: SDL_gpu.h:84
GPU_MatrixStack modelview_matrix
Definition: SDL_gpu.h:271
static const GPU_RendererEnum GPU_RENDERER_OPENGL_3
Definition: SDL_gpu.h:40
void(* SetAttributeui)(GPU_Renderer *renderer, int location, unsigned int value)
Definition: SDL_gpu.h:722
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glew.h:1222
GLuint GLenum matrix
Definition: glew.h:11418
void GPU_ArcFilled(GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
Definition: SDL_gpuShapes.c:57
static const GPU_FeatureEnum GPU_FEATURE_NON_POWER_OF_TWO
Definition: SDL_gpu.h:314
struct GPU_Rect GPU_Rect
GPU_RendererID GPU_GetRendererID(unsigned int index)
static const GPU_RendererEnum GPU_RENDERER_OPENGL_1
Definition: SDL_gpu.h:38
GPU_ShaderBlock GPU_LoadShaderBlock(Uint32 program_object, const char *position_name, const char *texcoord_name, const char *color_name, const char *modelViewMatrix_name)
Definition: SDL_gpu.c:2346
void GPU_UpdateSubImage(GPU_Image *image, const GPU_Rect *image_rect, SDL_Surface *surface, const GPU_Rect *surface_rect)
Definition: SDL_gpu.c:700
GPU_ShaderEnum
Definition: SDL_gpu.h:392
void GPU_Flip(GPU_Target *target)
Definition: SDL_gpu.c:2183
void(* GetUniformiv)(GPU_Renderer *renderer, Uint32 program_object, int location, int *values)
Definition: SDL_gpu.h:686
void GPU_SetAttributeSource(int num_values, GPU_Attribute source)
Definition: SDL_gpu.c:2517
GPU_Rect GPU_MakeRect(float x, float y, float w, float h)
Definition: SDL_gpu.c:607
void GPU_BlitTransform(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float degrees, float scaleX, float scaleY)
Definition: SDL_gpu.c:963
void GPU_FreeImage(GPU_Image *image)
Definition: SDL_gpu.c:873
static const GPU_RendererEnum GPU_RENDERER_UNKNOWN
Definition: SDL_gpu.h:36
GLuint index
Definition: glew.h:1782
GPU_FeatureEnum enabled_features
Definition: SDL_gpu.h:491
void GPU_SetDebugLevel(GPU_DebugLevelEnum level)
Definition: SDL_gpu.c:491
void GPU_SetCurrentRenderer(GPU_RendererID id)
Definition: SDL_gpu.c:56
void(* UpdateSubImage)(GPU_Renderer *renderer, GPU_Image *image, const GPU_Rect *image_rect, SDL_Surface *surface, const GPU_Rect *surface_rect)
Definition: SDL_gpu.h:556
Uint8 has_mipmaps
Definition: SDL_gpu.h:183
void GPU_SetAttributeuiv(int location, int num_elements, unsigned int *value)
Definition: SDL_gpu.c:2509
GLfloat GLfloat GLfloat GLfloat h
Definition: glew.h:5910
#define GPU_MATRIX_STACK_MAX
Definition: SDL_gpu.h:230
int GPU_GetNumActiveRenderers(void)
void GPU_SetShapeBlendEquation(GPU_BlendEqEnum color_equation, GPU_BlendEqEnum alpha_equation)
Definition: SDL_gpu.c:2071
void(* SetImageFilter)(GPU_Renderer *renderer, GPU_Image *image, GPU_FilterEnum filter)
Definition: SDL_gpu.h:619
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
static const GPU_RendererEnum GPU_RENDERER_D3D10
Definition: SDL_gpu.h:46
struct GPU_AttributeFormat GPU_AttributeFormat
#define SDL_GPU_VERSION_MAJOR
Definition: SDL_gpu.h:14
GPU_ShaderLanguageEnum shader_language
Definition: SDL_gpu.h:489
GPU_Target * GPU_CreateTargetFromWindow(Uint32 windowID)
Definition: SDL_gpu.c:395
void GPU_SetAttributeiv(int location, int num_elements, int *value)
Definition: SDL_gpu.c:2501
void GPU_GetUniformfv(Uint32 program_object, int location, float *values)
Definition: SDL_gpu.c:2427
GLdouble GLdouble GLdouble r
Definition: glew.h:1374
Uint32(* CompileShader)(GPU_Renderer *renderer, GPU_ShaderEnum shader_type, const char *shader_source)
Definition: SDL_gpu.h:638
int per_vertex_storage_stride_bytes
Definition: SDL_gpu.h:434
void GPU_SetShapeBlendFunction(GPU_BlendFuncEnum source_color, GPU_BlendFuncEnum dest_color, GPU_BlendFuncEnum source_alpha, GPU_BlendFuncEnum dest_alpha)
Definition: SDL_gpu.c:2057
GPU_Context * context
Definition: SDL_gpu.h:303
Uint8 GPU_SetWindowResolution(Uint16 w, Uint16 h)
Definition: SDL_gpu.c:427
Uint8 GPU_GetBlending(GPU_Image *image)
Definition: SDL_gpu.c:1922
void(* Sector)(GPU_Renderer *renderer, GPU_Target *target, float x, float y, float inner_radius, float outer_radius, float start_angle, float end_angle, SDL_Color color)
Definition: SDL_gpu.h:764
Uint8 is_alias
Definition: SDL_gpu.h:305
void GPU_Blit(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y)
Definition: SDL_gpu.c:911
void(* UpdateImage)(GPU_Renderer *renderer, GPU_Image *image, SDL_Surface *surface, const GPU_Rect *surface_rect)
Definition: SDL_gpu.h:553
void GPU_Circle(GPU_Target *target, float x, float y, float radius, SDL_Color color)
Definition: SDL_gpuShapes.c:66
Uint32(* CompileShader_RW)(GPU_Renderer *renderer, GPU_ShaderEnum shader_type, SDL_RWops *shader_source)
Definition: SDL_gpu.h:635
GPU_Attribute GPU_MakeAttribute(int location, void *values, GPU_AttributeFormat format)
Definition: SDL_gpu.c:2329
GPU_BlendFuncEnum dest_color
Definition: SDL_gpu.h:94
void GPU_GetUniformuiv(Uint32 program_object, int location, unsigned int *values)
Definition: SDL_gpu.c:2402
void(* TriFilled)(GPU_Renderer *renderer, GPU_Target *target, float x1, float y1, float x2, float y2, float x3, float y3, SDL_Color color)
Definition: SDL_gpu.h:773
GPU_DebugLevelEnum
Definition: SDL_gpu.h:469
int refcount
Definition: SDL_gpu.h:194
GPU_AttributeFormat GPU_MakeAttributeFormat(int num_elems_per_vertex, GPU_TypeEnum type, Uint8 normalize, int stride_bytes, int offset_bytes)
Definition: SDL_gpu.c:2323
GPU_Rect clip_rect
Definition: SDL_gpu.h:293
static const GPU_RendererEnum GPU_RENDERER_GLES_2
Definition: SDL_gpu.h:43
void * values
Definition: SDL_gpu.h:424
static const GPU_RendererEnum GPU_RENDERER_OPENGL_1_BASE
Definition: SDL_gpu.h:37
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glew.h:3448
static SDL_version GPU_GetCompiledVersion(void)
Definition: SDL_gpu.h:809
GPU_InitFlagEnum GPU_init_flags
Definition: SDL_gpu.h:487
GPU_AttributeFormat format
Definition: SDL_gpu.h:425
void GPU_SetUniformuiv(int location, int num_elements_per_value, int num_values, unsigned int *values)
Definition: SDL_gpu.c:2418
void GPU_SetShapeBlendMode(GPU_BlendPresetEnum mode)
Definition: SDL_gpu.c:2083
static const GPU_FeatureEnum GPU_FEATURE_GL_ABGR
Definition: SDL_gpu.h:321
void GPU_BlitScale(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float scaleX, float scaleY)
Definition: SDL_gpu.c:946
void(* SetUniformfv)(GPU_Renderer *renderer, int location, int num_elements_per_value, int num_values, float *values)
Definition: SDL_gpu.h:710
float w
Definition: SDL_gpu.h:30
int GPU_GetAttributeLocation(Uint32 program_object, const char *attrib_name)
Definition: SDL_gpu.c:2315
int matrix_mode
Definition: SDL_gpu.h:269
void(* GetUniformfv)(GPU_Renderer *renderer, Uint32 program_object, int location, float *values)
Definition: SDL_gpu.h:704
GPU_Image * GPU_CreateAliasImage(GPU_Image *image)
Definition: SDL_gpu.c:668
static const Uint32 GPU_NONE
Definition: SDL_gpu.h:354
void(* Circle)(GPU_Renderer *renderer, GPU_Target *target, float x, float y, float radius, SDL_Color color)
Definition: SDL_gpu.h:758
#define g
Definition: glew.h:12730
float h
Definition: SDL_gpu.h:30
static const GPU_FeatureEnum GPU_FEATURE_GL_BGRA
Definition: SDL_gpu.h:320
static const GPU_TypeEnum GPU_TYPE_FLOAT
Definition: SDL_gpu.h:379
void GPU_SetShaderImage(GPU_Image *image, int location, int image_unit)
Definition: SDL_gpu.c:2369
static const GPU_TypeEnum GPU_TYPE_UNSIGNED_BYTE
Definition: SDL_gpu.h:374
void GPU_SetTargetRGBA(GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_gpu.c:1907
void GPU_Pixel(GPU_Target *target, float x, float y, SDL_Color color)
Definition: SDL_gpuShapes.c:28
void GPU_SetAttributei(int location, int value)
Definition: SDL_gpu.c:2477
void * per_vertex_storage
Definition: SDL_gpu.h:437
void(* DetachShader)(GPU_Renderer *renderer, Uint32 program_object, Uint32 shader_object)
Definition: SDL_gpu.h:656
struct GPU_Camera GPU_Camera
void(* UpdateImageBytes)(GPU_Renderer *renderer, GPU_Image *image, const GPU_Rect *image_rect, const unsigned char *bytes, int bytes_per_row)
Definition: SDL_gpu.h:559
void(* Polygon)(GPU_Renderer *renderer, GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
Definition: SDL_gpu.h:788
void(* GenerateMipmaps)(GPU_Renderer *renderer, GPU_Image *image)
Definition: SDL_gpu.h:607
int window_h
Definition: SDL_gpu.h:253
Uint8(* IsDefaultShaderProgram)(GPU_Renderer *renderer, Uint32 program_object)
Definition: SDL_gpu.h:659
void GPU_TriangleBatch(GPU_Image *image, GPU_Target *target, unsigned short num_vertices, float *values, unsigned int num_indices, unsigned short *indices, GPU_BlitFlagEnum flags)
Definition: SDL_gpu.c:1634
void(* SetUniformiv)(GPU_Renderer *renderer, int location, int num_elements_per_value, int num_values, int *values)
Definition: SDL_gpu.h:692
void * data
Definition: SDL_gpu.h:193
struct GPU_BlendMode GPU_BlendMode
this module manages the cache of images.
Definition: image.cpp:75
GPU_WindowFlagEnum SDL_init_flags
Definition: SDL_gpu.h:486
GPU_BlendPresetEnum
Definition: SDL_gpu.h:106
Uint8(* SaveImage)(GPU_Renderer *renderer, GPU_Image *image, const char *filename)
Definition: SDL_gpu.h:547
void GPU_CloseCurrentRenderer(void)
Definition: SDL_gpu.c:452
unsigned int size
Definition: SDL_gpu.h:236
Uint32 GPU_FeatureEnum
Definition: SDL_gpu.h:313
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: glew.h:1221
SDL_Color color
Definition: SDL_gpu.h:185
void GPU_GenerateMipmaps(GPU_Image *image)
Definition: SDL_gpu.c:1800
Uint16 w
Definition: SDL_gpu.h:178
void GPU_Polygon(GPU_Target *target, unsigned int num_vertices, float *vertices, SDL_Color color)
GPU_WrapEnum
Definition: SDL_gpu.h:143
Uint32 GPU_TypeEnum
Definition: SDL_gpu.h:371
float line_thickness
Definition: SDL_gpu.h:266
void(* Arc)(GPU_Renderer *renderer, GPU_Target *target, float x, float y, float radius, float start_angle, float end_angle, SDL_Color color)
Definition: SDL_gpu.h:752
void GPU_BlitBatch(GPU_Image *image, GPU_Target *target, unsigned int num_sprites, float *values, GPU_BlitFlagEnum flags)
Definition: SDL_gpu.c:1017
Uint32 current_shader_program
Definition: SDL_gpu.h:260
Uint32(* LinkShaderProgram)(GPU_Renderer *renderer, Uint32 program_object)
Definition: SDL_gpu.h:641
void GPU_SetAttributeui(int location, unsigned int value)
Definition: SDL_gpu.c:2485
void(* UnsetVirtualResolution)(GPU_Renderer *renderer, GPU_Target *target)
Definition: SDL_gpu.h:526
GPU_Target * GPU_InitRenderer(GPU_RendererEnum renderer_enum, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
Definition: SDL_gpu.c:352
void(* SetUniformf)(GPU_Renderer *renderer, int location, float value)
Definition: SDL_gpu.h:707
GPU_WrapEnum wrap_mode_y
Definition: SDL_gpu.h:191
void GPU_DeactivateShaderProgram(void)
Definition: SDL_gpu.c:2299
int shader_version
Definition: SDL_gpu.h:490
static const GPU_InitFlagEnum GPU_INIT_ENABLE_VSYNC
Definition: SDL_gpu.h:347
float zoom
Definition: SDL_gpu.h:208
void GPU_LogInfo(const char *format,...)
Definition: SDL_gpu.c:79
void * data
Definition: SDL_gpu.h:273
map_location location
GPU_Target * GPU_GetWindowTarget(Uint32 windowID)
Definition: SDL_gpu.c:305
int refcount
Definition: SDL_gpu.h:304
void(* DeactivateShaderProgram)(GPU_Renderer *renderer)
Definition: SDL_gpu.h:665
void GPU_UnsetVirtualResolution(GPU_Target *target)
Definition: SDL_gpu.c:444
void GPU_PushErrorCode(const char *function, GPU_ErrorEnum error, const char *details,...)
Definition: SDL_gpu.c:503
void(* SetAttributeiv)(GPU_Renderer *renderer, int location, int num_elements, int *value)
Definition: SDL_gpu.h:728
float z
Definition: SDL_gpu.h:206
void GPU_SetRGBA(GPU_Image *image, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_gpu.c:1868
void GPU_RemoveRenderer(GPU_RendererID id)
int stored_window_h
Definition: SDL_gpu.h:257
void GPU_SetSnapMode(GPU_Image *image, GPU_SnapEnum mode)
Definition: SDL_gpu.c:2112
void GPU_RectangleRoundFilled(GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
Uint8 GPU_SaveImage(GPU_Image *image, const char *filename)
Definition: SDL_gpu.c:676
void GPU_LogError(const char *format,...)
Definition: SDL_gpu.c:103
void(* Clear)(GPU_Renderer *renderer, GPU_Target *target)
Definition: SDL_gpu.h:625
GPU_Image * GPU_CopyImageFromTarget(GPU_Target *target)
Definition: SDL_gpu.c:849
void GPU_SetRGB(GPU_Image *image, Uint8 r, Uint8 g, Uint8 b)
Definition: SDL_gpu.c:1858
void GPU_LogWarning(const char *format,...)
Definition: SDL_gpu.c:91
void(* SetWrapMode)(GPU_Renderer *renderer, GPU_Image *image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y)
Definition: SDL_gpu.h:622
void(* RectangleRoundFilled)(GPU_Renderer *renderer, GPU_Target *target, float x1, float y1, float x2, float y2, float radius, SDL_Color color)
Definition: SDL_gpu.h:785
void(* FreeTarget)(GPU_Renderer *renderer, GPU_Target *target)
Definition: SDL_gpu.h:580
GPU_ShaderLanguageEnum
Definition: SDL_gpu.h:402
struct GPU_RendererID GPU_RendererID
void GPU_GetRegisteredRendererList(GPU_RendererID *renderers_array)
void GPU_SetShapeBlending(Uint8 enable)
Definition: SDL_gpu.c:1939
void GPU_SetTargetRGB(GPU_Target *target, Uint8 r, Uint8 g, Uint8 b)
Definition: SDL_gpu.c:1892
float y
Definition: SDL_gpu.h:206
struct GPU_Image GPU_Image
GPU_Camera(* SetCamera)(GPU_Renderer *renderer, GPU_Target *target, GPU_Camera *cam)
Definition: SDL_gpu.h:535
Uint8 GPU_SaveSurface(SDL_Surface *surface, const char *filename)
Definition: SDL_gpu.c:810
void(* Rectangle)(GPU_Renderer *renderer, GPU_Target *target, float x1, float y1, float x2, float y2, SDL_Color color)
Definition: SDL_gpu.h:776
void GPU_Clear(GPU_Target *target)
Definition: SDL_gpu.c:2148
Uint32 default_textured_shader_program
Definition: SDL_gpu.h:261
GLsizei GLsizei GLchar * source
Definition: glew.h:1800
void(* CircleFilled)(GPU_Renderer *renderer, GPU_Target *target, float x, float y, float radius, SDL_Color color)
Definition: SDL_gpu.h:761
float x
Definition: SDL_gpu.h:29
void(* SetUniformuiv)(GPU_Renderer *renderer, int location, int num_elements_per_value, int num_values, unsigned int *values)
Definition: SDL_gpu.h:701
Uint8 use_blending
Definition: SDL_gpu.h:186
void GPU_SetUniformf(int location, float value)
Definition: SDL_gpu.c:2435
void GPU_ClearColor(GPU_Target *target, SDL_Color *color)
Definition: SDL_gpu.c:2156
GLenum target
Definition: glew.h:5190
int texcoord_loc
Definition: SDL_gpu.h:220
GPU_Camera GPU_GetDefaultCamera(void)
Definition: SDL_gpu.c:631
GPU_Image * GPU_CopyImageFromSurface(SDL_Surface *surface)
Definition: SDL_gpu.c:841
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)
Definition: SDL_gpuShapes.c:93
float(* GetLineThickness)(GPU_Renderer *renderer)
Definition: SDL_gpu.h:743
GPU_BlendFuncEnum source_alpha
Definition: SDL_gpu.h:95
void GPU_ClearRGBA(GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Definition: SDL_gpu.c:2167
void GPU_SetPreInitFlags(GPU_InitFlagEnum GPU_flags)
Definition: SDL_gpu.c:157
void GPU_SetUniformiv(int location, int num_elements_per_value, int num_values, int *values)
Definition: SDL_gpu.c:2393
GPU_Image * GPU_CopyImage(GPU_Image *image)
Definition: SDL_gpu.c:684
GPU_ErrorEnum error
Definition: SDL_gpu.h:460