#include "SDL.h"
#include <stdio.h>
#include <stdarg.h>
Go to the source code of this file.
Classes | |
struct | GPU_Rect |
struct | GPU_RendererID |
struct | GPU_BlendMode |
struct | GPU_Image |
struct | GPU_Camera |
struct | GPU_ShaderBlock |
struct | GPU_MatrixStack |
struct | GPU_Context |
struct | GPU_Target |
struct | GPU_AttributeFormat |
struct | GPU_Attribute |
struct | GPU_AttributeSource |
struct | GPU_ErrorObject |
struct | GPU_Renderer |
Macros | |
#define | SDL_GPU_VERSION_MAJOR 0 |
#define | SDL_GPU_VERSION_MINOR 9 |
#define | SDL_GPU_VERSION_PATCH 0 |
#define | SDL_GPU_USE_SDL2 |
#define | GPU_RENDERER_ORDER_MAX 10 |
#define | GPU_MATRIX_STACK_MAX 5 |
#define | GPU_FEATURE_ALL_BASE GPU_FEATURE_RENDER_TARGETS |
#define | GPU_FEATURE_ALL_BLEND_PRESETS (GPU_FEATURE_BLEND_EQUATIONS | GPU_FEATURE_BLEND_FUNC_SEPARATE) |
#define | GPU_FEATURE_ALL_GL_FORMATS (GPU_FEATURE_GL_BGR | GPU_FEATURE_GL_BGRA | GPU_FEATURE_GL_ABGR) |
#define | GPU_FEATURE_BASIC_SHADERS (GPU_FEATURE_FRAGMENT_SHADER | GPU_FEATURE_PIXEL_SHADER) |
#define | GPU_FEATURE_ALL_SHADERS (GPU_FEATURE_FRAGMENT_SHADER | GPU_FEATURE_PIXEL_SHADER | GPU_FEATURE_GEOMETRY_SHADER) |
#define | GPU_FEATURE_MASK 0x00FFFF |
#define | GPU_INIT_MASK 0xFF0000 |
#define | GPU_DEFAULT_INIT_FLAGS 0 |
#define | GPU_PASSTHROUGH_ALL (GPU_PASSTHROUGH_VERTICES | GPU_PASSTHROUGH_TEXCOORDS | GPU_PASSTHROUGH_COLORS) |
#define | GPU_Log GPU_LogInfo |
Typedefs | |
typedef struct GPU_Renderer | GPU_Renderer |
typedef struct GPU_Target | GPU_Target |
typedef struct GPU_Rect | GPU_Rect |
typedef Uint32 | GPU_RendererEnum |
typedef struct GPU_RendererID | GPU_RendererID |
typedef struct GPU_BlendMode | GPU_BlendMode |
typedef struct GPU_Image | GPU_Image |
typedef struct GPU_Camera | GPU_Camera |
typedef struct GPU_ShaderBlock | GPU_ShaderBlock |
typedef struct GPU_MatrixStack | GPU_MatrixStack |
typedef struct GPU_Context | GPU_Context |
typedef Uint32 | GPU_FeatureEnum |
typedef Uint32 | GPU_WindowFlagEnum |
typedef Uint32 | GPU_InitFlagEnum |
typedef Uint32 | GPU_BlitFlagEnum |
typedef Uint32 | GPU_TypeEnum |
typedef struct GPU_AttributeFormat | GPU_AttributeFormat |
typedef struct GPU_Attribute | GPU_Attribute |
typedef struct GPU_AttributeSource | GPU_AttributeSource |
typedef struct GPU_ErrorObject | GPU_ErrorObject |
#define GPU_DEFAULT_INIT_FLAGS 0 |
Definition at line 351 of file SDL_gpu.h.
Referenced by CVideo::initSDL().
#define GPU_FEATURE_ALL_BASE GPU_FEATURE_RENDER_TARGETS |
#define GPU_FEATURE_ALL_BLEND_PRESETS (GPU_FEATURE_BLEND_EQUATIONS | GPU_FEATURE_BLEND_FUNC_SEPARATE) |
#define GPU_FEATURE_ALL_GL_FORMATS (GPU_FEATURE_GL_BGR | GPU_FEATURE_GL_BGRA | GPU_FEATURE_GL_ABGR) |
#define GPU_FEATURE_ALL_SHADERS (GPU_FEATURE_FRAGMENT_SHADER | GPU_FEATURE_PIXEL_SHADER | GPU_FEATURE_GEOMETRY_SHADER) |
#define GPU_FEATURE_BASIC_SHADERS (GPU_FEATURE_FRAGMENT_SHADER | GPU_FEATURE_PIXEL_SHADER) |
#define GPU_FEATURE_MASK 0x00FFFF |
For separating combined feature flags from init flags.
Definition at line 336 of file SDL_gpu.h.
Referenced by CreateTargetFromWindow().
#define GPU_Log GPU_LogInfo |
#define GPU_MATRIX_STACK_MAX 5 |
Definition at line 230 of file SDL_gpu.h.
Referenced by GPU_PushMatrix().
#define GPU_PASSTHROUGH_ALL (GPU_PASSTHROUGH_VERTICES | GPU_PASSTHROUGH_TEXCOORDS | GPU_PASSTHROUGH_COLORS) |
Definition at line 368 of file SDL_gpu.h.
Referenced by GPU_BlitBatch(), GPU_BlitBatchSeparate(), and GPU_TriangleBatch().
#define GPU_RENDERER_ORDER_MAX 10 |
Definition at line 33 of file SDL_gpu.h.
Referenced by GPU_GetDefaultRendererOrder(), GPU_Init(), and GPU_SetRendererOrder().
#define SDL_GPU_VERSION_MAJOR 0 |
Definition at line 14 of file SDL_gpu.h.
Referenced by GPU_GetCompiledVersion().
#define SDL_GPU_VERSION_MINOR 9 |
Definition at line 15 of file SDL_gpu.h.
Referenced by GPU_GetCompiledVersion().
#define SDL_GPU_VERSION_PATCH 0 |
Definition at line 16 of file SDL_gpu.h.
Referenced by GPU_GetCompiledVersion().
typedef struct GPU_Attribute GPU_Attribute |
typedef struct GPU_AttributeFormat GPU_AttributeFormat |
typedef struct GPU_AttributeSource GPU_AttributeSource |
typedef struct GPU_BlendMode GPU_BlendMode |
Blend mode storage struct
typedef Uint32 GPU_BlitFlagEnum |
Bit flags for the blit batch functions.
typedef struct GPU_Camera GPU_Camera |
Camera object that determines viewing transform.
typedef struct GPU_Context GPU_Context |
Rendering context data. Only GPU_Targets which represent windows will store this.
typedef struct GPU_ErrorObject GPU_ErrorObject |
typedef Uint32 GPU_FeatureEnum |
Important GPU features which may not be supported depending on a device's extension support. Can be OR'd together.
Image object for containing pixel/texture data. A GPU_Image can be created with GPU_CreateImage(), GPU_LoadImage(), GPU_CopyImage(), or GPU_CopyImageFromSurface(). Free the memory with GPU_FreeImage() when you're done.
typedef Uint32 GPU_InitFlagEnum |
Initialization flags for changing default init parameters. Can be bitwise OR'ed together with GPU_FeatureEnums. Default (0) is to use late swap vsync and double buffering.
typedef struct GPU_MatrixStack GPU_MatrixStack |
Matrix stack data structure for replacing the old OpenGL matrix stack.
A struct representing a rectangular area with floating point precision.
typedef struct GPU_Renderer GPU_Renderer |
typedef Uint32 GPU_RendererEnum |
typedef struct GPU_RendererID GPU_RendererID |
Renderer ID object for identifying a specific renderer.
typedef struct GPU_ShaderBlock GPU_ShaderBlock |
Container for the built-in shader attribute and uniform locations (indices).
typedef struct GPU_Target GPU_Target |
typedef Uint32 GPU_TypeEnum |
Type enumeration for GPU_AttributeFormat specifications.
typedef Uint32 GPU_WindowFlagEnum |
enum GPU_BlendEqEnum |
Blend component equations
Enumerator | |
---|---|
GPU_EQ_ADD | |
GPU_EQ_SUBTRACT | |
GPU_EQ_REVERSE_SUBTRACT |
enum GPU_BlendFuncEnum |
Blend component functions
enum GPU_BlendPresetEnum |
enum GPU_DebugLevelEnum |
enum GPU_ErrorEnum |
enum GPU_FilterEnum |
Image filtering options. These affect the quality/interpolation of colors when images are scaled.
Enumerator | |
---|---|
GPU_FILTER_NEAREST | |
GPU_FILTER_LINEAR | |
GPU_FILTER_LINEAR_MIPMAP |
enum GPU_FormatEnum |
Image format enum
Enumerator | |
---|---|
GPU_FORMAT_LUMINANCE | |
GPU_FORMAT_LUMINANCE_ALPHA | |
GPU_FORMAT_RGB | |
GPU_FORMAT_RGBA | |
GPU_FORMAT_ALPHA | |
GPU_FORMAT_RG | |
GPU_FORMAT_YCbCr422 | |
GPU_FORMAT_YCbCr420P |
enum GPU_ShaderEnum |
enum GPU_SnapEnum |
Snap modes. Blitting with these modes will align the sprite with the target's pixel grid.
Enumerator | |
---|---|
GPU_SNAP_NONE | |
GPU_SNAP_POSITION | |
GPU_SNAP_DIMENSIONS | |
GPU_SNAP_POSITION_AND_DIMENSIONS |
enum GPU_WrapEnum |
Image wrapping options. These affect how images handle src_rect coordinates beyond their dimensions when blitted.
Enumerator | |
---|---|
GPU_WRAP_NONE | |
GPU_WRAP_REPEAT | |
GPU_WRAP_MIRRORED |
void GPU_ActivateShaderProgram | ( | Uint32 | program_object, |
GPU_ShaderBlock * | block | ||
) |
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.
Definition at line 2291 of file SDL_gpu.c.
References GPU_Renderer::ActivateShaderProgram, and GPU_Renderer::current_context_target.
GPU_Renderer* GPU_AddRenderer | ( | GPU_RendererID | id | ) |
Creates a new renderer matching the given identifier.
Definition at line 364 of file SDL_gpu_Renderer.c.
References GPU_CreateRenderer(), GPU_ERROR_BACKEND_ERROR, GPU_PushErrorCode(), i, GPU_Renderer::id, GPU_RendererID::index, and MAX_ACTIVE_RENDERERS.
Referenced by GPU_InitRendererByID().
void GPU_Arc | ( | GPU_Target * | target, |
float | x, | ||
float | y, | ||
float | radius, | ||
float | start_angle, | ||
float | end_angle, | ||
SDL_Color | color | ||
) |
Renders a colored arc curve (circle segment).
target | The destination render target |
x | x-coord of center point |
y | y-coord of center point |
radius | The radius of the circle / distance from the center point that rendering will occur |
start_angle | The angle to start from, in degrees. Measured clockwise from the positive x-axis. |
end_angle | The angle to end at, in degrees. Measured clockwise from the positive x-axis. |
color | The color of the shape to render |
Definition at line 47 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_ArcFilled | ( | GPU_Target * | target, |
float | x, | ||
float | y, | ||
float | radius, | ||
float | start_angle, | ||
float | end_angle, | ||
SDL_Color | color | ||
) |
Renders a colored filled arc (circle segment / pie piece).
target | The destination render target |
x | x-coord of center point |
y | y-coord of center point |
radius | The radius of the circle / distance from the center point that rendering will occur |
start_angle | The angle to start from, in degrees. Measured clockwise from the positive x-axis. |
end_angle | The angle to end at, in degrees. Measured clockwise from the positive x-axis. |
color | The color of the shape to render |
Definition at line 57 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_AttachShader | ( | Uint32 | program_object, |
Uint32 | shader_object | ||
) |
Attaches a shader object to a shader program for future linking.
Definition at line 2267 of file SDL_gpu.c.
References GPU_Renderer::AttachShader, and GPU_Renderer::current_context_target.
void GPU_Blit | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y | ||
) |
Draws the given image to the given render target.
src_rect | The region of the source image to use. |
x | Destination x-position |
y | Destination y-position |
Definition at line 911 of file SDL_gpu.c.
References GPU_Renderer::Blit, Blit(), CHECK_CONTEXT, CHECK_FUNCTION_POINTER, CHECK_RENDERER, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, GPU_ERROR_USER_ERROR, and RETURN_ERROR.
void GPU_BlitBatch | ( | GPU_Image * | image, |
GPU_Target * | target, | ||
unsigned int | num_sprites, | ||
float * | values, | ||
GPU_BlitFlagEnum | flags | ||
) |
Performs 'num_sprites' blits of the given image to the given target. Note: GPU_BlitBatch() cannot interpret a mix of normal values and "passthrough" values due to format ambiguity.
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. |
flags | Bit flags to control the interpretation of the array parameters. The only passthrough option accepted is GPU_PASSTHROUGH_ALL. |
Definition at line 1017 of file SDL_gpu.c.
References GPU_Renderer::BlitBatch, BlitBatch(), CHECK_CONTEXT, CHECK_FUNCTION_POINTER, CHECK_RENDERER, g, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, GPU_ERROR_USER_ERROR, GPU_PASSTHROUGH_ALL, GPU_PASSTHROUGH_COLORS, GPU_PASSTHROUGH_TEXCOORDS, GPU_PASSTHROUGH_VERTICES, GPU_PushErrorCode(), GPU_USE_DEFAULT_COLORS, GPU_USE_DEFAULT_POSITIONS, GPU_USE_DEFAULT_SRC_RECTS, GPU_Image::h, RETURN_ERROR, GPU_Image::texture_h, GPU_Image::texture_w, and GPU_Image::w.
void GPU_BlitBatchSeparate | ( | GPU_Image * | image, |
GPU_Target * | target, | ||
unsigned int | num_sprites, | ||
float * | positions, | ||
float * | src_rects, | ||
float * | colors, | ||
GPU_BlitFlagEnum | flags | ||
) |
Performs 'num_sprites' blits of the given image to the given target.
positions | A tightly-packed array of (x,y) values |
src_rects | A tightly-packed array of (x,y,w,h) values in image coordinates |
colors | A tightly-packed array of (r,g,b,a) values with a range from 0-255 |
flags | Bit flags to control the interpretation of the array parameters |
Definition at line 1349 of file SDL_gpu.c.
References GPU_Renderer::BlitBatch, BlitBatch(), CHECK_CONTEXT, CHECK_FUNCTION_POINTER, CHECK_RENDERER, g, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, GPU_ERROR_USER_ERROR, GPU_PASSTHROUGH_ALL, GPU_PASSTHROUGH_COLORS, GPU_PASSTHROUGH_TEXCOORDS, GPU_PASSTHROUGH_VERTICES, GPU_Image::h, RETURN_ERROR, GPU_Image::texture_h, GPU_Image::texture_w, and GPU_Image::w.
void GPU_BlitRotate | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y, | ||
float | degrees | ||
) |
Rotates and draws the given image to the given render target.
src_rect | The region of the source image to use. |
x | Destination x-position |
y | Destination y-position |
degrees | Rotation angle (in degrees) |
Definition at line 929 of file SDL_gpu.c.
References GPU_Renderer::BlitRotate, BlitRotate(), CHECK_CONTEXT, CHECK_FUNCTION_POINTER, CHECK_RENDERER, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, GPU_ERROR_USER_ERROR, and RETURN_ERROR.
void GPU_BlitScale | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y, | ||
float | scaleX, | ||
float | scaleY | ||
) |
Scales and draws the given image to the given render target.
src_rect | The region of the source image to use. |
x | Destination x-position |
y | Destination y-position |
scaleX | Horizontal stretch factor |
scaleY | Vertical stretch factor |
Definition at line 946 of file SDL_gpu.c.
References GPU_Renderer::BlitScale, BlitScale(), CHECK_CONTEXT, CHECK_FUNCTION_POINTER, CHECK_RENDERER, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, GPU_ERROR_USER_ERROR, and RETURN_ERROR.
void GPU_BlitTransform | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y, | ||
float | degrees, | ||
float | scaleX, | ||
float | scaleY | ||
) |
Scales, rotates, and draws the given image to the given render target.
src_rect | The region of the source image to use. |
x | Destination x-position |
y | Destination y-position |
degrees | Rotation angle (in degrees) |
scaleX | Horizontal stretch factor |
scaleY | Vertical stretch factor |
Definition at line 963 of file SDL_gpu.c.
References GPU_Renderer::BlitTransform, BlitTransform(), CHECK_CONTEXT, CHECK_FUNCTION_POINTER, CHECK_RENDERER, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, GPU_ERROR_USER_ERROR, and RETURN_ERROR.
void GPU_BlitTransformMatrix | ( | GPU_Image * | image, |
GPU_Rect * | src_rect, | ||
GPU_Target * | target, | ||
float | x, | ||
float | y, | ||
float * | matrix3x3 | ||
) |
Transforms and draws the given image to the given render target.
src_rect | The region of the source image to use. |
x | Destination x-position |
y | Destination y-position |
matrix3x3 | 3x3 matrix in column-major order (index = row + column*numColumns) |
Definition at line 997 of file SDL_gpu.c.
References GPU_Renderer::BlitTransformMatrix, BlitTransformMatrix(), CHECK_CONTEXT, CHECK_FUNCTION_POINTER, CHECK_RENDERER, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, GPU_ERROR_USER_ERROR, and RETURN_ERROR.
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 | ||
) |
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).
src_rect | The region of the source image to use. |
x | Destination x-position |
y | Destination y-position |
pivot_x | Pivot x-position (in image coordinates) |
pivot_y | Pivot y-position (in image coordinates) |
degrees | Rotation angle (in degrees) |
scaleX | Horizontal stretch factor |
scaleY | Vertical stretch factor |
Definition at line 980 of file SDL_gpu.c.
References GPU_Renderer::BlitTransformX, BlitTransformX(), CHECK_CONTEXT, CHECK_FUNCTION_POINTER, CHECK_RENDERER, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, GPU_ERROR_USER_ERROR, and RETURN_ERROR.
void GPU_Circle | ( | GPU_Target * | target, |
float | x, | ||
float | y, | ||
float | radius, | ||
SDL_Color | color | ||
) |
Renders a colored circle outline.
target | The destination render target |
x | x-coord of center point |
y | y-coord of center point |
radius | The radius of the circle / distance from the center point that rendering will occur |
color | The color of the shape to render |
Definition at line 66 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_CircleFilled | ( | GPU_Target * | target, |
float | x, | ||
float | y, | ||
float | radius, | ||
SDL_Color | color | ||
) |
Renders a colored filled circle.
target | The destination render target |
x | x-coord of center point |
y | y-coord of center point |
radius | The radius of the circle / distance from the center point that rendering will occur |
color | The color of the shape to render |
Definition at line 75 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_Clear | ( | GPU_Target * | target | ) |
Clears the contents of the given render target. Fills the target with color {0, 0, 0, 0}.
Definition at line 2148 of file SDL_gpu.c.
References GPU_Renderer::Clear, and GPU_Renderer::current_context_target.
void GPU_ClearColor | ( | GPU_Target * | target, |
SDL_Color * | color | ||
) |
Fills the given render target with a color. If 'color' is NULL, {0, 0, 0, 0} is used.
Definition at line 2156 of file SDL_gpu.c.
References GPU_Renderer::ClearRGBA, GPU_Renderer::current_context_target, and GET_ALPHA.
void GPU_ClearRGBA | ( | GPU_Target * | target, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b, | ||
Uint8 | a | ||
) |
Fills the given render target with a color.
Definition at line 2167 of file SDL_gpu.c.
References GPU_Renderer::ClearRGBA, and GPU_Renderer::current_context_target.
Clean up the renderer state.
Definition at line 452 of file SDL_gpu.c.
References GPU_RemoveRenderer(), GPU_Renderer::id, and GPU_Renderer::Quit.
Referenced by GPU_InitRendererByID().
Uint32 GPU_CompileShader | ( | GPU_ShaderEnum | shader_type, |
const char * | shader_source | ||
) |
Compiles shader source and returns the new shader object.
Definition at line 2227 of file SDL_gpu.c.
References GPU_Renderer::CompileShader, and GPU_Renderer::current_context_target.
Uint32 GPU_CompileShader_RW | ( | GPU_ShaderEnum | shader_type, |
SDL_RWops * | shader_source | ||
) |
Loads shader source from an SDL_RWops, compiles it, and returns the new shader object.
Definition at line 2198 of file SDL_gpu.c.
References GPU_Renderer::CompileShader_RW, and GPU_Renderer::current_context_target.
Referenced by GPU_LoadShader().
Copy an image to a new image. Don't forget to GPU_FreeImage() both.
Definition at line 684 of file SDL_gpu.c.
References GPU_Renderer::CopyImage, and GPU_Renderer::current_context_target.
GPU_Image* GPU_CopyImageFromSurface | ( | SDL_Surface * | surface | ) |
Copy SDL_Surface data into a new GPU_Image. Don't forget to SDL_FreeSurface() the surface and GPU_FreeImage() the image.
Definition at line 841 of file SDL_gpu.c.
References GPU_Renderer::CopyImageFromSurface, and GPU_Renderer::current_context_target.
GPU_Image* GPU_CopyImageFromTarget | ( | GPU_Target * | target | ) |
Copy GPU_Target data into a new GPU_Image. Don't forget to GPU_FreeImage() the image.
Definition at line 849 of file SDL_gpu.c.
References GPU_Renderer::CopyImageFromTarget, and GPU_Renderer::current_context_target.
SDL_Surface* GPU_CopySurfaceFromImage | ( | GPU_Image * | image | ) |
Copy GPU_Image data into a new SDL_Surface. Don't forget to SDL_FreeSurface() the surface and GPU_FreeImage() the image.
Definition at line 865 of file SDL_gpu.c.
References GPU_Renderer::CopySurfaceFromImage, and GPU_Renderer::current_context_target.
SDL_Surface* GPU_CopySurfaceFromTarget | ( | GPU_Target * | target | ) |
Copy GPU_Target data into a new SDL_Surface. Don't forget to SDL_FreeSurface() the surface.
Definition at line 857 of file SDL_gpu.c.
References GPU_Renderer::CopySurfaceFromTarget, and GPU_Renderer::current_context_target.
Creates an image that aliases the given image. Aliases can be used to store image settings (e.g. modulation color) for easy switching. GPU_FreeImage() frees the alias's memory, but does not affect the original.
Definition at line 668 of file SDL_gpu.c.
References GPU_Renderer::CreateAliasImage, and GPU_Renderer::current_context_target.
GPU_Target* GPU_CreateAliasTarget | ( | GPU_Target * | target | ) |
Creates a target that aliases the given target. Aliases can be used to store target settings (e.g. viewports) for easy switching. GPU_FreeTarget() frees the alias's memory, but does not affect the original.
Definition at line 403 of file SDL_gpu.c.
References GPU_Renderer::CreateAliasTarget, and GPU_Renderer::current_context_target.
GPU_Image* GPU_CreateImage | ( | Uint16 | w, |
Uint16 | h, | ||
GPU_FormatEnum | format | ||
) |
Create a new, blank image with the given format. Don't forget to GPU_FreeImage() it.
w | Image width in pixels |
h | Image height in pixels |
format | Format of color channels. |
Definition at line 652 of file SDL_gpu.c.
References GPU_Renderer::CreateImage, and GPU_Renderer::current_context_target.
GPU_Target* GPU_CreateTargetFromWindow | ( | Uint32 | windowID | ) |
Creates a separate context for the given window using the current renderer and returns a GPU_Target that represents it.
Definition at line 395 of file SDL_gpu.c.
References GPU_Renderer::CreateTargetFromWindow, and GPU_Renderer::current_context_target.
Deactivates the current shader program (activates program 0).
Definition at line 2299 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::DeactivateShaderProgram.
void GPU_DetachShader | ( | Uint32 | program_object, |
Uint32 | shader_object | ||
) |
Detaches a shader object from a shader program.
Definition at line 2275 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::DetachShader.
void GPU_Flip | ( | GPU_Target * | target | ) |
Updates the given target's associated window.
Definition at line 2183 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::Flip.
Referenced by CVideo::flip().
Send all buffered blitting data to the current context target.
Definition at line 2175 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::FlushBlitBuffer.
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!
Definition at line 873 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::FreeImage.
Referenced by CopyImage().
void GPU_FreeShader | ( | Uint32 | shader_object | ) |
Deletes a shader object.
Definition at line 2251 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::FreeShader.
void GPU_FreeShaderProgram | ( | Uint32 | program_object | ) |
Deletes a shader program.
Definition at line 2259 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::FreeShaderProgram.
void GPU_FreeTarget | ( | GPU_Target * | target | ) |
Deletes a render target in the proper way for this renderer.
Definition at line 901 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::FreeTarget.
Loads mipmaps for the given image, if supported by the renderer.
Definition at line 1800 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::GenerateMipmaps.
Referenced by CopyImage().
void GPU_GetActiveRendererList | ( | GPU_RendererID * | renderers_array | ) |
Gets an array of identifiers for the active renderers.
Definition at line 53 of file SDL_gpu_Renderer.c.
References GPU_InitRendererRegister(), i, GPU_Renderer::id, and MAX_ACTIVE_RENDERERS.
int GPU_GetAttributeLocation | ( | Uint32 | program_object, |
const char * | attrib_name | ||
) |
Returns an integer representing the location of the specified attribute shader variable.
Definition at line 2315 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::GetAttributeLocation.
Uint8 GPU_GetBlending | ( | GPU_Image * | image | ) |
Gets the current alpha blending setting.
Definition at line 1922 of file SDL_gpu.c.
References GPU_Image::use_blending.
GPU_BlendMode GPU_GetBlendModeFromPreset | ( | GPU_BlendPresetEnum | preset | ) |
Translates a blend preset into a blend mode.
Definition at line 1948 of file SDL_gpu.c.
References GPU_BLEND_ADD, GPU_BLEND_MOD_ALPHA, GPU_BLEND_MULTIPLY, GPU_BLEND_NORMAL, GPU_BLEND_NORMAL_ADD_ALPHA, GPU_BLEND_NORMAL_KEEP_ALPHA, GPU_BLEND_PREMULTIPLIED_ALPHA, GPU_BLEND_SET, GPU_BLEND_SET_ALPHA, GPU_BLEND_SUBTRACT, GPU_EQ_ADD, GPU_EQ_SUBTRACT, GPU_ERROR_USER_ERROR, GPU_FUNC_DST_COLOR, GPU_FUNC_ONE, GPU_FUNC_ONE_MINUS_SRC_ALPHA, GPU_FUNC_SRC_ALPHA, GPU_FUNC_ZERO, and GPU_PushErrorCode().
Referenced by CreateTargetFromWindow(), CreateUninitializedImage(), GPU_SetBlendMode(), and GPU_SetShapeBlendMode().
GPU_Camera GPU_GetCamera | ( | GPU_Target * | target | ) |
Definition at line 637 of file SDL_gpu.c.
References GPU_Target::camera, and GPU_GetDefaultCamera().
|
inlinestatic |
Definition at line 809 of file SDL_gpu.h.
References SDL_GPU_VERSION_MAJOR, SDL_GPU_VERSION_MINOR, and SDL_GPU_VERSION_PATCH.
Referenced by GPU_GetLinkedVersion().
GPU_Target* GPU_GetContextTarget | ( | void | ) |
Definition at line 882 of file SDL_gpu.c.
References GPU_Renderer::current_context_target.
Referenced by applyTargetCamera(), changeViewport(), CVideo::getx(), CVideo::gety(), GPU_GetCurrentMatrix(), GPU_GetModelView(), GPU_GetProjection(), GPU_MatrixMode(), GPU_PopMatrix(), and GPU_PushMatrix().
GPU_Renderer* GPU_GetCurrentRenderer | ( | void | ) |
Uint32 GPU_GetCurrentShaderProgram | ( | void | ) |
Definition at line 69 of file SDL_gpu.c.
References GPU_Target::context, GPU_Renderer::current_context_target, and GPU_Context::current_shader_program.
GPU_DebugLevelEnum GPU_GetDebugLevel | ( | void | ) |
Returns the current global debug level.
Definition at line 498 of file SDL_gpu.c.
References debug_level.
Referenced by GPU_LogInfo(), GPU_LogWarning(), GPU_PushErrorCode(), and GPU_Quit().
GPU_Camera GPU_GetDefaultCamera | ( | void | ) |
Definition at line 631 of file SDL_gpu.c.
Referenced by CreateTargetFromWindow(), GPU_GetCamera(), GPU_SetCamera(), LoadTarget(), and SetCamera().
void GPU_GetDefaultRendererOrder | ( | int * | order_size, |
GPU_RendererID * | order | ||
) |
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.
Definition at line 267 of file SDL_gpu_Renderer.c.
References GPU_MakeRendererID(), GPU_RENDERER_GLES_1, GPU_RENDERER_GLES_2, GPU_RENDERER_OPENGL_1, GPU_RENDERER_OPENGL_2, GPU_RENDERER_OPENGL_3, and GPU_RENDERER_ORDER_MAX.
Referenced by GPU_InitRendererRegister(), and GPU_SetRendererOrder().
const char* GPU_GetErrorString | ( | GPU_ErrorEnum | error | ) |
Gets the string representation of an error code.
Definition at line 556 of file SDL_gpu.c.
References GPU_ERROR_BACKEND_ERROR, GPU_ERROR_DATA_ERROR, GPU_ERROR_FILE_NOT_FOUND, GPU_ERROR_NONE, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, and GPU_ERROR_USER_ERROR.
Referenced by GPU_PushErrorCode().
Uint32 GPU_GetInitWindow | ( | void | ) |
Returns the window ID that has been set via GPU_SetInitWindow().
Definition at line 150 of file SDL_gpu.c.
References init_windowID.
Referenced by Init().
float GPU_GetLineThickness | ( | void | ) |
Returns the current line thickness value.
Definition at line 19 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
SDL_version GPU_GetLinkedVersion | ( | void | ) |
Definition at line 51 of file SDL_gpu.c.
References GPU_GetCompiledVersion().
Gets the number of active (created) renderers.
Definition at line 37 of file SDL_gpu_Renderer.c.
References GPU_InitRendererRegister(), i, and MAX_ACTIVE_RENDERERS.
Referenced by GPU_Quit(), and init_SDL().
Gets the number of registered (available) renderers.
Definition at line 72 of file SDL_gpu_Renderer.c.
References GPU_InitRendererRegister(), GPU_RENDERER_UNKNOWN, i, and MAX_REGISTERED_RENDERERS.
SDL_Color GPU_GetPixel | ( | GPU_Target * | target, |
Sint16 | x, | ||
Sint16 | y | ||
) |
Definition at line 2131 of file SDL_gpu.c.
References c, GPU_Renderer::current_context_target, and GPU_Renderer::GetPixel.
GPU_InitFlagEnum GPU_GetPreInitFlags | ( | void | ) |
Returns the current special flags to use for initialization.
Definition at line 162 of file SDL_gpu.c.
References preinit_flags.
Referenced by Init().
void GPU_GetRegisteredRendererList | ( | GPU_RendererID * | renderers_array | ) |
Gets an array of identifiers for the registered (available) renderers.
Definition at line 88 of file SDL_gpu_Renderer.c.
References GPU_InitRendererRegister(), GPU_RENDERER_UNKNOWN, i, RendererRegistration::id, and MAX_REGISTERED_RENDERERS.
GPU_Renderer* GPU_GetRenderer | ( | unsigned int | index | ) |
Gets the renderer for the given renderer index.
Definition at line 344 of file SDL_gpu_Renderer.c.
References MAX_ACTIVE_RENDERERS.
Referenced by GPU_GetRendererByID().
GPU_Renderer* GPU_GetRendererByID | ( | GPU_RendererID | id | ) |
Definition at line 353 of file SDL_gpu_Renderer.c.
References GPU_GetRenderer(), and GPU_InitRendererRegister().
Referenced by GPU_SetCurrentRenderer().
const char* GPU_GetRendererEnumString | ( | GPU_RendererEnum | id | ) |
Translates a GPU_RendererEnum into a string.
Definition at line 288 of file SDL_gpu_Renderer.c.
References GPU_RENDERER_D3D10, GPU_RENDERER_D3D11, GPU_RENDERER_D3D9, GPU_RENDERER_GLES_1, GPU_RENDERER_GLES_2, GPU_RENDERER_GLES_3, GPU_RENDERER_OPENGL_1, GPU_RENDERER_OPENGL_1_BASE, GPU_RENDERER_OPENGL_2, GPU_RENDERER_OPENGL_3, and GPU_RENDERER_OPENGL_4.
GPU_RendererID GPU_GetRendererID | ( | unsigned int | index | ) |
Gets the renderer identifier for the given registration index.
Definition at line 107 of file SDL_gpu_Renderer.c.
References GPU_RENDERER_UNKNOWN, RendererRegistration::id, makeRendererID(), and MAX_REGISTERED_RENDERERS.
void GPU_GetRendererOrder | ( | int * | order_size, |
GPU_RendererID * | order | ||
) |
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.
Definition at line 231 of file SDL_gpu_Renderer.c.
References renderer_order_size.
Referenced by GPU_Init().
const char* GPU_GetShaderMessage | ( | void | ) |
Returns the last shader log message.
Definition at line 2307 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::GetShaderMessage.
GPU_SnapEnum GPU_GetSnapMode | ( | GPU_Image * | image | ) |
Gets the current pixel snap setting. The default value is GPU_SNAP_POSITION_AND_DIMENSIONS.
Definition at line 2104 of file SDL_gpu.c.
References GPU_Image::snap_mode.
Fills "values" with the value of the uniform shader variable at the given location.
Definition at line 2427 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::GetUniformfv.
Fills "values" with the value of the uniform shader variable at the given location.
Definition at line 2377 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::GetUniformiv.
int GPU_GetUniformLocation | ( | Uint32 | program_object, |
const char * | uniform_name | ||
) |
Returns an integer representing the location of the specified uniform shader variable.
Definition at line 2338 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::GetUniformLocation.
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.
Definition at line 2452 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::GetUniformfv.
Fills "values" with the value of the uniform shader variable at the given location.
Definition at line 2402 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::GetUniformuiv.
void GPU_GetVirtualCoords | ( | GPU_Target * | target, |
float * | x, | ||
float * | y, | ||
float | displayX, | ||
float | displayY | ||
) |
Converts screen space coordinates (such as from mouse input) to logical drawing coordinates.
Definition at line 579 of file SDL_gpu.c.
References GPU_Target::context, GPU_Image::h, GPU_Target::h, GPU_Target::image, GPU_Image::w, GPU_Target::w, GPU_Context::window_h, and GPU_Context::window_w.
GPU_Target* GPU_GetWindowTarget | ( | Uint32 | windowID | ) |
Definition at line 305 of file SDL_gpu.c.
References i, init_window_mappings(), num_window_mappings, and GPU_WindowMapping::target.
GPU_Target* GPU_Init | ( | Uint16 | w, |
Uint16 | h, | ||
GPU_WindowFlagEnum | SDL_flags | ||
) |
Initializes SDL and SDL_gpu. Creates a window and goes through the renderer order to create a renderer context.
Definition at line 325 of file SDL_gpu.c.
References GPU_GetRendererOrder(), GPU_InitRendererByID(), GPU_InitRendererRegister(), GPU_RENDERER_ORDER_MAX, i, init_error_stack(), init_SDL(), renderer_order, renderer_order_size, and resources::screen.
Referenced by CVideo::initSDL().
GPU_Target* GPU_InitRenderer | ( | GPU_RendererEnum | renderer_enum, |
Uint16 | w, | ||
Uint16 | h, | ||
GPU_WindowFlagEnum | SDL_flags | ||
) |
Initializes SDL and SDL_gpu. Creates a window and the requested renderer context.
Definition at line 352 of file SDL_gpu.c.
References GPU_InitRendererByID(), and GPU_MakeRendererID().
GPU_Target* GPU_InitRendererByID | ( | GPU_RendererID | renderer_request, |
Uint16 | w, | ||
Uint16 | h, | ||
GPU_WindowFlagEnum | SDL_flags | ||
) |
Initializes SDL and SDL_gpu. Creates a window and the requested renderer context. By requesting a renderer via ID, you can specify the major and minor versions of an individual renderer backend.
Definition at line 357 of file SDL_gpu.c.
References GPU_AddRenderer(), GPU_CloseCurrentRenderer(), GPU_InitRendererRegister(), GPU_SetCurrentRenderer(), GPU_SetInitWindow(), GPU_Renderer::id, GPU_Renderer::Init, init_error_stack(), init_SDL(), num_window_mappings, and resources::screen.
Referenced by GPU_Init(), and GPU_InitRenderer().
Uint8 GPU_IsDefaultShaderProgram | ( | Uint32 | program_object | ) |
Returns 1 if the given shader program is a default shader for the current context, 0 otherwise.
Definition at line 2283 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::IsDefaultShaderProgram.
Uint8 GPU_IsFeatureEnabled | ( | GPU_FeatureEnum | feature | ) |
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.
Definition at line 387 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::IsFeatureEnabled.
void GPU_Line | ( | GPU_Target * | target, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2, | ||
SDL_Color | color | ||
) |
Renders a colored line.
target | The destination render target |
x1 | x-coord of starting point |
y1 | y-coord of starting point |
x2 | x-coord of ending point |
y2 | y-coord of ending point |
color | The color of the shape to render |
Definition at line 37 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
Uint32 GPU_LinkShaderProgram | ( | Uint32 | program_object | ) |
Links a shader program with any attached shader objects.
Definition at line 2235 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::LinkShaderProgram.
Uint32 GPU_LinkShaders | ( | Uint32 | shader_object1, |
Uint32 | shader_object2 | ||
) |
Creates and links a shader program with the given shader objects.
Definition at line 2243 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::LinkShaders.
GPU_Image* GPU_LoadImage | ( | const char * | filename | ) |
Load image from an image file that is supported by this renderer. Don't forget to GPU_FreeImage() it.
Definition at line 660 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::LoadImage.
Uint32 GPU_LoadShader | ( | GPU_ShaderEnum | shader_type, |
const char * | filename | ||
) |
Loads shader source from a file, compiles it, and returns the new shader object.
Definition at line 2206 of file SDL_gpu.c.
References GPU_CompileShader_RW(), GPU_ERROR_FILE_NOT_FOUND, GPU_ERROR_NULL_ARGUMENT, and GPU_PushErrorCode().
GPU_ShaderBlock GPU_LoadShaderBlock | ( | Uint32 | program_object, |
const char * | position_name, | ||
const char * | texcoord_name, | ||
const char * | color_name, | ||
const char * | modelViewMatrix_name | ||
) |
Loads the given shader program's built-in attribute and uniform locations.
Definition at line 2346 of file SDL_gpu.c.
References GPU_ShaderBlock::color_loc, GPU_Renderer::current_context_target, GPU_Renderer::LoadShaderBlock, GPU_ShaderBlock::modelViewProjection_loc, GPU_ShaderBlock::position_loc, and GPU_ShaderBlock::texcoord_loc.
Referenced by CreateTargetFromWindow().
SDL_Surface* GPU_LoadSurface | ( | const char * | filename | ) |
Load surface from an image file that is supported by this renderer. Don't forget to SDL_FreeSurface() it.
Definition at line 716 of file SDL_gpu.c.
References GPU_ERROR_DATA_ERROR, GPU_ERROR_NULL_ARGUMENT, GPU_PushErrorCode(), stbi_failure_reason(), stbi_image_free(), stbi_load(), and stbi_load_from_memory().
Referenced by LoadImage().
GPU_Target* GPU_LoadTarget | ( | GPU_Image * | image | ) |
Creates a new render target from the given image. It can then be accessed from image->target.
Definition at line 891 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::LoadTarget.
Referenced by CopyImage().
void GPU_LogError | ( | const char * | format, |
... | |||
) |
Prints an error log message.
Definition at line 103 of file SDL_gpu.c.
Referenced by GPU_PushErrorCode(), and GPU_Quit().
void GPU_LogInfo | ( | const char * | format, |
... | |||
) |
Prints an informational log message.
Definition at line 79 of file SDL_gpu.c.
References GPU_DEBUG_LEVEL_3, and GPU_GetDebugLevel().
void GPU_LogWarning | ( | const char * | format, |
... | |||
) |
Prints a warning log message.
Definition at line 91 of file SDL_gpu.c.
References GPU_DEBUG_LEVEL_2, and GPU_GetDebugLevel().
GPU_Attribute GPU_MakeAttribute | ( | int | location, |
void * | values, | ||
GPU_AttributeFormat | format | ||
) |
Returns a filled GPU_Attribute object.
Definition at line 2329 of file SDL_gpu.c.
References GPU_Attribute::format, GPU_Attribute::location, and GPU_Attribute::values.
GPU_AttributeFormat GPU_MakeAttributeFormat | ( | int | num_elems_per_vertex, |
GPU_TypeEnum | type, | ||
Uint8 | normalize, | ||
int | stride_bytes, | ||
int | offset_bytes | ||
) |
Returns a filled GPU_AttributeFormat object.
SDL_Color GPU_MakeColor | ( | Uint8 | r, |
Uint8 | g, | ||
Uint8 | b, | ||
Uint8 | a | ||
) |
void GPU_MakeCurrent | ( | GPU_Target * | target, |
Uint32 | windowID | ||
) |
Makes the given window the current rendering destination for the given context target. This also makes the target the current context for image loading and window operations. If the target does not represent a window, this does nothing.
Definition at line 411 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::MakeCurrent.
GPU_Rect GPU_MakeRect | ( | float | x, |
float | y, | ||
float | w, | ||
float | h | ||
) |
Definition at line 607 of file SDL_gpu.c.
Referenced by CreateTargetFromWindow(), LoadTarget(), and SetWindowResolution().
GPU_RendererID GPU_MakeRendererID | ( | GPU_RendererEnum | id, |
int | major_version, | ||
int | minor_version | ||
) |
Returns an initialized GPU_RendererID.
Definition at line 619 of file SDL_gpu.c.
Referenced by GPU_GetDefaultRendererOrder(), and GPU_InitRenderer().
void GPU_Pixel | ( | GPU_Target * | target, |
float | x, | ||
float | y, | ||
SDL_Color | color | ||
) |
Renders a colored point.
target | The destination render target |
x | x-coord of the point |
y | y-coord of the point |
color | The color of the shape to render |
Definition at line 28 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_Polygon | ( | GPU_Target * | target, |
unsigned int | num_vertices, | ||
float * | vertices, | ||
SDL_Color | color | ||
) |
Renders a colored polygon outline. The vertices are expected to define a convex polygon.
target | The destination render target |
num_vertices | Number of vertices (x and y pairs) |
vertices | An array of vertex positions stored as interlaced x and y coords, e.g. {x1, y1, x2, y2, ...} |
color | The color of the shape to render |
Definition at line 156 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_PolygonFilled | ( | GPU_Target * | target, |
unsigned int | num_vertices, | ||
float * | vertices, | ||
SDL_Color | color | ||
) |
Renders a colored filled polygon. The vertices are expected to define a convex polygon.
target | The destination render target |
num_vertices | Number of vertices (x and y pairs) |
vertices | An array of vertex positions stored as interlaced x and y coords, e.g. {x1, y1, x2, y2, ...} |
color | The color of the shape to render |
Definition at line 165 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
GPU_ErrorObject GPU_PopErrorCode | ( | void | ) |
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.
Definition at line 545 of file SDL_gpu.c.
References e, GPU_ERROR_NONE, and num_error_codes.
void GPU_PushErrorCode | ( | const char * | function, |
GPU_ErrorEnum | error, | ||
const char * | details, | ||
... | |||
) |
Pushes a new error code onto the error stack. If the stack is full, this function does nothing.
function | The name of the function that pushed the error |
error | The error code to push on the error stack |
details | Additional information string, can be NULL. |
Definition at line 503 of file SDL_gpu.c.
References GPU_ErrorObject::details, error(), GPU_ErrorObject::error, GPU_ErrorObject::function, GPU_DEBUG_LEVEL_1, GPU_ERROR_DETAILS_STRING_MAX, GPU_ERROR_FUNCTION_STRING_MAX, GPU_GetDebugLevel(), GPU_GetErrorString(), GPU_LogError(), GPU_MAX_NUM_ERRORS, and num_error_codes.
Referenced by Blit(), BlitBatch(), BlitRotate(), BlitScale(), BlitTransform(), BlitTransformMatrix(), BlitTransformX(), changeBlendMode(), compareFormats(), compile_shader_source(), CompileShader_RW(), CopyImage(), CopyImageFromSurface(), CopySurfaceFromImage(), CopySurfaceFromTarget(), CreateImage(), CreateTargetFromWindow(), CreateUninitializedImage(), GPU_AddRenderer(), GPU_AddWindowMapping(), GPU_BlitBatch(), GPU_CreateRenderer(), GPU_GetBlendModeFromPreset(), GPU_LoadShader(), GPU_LoadSurface(), GPU_PopMatrix(), GPU_PushMatrix(), GPU_SaveSurface(), GPU_SetRendererOrder(), Init(), init_SDL(), LinkShaderProgram(), LoadImage(), SaveImage(), SetCamera(), SetImageFilter(), SetUniformMatrixfv(), SetWrapMode(), TriangleBatch(), UpdateImageBytes(), and UpdateSubImage().
Clean up the renderer state and shut down SDL_gpu.
Definition at line 463 of file SDL_gpu.c.
References GPU_ErrorObject::details, GPU_ErrorObject::function, GPU_DEBUG_LEVEL_1, GPU_GetDebugLevel(), GPU_GetNumActiveRenderers(), GPU_LogError(), GPU_MAX_NUM_ERRORS, GPU_RemoveRenderer(), i, GPU_Renderer::id, inited_error_code_stack, num_error_codes, and GPU_Renderer::Quit.
void GPU_Rectangle | ( | GPU_Target * | target, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2, | ||
SDL_Color | color | ||
) |
Renders a colored rectangle outline.
target | The destination render target |
x1 | x-coord of top-left corner |
y1 | y-coord of top-left corner |
x2 | x-coord of bottom-right corner |
y2 | y-coord of bottom-right corner |
color | The color of the shape to render |
Definition at line 120 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_RectangleFilled | ( | GPU_Target * | target, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2, | ||
SDL_Color | color | ||
) |
Renders a colored filled rectangle.
target | The destination render target |
x1 | x-coord of top-left corner |
y1 | y-coord of top-left corner |
x2 | x-coord of bottom-right corner |
y2 | y-coord of bottom-right corner |
color | The color of the shape to render |
Definition at line 129 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_RectangleRound | ( | GPU_Target * | target, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2, | ||
float | radius, | ||
SDL_Color | color | ||
) |
Renders a colored rounded (filleted) rectangle outline.
target | The destination render target |
x1 | x-coord of top-left corner |
y1 | y-coord of top-left corner |
x2 | x-coord of bottom-right corner |
y2 | y-coord of bottom-right corner |
radius | The radius of the corners |
color | The color of the shape to render |
Definition at line 138 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_RectangleRoundFilled | ( | GPU_Target * | target, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2, | ||
float | radius, | ||
SDL_Color | color | ||
) |
Renders a colored filled rounded (filleted) rectangle.
target | The destination render target |
x1 | x-coord of top-left corner |
y1 | y-coord of top-left corner |
x2 | x-coord of bottom-right corner |
y2 | y-coord of bottom-right corner |
radius | The radius of the corners |
color | The color of the shape to render |
Definition at line 147 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_RemoveRenderer | ( | GPU_RendererID | id | ) |
Deletes the renderer matching the given identifier.
Definition at line 407 of file SDL_gpu_Renderer.c.
References GPU_FreeRenderer(), i, and MAX_ACTIVE_RENDERERS.
Referenced by GPU_CloseCurrentRenderer(), and GPU_Quit().
Uint8 GPU_SaveImage | ( | GPU_Image * | image, |
const char * | filename | ||
) |
Save image to a file. The file type is deduced from the extension. Supported formats are: png, bmp, tga. Returns 0 on failure.
Definition at line 676 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SaveImage.
Uint8 GPU_SaveSurface | ( | SDL_Surface * | surface, |
const char * | filename | ||
) |
Save surface to a file. The file type is deduced from the extension. Supported formats are: png, bmp, tga. Returns 0 on failure.
Definition at line 810 of file SDL_gpu.c.
References get_filename_ext(), GPU_ERROR_DATA_ERROR, GPU_PushErrorCode(), stbi_write_bmp(), stbi_write_png(), and stbi_write_tga().
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 | ||
) |
Renders a colored annular sector outline (ring segment).
target | The destination render target |
x | x-coord of center point |
y | y-coord of center point |
inner_radius | The inner radius of the ring |
outer_radius | The outer radius of the ring |
start_angle | The angle to start from, in degrees. Measured clockwise from the positive x-axis. |
end_angle | The angle to end at, in degrees. Measured clockwise from the positive x-axis. |
color | The color of the shape to render |
Definition at line 84 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
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 | ||
) |
Renders a colored filled annular sector (ring segment).
target | The destination render target |
x | x-coord of center point |
y | y-coord of center point |
inner_radius | The inner radius of the ring |
outer_radius | The outer radius of the ring |
start_angle | The angle to start from, in degrees. Measured clockwise from the positive x-axis. |
end_angle | The angle to end at, in degrees. Measured clockwise from the positive x-axis. |
color | The color of the shape to render |
Definition at line 93 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
Sets a constant-value shader attribute that will be used for each rendered vertex.
Definition at line 2469 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetAttributef.
Sets a constant-value shader attribute that will be used for each rendered vertex.
Definition at line 2493 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetAttributefv.
Sets a constant-value shader attribute that will be used for each rendered vertex.
Definition at line 2477 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetAttributei.
Sets a constant-value shader attribute that will be used for each rendered vertex.
Definition at line 2501 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetAttributeiv.
void GPU_SetAttributeSource | ( | int | num_values, |
GPU_Attribute | source | ||
) |
Enables a shader attribute and sets its source data.
Definition at line 2517 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetAttributeSource.
Sets a constant-value shader attribute that will be used for each rendered vertex.
Definition at line 2485 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetAttributeui.
Sets a constant-value shader attribute that will be used for each rendered vertex.
Definition at line 2509 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetAttributeuiv.
void GPU_SetBlendEquation | ( | GPU_Image * | image, |
GPU_BlendEqEnum | color_equation, | ||
GPU_BlendEqEnum | alpha_equation | ||
) |
Sets the blending component equations.
Definition at line 2037 of file SDL_gpu.c.
References GPU_BlendMode::alpha_equation, GPU_Image::blend_mode, and GPU_BlendMode::color_equation.
Referenced by GPU_SetBlendMode().
void GPU_SetBlendFunction | ( | GPU_Image * | image, |
GPU_BlendFuncEnum | source_color, | ||
GPU_BlendFuncEnum | dest_color, | ||
GPU_BlendFuncEnum | source_alpha, | ||
GPU_BlendFuncEnum | dest_alpha | ||
) |
Sets the blending component functions.
Definition at line 2026 of file SDL_gpu.c.
References GPU_Image::blend_mode, GPU_BlendMode::dest_alpha, GPU_BlendMode::dest_color, GPU_BlendMode::source_alpha, and GPU_BlendMode::source_color.
Referenced by GPU_SetBlendMode().
Enables/disables alpha blending for the given image.
Definition at line 1931 of file SDL_gpu.c.
References GPU_Image::use_blending.
Referenced by CopyImage().
void GPU_SetBlendMode | ( | GPU_Image * | image, |
GPU_BlendPresetEnum | mode | ||
) |
Sets the blending mode, if supported by the renderer.
Definition at line 2046 of file SDL_gpu.c.
References GPU_BlendMode::alpha_equation, GPU_BlendMode::color_equation, GPU_BlendMode::dest_alpha, GPU_BlendMode::dest_color, GPU_GetBlendModeFromPreset(), GPU_SetBlendEquation(), GPU_SetBlendFunction(), GPU_BlendMode::source_alpha, and GPU_BlendMode::source_color.
GPU_Camera GPU_SetCamera | ( | GPU_Target * | target, |
GPU_Camera * | cam | ||
) |
Sets the current render target's current camera.
target | A pointer to the target that will copy this camera. |
cam | A pointer to the camera data to use or NULL to use the default camera. |
Definition at line 644 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, GPU_GetDefaultCamera(), and GPU_Renderer::SetCamera.
GPU_Rect GPU_SetClip | ( | GPU_Target * | target, |
Sint16 | x, | ||
Sint16 | y, | ||
Uint16 | w, | ||
Uint16 | h | ||
) |
Sets the clipping rect for the given render target.
Definition at line 1822 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetClip.
Referenced by dialogs::unit_preview_pane::draw_contents(), gui::menu::imgsel_style::draw_row(), and display::drawing_buffer_commit().
GPU_Rect GPU_SetClipRect | ( | GPU_Target * | target, |
GPU_Rect | rect | ||
) |
Sets the clipping rect for the given render target.
Definition at line 1811 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, GPU_Rect::h, GPU_Renderer::SetClip, GPU_Rect::w, GPU_Rect::x, and GPU_Rect::y.
Sets the modulation color for subsequent drawing of the given image.
Definition at line 1844 of file SDL_gpu.c.
References c, and GPU_Image::color.
Referenced by CopyImage().
void GPU_SetCurrentRenderer | ( | GPU_RendererID | id | ) |
Switches the current renderer to the renderer matching the given identifier.
Definition at line 56 of file SDL_gpu.c.
References GPU_GetRendererByID(), and GPU_Renderer::SetAsCurrent.
Referenced by GPU_InitRendererByID().
void GPU_SetDebugLevel | ( | GPU_DebugLevelEnum | level | ) |
Sets the global debug level. GPU_DEBUG_LEVEL_0: Normal GPU_DEBUG_LEVEL_1: Prints messages when errors are pushed via GPU_PushErrorCode() GPU_DEBUG_LEVEL_2: Elevates warning logs to error priority GPU_DEBUG_LEVEL_3: Elevates info logs to error priority
Definition at line 491 of file SDL_gpu.c.
References debug_level, and GPU_DEBUG_LEVEL_MAX.
void GPU_SetImageFilter | ( | GPU_Image * | image, |
GPU_FilterEnum | filter | ||
) |
Sets the image filtering mode, if supported by the renderer.
Definition at line 2094 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetImageFilter.
Referenced by CopyImage().
void GPU_SetInitWindow | ( | Uint32 | windowID | ) |
The window corresponding to 'windowID' will be used to create the rendering context instead of creating a new window.
Definition at line 145 of file SDL_gpu.c.
References init_windowID.
Referenced by GPU_InitRendererByID(), and Init().
float GPU_SetLineThickness | ( | float | thickness | ) |
Sets the thickness of lines for the current context.
thickness | New line thickness in pixels measured across the line. Default is 1.0f. |
Definition at line 10 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_SetPreInitFlags | ( | GPU_InitFlagEnum | GPU_flags | ) |
Set special flags to use for initialization. Set these before calling GPU_Init().
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. |
Definition at line 157 of file SDL_gpu.c.
References preinit_flags.
void GPU_SetRendererOrder | ( | int | order_size, |
GPU_RendererID * | order | ||
) |
Sets the renderer ID order to use for initialization. If 'order' is NULL, it will restore the default order.
Definition at line 240 of file SDL_gpu_Renderer.c.
References GPU_ERROR_USER_ERROR, GPU_GetDefaultRendererOrder(), GPU_PushErrorCode(), GPU_RENDERER_ORDER_MAX, and renderer_order_size.
Sets the modulation color for subsequent drawing of the given image.
Definition at line 1858 of file SDL_gpu.c.
References c, GPU_Image::color, and g.
Sets the modulation color for subsequent drawing of the given image.
Definition at line 1868 of file SDL_gpu.c.
References c, GPU_Image::color, and g.
void GPU_SetShaderBlock | ( | GPU_ShaderBlock | block | ) |
Sets the current shader block to use the given attribute and uniform locations.
Definition at line 2361 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetShaderBlock.
Referenced by CreateTargetFromWindow().
Sets the given image unit to the given image so that a custom shader can sample multiple textures.
image | The source image/texture. Pass NULL to disable the image unit. |
location | The uniform location of a texture sampler |
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. |
Definition at line 2369 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetShaderImage.
void GPU_SetShapeBlendEquation | ( | GPU_BlendEqEnum | color_equation, |
GPU_BlendEqEnum | alpha_equation | ||
) |
Sets the blending component equations for shape rendering.
Definition at line 2071 of file SDL_gpu.c.
References GPU_BlendMode::alpha_equation, GPU_BlendMode::color_equation, GPU_Target::context, GPU_Renderer::current_context_target, and GPU_Context::shapes_blend_mode.
Referenced by GPU_SetShapeBlendMode().
void GPU_SetShapeBlendFunction | ( | GPU_BlendFuncEnum | source_color, |
GPU_BlendFuncEnum | dest_color, | ||
GPU_BlendFuncEnum | source_alpha, | ||
GPU_BlendFuncEnum | dest_alpha | ||
) |
Sets the blending component functions for shape rendering.
Definition at line 2057 of file SDL_gpu.c.
References GPU_Target::context, GPU_Renderer::current_context_target, GPU_BlendMode::dest_alpha, GPU_BlendMode::dest_color, GPU_Context::shapes_blend_mode, GPU_BlendMode::source_alpha, and GPU_BlendMode::source_color.
Referenced by GPU_SetShapeBlendMode().
void GPU_SetShapeBlending | ( | Uint8 | enable | ) |
Enables/disables alpha blending for shape rendering on the current window.
Definition at line 1939 of file SDL_gpu.c.
References GPU_Target::context, GPU_Renderer::current_context_target, and GPU_Context::shapes_use_blending.
void GPU_SetShapeBlendMode | ( | GPU_BlendPresetEnum | mode | ) |
Sets the blending mode for shape rendering on the current window, if supported by the renderer.
Definition at line 2083 of file SDL_gpu.c.
References GPU_BlendMode::alpha_equation, GPU_BlendMode::color_equation, GPU_Renderer::current_context_target, GPU_BlendMode::dest_alpha, GPU_BlendMode::dest_color, GPU_GetBlendModeFromPreset(), GPU_SetShapeBlendEquation(), GPU_SetShapeBlendFunction(), GPU_BlendMode::source_alpha, and GPU_BlendMode::source_color.
void GPU_SetSnapMode | ( | GPU_Image * | image, |
GPU_SnapEnum | mode | ||
) |
Sets the pixel grid snapping mode for the given image.
Definition at line 2112 of file SDL_gpu.c.
References GPU_Image::snap_mode.
Referenced by CopyImage().
void GPU_SetTargetColor | ( | GPU_Target * | target, |
SDL_Color * | color | ||
) |
Sets the modulation color for subsequent drawing of images and shapes on the given target. This has a cumulative effect with the image coloring functions. e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128); Would make the image draw with color of roughly (128, 64, 0).
Definition at line 1878 of file SDL_gpu.c.
References GPU_Target::color, and GPU_Target::use_color.
void GPU_SetTargetRGB | ( | GPU_Target * | target, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b | ||
) |
Sets the modulation color for subsequent drawing of images and shapes on the given target. This has a cumulative effect with the image coloring functions. e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128); Would make the image draw with color of roughly (128, 64, 0).
Definition at line 1892 of file SDL_gpu.c.
References c, GPU_Target::color, g, and GPU_Target::use_color.
void GPU_SetTargetRGBA | ( | GPU_Target * | target, |
Uint8 | r, | ||
Uint8 | g, | ||
Uint8 | b, | ||
Uint8 | a | ||
) |
Sets the modulation color for subsequent drawing of images and shapes on the given target. This has a cumulative effect with the image coloring functions. e.g. GPU_SetRGB(image, 255, 128, 0); GPU_SetTargetRGB(target, 128, 128, 128); Would make the image draw with color of roughly (128, 64, 0).
Definition at line 1907 of file SDL_gpu.c.
References c, GPU_Target::color, g, and GPU_Target::use_color.
Sets the value of the floating point uniform shader variable at the given location. This is equivalent to calling GPU_SetUniformfv(location, 1, 1, &value).
Definition at line 2435 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetUniformf.
Sets the value of the floating point uniform shader variable at the given location.
Definition at line 2443 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetUniformfv.
Sets the value of the integer uniform shader variable at the given location. This is equivalent to calling GPU_SetUniformiv(location, 1, 1, &value).
Definition at line 2385 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetUniformi.
Sets the value of the integer uniform shader variable at the given location.
Definition at line 2393 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetUniformiv.
void GPU_SetUniformMatrixfv | ( | int | location, |
int | num_matrices, | ||
int | num_rows, | ||
int | num_columns, | ||
Uint8 | transpose, | ||
float * | values | ||
) |
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.
Definition at line 2460 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetUniformMatrixfv.
Sets the value of the unsigned integer uniform shader variable at the given location. This is equivalent to calling GPU_SetUniformuiv(location, 1, 1, &value).
Definition at line 2410 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetUniformui.
void GPU_SetUniformuiv | ( | int | location, |
int | num_elements_per_value, | ||
int | num_values, | ||
unsigned int * | values | ||
) |
Sets the value of the unsigned integer uniform shader variable at the given location.
Definition at line 2418 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetUniformuiv.
void GPU_SetViewport | ( | GPU_Target * | target, |
GPU_Rect | viewport | ||
) |
Sets the given target's viewport.
Definition at line 625 of file SDL_gpu.c.
References GPU_Target::viewport.
void GPU_SetVirtualResolution | ( | GPU_Target * | target, |
Uint16 | w, | ||
Uint16 | h | ||
) |
Change the logical size of the given target. Rendering to this target will be scaled as if the dimensions were actually the ones given.
Definition at line 436 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetVirtualResolution.
Uint8 GPU_SetWindowResolution | ( | Uint16 | w, |
Uint16 | h | ||
) |
Change the actual size of the current context target's window. This resets the virtual resolution and viewport of the context target. Aside from direct resolution changes, this should also be called in response to SDL_WINDOWEVENT_RESIZED window events for resizable windows.
Definition at line 427 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetWindowResolution.
void GPU_SetWrapMode | ( | GPU_Image * | image, |
GPU_WrapEnum | wrap_mode_x, | ||
GPU_WrapEnum | wrap_mode_y | ||
) |
Sets the image wrapping mode, if supported by the renderer.
Definition at line 2120 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::SetWrapMode.
Referenced by CopyImage().
Uint8 GPU_ToggleFullscreen | ( | Uint8 | use_desktop_resolution | ) |
Enable/disable fullscreen mode for the current context target's window. 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.
use_desktop_resolution | If true, lets the window change its resolution when it enters fullscreen mode (via SDL_WINDOW_FULLSCREEN_DESKTOP). |
Definition at line 419 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::ToggleFullscreen.
void GPU_Tri | ( | GPU_Target * | target, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2, | ||
float | x3, | ||
float | y3, | ||
SDL_Color | color | ||
) |
Renders a colored triangle outline.
target | The destination render target |
x1 | x-coord of first point |
y1 | y-coord of first point |
x2 | x-coord of second point |
y2 | y-coord of second point |
x3 | x-coord of third point |
y3 | y-coord of third point |
color | The color of the shape to render |
Definition at line 102 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
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 | ||
) |
Renders triangles from the given set of vertices. This lets you render arbitrary 2D geometry.
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. |
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). |
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]. |
Definition at line 1634 of file SDL_gpu.c.
References CHECK_CONTEXT, CHECK_FUNCTION_POINTER, CHECK_RENDERER, GPU_ERROR_NULL_ARGUMENT, GPU_ERROR_UNSUPPORTED_FUNCTION, GPU_ERROR_USER_ERROR, GPU_PASSTHROUGH_ALL, GPU_PASSTHROUGH_COLORS, GPU_PASSTHROUGH_TEXCOORDS, GPU_USE_DEFAULT_COLORS, GPU_USE_DEFAULT_POSITIONS, GPU_USE_DEFAULT_SRC_RECTS, RETURN_ERROR, GPU_Image::texture_h, GPU_Image::texture_w, GPU_Renderer::TriangleBatch, and TriangleBatch().
void GPU_TriFilled | ( | GPU_Target * | target, |
float | x1, | ||
float | y1, | ||
float | x2, | ||
float | y2, | ||
float | x3, | ||
float | y3, | ||
SDL_Color | color | ||
) |
Renders a colored filled triangle.
target | The destination render target |
x1 | x-coord of first point |
y1 | y-coord of first point |
x2 | x-coord of second point |
y2 | y-coord of second point |
x3 | x-coord of third point |
y3 | y-coord of third point |
color | The color of the shape to render |
Definition at line 111 of file SDL_gpuShapes.c.
References CHECK_RENDERER.
void GPU_UnsetClip | ( | GPU_Target * | target | ) |
Turns off clipping for the given target.
Definition at line 1833 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::UnsetClip.
Referenced by dialogs::unit_preview_pane::draw_contents(), gui::menu::imgsel_style::draw_row(), display::drawing_buffer_commit(), and SetWindowResolution().
void GPU_UnsetVirtualResolution | ( | GPU_Target * | target | ) |
Reset the logical size of the given target to its original value.
Definition at line 444 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::UnsetVirtualResolution.
Update an image from surface data.
Definition at line 692 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::UpdateImage.
void GPU_UpdateImageBytes | ( | GPU_Image * | image, |
const GPU_Rect * | image_rect, | ||
const unsigned char * | bytes, | ||
int | bytes_per_row | ||
) |
Update an image from an array of pixel data.
Definition at line 708 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::UpdateImageBytes.
void GPU_UpdateSubImage | ( | GPU_Image * | image, |
const GPU_Rect * | image_rect, | ||
SDL_Surface * | surface, | ||
const GPU_Rect * | surface_rect | ||
) |
Update an image from surface data.
Definition at line 700 of file SDL_gpu.c.
References GPU_Renderer::current_context_target, and GPU_Renderer::UpdateSubImage.
|
static |
Definition at line 316 of file SDL_gpu.h.
Referenced by changeBlendMode(), and init_features().
|
static |
Definition at line 318 of file SDL_gpu.h.
Referenced by changeBlendMode(), and init_features().
|
static |
Definition at line 317 of file SDL_gpu.h.
Referenced by changeBlendMode(), and init_features().
|
static |
Definition at line 323 of file SDL_gpu.h.
Referenced by init_features().
|
static |
Definition at line 325 of file SDL_gpu.h.
Referenced by init_features().
|
static |
Definition at line 321 of file SDL_gpu.h.
Referenced by compareFormats(), and init_features().
|
static |
Definition at line 319 of file SDL_gpu.h.
Referenced by compareFormats(), and init_features().
|
static |
Definition at line 320 of file SDL_gpu.h.
Referenced by compareFormats(), and init_features().
|
static |
Definition at line 314 of file SDL_gpu.h.
Referenced by CopyImage(), CreateImage(), and init_features().
|
static |
|
static |
Definition at line 315 of file SDL_gpu.h.
Referenced by bindFramebuffer(), extBindFramebuffer(), FreeTarget(), init_features(), and LoadTarget().
|
static |
Definition at line 322 of file SDL_gpu.h.
Referenced by init_features().
|
static |
Definition at line 326 of file SDL_gpu.h.
Referenced by init_features(), and SetWrapMode().
|
static |
|
static |
Definition at line 348 of file SDL_gpu.h.
Referenced by CreateTargetFromWindow(), and Init().
|
static |
Definition at line 347 of file SDL_gpu.h.
Referenced by CreateTargetFromWindow().
|
static |
Definition at line 363 of file SDL_gpu.h.
Referenced by GPU_BlitBatch(), GPU_BlitBatchSeparate(), and GPU_TriangleBatch().
|
static |
Definition at line 362 of file SDL_gpu.h.
Referenced by GPU_BlitBatch(), GPU_BlitBatchSeparate(), and GPU_TriangleBatch().
|
static |
Definition at line 361 of file SDL_gpu.h.
Referenced by GPU_BlitBatch(), and GPU_BlitBatchSeparate().
|
static |
Definition at line 46 of file SDL_gpu.h.
Referenced by GPU_GetRendererEnumString().
|
static |
Definition at line 47 of file SDL_gpu.h.
Referenced by GPU_GetRendererEnumString().
|
static |
Definition at line 45 of file SDL_gpu.h.
Referenced by GPU_GetRendererEnumString().
|
static |
Definition at line 42 of file SDL_gpu.h.
Referenced by GPU_CreateRenderer_GLES_1(), GPU_GetDefaultRendererOrder(), GPU_GetRendererEnumString(), and GPU_RegisterRenderers().
|
static |
Definition at line 43 of file SDL_gpu.h.
Referenced by GPU_CreateRenderer_GLES_2(), GPU_GetDefaultRendererOrder(), GPU_GetRendererEnumString(), and GPU_RegisterRenderers().
|
static |
Definition at line 44 of file SDL_gpu.h.
Referenced by GPU_GetRendererEnumString().
|
static |
Definition at line 38 of file SDL_gpu.h.
Referenced by GPU_CreateRenderer_OpenGL_1(), GPU_GetDefaultRendererOrder(), GPU_GetRendererEnumString(), and GPU_RegisterRenderers().
|
static |
Definition at line 37 of file SDL_gpu.h.
Referenced by GPU_CreateRenderer_OpenGL_1_BASE(), GPU_GetRendererEnumString(), and GPU_RegisterRenderers().
|
static |
Definition at line 39 of file SDL_gpu.h.
Referenced by GPU_CreateRenderer_OpenGL_2(), GPU_GetDefaultRendererOrder(), GPU_GetRendererEnumString(), and GPU_RegisterRenderers().
|
static |
Definition at line 40 of file SDL_gpu.h.
Referenced by GPU_CreateRenderer_OpenGL_3(), GPU_GetDefaultRendererOrder(), GPU_GetRendererEnumString(), and GPU_RegisterRenderers().
|
static |
Definition at line 41 of file SDL_gpu.h.
Referenced by GPU_GetRendererEnumString().
|
static |
Definition at line 36 of file SDL_gpu.h.
Referenced by GPU_CreateRenderer(), GPU_FreeRenderer(), GPU_GetNumRegisteredRenderers(), GPU_GetRegisteredRendererList(), GPU_GetRendererID(), and GPU_InitRendererRegister().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 366 of file SDL_gpu.h.
Referenced by GPU_BlitBatch(), and GPU_TriangleBatch().
|
static |
Definition at line 364 of file SDL_gpu.h.
Referenced by GPU_BlitBatch(), and GPU_TriangleBatch().
|
static |
Definition at line 365 of file SDL_gpu.h.
Referenced by GPU_BlitBatch(), and GPU_TriangleBatch().