Compare commits

..

12 Commits

Author SHA1 Message Date
PavelBARABANOV 7951ac7db1 Bruno Fix overlay 3.0 2026-09-06 18:26:37 +03:00
PavelBARABANOV 283935dc7c h 2026-09-06 00:44:22 +02:00
PavelBARABANOV fc97a59d2c Bruno FIX OVERLAY 2.0 2026-09-06 00:44:22 +02:00
PavelBARABANOV b4a92a5db8 Brubo patch 2026-09-06 00:44:22 +02:00
PavelBARABANOV cd9c750545 find? 2026-09-06 00:44:22 +02:00
PavelBARABANOV 9858c9d346 add ColorOpaqueBlackRgba32 2026-09-06 00:44:22 +02:00
PavelBARABANOV 70e274fe5f return ClearAppletCaptureBuffer etc. 2026-09-06 00:44:22 +02:00
PavelBARABANOV 55546f2481 ac3 again 2026-09-06 00:44:22 +02:00
PavelBARABANOV 870dd5e175 headers 2026-09-06 00:44:22 +02:00
PavelBARABANOV 398f202891 for convenience 2026-09-06 00:44:22 +02:00
PavelBARABANOV 645938daf3 or 2026-09-06 00:44:22 +02:00
PavelBARABANOV 9d975c5870 return SetLayerZIndex(layer_id, 100000) 2026-09-06 00:44:22 +02:00
8 changed files with 63 additions and 102 deletions
@@ -83,7 +83,6 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
SHOW_SHADERS_BUILDING("show_shaders_building"),
DEBUG_FLUSH_BY_LINE("flush_line"),
EXTENDED_LOGGING("extended_logging"),
DONT_SHOW_DRIVER_SHADER_WARNING("dont_show_driver_shader_warning"),
ENABLE_OVERLAY("enable_overlay"),
@@ -262,13 +262,6 @@ abstract class SettingsItem(
descriptionId = R.string.flush_by_line_description
)
)
put(
SwitchSetting(
BooleanSetting.EXTENDED_LOGGING,
titleId = R.string.extended_logging,
descriptionId = R.string.extended_logging_description
)
)
val dockedModeSetting = object : AbstractBooleanSetting {
override val key = BooleanSetting.USE_DOCKED_MODE.key
@@ -1323,7 +1323,6 @@ class SettingsFragmentPresenter(
add(HeaderSetting(R.string.log))
add(BooleanSetting.DEBUG_FLUSH_BY_LINE.key)
add(BooleanSetting.EXTENDED_LOGGING.key)
add(StringSetting.LOG_FILTER.key)
}
@@ -636,8 +636,6 @@
<string name="log">Logging</string>
<string name="flush_by_line">Flush debug logs by line</string>
<string name="flush_by_line_description">Flushes debugging logs on each line written, making debugging easier in cases of crashing or freezing.</string>
<string name="extended_logging">Enable extended logging</string>
<string name="extended_logging_description">Increases the maximum log file size from 100 MiB to 1 GiB.</string>
<string name="log_filter">Log filter</string>
<string name="log_filter_description">Controls Eden\'s log categories. Example: *:Info Service.LM:Debug</string>
@@ -73,20 +73,16 @@ Result DisplayLayerManager::CreateManagedDisplayLayer(u64* out_layer_id) {
R_TRY(m_manager_display_service->CreateManagedLayer(
out_layer_id, 0, display_id, Service::AppletResourceUserId{m_process->GetProcessId()}));
m_manager_display_service->SetLayerVisibility(m_visible, *out_layer_id);
(void)m_display_service->GetContainer()->SetLayerStackMask(*out_layer_id,
this->GetLayerStackMask());
if (m_applet_id != AppletId::Application) {
(void)m_manager_display_service->SetLayerBlending(m_blending_enabled, *out_layer_id);
if (m_applet_id == AppletId::OverlayDisplay) {
(void)m_manager_display_service->SetLayerZIndex(Overlay, *out_layer_id);
(void)m_manager_display_service->SetLayerZIndex(-1, *out_layer_id);
(void)m_display_service->GetContainer()->SetLayerIsOverlay(*out_layer_id, true);
} else {
(void)m_manager_display_service->SetLayerZIndex(Foreground, *out_layer_id);
(void)m_manager_display_service->SetLayerZIndex(1, *out_layer_id);
}
}
(void)m_display_service->GetContainer()->SetLayerZIndex(*out_layer_id, true);
m_managed_display_layers.emplace(*out_layer_id);
R_SUCCEED();
@@ -126,12 +122,11 @@ Result DisplayLayerManager::IsSystemBufferSharingEnabled() {
// Ensure the overlay layer is visible
m_manager_display_service->SetLayerVisibility(m_visible, m_system_shared_layer_id);
(void)m_display_service->GetContainer()->SetLayerStackMask(m_system_shared_layer_id,
this->GetLayerStackMask());
m_manager_display_service->SetLayerBlending(m_blending_enabled, m_system_shared_layer_id);
s32 initial_z = Foreground;
s32 initial_z = 1;
(void)m_display_service->GetContainer()->SetLayerZIndex(m_system_shared_layer_id, true);
if (m_applet_id == AppletId::OverlayDisplay) {
initial_z = Overlay;
initial_z = -1;
(void)m_display_service->GetContainer()->SetLayerIsOverlay(m_system_shared_layer_id, true);
}
m_manager_display_service->SetLayerZIndex(initial_z, m_system_shared_layer_id);
@@ -300,28 +300,6 @@ Result SharedBufferManager::CreateSession(Kernel::KProcess* owner_process, u64*
}
}
// Claim a presentation slot range.
u32 slot_base = 0;
std::array<bool, SharedBufferMaxSessions> in_use{};
for (const auto& [existing_aruid, existing] : m_sessions) {
const u32 index = existing.presentation_slot_base / SharedBufferSlotsPerSession;
if (index < in_use.size())
in_use[index] = true;
}
u32 index = 0;
while (index < in_use.size() && in_use[index])
index++;
if (index >= in_use.size()) {
LOG_ERROR(Service_VI, "Out of shared buffer presentation slots ({} sessions)", SharedBufferMaxSessions);
R_THROW(VI::ResultOperationFailed);
}
slot_base = index * SharedBufferSlotsPerSession;
// Map into process.
Common::ProcessAddress map_address{};
R_TRY(MapSharedBufferIntoProcessAddressSpace(std::addressof(map_address), m_buffer_page_group,
@@ -330,7 +308,6 @@ Result SharedBufferManager::CreateSession(Kernel::KProcess* owner_process, u64*
// Create new session.
auto [it, was_emplaced] = m_sessions.emplace(aruid, SharedBufferSession{});
auto& session = it->second;
session.presentation_slot_base = slot_base;
auto& container = m_nvdrv->GetContainer();
session.session_id = container.OpenSession(owner_process);
+44 -40
View File
@@ -7,65 +7,69 @@
#version 460
#ifdef VULKAN
#define BINDING_COLOR_TEXTURE 1
#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
#define BINDING_COLOR_TEXTURE 0
#endif
layout (location = 0) in vec4 posPos;
layout (location = 0) out vec4 frag_color;
layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture;
const float FXAA_SPAN_MAX = 8.0;
const float FXAA_REDUCE_MUL = 1.0 / 8.0;
const float FXAA_REDUCE_MIN = 1.0 / 128.0;
#define FxaaTexLod0(t, p) textureLod(t, p, 0.0)
#define FxaaTexOff(t, p, o) textureLodOffset(t, p, 0.0, o)
vec3 FxaaPixelShader(vec4 posPos, sampler2D tex) {
mat4x3 rgb_matrix = mat4x3(
textureLod(tex, posPos.zw, 0.0).xyz,
textureLodOffset(tex, posPos.zw, 0.0, ivec2(1, 0)).xyz,
textureLodOffset(tex, posPos.zw, 0.0, ivec2(0, 1)).xyz,
textureLodOffset(tex, posPos.zw, 0.0, ivec2(1, 1)).xyz
);
vec3 rgbM = textureLod(tex, posPos.xy, 0.0).xyz;
vec3 rgbNW = FxaaTexLod0(tex, posPos.zw).xyz;
vec3 rgbNE = FxaaTexOff(tex, posPos.zw, ivec2(1,0)).xyz;
vec3 rgbSW = FxaaTexOff(tex, posPos.zw, ivec2(0,1)).xyz;
vec3 rgbSE = FxaaTexOff(tex, posPos.zw, ivec2(1,1)).xyz;
vec3 rgbM = FxaaTexLod0(tex, posPos.xy).xyz;
/*---------------------------------------------------------*/
vec3 luma = vec3(0.299, 0.587, 0.114);
// vec4(dot(m1, l), dot(m2, l), ...) => m * l
vec4 lume_per_rgb = luma * rgb_matrix;
float lumaNW = dot(rgbNW, luma);
float lumaNE = dot(rgbNE, luma);
float lumaSW = dot(rgbSW, luma);
float lumaSE = dot(rgbSE, luma);
float lumaM = dot(rgbM, luma);
float lumaMin = min(lumaM, min(min(lume_per_rgb.x, lume_per_rgb.y), min(lume_per_rgb.z, lume_per_rgb.w)));
float lumaMax = max(lumaM, max(max(lume_per_rgb.x, lume_per_rgb.y), max(lume_per_rgb.z, lume_per_rgb.w)));
vec2 dir = vec2(
-((lume_per_rgb.x + lume_per_rgb.y) - (lume_per_rgb.z + lume_per_rgb.w)),
+((lume_per_rgb.x + lume_per_rgb.z) - (lume_per_rgb.y + lume_per_rgb.w))
);
float rcp_dir_min = 1.0 / (min(abs(dir.x), abs(dir.y)) + max(
(lume_per_rgb.x + lume_per_rgb.y + lume_per_rgb.z + lume_per_rgb.w) * (0.25 * FXAA_REDUCE_MUL),
FXAA_REDUCE_MIN
));
dir = min(
vec2(FXAA_SPAN_MAX),
max(vec2(-FXAA_SPAN_MAX), dir * rcp_dir_min)
);
// Constants (calculating via division is faster)
mat4x2 const_dir = mat4x2(
(1.0 / 3.0 - 0.5) / textureSize(tex, 0),
(2.0 / 3.0 - 0.5) / textureSize(tex, 0),
(0.0 / 3.0 - 0.5) / textureSize(tex, 0),
(3.0 / 3.0 - 0.5) / textureSize(tex, 0)
);
// dir * const_dir[i] => dir * const_dir => vec4
/*---------------------------------------------------------*/
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
/*---------------------------------------------------------*/
vec2 dir;
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
/*---------------------------------------------------------*/
float dirReduce = max(
(lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),
FXAA_REDUCE_MIN);
float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
dir = min(vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
dir * rcpDirMin)) / textureSize(tex, 0);
/*--------------------------------------------------------*/
vec3 rgbA = (1.0 / 2.0) * (
textureLod(tex, fma(dir, const_dir[0], posPos.xy), 0.0).xyz +
textureLod(tex, fma(dir, const_dir[1], posPos.xy), 0.0).xyz
);
vec3 rgbB = fma(rgbA, vec3(1.0 / 2.0), (1.0 / 4.0) * (
textureLod(tex, fma(dir, const_dir[2], posPos.xy), 0.0).xyz +
textureLod(tex, fma(dir, const_dir[3], posPos.xy), 0.0).xyz
));
FxaaTexLod0(tex, posPos.xy + dir * (1.0 / 3.0 - 0.5)).xyz +
FxaaTexLod0(tex, posPos.xy + dir * (2.0 / 3.0 - 0.5)).xyz);
vec3 rgbB = rgbA * (1.0 / 2.0) + (1.0 / 4.0) * (
FxaaTexLod0(tex, posPos.xy + dir * (0.0 / 3.0 - 0.5)).xyz +
FxaaTexLod0(tex, posPos.xy + dir * (3.0 / 3.0 - 0.5)).xyz);
float lumaB = dot(rgbB, luma);
return ((lumaB < lumaMin) || (lumaB > lumaMax)) ? rgbA : rgbB;
if((lumaB < lumaMin) || (lumaB > lumaMax)) return rgbA;
return rgbB;
}
void main() {
frag_color = vec4(FxaaPixelShader(posPos, input_texture), texture(input_texture, posPos.xy).a);
frag_color = vec4(FxaaPixelShader(posPos, input_texture), texture(input_texture, posPos.xy).a);
}
+13 -17
View File
@@ -7,35 +7,31 @@ out gl_PerVertex {
vec4 gl_Position;
};
const vec2 vertices[3] =
vec2[3](vec2(-1,-1), vec2(3,-1), vec2(-1, 3));
layout (location = 0) out vec4 posPos;
#ifdef VULKAN
#define BINDING_COLOR_TEXTURE 0
#define VERTEX_ID gl_VertexIndex
#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
#define BINDING_COLOR_TEXTURE 0
#define VERTEX_ID gl_VertexID
#endif
layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture;
const float FXAA_SUBPIX_SHIFT = 0;
void main() {
// 0b00 -> (-1, -1) 0b01 -> (-1, 3) 0b10 -> (3, -1)
// ((x * 4) - 1) => 3
// :: (v + 1) / 2 => ((x * 4) + 1) / 2
// => (x * 4 + 1) / 2 => x * (4 / 2) + 1 / 2
// :: (v+1)/2 => v/2 + 1/2 => v*(1/2) + (1/2)
gl_Position = vec4(vec2(
float(((VERTEX_ID & 1) << 2) - 1),
float(((VERTEX_ID & 2) << 1) - 1)
), 0.0, 1.0);
posPos = vec2(
float((VERTEX_ID & 1) << 1),
float((VERTEX_ID & 2) << 0)
).xyxy - vec4(
0.0,
0.0,
(0.5 + FXAA_SUBPIX_SHIFT) / textureSize(input_texture, 0)
);
vec2 vertex = vertices[VERTEX_ID];
gl_Position = vec4(vertex, 0.0, 1.0);
vec2 vert_tex_coord = (vertex + 1.0) / 2.0;
posPos.xy = vert_tex_coord;
posPos.zw = vert_tex_coord - (0.5 + FXAA_SUBPIX_SHIFT) / textureSize(input_texture, 0);
}