2015-06-21 17:33:46 +02:00
|
|
|
/*
|
|
|
|
|
Simple DirectMedia Layer
|
2024-01-01 13:15:26 -08:00
|
|
|
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
2015-06-21 17:33:46 +02:00
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must not
|
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
|
appreciated but is not required.
|
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
|
misrepresented as being the original software.
|
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
|
*/
|
2022-11-29 18:34:15 -08:00
|
|
|
#include "SDL_internal.h"
|
2015-06-21 17:33:46 +02:00
|
|
|
|
2016-11-20 21:34:54 -08:00
|
|
|
#ifndef SDL_sysrender_h_
|
|
|
|
|
#define SDL_sysrender_h_
|
2015-06-21 17:33:46 +02:00
|
|
|
|
|
|
|
|
#include "SDL_yuv_sw_c.h"
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Set up for C function definitions, even when using C++
|
2022-06-26 18:47:34 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
2022-04-18 21:09:48 +02:00
|
|
|
|
2024-07-17 22:49:05 -07:00
|
|
|
typedef enum SDL_TextureAddressMode
|
|
|
|
|
{
|
|
|
|
|
SDL_TEXTURE_ADDRESS_AUTO,
|
|
|
|
|
SDL_TEXTURE_ADDRESS_CLAMP,
|
|
|
|
|
SDL_TEXTURE_ADDRESS_WRAP,
|
|
|
|
|
} SDL_TextureAddressMode;
|
|
|
|
|
|
2022-04-18 21:09:48 +02:00
|
|
|
/**
|
|
|
|
|
* A rectangle, with the origin at the upper left (double precision).
|
|
|
|
|
*/
|
|
|
|
|
typedef struct SDL_DRect
|
|
|
|
|
{
|
|
|
|
|
double x;
|
|
|
|
|
double y;
|
|
|
|
|
double w;
|
|
|
|
|
double h;
|
|
|
|
|
} SDL_DRect;
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// The SDL 2D rendering system
|
2015-06-21 17:33:46 +02:00
|
|
|
|
|
|
|
|
typedef struct SDL_RenderDriver SDL_RenderDriver;
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Rendering view state
|
2023-02-03 12:25:46 -08:00
|
|
|
typedef struct SDL_RenderViewState
|
|
|
|
|
{
|
2024-06-12 19:08:06 -07:00
|
|
|
int pixel_w;
|
|
|
|
|
int pixel_h;
|
|
|
|
|
SDL_Rect viewport;
|
2024-06-12 09:21:02 -07:00
|
|
|
SDL_Rect pixel_viewport;
|
2024-06-12 19:08:06 -07:00
|
|
|
SDL_Rect clip_rect;
|
|
|
|
|
SDL_Rect pixel_clip_rect;
|
2024-08-22 09:21:26 -07:00
|
|
|
bool clipping_enabled;
|
2023-02-03 12:25:46 -08:00
|
|
|
SDL_FPoint scale;
|
2024-09-16 13:33:16 -04:00
|
|
|
SDL_FPoint logical_scale;
|
|
|
|
|
SDL_FPoint logical_offset;
|
|
|
|
|
SDL_FPoint current_scale; // this is just `scale * logical_scale`, precalculated, since we use it a lot.
|
2023-02-03 12:25:46 -08:00
|
|
|
} SDL_RenderViewState;
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Define the SDL texture structure
|
2015-06-21 17:33:46 +02:00
|
|
|
struct SDL_Texture
|
|
|
|
|
{
|
2024-09-30 20:40:54 -07:00
|
|
|
// Public API definition
|
|
|
|
|
SDL_PixelFormat format; /**< The format of the texture, read-only */
|
|
|
|
|
int w; /**< The width of the texture, read-only. */
|
|
|
|
|
int h; /**< The height of the texture, read-only. */
|
|
|
|
|
|
|
|
|
|
int refcount; /**< Application reference count, used when freeing texture */
|
|
|
|
|
|
|
|
|
|
// Private API definition
|
|
|
|
|
SDL_Colorspace colorspace; // The colorspace of the texture
|
|
|
|
|
float SDR_white_point; // The SDR white point for this content
|
|
|
|
|
float HDR_headroom; // The HDR headroom needed by this content
|
|
|
|
|
SDL_TextureAccess access; // The texture access mode
|
|
|
|
|
SDL_BlendMode blendMode; // The texture blend mode
|
|
|
|
|
SDL_ScaleMode scaleMode; // The texture scale mode
|
|
|
|
|
SDL_FColor color; // Texture modulation values
|
|
|
|
|
SDL_RenderViewState view; // Target texture view state
|
2015-06-21 17:33:46 +02:00
|
|
|
|
|
|
|
|
SDL_Renderer *renderer;
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Support for formats not supported directly by the renderer
|
2015-06-21 17:33:46 +02:00
|
|
|
SDL_Texture *native;
|
|
|
|
|
SDL_SW_YUVTexture *yuv;
|
|
|
|
|
void *pixels;
|
|
|
|
|
int pitch;
|
|
|
|
|
SDL_Rect locked_rect;
|
2024-09-30 20:40:54 -07:00
|
|
|
SDL_Surface *locked_surface; // Locked region exposed as a SDL surface
|
2015-06-21 17:33:46 +02:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
Uint32 last_command_generation; // last command queue generation this texture was in.
|
2018-09-20 15:46:02 -04:00
|
|
|
|
2023-10-11 16:59:51 -07:00
|
|
|
SDL_PropertiesID props;
|
|
|
|
|
|
2024-09-30 20:40:54 -07:00
|
|
|
void *internal; // Driver specific texture representation
|
2015-06-21 17:33:46 +02:00
|
|
|
|
|
|
|
|
SDL_Texture *prev;
|
|
|
|
|
SDL_Texture *next;
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-20 15:46:02 -04:00
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
SDL_RENDERCMD_NO_OP,
|
|
|
|
|
SDL_RENDERCMD_SETVIEWPORT,
|
|
|
|
|
SDL_RENDERCMD_SETCLIPRECT,
|
2018-09-23 23:20:40 -04:00
|
|
|
SDL_RENDERCMD_SETDRAWCOLOR,
|
2018-09-20 15:46:02 -04:00
|
|
|
SDL_RENDERCMD_CLEAR,
|
|
|
|
|
SDL_RENDERCMD_DRAW_POINTS,
|
|
|
|
|
SDL_RENDERCMD_DRAW_LINES,
|
|
|
|
|
SDL_RENDERCMD_FILL_RECTS,
|
|
|
|
|
SDL_RENDERCMD_COPY,
|
2021-03-16 15:09:34 +01:00
|
|
|
SDL_RENDERCMD_COPY_EX,
|
|
|
|
|
SDL_RENDERCMD_GEOMETRY
|
2018-09-20 15:46:02 -04:00
|
|
|
} SDL_RenderCommandType;
|
|
|
|
|
|
|
|
|
|
typedef struct SDL_RenderCommand
|
|
|
|
|
{
|
|
|
|
|
SDL_RenderCommandType command;
|
2022-11-30 12:51:59 -08:00
|
|
|
union
|
|
|
|
|
{
|
|
|
|
|
struct
|
|
|
|
|
{
|
2018-09-23 23:20:40 -04:00
|
|
|
size_t first;
|
|
|
|
|
SDL_Rect rect;
|
|
|
|
|
} viewport;
|
2022-11-30 12:51:59 -08:00
|
|
|
struct
|
|
|
|
|
{
|
2024-08-22 09:21:26 -07:00
|
|
|
bool enabled;
|
2018-09-20 15:46:02 -04:00
|
|
|
SDL_Rect rect;
|
|
|
|
|
} cliprect;
|
2022-11-30 12:51:59 -08:00
|
|
|
struct
|
|
|
|
|
{
|
2018-09-20 15:46:02 -04:00
|
|
|
size_t first;
|
|
|
|
|
size_t count;
|
2024-02-05 23:20:43 -08:00
|
|
|
float color_scale;
|
2024-01-29 13:28:33 -08:00
|
|
|
SDL_FColor color;
|
2018-09-20 15:46:02 -04:00
|
|
|
SDL_BlendMode blend;
|
|
|
|
|
SDL_Texture *texture;
|
2024-07-17 22:49:05 -07:00
|
|
|
SDL_TextureAddressMode texture_address_mode;
|
2018-09-20 15:46:02 -04:00
|
|
|
} draw;
|
2022-11-30 12:51:59 -08:00
|
|
|
struct
|
|
|
|
|
{
|
2018-09-23 23:20:40 -04:00
|
|
|
size_t first;
|
2024-02-05 23:20:43 -08:00
|
|
|
float color_scale;
|
2024-01-29 13:28:33 -08:00
|
|
|
SDL_FColor color;
|
2018-09-20 15:46:02 -04:00
|
|
|
} color;
|
|
|
|
|
} data;
|
|
|
|
|
struct SDL_RenderCommand *next;
|
|
|
|
|
} SDL_RenderCommand;
|
|
|
|
|
|
2021-12-16 10:52:36 +01:00
|
|
|
typedef struct SDL_VertexSolid
|
|
|
|
|
{
|
|
|
|
|
SDL_FPoint position;
|
2024-01-29 13:28:33 -08:00
|
|
|
SDL_FColor color;
|
2021-12-16 10:52:36 +01:00
|
|
|
} SDL_VertexSolid;
|
|
|
|
|
|
2022-01-08 11:36:29 -08:00
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
SDL_RENDERLINEMETHOD_POINTS,
|
|
|
|
|
SDL_RENDERLINEMETHOD_LINES,
|
|
|
|
|
SDL_RENDERLINEMETHOD_GEOMETRY,
|
|
|
|
|
} SDL_RenderLineMethod;
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Define the SDL renderer structure
|
2015-06-21 17:33:46 +02:00
|
|
|
struct SDL_Renderer
|
|
|
|
|
{
|
2022-11-30 12:51:59 -08:00
|
|
|
void (*WindowEvent)(SDL_Renderer *renderer, const SDL_WindowEvent *event);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*GetOutputSize)(SDL_Renderer *renderer, int *w, int *h);
|
2024-08-22 09:21:26 -07:00
|
|
|
bool (*SupportsBlendMode)(SDL_Renderer *renderer, SDL_BlendMode blendMode);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*CreateTexture)(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props);
|
|
|
|
|
bool (*QueueSetViewport)(SDL_Renderer *renderer, SDL_RenderCommand *cmd);
|
|
|
|
|
bool (*QueueSetDrawColor)(SDL_Renderer *renderer, SDL_RenderCommand *cmd);
|
|
|
|
|
bool (*QueueDrawPoints)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points,
|
2022-11-30 12:51:59 -08:00
|
|
|
int count);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*QueueDrawLines)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points,
|
2022-11-30 12:51:59 -08:00
|
|
|
int count);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*QueueFillRects)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FRect *rects,
|
2022-11-30 12:51:59 -08:00
|
|
|
int count);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*QueueCopy)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
2023-03-02 08:56:54 -08:00
|
|
|
const SDL_FRect *srcrect, const SDL_FRect *dstrect);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*QueueCopyEx)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
2023-03-02 08:56:54 -08:00
|
|
|
const SDL_FRect *srcquad, const SDL_FRect *dstrect,
|
2024-01-20 06:31:37 -08:00
|
|
|
const double angle, const SDL_FPoint *center, const SDL_FlipMode flip, float scale_x, float scale_y);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*QueueGeometry)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
2024-01-29 13:28:33 -08:00
|
|
|
const float *xy, int xy_stride, const SDL_FColor *color, int color_stride, const float *uv, int uv_stride,
|
2022-11-30 12:51:59 -08:00
|
|
|
int num_vertices, const void *indices, int num_indices, int size_indices,
|
|
|
|
|
float scale_x, float scale_y);
|
|
|
|
|
|
2023-11-25 22:41:23 -05:00
|
|
|
void (*InvalidateCachedState)(SDL_Renderer *renderer);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*RunCommandQueue)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize);
|
|
|
|
|
bool (*UpdateTexture)(SDL_Renderer *renderer, SDL_Texture *texture,
|
2022-11-30 12:51:59 -08:00
|
|
|
const SDL_Rect *rect, const void *pixels,
|
|
|
|
|
int pitch);
|
2021-01-05 17:39:48 +01:00
|
|
|
#if SDL_HAVE_YUV
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*UpdateTextureYUV)(SDL_Renderer *renderer, SDL_Texture *texture,
|
2022-11-30 12:51:59 -08:00
|
|
|
const SDL_Rect *rect,
|
2015-06-21 17:33:46 +02:00
|
|
|
const Uint8 *Yplane, int Ypitch,
|
|
|
|
|
const Uint8 *Uplane, int Upitch,
|
|
|
|
|
const Uint8 *Vplane, int Vpitch);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*UpdateTextureNV)(SDL_Renderer *renderer, SDL_Texture *texture,
|
2022-11-30 12:51:59 -08:00
|
|
|
const SDL_Rect *rect,
|
|
|
|
|
const Uint8 *Yplane, int Ypitch,
|
|
|
|
|
const Uint8 *UVplane, int UVpitch);
|
2021-01-05 17:39:48 +01:00
|
|
|
#endif
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*LockTexture)(SDL_Renderer *renderer, SDL_Texture *texture,
|
2022-11-30 12:51:59 -08:00
|
|
|
const SDL_Rect *rect, void **pixels, int *pitch);
|
|
|
|
|
void (*UnlockTexture)(SDL_Renderer *renderer, SDL_Texture *texture);
|
|
|
|
|
void (*SetTextureScaleMode)(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*SetRenderTarget)(SDL_Renderer *renderer, SDL_Texture *texture);
|
2024-02-03 10:18:12 -08:00
|
|
|
SDL_Surface *(*RenderReadPixels)(SDL_Renderer *renderer, const SDL_Rect *rect);
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*RenderPresent)(SDL_Renderer *renderer);
|
2022-11-30 12:51:59 -08:00
|
|
|
void (*DestroyTexture)(SDL_Renderer *renderer, SDL_Texture *texture);
|
2015-06-21 17:33:46 +02:00
|
|
|
|
2022-11-30 12:51:59 -08:00
|
|
|
void (*DestroyRenderer)(SDL_Renderer *renderer);
|
2015-06-21 17:33:46 +02:00
|
|
|
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*SetVSync)(SDL_Renderer *renderer, int vsync);
|
2021-03-07 15:20:45 -08:00
|
|
|
|
2022-11-30 12:51:59 -08:00
|
|
|
void *(*GetMetalLayer)(SDL_Renderer *renderer);
|
|
|
|
|
void *(*GetMetalCommandEncoder)(SDL_Renderer *renderer);
|
2017-12-08 14:30:10 -08:00
|
|
|
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*AddVulkanRenderSemaphores)(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore);
|
2024-03-02 10:03:37 -08:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// The current renderer info
|
2024-06-03 19:26:43 -07:00
|
|
|
const char *name;
|
2024-07-08 14:59:18 -07:00
|
|
|
SDL_PixelFormat *texture_formats;
|
2024-06-03 19:26:43 -07:00
|
|
|
int num_texture_formats;
|
2024-08-22 09:21:26 -07:00
|
|
|
bool software;
|
2015-06-21 17:33:46 +02:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// The window associated with the renderer
|
2015-06-21 17:33:46 +02:00
|
|
|
SDL_Window *window;
|
2024-08-22 09:21:26 -07:00
|
|
|
bool hidden;
|
2015-06-21 17:33:46 +02:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Whether we should simulate vsync
|
2024-08-22 09:21:26 -07:00
|
|
|
bool wanted_vsync;
|
|
|
|
|
bool simulate_vsync;
|
2022-12-02 01:17:17 -08:00
|
|
|
Uint64 simulate_vsync_interval_ns;
|
|
|
|
|
Uint64 last_present;
|
2022-09-15 01:00:12 -07:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Support for logical output coordinates
|
2023-02-03 12:25:46 -08:00
|
|
|
SDL_RendererLogicalPresentation logical_presentation_mode;
|
2024-09-16 13:33:16 -04:00
|
|
|
int logical_w, logical_h;
|
2023-03-02 08:56:54 -08:00
|
|
|
SDL_FRect logical_src_rect;
|
2023-02-03 12:25:46 -08:00
|
|
|
SDL_FRect logical_dst_rect;
|
2016-01-05 16:39:18 -05:00
|
|
|
|
2023-02-03 12:25:46 -08:00
|
|
|
SDL_RenderViewState *view;
|
|
|
|
|
SDL_RenderViewState main_view;
|
2015-06-21 17:33:46 +02:00
|
|
|
|
2024-09-29 05:22:28 -07:00
|
|
|
// Cache the output size in pixels
|
|
|
|
|
int output_pixel_w, output_pixel_h;
|
2024-09-28 18:01:16 -07:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// The window pixel to point coordinate scale
|
2017-08-02 13:38:46 -07:00
|
|
|
SDL_FPoint dpi_scale;
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// The method of drawing lines
|
2022-01-08 11:36:29 -08:00
|
|
|
SDL_RenderLineMethod line_method;
|
2022-10-18 10:34:56 +02:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// The list of textures
|
2015-06-21 17:33:46 +02:00
|
|
|
SDL_Texture *textures;
|
|
|
|
|
SDL_Texture *target;
|
2023-04-28 07:31:12 -07:00
|
|
|
SDL_Mutex *target_mutex;
|
2015-06-21 17:33:46 +02:00
|
|
|
|
2024-01-29 18:32:27 -08:00
|
|
|
SDL_Colorspace output_colorspace;
|
2024-02-19 08:45:02 -08:00
|
|
|
float SDR_white_point;
|
|
|
|
|
float HDR_headroom;
|
2024-01-29 18:32:27 -08:00
|
|
|
|
2024-09-11 13:59:14 -07:00
|
|
|
float desired_color_scale;
|
2024-02-05 23:20:43 -08:00
|
|
|
float color_scale;
|
2024-01-29 13:28:33 -08:00
|
|
|
SDL_FColor color; /**< Color for drawing operations values */
|
2022-11-30 12:51:59 -08:00
|
|
|
SDL_BlendMode blendMode; /**< The drawing blend mode */
|
2024-07-17 22:49:05 -07:00
|
|
|
SDL_TextureAddressMode texture_address_mode;
|
2015-06-21 17:33:46 +02:00
|
|
|
|
2018-09-20 15:46:02 -04:00
|
|
|
SDL_RenderCommand *render_commands;
|
|
|
|
|
SDL_RenderCommand *render_commands_tail;
|
|
|
|
|
SDL_RenderCommand *render_commands_pool;
|
|
|
|
|
Uint32 render_command_generation;
|
2024-01-29 13:28:33 -08:00
|
|
|
SDL_FColor last_queued_color;
|
2024-02-06 05:31:43 -08:00
|
|
|
float last_queued_color_scale;
|
2023-02-03 12:25:46 -08:00
|
|
|
SDL_Rect last_queued_viewport;
|
|
|
|
|
SDL_Rect last_queued_cliprect;
|
2024-08-22 09:21:26 -07:00
|
|
|
bool last_queued_cliprect_enabled;
|
|
|
|
|
bool color_queued;
|
|
|
|
|
bool viewport_queued;
|
|
|
|
|
bool cliprect_queued;
|
2018-09-20 15:46:02 -04:00
|
|
|
|
|
|
|
|
void *vertex_data;
|
|
|
|
|
size_t vertex_data_used;
|
|
|
|
|
size_t vertex_data_allocation;
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Shaped window support
|
2024-08-22 09:21:26 -07:00
|
|
|
bool transparent_window;
|
2024-02-09 07:09:59 -08:00
|
|
|
SDL_Surface *shape_surface;
|
|
|
|
|
SDL_Texture *shape_texture;
|
|
|
|
|
|
2023-10-11 16:59:51 -07:00
|
|
|
SDL_PropertiesID props;
|
|
|
|
|
|
2024-08-22 09:21:26 -07:00
|
|
|
bool destroyed; // already destroyed by SDL_DestroyWindow; just free this struct in SDL_DestroyRenderer.
|
2024-04-18 10:20:31 -04:00
|
|
|
|
2024-07-16 11:09:18 -07:00
|
|
|
void *internal;
|
2024-06-23 00:41:19 -07:00
|
|
|
|
|
|
|
|
SDL_Renderer *next;
|
2015-06-21 17:33:46 +02:00
|
|
|
};
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Define the SDL render driver structure
|
2015-06-21 17:33:46 +02:00
|
|
|
struct SDL_RenderDriver
|
|
|
|
|
{
|
2024-08-22 17:33:49 -07:00
|
|
|
bool (*CreateRenderer)(SDL_Renderer *renderer, SDL_Window *window, SDL_PropertiesID props);
|
2015-06-21 17:33:46 +02:00
|
|
|
|
2024-05-09 12:10:42 -07:00
|
|
|
const char *name;
|
2015-06-21 17:33:46 +02:00
|
|
|
};
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Not all of these are available in a given build. Use #ifdefs, etc.
|
2015-06-21 17:33:46 +02:00
|
|
|
extern SDL_RenderDriver D3D_RenderDriver;
|
|
|
|
|
extern SDL_RenderDriver D3D11_RenderDriver;
|
2022-06-06 17:42:30 -07:00
|
|
|
extern SDL_RenderDriver D3D12_RenderDriver;
|
2015-06-21 17:33:46 +02:00
|
|
|
extern SDL_RenderDriver GL_RenderDriver;
|
|
|
|
|
extern SDL_RenderDriver GLES2_RenderDriver;
|
2016-04-21 03:16:44 -04:00
|
|
|
extern SDL_RenderDriver METAL_RenderDriver;
|
Vulkan Renderer (#9114)
This pull request adds an implementation of a Vulkan Render backend to SDL. I have so far tested this primarily on Windows, but also smoke tested on Linux and macOS (MoltenVK). I have not tried it yet on Android, but it should be usable there as well (sans any bugs I missed). This began as a port of the SDL Direct3D12 Renderer, which is the closest thing to Vulkan as existed in the SDL codebase. The shaders are more or less identical (with the only differences being in descriptor bindings vs root descriptors). The shaders are built using the HLSL frontend of glslang.
Everything in the code is pure Vulkan 1.0 (no extensions), with the exception of HDR support which requires the Vulkan instance extension `VK_EXT_swapchain_colorspace`. The code could have been simplified considerably if I used dynamic rendering, push descriptors, extended dynamic state, and other modern Vulkan-isms, but I felt it was more important to make the code as vanilla Vulkan as possible so that it would run on any Vulkan implementation.
The main differences with the Direct3D12 renderer are:
* Having to manage renderpasses for performing clears. There is likely some optimization that would still remain for more efficient use of TBDR hardware where there might be some unnecessary load/stores, but it does attempt to do clears using renderpasses.
* Constant buffer data couldn't be directly updated in the command buffer since I didn't want to rely on push descriptors, so there is a persistently mapped buffer with increasing offset per swapchain image where CB data gets written.
* Many more resources are dependent on the swapchain resizing due to i.e. Vulkan requiring the VkFramebuffer to reference the VkImageView of the swapchain, so there is a bit more code around handling that than was necessary in D3D12.
* For NV12/NV21 textures, rather than there being plane data in the texture itself, the UV data is placed in a separate `VkImage`/`VkImageView`.
I've verified that `testcolorspace` works with both sRGB and HDR linear. I've tested `testoverlay` works with the various YUV/NV12/NV21 formats. I've tested `testsprite`. I've checked that window resizing and swapchain out-of-date handling when minimizing are working. I've run through `testautomation` with the render tests. I also have run several of the tests with Vulkan validation and synchronization validation. Surely I will have missed some things, but I think it's in a good state to be merged and build out from here.
2024-02-22 17:58:11 -05:00
|
|
|
extern SDL_RenderDriver VULKAN_RenderDriver;
|
2022-06-30 11:44:35 -03:00
|
|
|
extern SDL_RenderDriver PS2_RenderDriver;
|
2015-06-21 17:33:46 +02:00
|
|
|
extern SDL_RenderDriver PSP_RenderDriver;
|
|
|
|
|
extern SDL_RenderDriver SW_RenderDriver;
|
2020-11-16 20:40:22 +03:00
|
|
|
extern SDL_RenderDriver VITA_GXM_RenderDriver;
|
2024-03-18 11:43:23 -07:00
|
|
|
extern SDL_RenderDriver GPU_RenderDriver;
|
2015-06-21 17:33:46 +02:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Clean up any renderers at shutdown
|
2024-06-23 00:41:19 -07:00
|
|
|
extern void SDL_QuitRender(void);
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Add a supported texture format to a renderer
|
2024-08-22 17:33:49 -07:00
|
|
|
extern bool SDL_AddSupportedTextureFormat(SDL_Renderer *renderer, SDL_PixelFormat format);
|
2024-05-09 12:10:42 -07:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Setup colorspace conversion
|
2024-01-29 18:32:27 -08:00
|
|
|
extern void SDL_SetupRendererColorspace(SDL_Renderer *renderer, SDL_PropertiesID props);
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Colorspace conversion functions
|
2024-08-22 09:21:26 -07:00
|
|
|
extern bool SDL_RenderingLinearSpace(SDL_Renderer *renderer);
|
2024-02-02 12:09:37 -08:00
|
|
|
extern void SDL_ConvertToLinear(SDL_FColor *color);
|
|
|
|
|
extern void SDL_ConvertFromLinear(SDL_FColor *color);
|
2024-01-29 18:32:27 -08:00
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Blend mode functions
|
Implemented more flexible blending modes for accelerated renderers
This fixes bug 2594 - Propose new blend mode, SDL_BLENDMODE_BLEND_DSTA
blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA,
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
SDL_BLENDOPERATION_ADD,
SDL_BLENDFACTOR_ZERO,
SDL_BLENDFACTOR_ONE,
SDL_BLENDOPERATION_ADD);
This fixes bug 2828 - Subtractive Blending
blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA,
SDL_BLENDFACTOR_ONE,
SDL_BLENDOPERATION_SUBTRACT,
SDL_BLENDFACTOR_ZERO,
SDL_BLENDFACTOR_ONE,
SDL_BLENDOPERATION_SUBTRACT);
This goes partway to fixing bug 3684 - Add support for a pre-multiplied alpha blending mode
blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE,
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
SDL_BLENDOPERATION_ADD,
SDL_BLENDFACTOR_ONE,
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
SDL_BLENDOPERATION_ADD);
2017-08-14 05:51:44 -07:00
|
|
|
extern SDL_BlendFactor SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode);
|
|
|
|
|
extern SDL_BlendFactor SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode);
|
|
|
|
|
extern SDL_BlendOperation SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode);
|
|
|
|
|
extern SDL_BlendFactor SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode);
|
|
|
|
|
extern SDL_BlendFactor SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode);
|
|
|
|
|
extern SDL_BlendOperation SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode);
|
|
|
|
|
|
2018-09-20 15:46:02 -04:00
|
|
|
/* drivers call this during their Queue*() methods to make space in a array that are used
|
|
|
|
|
for a vertex buffer during RunCommandQueue(). Pointers returned here are only valid until
|
|
|
|
|
the next call, because it might be in an array that gets realloc()'d. */
|
2018-09-23 23:20:40 -04:00
|
|
|
extern void *SDL_AllocateRenderVertices(SDL_Renderer *renderer, const size_t numbytes, const size_t alignment, size_t *offset);
|
2018-09-20 15:46:02 -04:00
|
|
|
|
2024-04-18 10:20:31 -04:00
|
|
|
// Let the video subsystem destroy a renderer without making its pointer invalid.
|
|
|
|
|
extern void SDL_DestroyRendererWithoutFreeing(SDL_Renderer *renderer);
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
// Ends C function definitions when using C++
|
2022-06-26 18:47:34 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
2024-08-22 10:30:45 -07:00
|
|
|
#endif // SDL_sysrender_h_
|