mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-07 20:50:58 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3133a53873 | |||
| 74ccea3def |
+1
@@ -83,6 +83,7 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
|
|||||||
SHOW_SHADERS_BUILDING("show_shaders_building"),
|
SHOW_SHADERS_BUILDING("show_shaders_building"),
|
||||||
|
|
||||||
DEBUG_FLUSH_BY_LINE("flush_line"),
|
DEBUG_FLUSH_BY_LINE("flush_line"),
|
||||||
|
EXTENDED_LOGGING("extended_logging"),
|
||||||
DONT_SHOW_DRIVER_SHADER_WARNING("dont_show_driver_shader_warning"),
|
DONT_SHOW_DRIVER_SHADER_WARNING("dont_show_driver_shader_warning"),
|
||||||
ENABLE_OVERLAY("enable_overlay"),
|
ENABLE_OVERLAY("enable_overlay"),
|
||||||
|
|
||||||
|
|||||||
+7
@@ -262,6 +262,13 @@ abstract class SettingsItem(
|
|||||||
descriptionId = R.string.flush_by_line_description
|
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 {
|
val dockedModeSetting = object : AbstractBooleanSetting {
|
||||||
override val key = BooleanSetting.USE_DOCKED_MODE.key
|
override val key = BooleanSetting.USE_DOCKED_MODE.key
|
||||||
|
|||||||
+1
@@ -1323,6 +1323,7 @@ class SettingsFragmentPresenter(
|
|||||||
add(HeaderSetting(R.string.log))
|
add(HeaderSetting(R.string.log))
|
||||||
|
|
||||||
add(BooleanSetting.DEBUG_FLUSH_BY_LINE.key)
|
add(BooleanSetting.DEBUG_FLUSH_BY_LINE.key)
|
||||||
|
add(BooleanSetting.EXTENDED_LOGGING.key)
|
||||||
add(StringSetting.LOG_FILTER.key)
|
add(StringSetting.LOG_FILTER.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -636,6 +636,8 @@
|
|||||||
<string name="log">Logging</string>
|
<string name="log">Logging</string>
|
||||||
<string name="flush_by_line">Flush debug logs by line</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="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">Log filter</string>
|
||||||
<string name="log_filter_description">Controls Eden\'s log categories. Example: *:Info Service.LM:Debug</string>
|
<string name="log_filter_description">Controls Eden\'s log categories. Example: *:Info Service.LM:Debug</string>
|
||||||
|
|
||||||
|
|||||||
@@ -7,69 +7,65 @@
|
|||||||
#version 460
|
#version 460
|
||||||
|
|
||||||
#ifdef VULKAN
|
#ifdef VULKAN
|
||||||
|
|
||||||
#define BINDING_COLOR_TEXTURE 1
|
#define BINDING_COLOR_TEXTURE 1
|
||||||
|
|
||||||
#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
|
#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
|
||||||
|
|
||||||
#define BINDING_COLOR_TEXTURE 0
|
#define BINDING_COLOR_TEXTURE 0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
layout (location = 0) in vec4 posPos;
|
layout (location = 0) in vec4 posPos;
|
||||||
|
|
||||||
layout (location = 0) out vec4 frag_color;
|
layout (location = 0) out vec4 frag_color;
|
||||||
|
|
||||||
layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture;
|
layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture;
|
||||||
|
|
||||||
const float FXAA_SPAN_MAX = 8.0;
|
const float FXAA_SPAN_MAX = 8.0;
|
||||||
const float FXAA_REDUCE_MUL = 1.0 / 8.0;
|
const float FXAA_REDUCE_MUL = 1.0 / 8.0;
|
||||||
const float FXAA_REDUCE_MIN = 1.0 / 128.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) {
|
vec3 FxaaPixelShader(vec4 posPos, sampler2D tex) {
|
||||||
|
mat4x3 rgb_matrix = mat4x3(
|
||||||
vec3 rgbNW = FxaaTexLod0(tex, posPos.zw).xyz;
|
textureLod(tex, posPos.zw, 0.0).xyz,
|
||||||
vec3 rgbNE = FxaaTexOff(tex, posPos.zw, ivec2(1,0)).xyz;
|
textureLodOffset(tex, posPos.zw, 0.0, ivec2(1, 0)).xyz,
|
||||||
vec3 rgbSW = FxaaTexOff(tex, posPos.zw, ivec2(0,1)).xyz;
|
textureLodOffset(tex, posPos.zw, 0.0, ivec2(0, 1)).xyz,
|
||||||
vec3 rgbSE = FxaaTexOff(tex, posPos.zw, ivec2(1,1)).xyz;
|
textureLodOffset(tex, posPos.zw, 0.0, ivec2(1, 1)).xyz
|
||||||
vec3 rgbM = FxaaTexLod0(tex, posPos.xy).xyz;
|
);
|
||||||
/*---------------------------------------------------------*/
|
vec3 rgbM = textureLod(tex, posPos.xy, 0.0).xyz;
|
||||||
vec3 luma = vec3(0.299, 0.587, 0.114);
|
vec3 luma = vec3(0.299, 0.587, 0.114);
|
||||||
float lumaNW = dot(rgbNW, luma);
|
// vec4(dot(m1, l), dot(m2, l), ...) => m * l
|
||||||
float lumaNE = dot(rgbNE, luma);
|
vec4 lume_per_rgb = luma * rgb_matrix;
|
||||||
float lumaSW = dot(rgbSW, luma);
|
|
||||||
float lumaSE = dot(rgbSE, luma);
|
|
||||||
float lumaM = dot(rgbM, 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 lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
float lumaMax = max(lumaM, max(max(lume_per_rgb.x, lume_per_rgb.y), max(lume_per_rgb.z, lume_per_rgb.w)));
|
||||||
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
vec2 dir = vec2(
|
||||||
/*---------------------------------------------------------*/
|
-((lume_per_rgb.x + lume_per_rgb.y) - (lume_per_rgb.z + lume_per_rgb.w)),
|
||||||
vec2 dir;
|
+((lume_per_rgb.x + lume_per_rgb.z) - (lume_per_rgb.y + lume_per_rgb.w))
|
||||||
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
);
|
||||||
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
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),
|
||||||
float dirReduce = max(
|
FXAA_REDUCE_MIN
|
||||||
(lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),
|
));
|
||||||
FXAA_REDUCE_MIN);
|
dir = min(
|
||||||
float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
|
vec2(FXAA_SPAN_MAX),
|
||||||
dir = min(vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
max(vec2(-FXAA_SPAN_MAX), dir * rcp_dir_min)
|
||||||
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
);
|
||||||
dir * rcpDirMin)) / textureSize(tex, 0);
|
// 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
|
||||||
vec3 rgbA = (1.0 / 2.0) * (
|
vec3 rgbA = (1.0 / 2.0) * (
|
||||||
FxaaTexLod0(tex, posPos.xy + dir * (1.0 / 3.0 - 0.5)).xyz +
|
textureLod(tex, fma(dir, const_dir[0], posPos.xy), 0.0).xyz +
|
||||||
FxaaTexLod0(tex, posPos.xy + dir * (2.0 / 3.0 - 0.5)).xyz);
|
textureLod(tex, fma(dir, const_dir[1], posPos.xy), 0.0).xyz
|
||||||
vec3 rgbB = rgbA * (1.0 / 2.0) + (1.0 / 4.0) * (
|
);
|
||||||
FxaaTexLod0(tex, posPos.xy + dir * (0.0 / 3.0 - 0.5)).xyz +
|
vec3 rgbB = fma(rgbA, vec3(1.0 / 2.0), (1.0 / 4.0) * (
|
||||||
FxaaTexLod0(tex, posPos.xy + dir * (3.0 / 3.0 - 0.5)).xyz);
|
textureLod(tex, fma(dir, const_dir[2], posPos.xy), 0.0).xyz +
|
||||||
|
textureLod(tex, fma(dir, const_dir[3], posPos.xy), 0.0).xyz
|
||||||
|
));
|
||||||
float lumaB = dot(rgbB, luma);
|
float lumaB = dot(rgbB, luma);
|
||||||
if((lumaB < lumaMin) || (lumaB > lumaMax)) return rgbA;
|
return ((lumaB < lumaMin) || (lumaB > lumaMax)) ? rgbA : rgbB;
|
||||||
return rgbB;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,31 +7,35 @@ out gl_PerVertex {
|
|||||||
vec4 gl_Position;
|
vec4 gl_Position;
|
||||||
};
|
};
|
||||||
|
|
||||||
const vec2 vertices[3] =
|
|
||||||
vec2[3](vec2(-1,-1), vec2(3,-1), vec2(-1, 3));
|
|
||||||
|
|
||||||
layout (location = 0) out vec4 posPos;
|
layout (location = 0) out vec4 posPos;
|
||||||
|
|
||||||
#ifdef VULKAN
|
#ifdef VULKAN
|
||||||
|
|
||||||
#define BINDING_COLOR_TEXTURE 0
|
#define BINDING_COLOR_TEXTURE 0
|
||||||
#define VERTEX_ID gl_VertexIndex
|
#define VERTEX_ID gl_VertexIndex
|
||||||
|
|
||||||
#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
|
#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
|
||||||
|
|
||||||
#define BINDING_COLOR_TEXTURE 0
|
#define BINDING_COLOR_TEXTURE 0
|
||||||
#define VERTEX_ID gl_VertexID
|
#define VERTEX_ID gl_VertexID
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture;
|
layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture;
|
||||||
|
|
||||||
const float FXAA_SUBPIX_SHIFT = 0;
|
const float FXAA_SUBPIX_SHIFT = 0;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec2 vertex = vertices[VERTEX_ID];
|
// 0b00 -> (-1, -1) 0b01 -> (-1, 3) 0b10 -> (3, -1)
|
||||||
gl_Position = vec4(vertex, 0.0, 1.0);
|
// ((x * 4) - 1) => 3
|
||||||
vec2 vert_tex_coord = (vertex + 1.0) / 2.0;
|
// :: (v + 1) / 2 => ((x * 4) + 1) / 2
|
||||||
posPos.xy = vert_tex_coord;
|
// => (x * 4 + 1) / 2 => x * (4 / 2) + 1 / 2
|
||||||
posPos.zw = vert_tex_coord - (0.5 + FXAA_SUBPIX_SHIFT) / textureSize(input_texture, 0);
|
// :: (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)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user