mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-27 21:48:29 +00:00
Finalized the SDL render API colorspaces
The renderer will always use the sRGB colorspace for drawing, and will default to the sRGB output colorspace. If you want blending in linear space and HDR support, you can select the scRGB output colorspace, which is supported by the direct3d11 and direct3d12
This commit is contained in:
@@ -1176,6 +1176,7 @@ SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface)
|
||||
|
||||
static SDL_Renderer *SW_CreateRenderer(SDL_Window *window, SDL_PropertiesID create_props)
|
||||
{
|
||||
SDL_Renderer *renderer;
|
||||
const char *hint;
|
||||
SDL_Surface *surface;
|
||||
SDL_bool no_hint_set;
|
||||
@@ -1206,7 +1207,21 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window *window, SDL_PropertiesID crea
|
||||
if (!surface) {
|
||||
return NULL;
|
||||
}
|
||||
return SW_CreateRendererForSurface(surface);
|
||||
|
||||
renderer = SW_CreateRendererForSurface(surface);
|
||||
if (!renderer) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SDL_SetupRendererColorspace(renderer, create_props);
|
||||
|
||||
if (renderer->output_colorspace != SDL_COLORSPACE_SRGB) {
|
||||
SDL_SetError("Unsupported output colorspace");
|
||||
SW_DestroyRenderer(renderer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
SDL_RenderDriver SW_RenderDriver = {
|
||||
|
Reference in New Issue
Block a user