|
SDL_gpu
0.11.0
A hardware-accelerated, cross-platform 2D graphics API
|
#include <stdint.h>#include <stdlib.h>#include "SDL_platform.h"#include <math.h>#include <string.h>#include "stb_image.h"#include "stb_image_write.h"Go to the source code of this file.
Macros | |
| #define | GLAPIENTRY |
| #define | intptr_t long |
| #define | M_PI 3.14159265358979323846 |
| #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 | SDL_Window SDL_Surface |
| #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 | 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 | SET_RELATIVE_INDEXED_VERTEX(offset) index_buffer[cdata->index_buffer_num_vertices++] = cdata->blit_buffer_num_vertices + (offset); |
| #define | BEGIN_UNTEXTURED_SEGMENTS(x1, y1, x2, y2, r, g, b, a) |
| #define | SET_UNTEXTURED_SEGMENTS(x1, y1, x2, y2, r, g, b, a) |
| #define | LOOP_UNTEXTURED_SEGMENTS() |
| #define | END_UNTEXTURED_SEGMENTS(x1, y1, x2, y2, r, g, b, a) |
| #define | MAX(a, b) ((a) > (b)? (a) : (b)) |
| #define | SET_COMMON_FUNCTIONS(impl) |
Functions | |
| int | gpu_strcasecmp (const char *s1, const char *s2) |
| static_inline SDL_Window * | get_window (Uint32 windowID) |
| static_inline Uint32 | get_window_id (SDL_Surface *window) |
| static_inline void | get_window_dimensions (SDL_Window *window, int *w, int *h) |
| static_inline void | get_drawable_dimensions (SDL_Window *window, int *w, int *h) |
| static_inline void | resize_window (GPU_Target *target, int w, int h) |
| static_inline GPU_bool | get_fullscreen_state (SDL_Window *window) |
| static_inline GPU_bool | has_colorkey (SDL_Surface *surface) |
| static_inline void | get_target_window_dimensions (GPU_Target *target, int *w, int *h) |
| static_inline void | get_target_drawable_dimensions (GPU_Target *target, int *w, int *h) |
| static_inline void | fast_upload_texture (const void *pixels, GPU_Rect update_rect, Uint32 format, int alignment, int row_length) |
| static_inline void | upload_texture (const void *pixels, GPU_Rect update_rect, Uint32 format, int alignment, int row_length, unsigned int pitch, int bytes_per_pixel) |
| static_inline void | upload_new_texture (void *pixels, GPU_Rect update_rect, Uint32 format, int alignment, int row_length, int bytes_per_pixel) |
| static_inline GPU_bool | isPowerOfTwo (unsigned int x) |
| static_inline unsigned int | getNearestPowerOf2 (unsigned int n) |
| static_inline void | flushAndBindTexture (GPU_Renderer *renderer, GLuint handle) |
| 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 GPU_bool | isCurrentTarget (GPU_Renderer *renderer, GPU_Target *target) |
| static_inline void | flushAndClearBlitBufferIfCurrentFramebuffer (GPU_Renderer *renderer, GPU_Target *target) |
| static_inline Uint32 | getPixel (SDL_Surface *Surface, int x, int y) |
| static_inline void | submit_buffer_data (int bytes, float *values, int bytes_indices, unsigned short *indices) |
Variables | |
| static GLuint | framebuffer = glBindFramebufferNOOP |
| static const GLuint * | framebuffers = glDeleteFramebuffersNOOP |
| static GLenum | attachment |
| static GLenum GLenum | textarget |
| static GLenum GLenum GLuint | texture |
| static GLenum GLenum GLuint GLint | level = glFramebufferTexture2DNOOP |
| static GLuint * | ids = glGenFramebuffersNOOP |
| #define BEGIN_UNTEXTURED_SEGMENTS | ( | x1, | |
| y1, | |||
| x2, | |||
| y2, | |||
| r, | |||
| g, | |||
| b, | |||
| a | |||
| ) |
Definition at line 4031 of file renderer_GL_common.inl.
| #define END_UNTEXTURED_SEGMENTS | ( | x1, | |
| y1, | |||
| x2, | |||
| y2, | |||
| r, | |||
| g, | |||
| b, | |||
| a | |||
| ) |
Definition at line 4051 of file renderer_GL_common.inl.
| #define GET_ALPHA | ( | sdl_color | ) | ((sdl_color).unused) |
Definition at line 151 of file renderer_GL_common.inl.
| #define GLAPIENTRY |
Definition at line 8 of file renderer_GL_common.inl.
| #define GPU_BLIT_BUFFER_ABSOLUTE_MAX_VERTICES 60000 |
Definition at line 90 of file renderer_GL_common.inl.
| #define GPU_BLIT_BUFFER_COLOR_OFFSET 4 |
Definition at line 102 of file renderer_GL_common.inl.
| #define GPU_BLIT_BUFFER_FLOATS_PER_VERTEX 8 |
Definition at line 96 of file renderer_GL_common.inl.
| #define GPU_BLIT_BUFFER_INIT_MAX_NUM_VERTICES (GPU_BLIT_BUFFER_VERTICES_PER_SPRITE*1000) |
Definition at line 86 of file renderer_GL_common.inl.
| #define GPU_BLIT_BUFFER_STRIDE (sizeof(float)*GPU_BLIT_BUFFER_FLOATS_PER_VERTEX) |
Definition at line 99 of file renderer_GL_common.inl.
| #define GPU_BLIT_BUFFER_TEX_COORD_OFFSET 2 |
Definition at line 101 of file renderer_GL_common.inl.
| #define GPU_BLIT_BUFFER_VERTEX_OFFSET 0 |
Definition at line 100 of file renderer_GL_common.inl.
| #define GPU_BLIT_BUFFER_VERTICES_PER_SPRITE 4 |
Definition at line 85 of file renderer_GL_common.inl.
| #define GPU_INDEX_BUFFER_ABSOLUTE_MAX_VERTICES 4000000000u |
Definition at line 92 of file renderer_GL_common.inl.
| #define intptr_t long |
Definition at line 23 of file renderer_GL_common.inl.
| #define LOOP_UNTEXTURED_SEGMENTS | ( | ) |
Definition at line 4045 of file renderer_GL_common.inl.
| #define M_PI 3.14159265358979323846 |
Definition at line 30 of file renderer_GL_common.inl.
| #define MAX | ( | a, | |
| b | |||
| ) | ((a) > (b)? (a) : (b)) |
Definition at line 5539 of file renderer_GL_common.inl.
| #define MIX_COLOR_COMPONENT | ( | a, | |
| b | |||
| ) | (((a)/255.0f * (b)/255.0f)*255) |
Definition at line 988 of file renderer_GL_common.inl.
| #define MIX_COLOR_COMPONENT_NORMALIZED_RESULT | ( | a, | |
| b | |||
| ) | ((a)/255.0f * (b)/255.0f) |
Definition at line 987 of file renderer_GL_common.inl.
| #define SDL_GPU_DISABLE_SHADERS |
Definition at line 223 of file renderer_GL_common.inl.
| #define SDL_Window SDL_Surface |
Definition at line 150 of file renderer_GL_common.inl.
| #define SET_COMMON_FUNCTIONS | ( | impl | ) |
Definition at line 6761 of file renderer_GL_common.inl.
| #define SET_INDEXED_VERTEX | ( | offset | ) | index_buffer[cdata->index_buffer_num_vertices++] = blit_buffer_starting_index + (offset); |
Definition at line 4023 of file renderer_GL_common.inl.
| #define SET_RELATIVE_INDEXED_VERTEX | ( | offset | ) | index_buffer[cdata->index_buffer_num_vertices++] = cdata->blit_buffer_num_vertices + (offset); |
Definition at line 4026 of file renderer_GL_common.inl.
| #define SET_TEXTURED_VERTEX | ( | x, | |
| y, | |||
| s, | |||
| t, | |||
| r, | |||
| g, | |||
| b, | |||
| a | |||
| ) |
Definition at line 3975 of file renderer_GL_common.inl.
| #define SET_TEXTURED_VERTEX_UNINDEXED | ( | x, | |
| y, | |||
| s, | |||
| t, | |||
| r, | |||
| g, | |||
| b, | |||
| a | |||
| ) |
Definition at line 3989 of file renderer_GL_common.inl.
| #define SET_UNTEXTURED_SEGMENTS | ( | x1, | |
| y1, | |||
| x2, | |||
| y2, | |||
| r, | |||
| g, | |||
| b, | |||
| a | |||
| ) |
Definition at line 4036 of file renderer_GL_common.inl.
| #define SET_UNTEXTURED_VERTEX | ( | x, | |
| y, | |||
| r, | |||
| g, | |||
| b, | |||
| a | |||
| ) |
Definition at line 4002 of file renderer_GL_common.inl.
| #define SET_UNTEXTURED_VERTEX_UNINDEXED | ( | x, | |
| y, | |||
| r, | |||
| g, | |||
| b, | |||
| a | |||
| ) |
Definition at line 4013 of file renderer_GL_common.inl.
| #define static_inline static inline |
Definition at line 38 of file renderer_GL_common.inl.
| static_inline void fast_upload_texture | ( | const void * | pixels, |
| GPU_Rect | update_rect, | ||
| Uint32 | format, | ||
| int | alignment, | ||
| int | row_length | ||
| ) |
Definition at line 273 of file renderer_GL_common.inl.
| static_inline void flushAndBindFramebuffer | ( | GPU_Renderer * | renderer, |
| GLuint | handle | ||
| ) |
Definition at line 651 of file renderer_GL_common.inl.
| static_inline void flushAndBindTexture | ( | GPU_Renderer * | renderer, |
| GLuint | handle | ||
| ) |
Definition at line 611 of file renderer_GL_common.inl.
| static_inline void flushAndClearBlitBufferIfCurrentFramebuffer | ( | GPU_Renderer * | renderer, |
| GPU_Target * | target | ||
| ) |
Definition at line 683 of file renderer_GL_common.inl.
| static_inline void flushAndClearBlitBufferIfCurrentTexture | ( | GPU_Renderer * | renderer, |
| GPU_Image * | image | ||
| ) |
Definition at line 668 of file renderer_GL_common.inl.
| static_inline void flushBlitBufferIfCurrentTexture | ( | GPU_Renderer * | renderer, |
| GPU_Image * | image | ||
| ) |
Definition at line 660 of file renderer_GL_common.inl.
| static_inline void get_drawable_dimensions | ( | SDL_Window * | window, |
| int * | w, | ||
| int * | h | ||
| ) |
Definition at line 171 of file renderer_GL_common.inl.
| static_inline GPU_bool get_fullscreen_state | ( | SDL_Window * | window | ) |
Definition at line 186 of file renderer_GL_common.inl.
| static_inline void get_target_drawable_dimensions | ( | GPU_Target * | target, |
| int * | w, | ||
| int * | h | ||
| ) |
Definition at line 209 of file renderer_GL_common.inl.
| static_inline void get_target_window_dimensions | ( | GPU_Target * | target, |
| int * | w, | ||
| int * | h | ||
| ) |
Definition at line 200 of file renderer_GL_common.inl.
| static_inline SDL_Window* get_window | ( | Uint32 | windowID | ) |
Definition at line 153 of file renderer_GL_common.inl.
| static_inline void get_window_dimensions | ( | SDL_Window * | window, |
| int * | w, | ||
| int * | h | ||
| ) |
Definition at line 163 of file renderer_GL_common.inl.
| static_inline Uint32 get_window_id | ( | SDL_Surface * | window | ) |
Definition at line 158 of file renderer_GL_common.inl.
| static_inline unsigned int getNearestPowerOf2 | ( | unsigned int | n | ) |
Definition at line 588 of file renderer_GL_common.inl.
| static_inline Uint32 getPixel | ( | SDL_Surface * | Surface, |
| int | x, | ||
| int | y | ||
| ) |
Definition at line 3653 of file renderer_GL_common.inl.
| static_inline GPU_bool has_colorkey | ( | SDL_Surface * | surface | ) |
Definition at line 191 of file renderer_GL_common.inl.
| static_inline GPU_bool isCurrentTarget | ( | GPU_Renderer * | renderer, |
| GPU_Target * | target | ||
| ) |
Definition at line 677 of file renderer_GL_common.inl.
| static_inline GPU_bool isPowerOfTwo | ( | unsigned int | x | ) |
Definition at line 583 of file renderer_GL_common.inl.
| static_inline void resize_window | ( | GPU_Target * | target, |
| int | w, | ||
| int | h | ||
| ) |
Definition at line 176 of file renderer_GL_common.inl.
| static_inline void submit_buffer_data | ( | int | bytes, |
| float * | values, | ||
| int | bytes_indices, | ||
| unsigned short * | indices | ||
| ) |
Definition at line 4623 of file renderer_GL_common.inl.
| static_inline void upload_new_texture | ( | void * | pixels, |
| GPU_Rect | update_rect, | ||
| Uint32 | format, | ||
| int | alignment, | ||
| int | row_length, | ||
| int | bytes_per_pixel | ||
| ) |
Definition at line 349 of file renderer_GL_common.inl.
| static_inline void upload_texture | ( | const void * | pixels, |
| GPU_Rect | update_rect, | ||
| Uint32 | format, | ||
| int | alignment, | ||
| int | row_length, | ||
| unsigned int | pitch, | ||
| int | bytes_per_pixel | ||
| ) |
Definition at line 336 of file renderer_GL_common.inl.
| GLenum attachment |
Definition at line 403 of file renderer_GL_common.inl.
| GLuint framebuffer = glBindFramebufferNOOP |
Definition at line 400 of file renderer_GL_common.inl.
| const GLuint* framebuffers = glDeleteFramebuffersNOOP |
Definition at line 402 of file renderer_GL_common.inl.
| GLuint* ids = glGenFramebuffersNOOP |
Definition at line 404 of file renderer_GL_common.inl.
| GLenum GLenum GLuint GLint level = glFramebufferTexture2DNOOP |
Definition at line 403 of file renderer_GL_common.inl.
| GLenum GLenum textarget |
Definition at line 403 of file renderer_GL_common.inl.
| GLenum GLenum GLuint texture |
Definition at line 403 of file renderer_GL_common.inl.
1.8.13