Android SurfaceView 缩放错误(ThreadedRenderer)
Android SurfaceView scaling error (ThreadedRenderer)
Current device I am working with:
Samsung Galaxy S6 (SM-G920F)
Android 6.0.1
2560 x 1440
我使用 androids 表面视图创建了一个简单的游戏引擎(在单独的线程中连续渲染)。
我 运行 遇到了关于 window 显示指标的问题。我的设备似乎随机将视口缩放了 0.75,这导致屏幕显示不正确。
错误(SRIB_DSS / libEGL),MultiPhoneWindow?
01-10 11:21:06.761 23218-23218/? D/SecWifiDisplayUtil: Metadata value : SecSettings2
01-10 11:21:06.761 23218-23218/? D/ViewRootImpl: #1 mView = com.android.internal.policy.MultiPhoneWindow$MultiPhoneDecorView{ad58a84 I.E...... R.....ID 0,0-0,0}
01-10 11:21:06.761 23218-23248/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
01-10 11:21:06.771 23218-23218/? D/MultiPhoneWindow: performUpdateVisibility, same visibility false
01-10 11:21:06.791 23218-23218/? E/SRIB_DSS_ThreadedRenderer: initialize, mIsDcsEnabledApp=true , with format= -1 scaleFactor=0.75
01-10 11:21:06.791 23218-23218/? D/ThreadedRenderer: SRIB_DCS & DSS android_view_ThreadedRenderer_dcs_initialize Rendering in format=-1, factor=0.750000
01-10 11:21:06.791 23218-23218/? D/libEGL: SRIB_DCS:EGL_DCS_setDcsApp format=-1
01-10 11:21:06.791 23218-23218/? E/libEGL: SRIB_DSS: EGL_DSS_setDssApp factor=0.750000
01-10 11:21:06.811 23218-23248/? D/libEGL: loaded /vendor/lib64/egl/libGLES_mali.so
01-10 11:21:06.821 23218-23248/? D/libEGL: eglInitialize EGLDisplay = 0x7f8f42b178
01-10 11:21:06.821 23218-23248/? I/OpenGLRenderer: Initialized EGL, version 1.4
01-10 11:21:06.821 23218-23248/? D/: ro.exynos.dss isEnabled: 0
01-10 11:21:06.831 23218-23248/? D/mali_winsys: new_window_surface returns 0x3000, [1920x1080]-format:1
01-10 11:21:06.841 23218-23218/? I/System.out: -----SURFACE CHANGED-----
01-10 11:21:06.841 23218-23218/? I/System.out: Width: 1920
01-10 11:21:06.841 23218-23218/? I/System.out: Height: 1080
01-10 11:21:06.841 23218-23218/? I/System.out: x: 1.0, y: 1.0
01-10 11:21:06.861 23218-23218/? D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=2
我已经使用相同的引擎和相同的 phone 创建了一些其他应用程序,但没有缩放错误。我的其他设备 (Moto g XT1032) 没有错误。当我卸载应用程序时,会使用正确的缩放比例,但当我重新启动应用程序时,它会再次缩放 0.75。
没有错误
01-10 11:54:54.461 29397-29397/particlesystem.com.ds.mo.particlesystem D/SecWifiDisplayUtil: Metadata value : SecSettings2
01-10 11:54:54.461 29397-29397/particlesystem.com.ds.mo.particlesystem D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{1ba6bd9 I.E...... R.....ID 0,0-0,0}
01-10 11:54:54.461 29397-29728/particlesystem.com.ds.mo.particlesystem D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
01-10 11:54:54.521 29397-29728/particlesystem.com.ds.mo.particlesystem D/libEGL: loaded /vendor/lib64/egl/libGLES_mali.so
01-10 11:54:54.531 29397-29728/particlesystem.com.ds.mo.particlesystem D/libEGL: eglInitialize EGLDisplay = 0x7f9eb7f178
01-10 11:54:54.531 29397-29728/particlesystem.com.ds.mo.particlesystem I/OpenGLRenderer: Initialized EGL, version 1.4
01-10 11:54:54.531 29397-29728/particlesystem.com.ds.mo.particlesystem D/mali_winsys: new_window_surface returns 0x3000, [2560x1440]-format:1
01-10 11:54:54.551 29397-29397/particlesystem.com.ds.mo.particlesystem I/System.out: -----SURFACE CHANGED-----
01-10 11:54:54.551 29397-29397/particlesystem.com.ds.mo.particlesystem I/System.out: Width: 2560
01-10 11:54:54.551 29397-29397/particlesystem.com.ds.mo.particlesystem I/System.out: Height: 1440
01-10 11:54:54.551 29397-29397/particlesystem.com.ds.mo.particlesystem I/System.out: x: 2.0, y: 2.0
01-10 11:54:54.601 29397-29397/particlesystem.com.ds.mo.particlesystem D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=2
01-10 11:54:54.671 29397-29397/particlesystem.com.ds.mo.particlesystem I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@de6d751 time:18008434
我在表面变化的方法中得到缩放值。
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
System.out.println("-----SURFACE CHANGED-----");
System.out.println("Width: " + width);
System.out.println("Height: " + height);
//Set Viewports
//Get the scale value based on the surface created
scaleX = (float) width / GAME_WIDTH;
scaleY = (float) height / GAME_HEIGHT;
//Round scale to 2.d.p
scaleX = Math.round(scaleX * 100) / 100;
scaleY = Math.round(scaleY * 100) / 100;
System.out.println("x: " + scaleX + ", y: " + scaleY);
resetScaleSwipe();
}
可怕的是我在一周前使用所述引擎发布了我的第一款游戏,我不确定问题是否出在我的设备上。任何帮助都可以,谢谢。
我找到了解决方案
当您将游戏发布到应用商店时,一些三星设备会尝试对其进行优化。默认情况下,输出质量设置为 "Balanced quality",这会将分辨率降低到 75% 并在 60 时限制 fps。
P.S.Math.round() returns 一个整数,因此通过将 100 强制转换或更改为 100f 来确保缩放值是一个浮点数
要解决此问题,您必须下载三星的 game tuner 应用并将质量更改为最高!
Phones affected: Samsung Galaxy series (S6, S6e, S6e+, Note 5)
Current device I am working with:
Samsung Galaxy S6 (SM-G920F)
Android 6.0.1
2560 x 1440
我使用 androids 表面视图创建了一个简单的游戏引擎(在单独的线程中连续渲染)。
我 运行 遇到了关于 window 显示指标的问题。我的设备似乎随机将视口缩放了 0.75,这导致屏幕显示不正确。
错误(SRIB_DSS / libEGL),MultiPhoneWindow?
01-10 11:21:06.761 23218-23218/? D/SecWifiDisplayUtil: Metadata value : SecSettings2
01-10 11:21:06.761 23218-23218/? D/ViewRootImpl: #1 mView = com.android.internal.policy.MultiPhoneWindow$MultiPhoneDecorView{ad58a84 I.E...... R.....ID 0,0-0,0}
01-10 11:21:06.761 23218-23248/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
01-10 11:21:06.771 23218-23218/? D/MultiPhoneWindow: performUpdateVisibility, same visibility false
01-10 11:21:06.791 23218-23218/? E/SRIB_DSS_ThreadedRenderer: initialize, mIsDcsEnabledApp=true , with format= -1 scaleFactor=0.75
01-10 11:21:06.791 23218-23218/? D/ThreadedRenderer: SRIB_DCS & DSS android_view_ThreadedRenderer_dcs_initialize Rendering in format=-1, factor=0.750000
01-10 11:21:06.791 23218-23218/? D/libEGL: SRIB_DCS:EGL_DCS_setDcsApp format=-1
01-10 11:21:06.791 23218-23218/? E/libEGL: SRIB_DSS: EGL_DSS_setDssApp factor=0.750000
01-10 11:21:06.811 23218-23248/? D/libEGL: loaded /vendor/lib64/egl/libGLES_mali.so
01-10 11:21:06.821 23218-23248/? D/libEGL: eglInitialize EGLDisplay = 0x7f8f42b178
01-10 11:21:06.821 23218-23248/? I/OpenGLRenderer: Initialized EGL, version 1.4
01-10 11:21:06.821 23218-23248/? D/: ro.exynos.dss isEnabled: 0
01-10 11:21:06.831 23218-23248/? D/mali_winsys: new_window_surface returns 0x3000, [1920x1080]-format:1
01-10 11:21:06.841 23218-23218/? I/System.out: -----SURFACE CHANGED-----
01-10 11:21:06.841 23218-23218/? I/System.out: Width: 1920
01-10 11:21:06.841 23218-23218/? I/System.out: Height: 1080
01-10 11:21:06.841 23218-23218/? I/System.out: x: 1.0, y: 1.0
01-10 11:21:06.861 23218-23218/? D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=2
我已经使用相同的引擎和相同的 phone 创建了一些其他应用程序,但没有缩放错误。我的其他设备 (Moto g XT1032) 没有错误。当我卸载应用程序时,会使用正确的缩放比例,但当我重新启动应用程序时,它会再次缩放 0.75。
没有错误
01-10 11:54:54.461 29397-29397/particlesystem.com.ds.mo.particlesystem D/SecWifiDisplayUtil: Metadata value : SecSettings2
01-10 11:54:54.461 29397-29397/particlesystem.com.ds.mo.particlesystem D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{1ba6bd9 I.E...... R.....ID 0,0-0,0}
01-10 11:54:54.461 29397-29728/particlesystem.com.ds.mo.particlesystem D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
01-10 11:54:54.521 29397-29728/particlesystem.com.ds.mo.particlesystem D/libEGL: loaded /vendor/lib64/egl/libGLES_mali.so
01-10 11:54:54.531 29397-29728/particlesystem.com.ds.mo.particlesystem D/libEGL: eglInitialize EGLDisplay = 0x7f9eb7f178
01-10 11:54:54.531 29397-29728/particlesystem.com.ds.mo.particlesystem I/OpenGLRenderer: Initialized EGL, version 1.4
01-10 11:54:54.531 29397-29728/particlesystem.com.ds.mo.particlesystem D/mali_winsys: new_window_surface returns 0x3000, [2560x1440]-format:1
01-10 11:54:54.551 29397-29397/particlesystem.com.ds.mo.particlesystem I/System.out: -----SURFACE CHANGED-----
01-10 11:54:54.551 29397-29397/particlesystem.com.ds.mo.particlesystem I/System.out: Width: 2560
01-10 11:54:54.551 29397-29397/particlesystem.com.ds.mo.particlesystem I/System.out: Height: 1440
01-10 11:54:54.551 29397-29397/particlesystem.com.ds.mo.particlesystem I/System.out: x: 2.0, y: 2.0
01-10 11:54:54.601 29397-29397/particlesystem.com.ds.mo.particlesystem D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=2
01-10 11:54:54.671 29397-29397/particlesystem.com.ds.mo.particlesystem I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@de6d751 time:18008434
我在表面变化的方法中得到缩放值。
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
System.out.println("-----SURFACE CHANGED-----");
System.out.println("Width: " + width);
System.out.println("Height: " + height);
//Set Viewports
//Get the scale value based on the surface created
scaleX = (float) width / GAME_WIDTH;
scaleY = (float) height / GAME_HEIGHT;
//Round scale to 2.d.p
scaleX = Math.round(scaleX * 100) / 100;
scaleY = Math.round(scaleY * 100) / 100;
System.out.println("x: " + scaleX + ", y: " + scaleY);
resetScaleSwipe();
}
可怕的是我在一周前使用所述引擎发布了我的第一款游戏,我不确定问题是否出在我的设备上。任何帮助都可以,谢谢。
我找到了解决方案
当您将游戏发布到应用商店时,一些三星设备会尝试对其进行优化。默认情况下,输出质量设置为 "Balanced quality",这会将分辨率降低到 75% 并在 60 时限制 fps。
P.S.Math.round() returns 一个整数,因此通过将 100 强制转换或更改为 100f 来确保缩放值是一个浮点数
要解决此问题,您必须下载三星的 game tuner 应用并将质量更改为最高!
Phones affected: Samsung Galaxy series (S6, S6e, S6e+, Note 5)