mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-08 05:02:40 +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"),
|
||||
|
||||
DEBUG_FLUSH_BY_LINE("flush_line"),
|
||||
EXTENDED_LOGGING("extended_logging"),
|
||||
DONT_SHOW_DRIVER_SHADER_WARNING("dont_show_driver_shader_warning"),
|
||||
ENABLE_OVERLAY("enable_overlay"),
|
||||
|
||||
|
||||
+7
@@ -262,6 +262,13 @@ 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
|
||||
|
||||
+1
@@ -1323,6 +1323,7 @@ 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,6 +636,8 @@
|
||||
<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>
|
||||
|
||||
|
||||
@@ -321,6 +321,8 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit,
|
||||
uni_env.PadCodeMem();
|
||||
jit_env.modified_memory.clear();
|
||||
uni_env.modified_memory.clear();
|
||||
jit_env.interrupts.clear();
|
||||
uni_env.interrupts.clear();
|
||||
|
||||
jit.Regs() = regs;
|
||||
jit.ExtRegs() = vecs;
|
||||
|
||||
@@ -176,6 +176,8 @@ static void RunTestInstance(Dynarmic::A64::Jit& jit, A64Unicorn& uni, A64TestEnv
|
||||
uni_env.code_mem_start_address = instructions_start;
|
||||
jit_env.modified_memory.clear();
|
||||
uni_env.modified_memory.clear();
|
||||
jit_env.interrupts.clear();
|
||||
uni_env.interrupts.clear();
|
||||
|
||||
const u64 initial_sp = RandInt<u64>(0x30'0000'0000, 0x40'0000'0000) * 4;
|
||||
|
||||
|
||||
@@ -282,17 +282,20 @@ int main(int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* const hex_instruction = [s = argv[2]] {
|
||||
if (strlen(s) > 2 && s[0] == '0' && s[1] == 'x')
|
||||
return s + 2;
|
||||
return s;
|
||||
const char* const hex_instruction = [argv] {
|
||||
if (strlen(argv[2]) > 2 && argv[2][0] == '0' && argv[2][1] == 'x') {
|
||||
return argv[2] + 2;
|
||||
}
|
||||
return argv[2];
|
||||
}();
|
||||
|
||||
if (strlen(hex_instruction) > 8) {
|
||||
fmt::print("hex string too long\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const u32 instruction = strtol(hex_instruction, nullptr, 16);
|
||||
|
||||
if (strcmp(argv[1], "a32") == 0) {
|
||||
PrintA32Instruction(instruction);
|
||||
} else if (strcmp(argv[1], "a64") == 0) {
|
||||
@@ -303,11 +306,13 @@ int main(int argc, char** argv) {
|
||||
fmt::print("Invalid mode: {}\nValid values: a32, a64, thumb\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
if (strcmp(argv[3], "-exec") != 0) {
|
||||
fmt::print("Invalid option {}\n", argv[3]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "a32") == 0) {
|
||||
ExecuteA32Instruction(instruction);
|
||||
} else {
|
||||
@@ -315,5 +320,6 @@ int main(int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -354,8 +354,6 @@ u32 GenRandomA64Inst(u64 pc, bool is_last_inst) {
|
||||
"MSR_reg",
|
||||
"MSR_imm",
|
||||
"MRS",
|
||||
// generates F16
|
||||
"FCADD_vec",
|
||||
};
|
||||
|
||||
for (const auto& [fn, bitstring] : list) {
|
||||
@@ -442,6 +440,7 @@ void RunTestInstance(Dynarmic::A32::Jit& jit,
|
||||
std::copy(instructions.begin(), instructions.end(), jit_env.code_mem.begin() + num_words);
|
||||
jit_env.PadCodeMem();
|
||||
jit_env.modified_memory.clear();
|
||||
jit_env.interrupts.clear();
|
||||
|
||||
jit.Regs() = regs;
|
||||
jit.ExtRegs() = vecs;
|
||||
@@ -511,6 +510,7 @@ void RunTestInstance(Dynarmic::A64::Jit& jit,
|
||||
jit_env.code_mem.emplace_back(0x14000000); // B .
|
||||
jit_env.code_mem_start_address = start_address;
|
||||
jit_env.modified_memory.clear();
|
||||
jit_env.interrupts.clear();
|
||||
|
||||
jit.SetRegisters(regs);
|
||||
jit.SetVectors(vecs);
|
||||
@@ -536,52 +536,36 @@ void RunTestInstance(Dynarmic::A64::Jit& jit,
|
||||
fmt::print("initial_regs:");
|
||||
for (u64 i : regs)
|
||||
fmt::print(" {:016x}", i);
|
||||
fmt::print(
|
||||
"\n"
|
||||
"initial_vecs:"
|
||||
);
|
||||
fmt::print("\n");
|
||||
fmt::print("initial_vecs:");
|
||||
for (auto i : vecs)
|
||||
fmt::print(" {:016x}:{:016x}", i[0], i[1]);
|
||||
fmt::print(
|
||||
"\n"
|
||||
"initial_sp: {:016x}\n"
|
||||
"initial_pstate: {:08x}\n"
|
||||
"initial_fpcr: {:08x}\n"
|
||||
"final_regs:"
|
||||
, initial_sp
|
||||
, pstate
|
||||
, fpcr
|
||||
);
|
||||
fmt::print("\n");
|
||||
fmt::print("initial_sp: {:016x}\n", initial_sp);
|
||||
fmt::print("initial_pstate: {:08x}\n", pstate);
|
||||
fmt::print("initial_fpcr: {:08x}\n", fpcr);
|
||||
fmt::print("final_regs:");
|
||||
for (u64 i : jit.GetRegisters())
|
||||
fmt::print(" {:016x}", i);
|
||||
fmt::print(
|
||||
"\n"
|
||||
"final_vecs:"
|
||||
);
|
||||
fmt::print("\n");
|
||||
fmt::print("final_vecs:");
|
||||
for (auto i : jit.GetVectors())
|
||||
fmt::print(" {:016x}:{:016x}", i[0], i[1]);
|
||||
fmt::print(
|
||||
"\n"
|
||||
"final_sp: {:016x}\n"
|
||||
"final_pc: {:016x}\n"
|
||||
"final_pstate: {:08x}\n"
|
||||
"final_fpcr: {:08x}\n"
|
||||
"final_qc : {}\n"
|
||||
"mod_mem:"
|
||||
, jit.GetSP()
|
||||
, jit.GetPC()
|
||||
, jit.GetPstate()
|
||||
, jit.GetFpcr()
|
||||
, FP::FPSR{jit.GetFpsr()}.QC()
|
||||
);
|
||||
fmt::print("\n");
|
||||
fmt::print("final_sp: {:016x}\n", jit.GetSP());
|
||||
fmt::print("final_pc: {:016x}\n", jit.GetPC());
|
||||
fmt::print("final_pstate: {:08x}\n", jit.GetPstate());
|
||||
fmt::print("final_fpcr: {:08x}\n", jit.GetFpcr());
|
||||
fmt::print("final_qc : {}\n", FP::FPSR{jit.GetFpsr()}.QC());
|
||||
fmt::print("mod_mem:");
|
||||
for (auto [addr, value] : jit_env.modified_memory)
|
||||
fmt::print(" {:08x}:{:02x}", addr, value);
|
||||
fmt::print(
|
||||
"\n"
|
||||
"===\n"
|
||||
"{}"
|
||||
, jit.Disassemble()
|
||||
);
|
||||
fmt::print("\n");
|
||||
fmt::print("interrupts:\n");
|
||||
for (const auto& i : jit_env.interrupts)
|
||||
std::puts(i.c_str());
|
||||
fmt::print("===\n");
|
||||
fmt::print("{}", jit.Disassemble());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ void RunTestInstance(Dynarmic::A32::Jit& jit,
|
||||
std::copy(instructions.begin(), instructions.end(), jit_env.code_mem.begin() + num_words);
|
||||
jit_env.PadCodeMem();
|
||||
jit_env.modified_memory.clear();
|
||||
jit_env.interrupts.clear();
|
||||
|
||||
jit.Regs() = regs;
|
||||
jit.ExtRegs() = vecs;
|
||||
@@ -191,6 +192,7 @@ void RunTestInstance(A64::Jit& jit,
|
||||
jit_env.code_mem.emplace_back(0x14000000); // B .
|
||||
jit_env.code_mem_start_address = start_address;
|
||||
jit_env.modified_memory.clear();
|
||||
jit_env.interrupts.clear();
|
||||
|
||||
jit.SetRegisters(regs);
|
||||
jit.SetVectors(vecs);
|
||||
|
||||
@@ -7,69 +7,65 @@
|
||||
#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) {
|
||||
|
||||
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;
|
||||
/*---------------------------------------------------------*/
|
||||
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 luma = vec3(0.299, 0.587, 0.114);
|
||||
float lumaNW = dot(rgbNW, luma);
|
||||
float lumaNE = dot(rgbNE, luma);
|
||||
float lumaSW = dot(rgbSW, luma);
|
||||
float lumaSE = dot(rgbSE, luma);
|
||||
// vec4(dot(m1, l), dot(m2, l), ...) => m * l
|
||||
vec4 lume_per_rgb = luma * rgb_matrix;
|
||||
float lumaM = dot(rgbM, luma);
|
||||
/*---------------------------------------------------------*/
|
||||
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);
|
||||
/*--------------------------------------------------------*/
|
||||
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
|
||||
vec3 rgbA = (1.0 / 2.0) * (
|
||||
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);
|
||||
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
|
||||
));
|
||||
float lumaB = dot(rgbB, luma);
|
||||
if((lumaB < lumaMin) || (lumaB > lumaMax)) return rgbA;
|
||||
return rgbB;
|
||||
return ((lumaB < lumaMin) || (lumaB > lumaMax)) ? rgbA : 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);
|
||||
}
|
||||
|
||||
@@ -7,31 +7,35 @@ 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() {
|
||||
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);
|
||||
// 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)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user