SDL_GPUBlendFactor(3type)

πŸ’– SDL_GPUBlendFactor πŸ’–

okay bestie, welcome to the SDL3 DATATYPES corner of the manual, where we're talking about SDL_GPUBlendFactor β€” the enum that decides how much of each thing gets mixed in when you blend. no cap, it's the glow-up recipe for your pixels. ✨


🌸 NAME 🌸

SDL_GPUBlendFactor β€” specifies a blending factor to be used when pixels in a render target are blended with existing pixels in the texture.

like… it literally tells the GPU "hey, how much of the new pixel and how much of the old pixel are we stirring into this smoothie". πŸ₯€


✨ SYNOPSIS ✨

#include <SDL3/SDL_gpu.h>

typedef enum SDL_GPUBlendFactor
{
    SDL_GPU_BLENDFACTOR_INVALID,
    SDL_GPU_BLENDFACTOR_ZERO,                      /**< 0 */
    SDL_GPU_BLENDFACTOR_ONE,                       /**< 1 */
    SDL_GPU_BLENDFACTOR_SRC_COLOR,                 /**< source color */
    SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR,       /**< 1 - source color */
    SDL_GPU_BLENDFACTOR_DST_COLOR,                 /**< destination color */
    SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR,       /**< 1 - destination color */
    SDL_GPU_BLENDFACTOR_SRC_ALPHA,                 /**< source alpha */
    SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,       /**< 1 - source alpha */
    SDL_GPU_BLENDFACTOR_DST_ALPHA,                 /**< destination alpha */
    SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA,       /**< 1 - destination alpha */
    SDL_GPU_BLENDFACTOR_CONSTANT_COLOR,            /**< blend constant */
    SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR,  /**< 1 - blend constant */
    SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE         /**< min(source alpha, 1 - destination alpha) */
} SDL_GPUBlendFactor;

πŸŽ€ DESCRIPTION πŸŽ€

so the source color is the value written by the fragment shader. that's the new hotness, the fresh fit. πŸ‘‘

and the destination color is the value currently existing in the texture. that's the outfit already in your closet, the one that's been there. πŸ’…

when you blend, these two get combined using a blend factor on each side, and this enum is your menu of factors. iykyk. 🌈


πŸ¦‹ AVAILABILITY πŸ¦‹

this enum is available since SDL 3.2.0. it's giving new-ish but very settled. periodt.


πŸ”₯ SEE ALSO πŸ”₯


bestie reminder: if you're reaching for this enum, you're probably already deep in graphics pipeline territory. hydrate, take a breath, and go read SDL_CreateGPUGraphicsPipeline(3). 🫢

okay that's the whole vibe, no skips, every single factor accounted for πŸ’œ β€” this page came to you from Simple Directmedia Layer, running SDL 3.4.18, and it's the SDL_GPUBlendFactor(3type) manual page. stay slaying, go blend something iconic βœ¨πŸŽ€

πŸ“¦ where this page comes from