The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions | Variables
SDL_gpu_GL_common.inl File Reference
#include "SDL_gpu_GL_matrix.h"
#include "SDL_platform.h"
#include "stb_image.h"
#include "stb_image_write.h"
#include <math.h>
#include <string.h>
#include <strings.h>
Include dependency graph for SDL_gpu_GL_common.inl:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define static_inline   static inline
 
#define GPU_BLIT_BUFFER_VERTICES_PER_SPRITE   4
 
#define GPU_BLIT_BUFFER_INIT_MAX_NUM_VERTICES   (GPU_BLIT_BUFFER_VERTICES_PER_SPRITE*1000)
 
#define GPU_BLIT_BUFFER_ABSOLUTE_MAX_VERTICES   60000
 
#define GPU_INDEX_BUFFER_ABSOLUTE_MAX_VERTICES   4000000000u
 
#define GPU_BLIT_BUFFER_FLOATS_PER_VERTEX   8
 
#define GPU_BLIT_BUFFER_STRIDE   (sizeof(float)*GPU_BLIT_BUFFER_FLOATS_PER_VERTEX)
 
#define GPU_BLIT_BUFFER_VERTEX_OFFSET   0
 
#define GPU_BLIT_BUFFER_TEX_COORD_OFFSET   2
 
#define GPU_BLIT_BUFFER_COLOR_OFFSET   4
 
#define M_PI   3.14159265358979323846
 
#define GET_ALPHA(sdl_color)   ((sdl_color).unused)
 
#define SDL_GPU_DISABLE_SHADERS
 
#define MIX_COLOR_COMPONENT_NORMALIZED_RESULT(a, b)   ((a)/255.0f * (b)/255.0f)
 
#define MIX_COLOR_COMPONENT(a, b)   (((a)/255.0f * (b)/255.0f)*255)
 
#define MIX_COLORS(color1, color2)   {MIX_COLOR_COMPONENT(color1.r, color2.r), MIX_COLOR_COMPONENT(color1.g, color2.g), MIX_COLOR_COMPONENT(color1.b, color2.b), MIX_COLOR_COMPONENT(GET_ALPHA(color1), GET_ALPHA(color2))}
 
#define SET_TEXTURED_VERTEX(x, y, s, t, r, g, b, a)
 
#define SET_TEXTURED_VERTEX_UNINDEXED(x, y, s, t, r, g, b, a)
 
#define SET_UNTEXTURED_VERTEX(x, y, r, g, b, a)
 
#define SET_UNTEXTURED_VERTEX_UNINDEXED(x, y, r, g, b, a)
 
#define SET_INDEXED_VERTEX(offset)   index_buffer[cdata->index_buffer_num_vertices++] = blit_buffer_starting_index + (offset);
 
#define MAX(a, b)   ((a) > (b)? (a) : (b))
 
#define SET_COMMON_FUNCTIONS(renderer)
 

Functions

void GPU_AddWindowMapping (GPU_Target *target)
 
void GPU_RemoveWindowMapping (Uint32 windowID)
 
void GPU_RemoveWindowMappingByTarget (GPU_Target *target)
 
static SDL_PixelFormat * AllocFormat (GLenum glFormat)
 
static void FreeFormat (SDL_PixelFormat *format)
 
static Uint8 isExtensionSupported (const char *extension_str)
 
static void init_features (GPU_Renderer *renderer)
 
static void extBindFramebuffer (GPU_Renderer *renderer, GLuint handle)
 
static_inline Uint8 isPowerOfTwo (unsigned int x)
 
static_inline unsigned int getNearestPowerOf2 (unsigned int n)
 
static void bindTexture (GPU_Renderer *renderer, GPU_Image *image)
 
static_inline void flushAndBindTexture (GPU_Renderer *renderer, GLuint handle)
 
static Uint8 bindFramebuffer (GPU_Renderer *renderer, GPU_Target *target)
 
static_inline void flushAndBindFramebuffer (GPU_Renderer *renderer, GLuint handle)
 
static_inline void flushBlitBufferIfCurrentTexture (GPU_Renderer *renderer, GPU_Image *image)
 
static_inline void flushAndClearBlitBufferIfCurrentTexture (GPU_Renderer *renderer, GPU_Image *image)
 
static_inline Uint8 isCurrentTarget (GPU_Renderer *renderer, GPU_Target *target)
 
static_inline void flushAndClearBlitBufferIfCurrentFramebuffer (GPU_Renderer *renderer, GPU_Target *target)
 
static Uint8 growBlitBuffer (GPU_CONTEXT_DATA *cdata, unsigned int minimum_vertices_needed)
 
static Uint8 growIndexBuffer (GPU_CONTEXT_DATA *cdata, unsigned int minimum_vertices_needed)
 
static void makeContextCurrent (GPU_Renderer *renderer, GPU_Target *target)
 
static void setClipRect (GPU_Renderer *renderer, GPU_Target *target)
 
static void unsetClipRect (GPU_Renderer *renderer, GPU_Target *target)
 
static void prepareToRenderToTarget (GPU_Renderer *renderer, GPU_Target *target)
 
static void changeColor (GPU_Renderer *renderer, SDL_Color color)
 
static void changeBlending (GPU_Renderer *renderer, Uint8 enable)
 
static void changeBlendMode (GPU_Renderer *renderer, GPU_BlendMode mode)
 
static Uint32 get_proper_program_id (GPU_Renderer *renderer, Uint32 program_object)
 
static void applyTexturing (GPU_Renderer *renderer)
 
static void changeTexturing (GPU_Renderer *renderer, Uint8 enable)
 
static void enableTexturing (GPU_Renderer *renderer)
 
static void disableTexturing (GPU_Renderer *renderer)
 
static void prepareToRenderImage (GPU_Renderer *renderer, GPU_Target *target, GPU_Image *image)
 
static void prepareToRenderShapes (GPU_Renderer *renderer, unsigned int shape)
 
static void changeViewport (GPU_Target *target)
 
static void applyTargetCamera (GPU_Target *target)
 
static Uint8 equal_cameras (GPU_Camera a, GPU_Camera b)
 
static void changeCamera (GPU_Target *target)
 
static GPU_TargetInit (GPU_Renderer *renderer, GPU_RendererID renderer_request, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
 
static Uint8 IsFeatureEnabled (GPU_Renderer *renderer, GPU_FeatureEnum feature)
 
static GPU_TargetCreateTargetFromWindow (GPU_Renderer *renderer, Uint32 windowID, GPU_Target *target)
 
static GPU_TargetCreateAliasTarget (GPU_Renderer *renderer, GPU_Target *target)
 
static void MakeCurrent (GPU_Renderer *renderer, GPU_Target *target, Uint32 windowID)
 
static void SetAsCurrent (GPU_Renderer *renderer)
 
static Uint8 SetWindowResolution (GPU_Renderer *renderer, Uint16 w, Uint16 h)
 
static void SetVirtualResolution (GPU_Renderer *renderer, GPU_Target *target, Uint16 w, Uint16 h)
 
static void UnsetVirtualResolution (GPU_Renderer *renderer, GPU_Target *target)
 
static void Quit (GPU_Renderer *renderer)
 
static Uint8 ToggleFullscreen (GPU_Renderer *renderer, Uint8 use_desktop_resolution)
 
static GPU_Camera SetCamera (GPU_Renderer *renderer, GPU_Target *target, GPU_Camera *cam)
 
static GPU_ImageCreateUninitializedImage (GPU_Renderer *renderer, Uint16 w, Uint16 h, GPU_FormatEnum format)
 
static GPU_ImageCreateImage (GPU_Renderer *renderer, Uint16 w, Uint16 h, GPU_FormatEnum format)
 
static GPU_ImageLoadImage (GPU_Renderer *renderer, const char *filename)
 
static GPU_ImageCreateAliasImage (GPU_Renderer *renderer, GPU_Image *image)
 
static Uint8 readTargetPixels (GPU_Renderer *renderer, GPU_Target *source, GLint format, GLubyte *pixels)
 
static Uint8 readImagePixels (GPU_Renderer *renderer, GPU_Image *source, GLint format, GLubyte *pixels)
 
static unsigned char * getRawTargetData (GPU_Renderer *renderer, GPU_Target *target)
 
static unsigned char * getRawImageData (GPU_Renderer *renderer, GPU_Image *image)
 
static const char * get_filename_ext (const char *filename)
 
static Uint8 SaveImage (GPU_Renderer *renderer, GPU_Image *image, const char *filename)
 
static SDL_Surface * CopySurfaceFromTarget (GPU_Renderer *renderer, GPU_Target *target)
 
static SDL_Surface * CopySurfaceFromImage (GPU_Renderer *renderer, GPU_Image *image)
 
static int compareFormats (GPU_Renderer *renderer, GLenum glFormat, SDL_Surface *surface, GLenum *surfaceFormatResult)
 
static Uint8 hasColorkey (SDL_Surface *surface)
 
static SDL_Surface * copySurfaceIfNeeded (GPU_Renderer *renderer, GLenum glFormat, SDL_Surface *surface, GLenum *surfaceFormatResult)
 
static GPU_ImageCopyImage (GPU_Renderer *renderer, GPU_Image *image)
 
static void UpdateImage (GPU_Renderer *renderer, GPU_Image *image, SDL_Surface *surface, const GPU_Rect *surface_rect)
 
static void UpdateSubImage (GPU_Renderer *renderer, GPU_Image *image, const GPU_Rect *image_rect, SDL_Surface *surface, const GPU_Rect *surface_rect)
 
static void UpdateImageBytes (GPU_Renderer *renderer, GPU_Image *image, const GPU_Rect *image_rect, const unsigned char *bytes, int bytes_per_row)
 
static_inline Uint32 getPixel (SDL_Surface *Surface, int x, int y)
 
static GPU_ImageCopyImageFromSurface (GPU_Renderer *renderer, SDL_Surface *surface)
 
static GPU_ImageCopyImageFromTarget (GPU_Renderer *renderer, GPU_Target *target)
 
static void FreeImage (GPU_Renderer *renderer, GPU_Image *image)
 
static GPU_TargetLoadTarget (GPU_Renderer *renderer, GPU_Image *image)
 
static void FreeTarget (GPU_Renderer *renderer, GPU_Target *target)
 
static void Blit (GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y)
 
static void BlitRotate (GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float degrees)
 
static void BlitScale (GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float scaleX, float scaleY)
 
static 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)
 
static void BlitTransformX (GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float pivot_x, float pivot_y, float degrees, float scaleX, float scaleY)
 
static void BlitTransformMatrix (GPU_Renderer *renderer, GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float *matrix3x3)
 
static int get_lowest_attribute_num_values (GPU_CONTEXT_DATA *cdata, int cap)
 
static void BlitBatch (GPU_Renderer *renderer, GPU_Image *image, GPU_Target *target, unsigned int num_sprites, float *values, GPU_BlitFlagEnum flags)
 
static 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)
 
static void GenerateMipmaps (GPU_Renderer *renderer, GPU_Image *image)
 
static GPU_Rect SetClip (GPU_Renderer *renderer, GPU_Target *target, Sint16 x, Sint16 y, Uint16 w, Uint16 h)
 
static void UnsetClip (GPU_Renderer *renderer, GPU_Target *target)
 
static SDL_Color GetPixel (GPU_Renderer *renderer, GPU_Target *target, Sint16 x, Sint16 y)
 
static void SetImageFilter (GPU_Renderer *renderer, GPU_Image *image, GPU_FilterEnum filter)
 
static void SetWrapMode (GPU_Renderer *renderer, GPU_Image *image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y)
 
static void Clear (GPU_Renderer *renderer, GPU_Target *target)
 
static void ClearRGBA (GPU_Renderer *renderer, GPU_Target *target, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 
static void DoPartialFlush (GPU_CONTEXT_DATA *cdata, unsigned short num_vertices, float *blit_buffer, unsigned int num_indices, unsigned short *index_buffer)
 
static void DoUntexturedFlush (GPU_CONTEXT_DATA *cdata, unsigned short num_vertices, float *blit_buffer, unsigned int num_indices, unsigned short *index_buffer)
 
static void FlushBlitBuffer (GPU_Renderer *renderer)
 
static void Flip (GPU_Renderer *renderer, GPU_Target *target)
 
static Uint32 GetShaderSourceSize (const char *filename)
 
static Uint32 GetShaderSource (const char *filename, char *result)
 
static void read_until_end_of_comment (SDL_RWops *rwops, char multiline)
 
static Uint32 GetShaderSourceSize_RW (SDL_RWops *shader_source)
 
static Uint32 GetShaderSource_RW (SDL_RWops *shader_source, char *result)
 
static Uint32 compile_shader_source (GPU_ShaderEnum shader_type, const char *shader_source)
 
static Uint32 CompileShader_RW (GPU_Renderer *renderer, GPU_ShaderEnum shader_type, SDL_RWops *shader_source)
 
static Uint32 CompileShader (GPU_Renderer *renderer, GPU_ShaderEnum shader_type, const char *shader_source)
 
static Uint32 LinkShaderProgram (GPU_Renderer *renderer, Uint32 program_object)
 
static Uint32 LinkShaders (GPU_Renderer *renderer, Uint32 shader_object1, Uint32 shader_object2)
 
static void FreeShader (GPU_Renderer *renderer, Uint32 shader_object)
 
static void FreeShaderProgram (GPU_Renderer *renderer, Uint32 program_object)
 
static void AttachShader (GPU_Renderer *renderer, Uint32 program_object, Uint32 shader_object)
 
static void DetachShader (GPU_Renderer *renderer, Uint32 program_object, Uint32 shader_object)
 
static Uint8 IsDefaultShaderProgram (GPU_Renderer *renderer, Uint32 program_object)
 
static void ActivateShaderProgram (GPU_Renderer *renderer, Uint32 program_object, GPU_ShaderBlock *block)
 
static void DeactivateShaderProgram (GPU_Renderer *renderer)
 
static const char * GetShaderMessage (GPU_Renderer *renderer)
 
static int GetAttributeLocation (GPU_Renderer *renderer, Uint32 program_object, const char *attrib_name)
 
static int GetUniformLocation (GPU_Renderer *renderer, Uint32 program_object, const char *uniform_name)
 
static 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)
 
static void SetShaderBlock (GPU_Renderer *renderer, GPU_ShaderBlock block)
 
static void SetShaderImage (GPU_Renderer *renderer, GPU_Image *image, int location, int image_unit)
 
static void GetUniformiv (GPU_Renderer *renderer, Uint32 program_object, int location, int *values)
 
static void SetUniformi (GPU_Renderer *renderer, int location, int value)
 
static void SetUniformiv (GPU_Renderer *renderer, int location, int num_elements_per_value, int num_values, int *values)
 
static void GetUniformuiv (GPU_Renderer *renderer, Uint32 program_object, int location, unsigned int *values)
 
static void SetUniformui (GPU_Renderer *renderer, int location, unsigned int value)
 
static void SetUniformuiv (GPU_Renderer *renderer, int location, int num_elements_per_value, int num_values, unsigned int *values)
 
static void GetUniformfv (GPU_Renderer *renderer, Uint32 program_object, int location, float *values)
 
static void SetUniformf (GPU_Renderer *renderer, int location, float value)
 
static void SetUniformfv (GPU_Renderer *renderer, int location, int num_elements_per_value, int num_values, float *values)
 
static void SetUniformMatrixfv (GPU_Renderer *renderer, int location, int num_matrices, int num_rows, int num_columns, Uint8 transpose, float *values)
 
static void SetAttributef (GPU_Renderer *renderer, int location, float value)
 
static void SetAttributei (GPU_Renderer *renderer, int location, int value)
 
static void SetAttributeui (GPU_Renderer *renderer, int location, unsigned int value)
 
static void SetAttributefv (GPU_Renderer *renderer, int location, int num_elements, float *value)
 
static void SetAttributeiv (GPU_Renderer *renderer, int location, int num_elements, int *value)
 
static void SetAttributeuiv (GPU_Renderer *renderer, int location, int num_elements, unsigned int *value)
 
static void SetAttributeSource (GPU_Renderer *renderer, int num_values, GPU_Attribute source)
 

Variables

static char shader_message [256]
 

Macro Definition Documentation

#define GET_ALPHA (   sdl_color)    ((sdl_color).unused)

Definition at line 91 of file SDL_gpu_GL_common.inl.

Referenced by Blit(), BlitTransformX(), changeColor(), and GetPixel().

#define GPU_BLIT_BUFFER_ABSOLUTE_MAX_VERTICES   60000

Definition at line 61 of file SDL_gpu_GL_common.inl.

Referenced by growBlitBuffer().

#define GPU_BLIT_BUFFER_COLOR_OFFSET   4
#define GPU_BLIT_BUFFER_FLOATS_PER_VERTEX   8
#define GPU_BLIT_BUFFER_INIT_MAX_NUM_VERTICES   (GPU_BLIT_BUFFER_VERTICES_PER_SPRITE*1000)

Definition at line 57 of file SDL_gpu_GL_common.inl.

Referenced by CreateTargetFromWindow().

#define GPU_BLIT_BUFFER_STRIDE   (sizeof(float)*GPU_BLIT_BUFFER_FLOATS_PER_VERTEX)
#define GPU_BLIT_BUFFER_TEX_COORD_OFFSET   2

Definition at line 72 of file SDL_gpu_GL_common.inl.

Referenced by Blit(), BlitBatch(), BlitTransformX(), and DoPartialFlush().

#define GPU_BLIT_BUFFER_VERTEX_OFFSET   0
#define GPU_BLIT_BUFFER_VERTICES_PER_SPRITE   4

Definition at line 56 of file SDL_gpu_GL_common.inl.

Referenced by Blit(), and BlitTransformX().

#define GPU_INDEX_BUFFER_ABSOLUTE_MAX_VERTICES   4000000000u

Definition at line 63 of file SDL_gpu_GL_common.inl.

Referenced by growIndexBuffer().

#define M_PI   3.14159265358979323846

Definition at line 84 of file SDL_gpu_GL_common.inl.

Referenced by BlitTransformX(), RectangleRound(), and RectangleRoundFilled().

#define MAX (   a,
  b 
)    ((a) > (b)? (a) : (b))

Definition at line 4537 of file SDL_gpu_GL_common.inl.

Referenced by FlushBlitBuffer().

#define MIX_COLOR_COMPONENT (   a,
  b 
)    (((a)/255.0f * (b)/255.0f)*255)

Definition at line 625 of file SDL_gpu_GL_common.inl.

#define MIX_COLOR_COMPONENT_NORMALIZED_RESULT (   a,
  b 
)    ((a)/255.0f * (b)/255.0f)

Definition at line 624 of file SDL_gpu_GL_common.inl.

Referenced by Blit(), and BlitTransformX().

Definition at line 626 of file SDL_gpu_GL_common.inl.

Referenced by prepareToRenderImage().

#define SDL_GPU_DISABLE_SHADERS

Definition at line 97 of file SDL_gpu_GL_common.inl.

#define SET_COMMON_FUNCTIONS (   renderer)
#define SET_INDEXED_VERTEX (   offset)    index_buffer[cdata->index_buffer_num_vertices++] = blit_buffer_starting_index + (offset);
#define SET_TEXTURED_VERTEX (   x,
  y,
  s,
  t,
  r,
  g,
  b,
  a 
)
Value:
blit_buffer[vert_index] = x; \
blit_buffer[vert_index+1] = y; \
blit_buffer[tex_index] = s; \
blit_buffer[tex_index+1] = t; \
blit_buffer[color_index] = r; \
blit_buffer[color_index+1] = g; \
blit_buffer[color_index+2] = b; \
blit_buffer[color_index+3] = a; \
index_buffer[cdata->index_buffer_num_vertices++] = cdata->blit_buffer_num_vertices++; \
#define GPU_BLIT_BUFFER_FLOATS_PER_VERTEX
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
GLdouble GLdouble t
Definition: glew.h:1366
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:7319
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
GLdouble GLdouble GLdouble r
Definition: glew.h:1374
#define g
Definition: glew.h:12730
GLdouble s
Definition: glew.h:1358

Definition at line 3021 of file SDL_gpu_GL_common.inl.

#define SET_TEXTURED_VERTEX_UNINDEXED (   x,
  y,
  s,
  t,
  r,
  g,
  b,
  a 
)
Value:
blit_buffer[vert_index] = x; \
blit_buffer[vert_index+1] = y; \
blit_buffer[tex_index] = s; \
blit_buffer[tex_index+1] = t; \
blit_buffer[color_index] = r; \
blit_buffer[color_index+1] = g; \
blit_buffer[color_index+2] = b; \
blit_buffer[color_index+3] = a; \
#define GPU_BLIT_BUFFER_FLOATS_PER_VERTEX
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
GLdouble GLdouble t
Definition: glew.h:1366
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:7319
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
GLdouble GLdouble GLdouble r
Definition: glew.h:1374
#define g
Definition: glew.h:12730
GLdouble s
Definition: glew.h:1358

Definition at line 3035 of file SDL_gpu_GL_common.inl.

Referenced by Blit(), and BlitTransformX().

#define SET_UNTEXTURED_VERTEX (   x,
  y,
  r,
  g,
  b,
  a 
)
Value:
blit_buffer[vert_index] = x; \
blit_buffer[vert_index+1] = y; \
blit_buffer[color_index] = r; \
blit_buffer[color_index+1] = g; \
blit_buffer[color_index+2] = b; \
blit_buffer[color_index+3] = a; \
index_buffer[cdata->index_buffer_num_vertices++] = cdata->blit_buffer_num_vertices++; \
#define GPU_BLIT_BUFFER_FLOATS_PER_VERTEX
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:7319
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
GLdouble GLdouble GLdouble r
Definition: glew.h:1374
#define g
Definition: glew.h:12730

Definition at line 3048 of file SDL_gpu_GL_common.inl.

Referenced by Arc(), ArcFilled(), Circle(), CircleFilled(), Line(), Pixel(), Polygon(), PolygonFilled(), Rectangle(), RectangleFilled(), RectangleRound(), RectangleRoundFilled(), SectorFilled(), Tri(), and TriFilled().

#define SET_UNTEXTURED_VERTEX_UNINDEXED (   x,
  y,
  r,
  g,
  b,
  a 
)
Value:
blit_buffer[vert_index] = x; \
blit_buffer[vert_index+1] = y; \
blit_buffer[color_index] = r; \
blit_buffer[color_index+1] = g; \
blit_buffer[color_index+2] = b; \
blit_buffer[color_index+3] = a; \
#define GPU_BLIT_BUFFER_FLOATS_PER_VERTEX
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:7319
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
GLdouble GLdouble GLdouble r
Definition: glew.h:1374
#define g
Definition: glew.h:12730

Definition at line 3059 of file SDL_gpu_GL_common.inl.

#define static_inline   static inline

Definition at line 14 of file SDL_gpu_GL_common.inl.

Function Documentation

static void ActivateShaderProgram ( GPU_Renderer renderer,
Uint32  program_object,
GPU_ShaderBlock block 
)
static
static SDL_PixelFormat * AllocFormat ( GLenum  glFormat)
static
static void applyTargetCamera ( GPU_Target target)
static
static void applyTexturing ( GPU_Renderer renderer)
static
static void AttachShader ( GPU_Renderer renderer,
Uint32  program_object,
Uint32  shader_object 
)
static

Definition at line 4987 of file SDL_gpu_GL_common.inl.

References glAttachShader.

static Uint8 bindFramebuffer ( GPU_Renderer renderer,
GPU_Target target 
)
static
static void bindTexture ( GPU_Renderer renderer,
GPU_Image image 
)
static
static void Blit ( GPU_Renderer renderer,
GPU_Image image,
GPU_Rect src_rect,
GPU_Target target,
float  x,
float  y 
)
static
static void BlitBatch ( GPU_Renderer renderer,
GPU_Image image,
GPU_Target target,
unsigned int  num_sprites,
float *  values,
GPU_BlitFlagEnum  flags 
)
static
static void BlitRotate ( GPU_Renderer renderer,
GPU_Image image,
GPU_Rect src_rect,
GPU_Target target,
float  x,
float  y,
float  degrees 
)
static
static void BlitScale ( GPU_Renderer renderer,
GPU_Image image,
GPU_Rect src_rect,
GPU_Target target,
float  x,
float  y,
float  scaleX,
float  scaleY 
)
static
static 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 
)
static
static void BlitTransformMatrix ( GPU_Renderer renderer,
GPU_Image image,
GPU_Rect src_rect,
GPU_Target target,
float  x,
float  y,
float *  matrix3x3 
)
static
static void BlitTransformX ( GPU_Renderer renderer,
GPU_Image image,
GPU_Rect src_rect,
GPU_Target target,
float  x,
float  y,
float  pivot_x,
float  pivot_y,
float  degrees,
float  scaleX,
float  scaleY 
)
static
static void changeBlending ( GPU_Renderer renderer,
Uint8  enable 
)
static
static void changeBlendMode ( GPU_Renderer renderer,
GPU_BlendMode  mode 
)
static
static void changeCamera ( GPU_Target target)
static

Definition at line 736 of file SDL_gpu_GL_common.inl.

References applyTargetCamera().

Referenced by BlitBatch(), FlushBlitBuffer(), and TriangleBatch().

static void changeColor ( GPU_Renderer renderer,
SDL_Color  color 
)
static
static void changeTexturing ( GPU_Renderer renderer,
Uint8  enable 
)
static
static void changeViewport ( GPU_Target target)
static
static void Clear ( GPU_Renderer renderer,
GPU_Target target 
)
static
static void ClearRGBA ( GPU_Renderer renderer,
GPU_Target target,
Uint8  r,
Uint8  g,
Uint8  b,
Uint8  a 
)
static
static int compareFormats ( GPU_Renderer renderer,
GLenum  glFormat,
SDL_Surface *  surface,
GLenum surfaceFormatResult 
)
static
static Uint32 compile_shader_source ( GPU_ShaderEnum  shader_type,
const char *  shader_source 
)
static
static Uint32 CompileShader ( GPU_Renderer renderer,
GPU_ShaderEnum  shader_type,
const char *  shader_source 
)
static

Definition at line 4927 of file SDL_gpu_GL_common.inl.

References GPU_Renderer::CompileShader_RW.

static Uint32 CompileShader_RW ( GPU_Renderer renderer,
GPU_ShaderEnum  shader_type,
SDL_RWops *  shader_source 
)
static
static GPU_Image* CopyImage ( GPU_Renderer renderer,
GPU_Image image 
)
static
static GPU_Image* CopyImageFromSurface ( GPU_Renderer renderer,
SDL_Surface *  surface 
)
static
static GPU_Image* CopyImageFromTarget ( GPU_Renderer renderer,
GPU_Target target 
)
static
static SDL_Surface* CopySurfaceFromImage ( GPU_Renderer renderer,
GPU_Image image 
)
static
static SDL_Surface* CopySurfaceFromTarget ( GPU_Renderer renderer,
GPU_Target target 
)
static
static SDL_Surface* copySurfaceIfNeeded ( GPU_Renderer renderer,
GLenum  glFormat,
SDL_Surface *  surface,
GLenum surfaceFormatResult 
)
static

Definition at line 2286 of file SDL_gpu_GL_common.inl.

References AllocFormat(), compareFormats(), and FreeFormat().

Referenced by UpdateSubImage().

static GPU_Image* CreateAliasImage ( GPU_Renderer renderer,
GPU_Image image 
)
static
static GPU_Target* CreateAliasTarget ( GPU_Renderer renderer,
GPU_Target target 
)
static
static GPU_Image* CreateImage ( GPU_Renderer renderer,
Uint16  w,
Uint16  h,
GPU_FormatEnum  format 
)
static
static GPU_Target* CreateTargetFromWindow ( GPU_Renderer renderer,
Uint32  windowID,
GPU_Target target 
)
static

Definition at line 890 of file SDL_gpu_GL_common.inl.

References applyTargetCamera(), GPU_Target::camera, GPU_Target::clip_rect, GPU_Renderer::CompileShader, GPU_Context::context, GPU_Target::context, GPU_Renderer::current_context_target, GPU_Context::current_shader_program, GPU_Context::data, GPU_Target::data, GPU_Context::default_textured_shader_program, GPU_Context::default_untextured_shader_program, lg::err(), GPU_Context::failed, GL_ARRAY_BUFFER, GL_BLEND, GL_COLOR_BUFFER_BIT, GL_FRAMEBUFFER_BINDING, GL_ONE_MINUS_SRC_ALPHA, GL_RGBA, GL_SRC_ALPHA, GL_STREAM_DRAW, GL_TEXTURE_2D, GL_TRIANGLES, GL_VERSION, glBindBuffer, glBindVertexArray, glBlendFunc(), glBufferData, glClear(), glClearColor(), glColor4f(), glDisable(), glEnable(), GLEW_OK, glewInit(), glGenBuffers, glGenVertexArrays, glGetIntegerv(), glGetString(), glUseProgram, glViewport(), GPU_AddWindowMapping(), GPU_BLEND_NORMAL, GPU_BLIT_BUFFER_INIT_MAX_NUM_VERTICES, GPU_BLIT_BUFFER_STRIDE, GPU_CONTEXT_DATA, GPU_DEFAULT_TEXTURED_FRAGMENT_SHADER_SOURCE, GPU_DEFAULT_TEXTURED_VERTEX_SHADER_SOURCE, GPU_DEFAULT_UNTEXTURED_FRAGMENT_SHADER_SOURCE, GPU_DEFAULT_UNTEXTURED_VERTEX_SHADER_SOURCE, GPU_ERROR_BACKEND_ERROR, GPU_FEATURE_MASK, GPU_FRAGMENT_SHADER, GPU_GetBlendModeFromPreset(), GPU_GetDefaultCamera(), GPU_INIT_DISABLE_VSYNC, GPU_INIT_ENABLE_VSYNC, GPU_Renderer::GPU_init_flags, GPU_LoadShaderBlock(), GPU_MakeRect(), GPU_MatrixIdentity(), GPU_MODELVIEW, GPU_PushErrorCode(), GPU_RemoveWindowMapping(), GPU_SetShaderBlock(), GPU_TARGET_DATA, GPU_VERTEX_SHADER, GPU_Rect::h, GPU_Target::h, GPU_Renderer::id, GPU_Target::image, init_features(), GPU_Target::is_alias, GPU_Renderer::IsFeatureEnabled, GPU_Context::line_thickness, GPU_Renderer::LinkShaders, GPU_RendererID::major_version, GPU_Renderer::MakeCurrent, GPU_MatrixStack::matrix, GPU_Context::matrix_mode, GPU_RendererID::minor_version, GPU_Context::modelview_matrix, GPU_Context::projection_matrix, GPU_Target::refcount, GPU_Target::renderer, GPU_Renderer::requested_id, resources::screen, SDL_GPU_GL_MAJOR_VERSION, SDL_GPU_GLES_MAJOR_VERSION, GPU_Renderer::SetLineThickness, GPU_Context::shapes_blend_mode, GPU_Context::shapes_use_blending, GPU_MatrixStack::size, GPU_Context::stored_window_h, GPU_Context::stored_window_w, GPU_Target::use_clip_rect, GPU_Target::use_color, GPU_Context::use_texturing, GPU_Target::viewport, GPU_Rect::w, GPU_Target::w, GPU_Context::window_h, GPU_Context::window_w, GPU_Context::windowID, GPU_Rect::x, and GPU_Rect::y.

static GPU_Image* CreateUninitializedImage ( GPU_Renderer renderer,
Uint16  w,
Uint16  h,
GPU_FormatEnum  format 
)
static
static void DeactivateShaderProgram ( GPU_Renderer renderer)
static

Definition at line 5054 of file SDL_gpu_GL_common.inl.

References GPU_Renderer::ActivateShaderProgram.

static void DetachShader ( GPU_Renderer renderer,
Uint32  program_object,
Uint32  shader_object 
)
static

Definition at line 4994 of file SDL_gpu_GL_common.inl.

References glDetachShader.

static void disableTexturing ( GPU_Renderer renderer)
static
static void DoPartialFlush ( GPU_CONTEXT_DATA cdata,
unsigned short  num_vertices,
float *  blit_buffer,
unsigned int  num_indices,
unsigned short *  index_buffer 
)
static
static void DoUntexturedFlush ( GPU_CONTEXT_DATA cdata,
unsigned short  num_vertices,
float *  blit_buffer,
unsigned int  num_indices,
unsigned short *  index_buffer 
)
static
static void enableTexturing ( GPU_Renderer renderer)
static
static Uint8 equal_cameras ( GPU_Camera  a,
GPU_Camera  b 
)
static

Definition at line 731 of file SDL_gpu_GL_common.inl.

References GPU_Camera::angle, GPU_Camera::x, GPU_Camera::y, GPU_Camera::z, and GPU_Camera::zoom.

Referenced by SetCamera().

static void extBindFramebuffer ( GPU_Renderer renderer,
GLuint  handle 
)
static
static void Flip ( GPU_Renderer renderer,
GPU_Target target 
)
static
static_inline void flushAndBindFramebuffer ( GPU_Renderer renderer,
GLuint  handle 
)
static_inline void flushAndBindTexture ( GPU_Renderer renderer,
GLuint  handle 
)
static_inline void flushAndClearBlitBufferIfCurrentFramebuffer ( GPU_Renderer renderer,
GPU_Target target 
)
static_inline void flushAndClearBlitBufferIfCurrentTexture ( GPU_Renderer renderer,
GPU_Image image 
)
static void FlushBlitBuffer ( GPU_Renderer renderer)
static
static_inline void flushBlitBufferIfCurrentTexture ( GPU_Renderer renderer,
GPU_Image image 
)
static void FreeFormat ( SDL_PixelFormat *  format)
static
static void FreeImage ( GPU_Renderer renderer,
GPU_Image image 
)
static
static void FreeShader ( GPU_Renderer renderer,
Uint32  shader_object 
)
static

Definition at line 4973 of file SDL_gpu_GL_common.inl.

References glDeleteShader.

static void FreeShaderProgram ( GPU_Renderer renderer,
Uint32  program_object 
)
static

Definition at line 4980 of file SDL_gpu_GL_common.inl.

References glDeleteProgram.

static void FreeTarget ( GPU_Renderer renderer,
GPU_Target target 
)
static
static void GenerateMipmaps ( GPU_Renderer renderer,
GPU_Image image 
)
static
static const char* get_filename_ext ( const char *  filename)
static

Definition at line 1890 of file SDL_gpu_GL_common.inl.

Referenced by SaveImage().

static int get_lowest_attribute_num_values ( GPU_CONTEXT_DATA cdata,
int  cap 
)
static
static Uint32 get_proper_program_id ( GPU_Renderer renderer,
Uint32  program_object 
)
static
static int GetAttributeLocation ( GPU_Renderer renderer,
Uint32  program_object,
const char *  attrib_name 
)
static

Definition at line 5064 of file SDL_gpu_GL_common.inl.

References get_proper_program_id(), and glGetAttribLocation.

static_inline unsigned int getNearestPowerOf2 ( unsigned int  n)

Definition at line 255 of file SDL_gpu_GL_common.inl.

Referenced by CopyImage(), and CreateImage().

static_inline Uint32 getPixel ( SDL_Surface *  Surface,
int  x,
int  y 
)

Definition at line 2727 of file SDL_gpu_GL_common.inl.

References g.

static SDL_Color GetPixel ( GPU_Renderer renderer,
GPU_Target target,
Sint16  x,
Sint16  y 
)
static
static unsigned char* getRawImageData ( GPU_Renderer renderer,
GPU_Image image 
)
static
static unsigned char* getRawTargetData ( GPU_Renderer renderer,
GPU_Target target 
)
static
static const char* GetShaderMessage ( GPU_Renderer renderer)
static

Definition at line 5059 of file SDL_gpu_GL_common.inl.

References shader_message.

static Uint32 GetShaderSource ( const char *  filename,
char *  result 
)
static

Definition at line 4817 of file SDL_gpu_GL_common.inl.

References GetShaderSource_RW().

Referenced by GetShaderSource_RW().

static Uint32 GetShaderSource_RW ( SDL_RWops *  shader_source,
char *  result 
)
static
static Uint32 GetShaderSourceSize ( const char *  filename)
static

Definition at line 4832 of file SDL_gpu_GL_common.inl.

References GetShaderSourceSize_RW().

Referenced by GetShaderSourceSize_RW().

static Uint32 GetShaderSourceSize_RW ( SDL_RWops *  shader_source)
static
static void GetUniformfv ( GPU_Renderer renderer,
Uint32  program_object,
int  location,
float *  values 
)
static

Definition at line 5270 of file SDL_gpu_GL_common.inl.

References get_proper_program_id(), and glGetUniformfv.

static void GetUniformiv ( GPU_Renderer renderer,
Uint32  program_object,
int  location,
int values 
)
static

Definition at line 5156 of file SDL_gpu_GL_common.inl.

References get_proper_program_id(), and glGetUniformiv.

static int GetUniformLocation ( GPU_Renderer renderer,
Uint32  program_object,
const char *  uniform_name 
)
static

Definition at line 5076 of file SDL_gpu_GL_common.inl.

References get_proper_program_id(), and glGetUniformLocation.

static void GetUniformuiv ( GPU_Renderer renderer,
Uint32  program_object,
int  location,
unsigned int values 
)
static

Definition at line 5200 of file SDL_gpu_GL_common.inl.

References get_proper_program_id(), glGetUniformiv, and glGetUniformuiv.

void GPU_AddWindowMapping ( GPU_Target target)
void GPU_RemoveWindowMapping ( Uint32  windowID)
void GPU_RemoveWindowMappingByTarget ( GPU_Target target)

Definition at line 268 of file SDL_gpu.c.

References GPU_Target::context, i, init_window_mappings(), num_window_mappings, and GPU_Context::windowID.

Referenced by FreeTarget().

static Uint8 growBlitBuffer ( GPU_CONTEXT_DATA cdata,
unsigned int  minimum_vertices_needed 
)
static
static Uint8 growIndexBuffer ( GPU_CONTEXT_DATA cdata,
unsigned int  minimum_vertices_needed 
)
static
static Uint8 hasColorkey ( SDL_Surface *  surface)
static

Definition at line 2271 of file SDL_gpu_GL_common.inl.

Referenced by CopyImageFromSurface().

static GPU_Target* Init ( GPU_Renderer renderer,
GPU_RendererID  renderer_request,
Uint16  w,
Uint16  h,
GPU_WindowFlagEnum  SDL_flags 
)
static
static void init_features ( GPU_Renderer renderer)
static
static_inline Uint8 isCurrentTarget ( GPU_Renderer renderer,
GPU_Target target 
)
static Uint8 IsDefaultShaderProgram ( GPU_Renderer renderer,
Uint32  program_object 
)
static
static Uint8 isExtensionSupported ( const char *  extension_str)
static

Definition at line 113 of file SDL_gpu_GL_common.inl.

References GL_EXTENSIONS, glewIsExtensionSupported, and glGetString().

Referenced by init_features().

static Uint8 IsFeatureEnabled ( GPU_Renderer renderer,
GPU_FeatureEnum  feature 
)
static

Definition at line 884 of file SDL_gpu_GL_common.inl.

References GPU_Renderer::enabled_features.

static_inline Uint8 isPowerOfTwo ( unsigned int  x)

Definition at line 250 of file SDL_gpu_GL_common.inl.

Referenced by CopyImage(), and CreateImage().

static Uint32 LinkShaderProgram ( GPU_Renderer renderer,
Uint32  program_object 
)
static
static Uint32 LinkShaders ( GPU_Renderer renderer,
Uint32  shader_object1,
Uint32  shader_object2 
)
static
static GPU_Image* LoadImage ( GPU_Renderer renderer,
const char *  filename 
)
static
static 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 
)
static
static GPU_Target* LoadTarget ( GPU_Renderer renderer,
GPU_Image image 
)
static
static void makeContextCurrent ( GPU_Renderer renderer,
GPU_Target target 
)
static
static void MakeCurrent ( GPU_Renderer renderer,
GPU_Target target,
Uint32  windowID 
)
static
static void prepareToRenderImage ( GPU_Renderer renderer,
GPU_Target target,
GPU_Image image 
)
static
static void prepareToRenderShapes ( GPU_Renderer renderer,
unsigned int  shape 
)
static
static void prepareToRenderToTarget ( GPU_Renderer renderer,
GPU_Target target 
)
static
static void Quit ( GPU_Renderer renderer)
static
static void read_until_end_of_comment ( SDL_RWops *  rwops,
char  multiline 
)
static

Definition at line 4628 of file SDL_gpu_GL_common.inl.

Referenced by GetShaderSource_RW(), and GetShaderSourceSize_RW().

static Uint8 readImagePixels ( GPU_Renderer renderer,
GPU_Image source,
GLint  format,
GLubyte pixels 
)
static
static Uint8 readTargetPixels ( GPU_Renderer renderer,
GPU_Target source,
GLint  format,
GLubyte pixels 
)
static
static Uint8 SaveImage ( GPU_Renderer renderer,
GPU_Image image,
const char *  filename 
)
static
static void SetAsCurrent ( GPU_Renderer renderer)
static
static void SetAttributef ( GPU_Renderer renderer,
int  location,
float  value 
)
static
static void SetAttributefv ( GPU_Renderer renderer,
int  location,
int  num_elements,
float *  value 
)
static
static void SetAttributei ( GPU_Renderer renderer,
int  location,
int  value 
)
static
static void SetAttributeiv ( GPU_Renderer renderer,
int  location,
int  num_elements,
int value 
)
static
static void SetAttributeSource ( GPU_Renderer renderer,
int  num_values,
GPU_Attribute  source 
)
static
static void SetAttributeui ( GPU_Renderer renderer,
int  location,
unsigned int  value 
)
static
static void SetAttributeuiv ( GPU_Renderer renderer,
int  location,
int  num_elements,
unsigned int value 
)
static
static GPU_Camera SetCamera ( GPU_Renderer renderer,
GPU_Target target,
GPU_Camera cam 
)
static
static GPU_Rect SetClip ( GPU_Renderer renderer,
GPU_Target target,
Sint16  x,
Sint16  y,
Uint16  w,
Uint16  h 
)
static
static void setClipRect ( GPU_Renderer renderer,
GPU_Target target 
)
static
static void SetImageFilter ( GPU_Renderer renderer,
GPU_Image image,
GPU_FilterEnum  filter 
)
static
static void SetShaderBlock ( GPU_Renderer renderer,
GPU_ShaderBlock  block 
)
static
static void SetShaderImage ( GPU_Renderer renderer,
GPU_Image image,
int  location,
int  image_unit 
)
static
static void SetUniformf ( GPU_Renderer renderer,
int  location,
float  value 
)
static
static void SetUniformfv ( GPU_Renderer renderer,
int  location,
int  num_elements_per_value,
int  num_values,
float *  values 
)
static
static void SetUniformi ( GPU_Renderer renderer,
int  location,
int  value 
)
static
static void SetUniformiv ( GPU_Renderer renderer,
int  location,
int  num_elements_per_value,
int  num_values,
int values 
)
static
static void SetUniformMatrixfv ( GPU_Renderer renderer,
int  location,
int  num_matrices,
int  num_rows,
int  num_columns,
Uint8  transpose,
float *  values 
)
static
static void SetUniformui ( GPU_Renderer renderer,
int  location,
unsigned int  value 
)
static
static void SetUniformuiv ( GPU_Renderer renderer,
int  location,
int  num_elements_per_value,
int  num_values,
unsigned int values 
)
static
static void SetVirtualResolution ( GPU_Renderer renderer,
GPU_Target target,
Uint16  w,
Uint16  h 
)
static
static Uint8 SetWindowResolution ( GPU_Renderer renderer,
Uint16  w,
Uint16  h 
)
static
static void SetWrapMode ( GPU_Renderer renderer,
GPU_Image image,
GPU_WrapEnum  wrap_mode_x,
GPU_WrapEnum  wrap_mode_y 
)
static
static Uint8 ToggleFullscreen ( GPU_Renderer renderer,
Uint8  use_desktop_resolution 
)
static
static 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 
)
static
static void UnsetClip ( GPU_Renderer renderer,
GPU_Target target 
)
static
static void unsetClipRect ( GPU_Renderer renderer,
GPU_Target target 
)
static
static void UnsetVirtualResolution ( GPU_Renderer renderer,
GPU_Target target 
)
static
static void UpdateImage ( GPU_Renderer renderer,
GPU_Image image,
SDL_Surface *  surface,
const GPU_Rect surface_rect 
)
static

Definition at line 2518 of file SDL_gpu_GL_common.inl.

References GPU_Renderer::UpdateSubImage.

static void UpdateImageBytes ( GPU_Renderer renderer,
GPU_Image image,
const GPU_Rect image_rect,
const unsigned char *  bytes,
int  bytes_per_row 
)
static
static void UpdateSubImage ( GPU_Renderer renderer,
GPU_Image image,
const GPU_Rect image_rect,
SDL_Surface *  surface,
const GPU_Rect surface_rect 
)
static

Variable Documentation

char shader_message[256]
static

Definition at line 4847 of file SDL_gpu_GL_common.inl.

Referenced by GetShaderMessage().