Go to the source code of this file.
Classes | |
struct | GPU_WindowMapping |
Macros | |
#define | GET_ALPHA(sdl_color) ((sdl_color).a) |
#define | CHECK_RENDERER (current_renderer != NULL) |
#define | CHECK_CONTEXT (current_renderer->current_context_target != NULL) |
#define | CHECK_FUNCTION_POINTER(fn) (current_renderer->fn != NULL) |
#define | RETURN_ERROR(code, details) do{ GPU_PushErrorCode(__func__, code, "%s", details); return; } while(0) |
#define | GPU_MAX_NUM_ERRORS 20 |
#define | GPU_ERROR_FUNCTION_STRING_MAX 128 |
#define | GPU_ERROR_DETAILS_STRING_MAX 512 |
#define | GPU_INITIAL_WINDOW_MAPPINGS_SIZE 10 |
Typedefs | |
typedef struct GPU_WindowMapping | GPU_WindowMapping |
Variables | |
static GPU_Renderer * | current_renderer = NULL |
static GPU_DebugLevelEnum | debug_level = GPU_DEBUG_LEVEL_0 |
static GPU_ErrorObject | error_code_stack [GPU_MAX_NUM_ERRORS] |
static int | num_error_codes = 0 |
static int | inited_error_code_stack = 0 |
static GPU_WindowMapping * | window_mappings = NULL |
static int | window_mappings_size = 0 |
static int | num_window_mappings = 0 |
static Uint32 | init_windowID = 0 |
static GPU_InitFlagEnum | preinit_flags = GPU_DEFAULT_INIT_FLAGS |
#define CHECK_CONTEXT (current_renderer->current_context_target != NULL) |
Definition at line 21 of file SDL_gpu.c.
Referenced by GPU_Blit(), GPU_BlitBatch(), GPU_BlitBatchSeparate(), GPU_BlitRotate(), GPU_BlitScale(), GPU_BlitTransform(), GPU_BlitTransformMatrix(), GPU_BlitTransformX(), and GPU_TriangleBatch().
#define CHECK_FUNCTION_POINTER | ( | fn | ) | (current_renderer->fn != NULL) |
Definition at line 22 of file SDL_gpu.c.
Referenced by GPU_Blit(), GPU_BlitBatch(), GPU_BlitBatchSeparate(), GPU_BlitRotate(), GPU_BlitScale(), GPU_BlitTransform(), GPU_BlitTransformMatrix(), GPU_BlitTransformX(), and GPU_TriangleBatch().
#define CHECK_RENDERER (current_renderer != NULL) |
Definition at line 20 of file SDL_gpu.c.
Referenced by GPU_Blit(), GPU_BlitBatch(), GPU_BlitBatchSeparate(), GPU_BlitRotate(), GPU_BlitScale(), GPU_BlitTransform(), GPU_BlitTransformMatrix(), GPU_BlitTransformX(), and GPU_TriangleBatch().
#define GET_ALPHA | ( | sdl_color | ) | ((sdl_color).a) |
Definition at line 15 of file SDL_gpu.c.
Referenced by GPU_ClearColor().
#define GPU_ERROR_DETAILS_STRING_MAX 512 |
Definition at line 33 of file SDL_gpu.c.
Referenced by GPU_PushErrorCode(), and init_error_stack().
#define GPU_ERROR_FUNCTION_STRING_MAX 128 |
Definition at line 32 of file SDL_gpu.c.
Referenced by GPU_PushErrorCode(), and init_error_stack().
#define GPU_INITIAL_WINDOW_MAPPINGS_SIZE 10 |
Definition at line 45 of file SDL_gpu.c.
Referenced by init_window_mappings().
#define GPU_MAX_NUM_ERRORS 20 |
Definition at line 31 of file SDL_gpu.c.
Referenced by GPU_PushErrorCode(), GPU_Quit(), and init_error_stack().
#define RETURN_ERROR | ( | code, | |
details | |||
) | do{ GPU_PushErrorCode(__func__, code, "%s", details); return; } while(0) |
Definition at line 23 of file SDL_gpu.c.
Referenced by GPU_Blit(), GPU_BlitBatch(), GPU_BlitBatchSeparate(), GPU_BlitRotate(), GPU_BlitScale(), GPU_BlitTransform(), GPU_BlitTransformMatrix(), GPU_BlitTransformX(), and GPU_TriangleBatch().
typedef struct GPU_WindowMapping GPU_WindowMapping |
A mapping of windowID to a GPU_Target to facilitate GPU_GetWindowTarget().
|
static |
Definition at line 802 of file SDL_gpu.c.
Referenced by GPU_SaveSurface().
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.
void GPU_AddWindowMapping | ( | GPU_Target * | target | ) |
Definition at line 191 of file SDL_gpu.c.
References GPU_Target::context, GPU_ERROR_DATA_ERROR, GPU_PushErrorCode(), i, init_window_mappings(), num_window_mappings, window_mappings_size, and GPU_Context::windowID.
Referenced by CreateTargetFromWindow(), and MakeCurrent().
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_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().
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().
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().
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().
SDL_version GPU_GetLinkedVersion | ( | void | ) |
Definition at line 51 of file SDL_gpu.c.
References GPU_GetCompiledVersion().
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().
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().
Definition at line 204 of file SDL_gpu_Renderer.c.
References RendererRegistration::createFn, RendererRegistration::freeFn, GPU_GetDefaultRendererOrder(), GPU_RegisterRenderers(), GPU_RENDERER_UNKNOWN, i, RendererRegistration::id, GPU_RendererID::id, GPU_RendererID::index, initialized, MAX_ACTIVE_RENDERERS, MAX_REGISTERED_RENDERERS, and renderer_order_size.
Referenced by GPU_GetActiveRendererList(), GPU_GetNumActiveRenderers(), GPU_GetNumRegisteredRenderers(), GPU_GetRegisteredRendererList(), GPU_GetRendererByID(), GPU_Init(), and GPU_InitRendererByID().
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.
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().
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_RemoveWindowMapping | ( | Uint32 | windowID | ) |
Definition at line 237 of file SDL_gpu.c.
References GPU_Target::context, i, init_window_mappings(), num_window_mappings, GPU_WindowMapping::target, and GPU_Context::windowID.
Referenced by CreateTargetFromWindow(), and MakeCurrent().
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().
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().
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().
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.
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_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_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 167 of file SDL_gpu.c.
References GPU_ErrorObject::details, GPU_ErrorObject::function, GPU_ERROR_DETAILS_STRING_MAX, GPU_ERROR_FUNCTION_STRING_MAX, GPU_MAX_NUM_ERRORS, i, and inited_error_code_stack.
Referenced by GPU_Init(), and GPU_InitRendererByID().
|
static |
Definition at line 116 of file SDL_gpu.c.
References GPU_ERROR_BACKEND_ERROR, GPU_GetNumActiveRenderers(), and GPU_PushErrorCode().
Referenced by GPU_Init(), and GPU_InitRendererByID().
|
static |
Definition at line 181 of file SDL_gpu.c.
References GPU_INITIAL_WINDOW_MAPPINGS_SIZE, num_window_mappings, and window_mappings_size.
Referenced by GPU_AddWindowMapping(), GPU_GetWindowTarget(), GPU_RemoveWindowMapping(), and GPU_RemoveWindowMappingByTarget().
|
static |
Definition at line 27 of file SDL_gpu.c.
Referenced by GPU_GetCurrentRenderer().
|
static |
Definition at line 29 of file SDL_gpu.c.
Referenced by GPU_GetDebugLevel(), and GPU_SetDebugLevel().
|
static |
|
static |
Definition at line 143 of file SDL_gpu.c.
Referenced by GPU_GetInitWindow(), and GPU_SetInitWindow().
|
static |
Definition at line 36 of file SDL_gpu.c.
Referenced by GPU_Quit(), and init_error_stack().
|
static |
Definition at line 35 of file SDL_gpu.c.
Referenced by GPU_PopErrorCode(), GPU_PushErrorCode(), and GPU_Quit().
|
static |
Definition at line 48 of file SDL_gpu.c.
Referenced by GPU_AddWindowMapping(), GPU_GetWindowTarget(), GPU_InitRendererByID(), GPU_RemoveWindowMapping(), GPU_RemoveWindowMappingByTarget(), and init_window_mappings().
|
static |
Definition at line 155 of file SDL_gpu.c.
Referenced by GPU_GetPreInitFlags(), and GPU_SetPreInitFlags().
|
static |
|
static |
Definition at line 47 of file SDL_gpu.c.
Referenced by GPU_AddWindowMapping(), and init_window_mappings().