4 Комити ec2e6dfdac ... 1a0d98f984

Аутор SHA1 Порука Датум
  lui 1a0d98f984 renderer: add area sampling scaling method (#57) пре 2 недеља
  spectranator eefc75732f ALL development is happening on dark git now :-) пре 2 недеља
  lui d6ca4f11c1 profile_manager: Implement firmware avatar selector (#56) пре 2 недеља
  echosys ab4c093976 Fix Android crash caused by incorrect type in progress dialog callbacks (#58) пре 2 недеља

+ 1 - 1
README.md

@@ -59,7 +59,7 @@ A secondary goal is the improvement of usability on low-end systems. This includ
 
 ## Development
 
-Most of the development happens on [Dark Git](http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/). It's also where [our central repository](http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu) is hosted.
+All development happens on [Dark Git](http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/). It's also where [our central repository](http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu) is hosted.
 
 To clone this git repository, you can use these commands given tor is installed and running:
 

+ 6 - 6
src/android/app/src/main/jni/native.cpp

@@ -459,8 +459,8 @@ int Java_org_yuzu_yuzu_1emu_NativeLibrary_installFileToNand(JNIEnv* env, jobject
         jlambdaClass, "invoke", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
     const auto callback = [env, jcallback, jlambdaInvokeMethod](size_t max, size_t progress) {
         auto jwasCancelled = env->CallObjectMethod(jcallback, jlambdaInvokeMethod,
-                                                   Common::Android::ToJDouble(env, max),
-                                                   Common::Android::ToJDouble(env, progress));
+                                                   Common::Android::ToJLong(env, max),
+                                                   Common::Android::ToJLong(env, progress));
         return Common::Android::GetJBoolean(env, jwasCancelled);
     };
 
@@ -791,8 +791,8 @@ jobjectArray Java_org_yuzu_yuzu_1emu_NativeLibrary_verifyInstalledContents(JNIEn
         jlambdaClass, "invoke", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
     const auto callback = [env, jcallback, jlambdaInvokeMethod](size_t max, size_t progress) {
         auto jwasCancelled = env->CallObjectMethod(jcallback, jlambdaInvokeMethod,
-                                                   Common::Android::ToJDouble(env, max),
-                                                   Common::Android::ToJDouble(env, progress));
+                                                   Common::Android::ToJLong(env, max),
+                                                   Common::Android::ToJLong(env, progress));
         return Common::Android::GetJBoolean(env, jwasCancelled);
     };
 
@@ -814,8 +814,8 @@ jint Java_org_yuzu_yuzu_1emu_NativeLibrary_verifyGameContents(JNIEnv* env, jobje
         jlambdaClass, "invoke", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
     const auto callback = [env, jcallback, jlambdaInvokeMethod](size_t max, size_t progress) {
         auto jwasCancelled = env->CallObjectMethod(jcallback, jlambdaInvokeMethod,
-                                                   Common::Android::ToJDouble(env, max),
-                                                   Common::Android::ToJDouble(env, progress));
+                                                   Common::Android::ToJLong(env, max),
+                                                   Common::Android::ToJLong(env, progress));
         return Common::Android::GetJBoolean(env, jwasCancelled);
     };
     auto& session = EmulationSession::GetInstance();

+ 8 - 0
src/common/android/android_common.cpp

@@ -54,6 +54,14 @@ jobject ToJInteger(JNIEnv* env, s32 value) {
     return env->NewObject(GetIntegerClass(), GetIntegerConstructor(), value);
 }
 
+s64 GetJLong(JNIEnv* env, jobject jlong) {
+    return env->GetLongField(jlong, GetIntegerValueField());
+}
+
+jobject ToJLong(JNIEnv* env, s64 value) {
+    return env->NewObject(GetLongClass(), GetLongConstructor(), value);
+}
+
 bool GetJBoolean(JNIEnv* env, jobject jboolean) {
     return env->GetBooleanField(jboolean, GetBooleanValueField());
 }

+ 3 - 0
src/common/android/android_common.h

@@ -20,6 +20,9 @@ jobject ToJDouble(JNIEnv* env, double value);
 s32 GetJInteger(JNIEnv* env, jobject jinteger);
 jobject ToJInteger(JNIEnv* env, s32 value);
 
+s64 GetJLong(JNIEnv* env, jobject jlong);
+jobject ToJLong(JNIEnv* env, s64 value);
+
 bool GetJBoolean(JNIEnv* env, jobject jboolean);
 jobject ToJBoolean(JNIEnv* env, bool value);
 

+ 22 - 0
src/common/android/id_cache.cpp

@@ -61,6 +61,10 @@ static jclass s_integer_class;
 static jmethodID s_integer_constructor;
 static jfieldID s_integer_value_field;
 
+static jclass s_long_class;
+static jmethodID s_long_constructor;
+static jfieldID s_long_value_field;
+
 static jclass s_boolean_class;
 static jmethodID s_boolean_constructor;
 static jfieldID s_boolean_value_field;
@@ -288,6 +292,18 @@ jfieldID GetIntegerValueField() {
     return s_integer_value_field;
 }
 
+jclass GetLongClass() {
+    return s_long_class;
+}
+
+jmethodID GetLongConstructor() {
+    return s_long_constructor;
+}
+
+jfieldID GetLongValueField() {
+    return s_long_value_field;
+}
+
 jclass GetBooleanClass() {
     return s_boolean_class;
 }
@@ -493,6 +509,12 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) {
     s_integer_value_field = env->GetFieldID(int_class, "value", "I");
     env->DeleteLocalRef(int_class);
 
+    const jclass long_class = env->FindClass("java/lang/Long");
+    s_long_class = reinterpret_cast<jclass>(env->NewGlobalRef(long_class));
+    s_long_constructor = env->GetMethodID(long_class, "<init>", "(J)V");
+    s_long_value_field = env->GetFieldID(long_class, "value", "J");
+    env->DeleteLocalRef(long_class);
+
     const jclass boolean_class = env->FindClass("java/lang/Boolean");
     s_boolean_class = reinterpret_cast<jclass>(env->NewGlobalRef(boolean_class));
     s_boolean_constructor = env->GetMethodID(boolean_class, "<init>", "(Z)V");

+ 4 - 0
src/common/android/id_cache.h

@@ -81,6 +81,10 @@ jclass GetIntegerClass();
 jmethodID GetIntegerConstructor();
 jfieldID GetIntegerValueField();
 
+jclass GetLongClass();
+jmethodID GetLongConstructor();
+jfieldID GetLongValueField();
+
 jclass GetBooleanClass();
 jmethodID GetBooleanConstructor();
 jfieldID GetBooleanValueField();

+ 1 - 1
src/common/settings_enums.h

@@ -145,7 +145,7 @@ ENUM(NvdecEmulation, Off, Cpu, Gpu);
 ENUM(ResolutionSetup, Res1_2X, Res3_4X, Res1X, Res3_2X, Res2X, Res3X, Res4X, Res5X, Res6X, Res7X,
      Res8X);
 
-ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, ScaleForce, Fsr, MaxEnum);
+ENUM(ScalingFilter, NearestNeighbor, Bilinear, Bicubic, Gaussian, ScaleForce, Fsr, Area, MaxEnum);
 
 ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum);
 

+ 1 - 0
src/video_core/host_shaders/CMakeLists.txt

@@ -41,6 +41,7 @@ set(SHADER_FILES
     opengl_present_scaleforce.frag
     opengl_smaa.glsl
     pitch_unswizzle.comp
+    present_area.frag
     present_bicubic.frag
     present_gaussian.frag
     queries_prefix_scan_sum.comp

+ 107 - 0
src/video_core/host_shaders/present_area.frag

@@ -0,0 +1,107 @@
+#version 460 core
+
+layout(location = 0) in vec2 frag_tex_coord;
+layout(location = 0) out vec4 color;
+layout(binding = 0) uniform sampler2D color_texture;
+
+#ifdef VULKAN
+
+struct ScreenRectVertex {
+    vec2 position;
+    vec2 tex_coord;
+};
+layout (push_constant) uniform PushConstants {
+    mat4 modelview_matrix;
+    ScreenRectVertex vertices[4];
+};
+
+#else // OpenGL
+
+layout(location = 1) uniform uvec2 screen_size;
+
+#endif
+
+/***** Area Sampling *****/
+
+// By Sam Belliveau and Filippo Tarpini. Public Domain license.
+// Effectively a more accurate sharp bilinear filter when upscaling,
+// that also works as a mathematically perfect downscale filter.
+// https://entropymine.com/imageworsener/pixelmixing/
+// https://github.com/obsproject/obs-studio/pull/1715
+// https://legacy.imagemagick.org/Usage/filter/
+vec4 AreaSampling(sampler2D textureSampler, vec2 texCoords, vec2 source_size, vec2 target_size) {
+    // Determine the sizes of the source and target images.
+    vec2 inverted_target_size = vec2(1.0) / target_size;
+
+    // Determine the range of the source image that the target pixel will cover.
+    vec2 range = source_size * inverted_target_size;
+    vec2 beg = (texCoords.xy * source_size) - (range * 0.5);
+    vec2 end = beg + range;
+
+    // Compute the top-left and bottom-right corners of the pixel box.
+    ivec2 f_beg = ivec2(floor(beg));
+    ivec2 f_end = ivec2(floor(end));
+
+    // Compute how much of the start and end pixels are covered horizontally & vertically.
+    float area_w = 1.0 - fract(beg.x);
+    float area_n = 1.0 - fract(beg.y);
+    float area_e = fract(end.x);
+    float area_s = fract(end.y);
+
+    // Compute the areas of the corner pixels in the pixel box.
+    float area_nw = area_n * area_w;
+    float area_ne = area_n * area_e;
+    float area_sw = area_s * area_w;
+    float area_se = area_s * area_e;
+
+    // Initialize the color accumulator.
+    vec4 avg_color = vec4(0.0, 0.0, 0.0, 0.0);
+
+    // Accumulate corner pixels.
+    avg_color += area_nw * texelFetch(textureSampler, ivec2(f_beg.x, f_beg.y), 0);
+    avg_color += area_ne * texelFetch(textureSampler, ivec2(f_end.x, f_beg.y), 0);
+    avg_color += area_sw * texelFetch(textureSampler, ivec2(f_beg.x, f_end.y), 0);
+    avg_color += area_se * texelFetch(textureSampler, ivec2(f_end.x, f_end.y), 0);
+
+    // Determine the size of the pixel box.
+    int x_range = int(f_end.x - f_beg.x - 0.5);
+    int y_range = int(f_end.y - f_beg.y - 0.5);
+
+    // Accumulate top and bottom edge pixels.
+    for (int x = f_beg.x + 1; x <= f_beg.x + x_range; ++x) {
+        avg_color += area_n * texelFetch(textureSampler, ivec2(x, f_beg.y), 0);
+        avg_color += area_s * texelFetch(textureSampler, ivec2(x, f_end.y), 0);
+    }
+
+    // Accumulate left and right edge pixels and all the pixels in between.
+    for (int y = f_beg.y + 1; y <= f_beg.y + y_range; ++y) {
+        avg_color += area_w * texelFetch(textureSampler, ivec2(f_beg.x, y), 0);
+        avg_color += area_e * texelFetch(textureSampler, ivec2(f_end.x, y), 0);
+
+        for (int x = f_beg.x + 1; x <= f_beg.x + x_range; ++x) {
+            avg_color += texelFetch(textureSampler, ivec2(x, y), 0);
+        }
+    }
+
+    // Compute the area of the pixel box that was sampled.
+    float area_corners = area_nw + area_ne + area_sw + area_se;
+    float area_edges = float(x_range) * (area_n + area_s) + float(y_range) * (area_w + area_e);
+    float area_center = float(x_range) * float(y_range);
+
+    // Return the normalized average color.
+    return avg_color / (area_corners + area_edges + area_center);
+}
+
+void main() {
+    vec2 source_image_size = textureSize(color_texture, 0);
+    vec2 window_size;
+
+    #ifdef VULKAN
+    window_size.x = vertices[1].position.x - vertices[0].position.x;
+    window_size.y = vertices[2].position.y - vertices[0].position.y;
+    #else // OpenGL
+    window_size = screen_size;
+    #endif
+
+    color = AreaSampling(color_texture, frag_tex_coord, source_image_size, window_size);
+}

+ 0 - 0
src/video_core/renderer_opengl/gl_blit_screen.cpp


Неке датотеке нису приказане због велике количине промена