Add srgb default framebuffer support in application options (implemented in sdl2 non-web only)

This commit is contained in:
Nikita Lisitsa 2026-07-21 13:20:10 +03:00
parent 63f247c877
commit 0236fc97b7
2 changed files with 5 additions and 0 deletions

View file

@ -24,6 +24,7 @@ namespace psemek::app
std::string name; std::string name;
int multisampling = 4; int multisampling = 4;
bool highdpi = false; bool highdpi = false;
bool srgb = false;
#if defined(PSEMEK_GRAPHICS_API_WEBGPU) #if defined(PSEMEK_GRAPHICS_API_WEBGPU)
std::vector<wgpu::feature> required_features = {}; std::vector<wgpu::feature> required_features = {};
std::optional<wgpu::limits> required_limits = {}; std::optional<wgpu::limits> required_limits = {};

View file

@ -38,6 +38,7 @@ namespace psemek::sdl2
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, options.srgb ? 1 : 0);
if (options.multisampling == 0) if (options.multisampling == 0)
{ {
@ -83,6 +84,9 @@ namespace psemek::sdl2
SDL_GL_MakeCurrent(window_, gl_context_); SDL_GL_MakeCurrent(window_, gl_context_);
gfx::init(); gfx::init();
if (options.srgb)
gl::Enable(gl::FRAMEBUFFER_SRGB);
#elif defined(PSEMEK_GRAPHICS_API_WEBGPU) #elif defined(PSEMEK_GRAPHICS_API_WEBGPU)
wgpu::setup_logging(log::level::error); wgpu::setup_logging(log::level::error);