fp16 config

This commit is contained in:
UjinT34 2025-06-22 12:40:45 +03:00
parent 210930bef9
commit feb53005a9
3 changed files with 15 additions and 3 deletions

View file

@ -1543,6 +1543,7 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.data = SConfigOptionDescription::SRangeData{.value = 1, .min = 0, .max = 2},
},
SConfigOptionDescription{
.value = "render:new_render_scheduling",
.description = "enable new render scheduling, which should improve FPS on underpowered devices. This does not add latency when your PC can keep up.",
.type = CONFIG_OPTION_BOOL,
@ -1561,6 +1562,13 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.type = CONFIG_OPTION_CHOICE,
.data = SConfigOptionDescription::SChoiceData{0, "srgb,gamma22,gamma22force"},
},
SConfigOptionDescription{
.value = "render:use_fp16",
.description = "Use FP16 for internal buffers. Required for scRGB HDR. Slightly increases VRAM usage (64mb extra at 4k)",
.type = CONFIG_OPTION_BOOL,
.data = SConfigOptionDescription::SBoolData{true},
},
/*
* cursor:

View file

@ -763,6 +763,7 @@ CConfigManager::CConfigManager() {
registerConfigVar("render:new_render_scheduling", Hyprlang::INT{0});
registerConfigVar("render:non_shader_cm", Hyprlang::INT{3});
registerConfigVar("render:cm_sdr_eotf", Hyprlang::INT{0});
registerConfigVar("render:use_fp16", Hyprlang::INT{1});
registerConfigVar("ecosystem:no_update_news", Hyprlang::INT{0});
registerConfigVar("ecosystem:no_donation_nag", Hyprlang::INT{0});

View file

@ -1,5 +1,6 @@
#include "Framebuffer.hpp"
#include "OpenGL.hpp"
#include "../config/ConfigValue.hpp"
CFramebuffer::CFramebuffer() {
;
@ -9,8 +10,10 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) {
bool firstAlloc = false;
RASSERT((w > 0 && h > 0), "cannot alloc a FB with negative / zero size! (attempted {}x{})", w, h);
uint32_t glFormat = NFormatUtils::drmFormatToGL(drmFormat);
uint32_t glType = NFormatUtils::glFormatToType(glFormat);
static auto PFP16 = CConfigValue<Hyprlang::INT>("render:send_content_type");
uint32_t glFormat = NFormatUtils::drmFormatToGL(drmFormat);
uint32_t glType = NFormatUtils::glFormatToType(glFormat);
if (drmFormat != m_drmFormat || m_size != Vector2D{w, h})
release();
@ -36,7 +39,7 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) {
if (firstAlloc || m_size != Vector2D(w, h)) {
m_tex->bind();
glTexImage2D(GL_TEXTURE_2D, 0, glFormat, w, h, 0, GL_RGBA, glType, nullptr);
glTexImage2D(GL_TEXTURE_2D, 0, *PFP16 ? GL_RGBA16F : glFormat, w, h, 0, GL_RGBA, glType, nullptr);
glBindFramebuffer(GL_FRAMEBUFFER, m_fb);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_tex->m_texID, 0);