termux-user-repository / tur

A place for all types of Termux packages.
Other
416 stars 81 forks source link

[Bug]: Blender crash when attempting to use with virglrenderer-android #513

Closed robertkirkman closed 1 year ago

robertkirkman commented 1 year ago

Problem description

blender works when using with llvmpipe, but attempting to use with GALLIUM_DRIVER=virpipe to render Eevee with system GPU results in Segmentation fault, despite glxgears and glmark2 not crashing.

Only thing that appears within termux-x11 before crash: image

stdout + stderr

``` EGL major/minor: 1.4 EGL version: 1.4 Android META-EGL EGL vendor: Android EGL extensions: EGL_ANDROID_front_buffer_auto_refresh EGL_ANDROID_get_frame_timestamps EGL_ANDROID_get_native_client_buffer EGL_ANDROID_presentation_time EGL_EXT_surface_CTA861_3_metadata EGL_EXT_surface_SMPTE2086_metadata EGL_KHR_get_all_proc_addresses EGL_KHR_swap_buffers_with_damage EGL_ANDROID_image_native_buffer EGL_ANDROID_native_fence_sync EGL_ANDROID_recordable EGL_EXT_create_context_robustness EGL_EXT_image_gl_colorspace EGL_EXT_pixel_format_float EGL_EXT_protected_content EGL_IMG_context_priority EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_fence_sync EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_mutable_render_buffer EGL_KHR_no_config_context EGL_KHR_partial_update EGL_KHR_surfaceless_context EGL_KHR_wait_sync gl_version 32 - es profile enabled vtest_client_dispatch_commands: client context created. GLSL feature level 430 GLSL feature level 430 Mesa: error: GL_INVALID_ENUM in glGetIntegerv(pname=GL_MAX_FRAGMENT_UNIFORM_BLOCKS) Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_anim_bvh' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_curve_svg' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_mesh_ply' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_mesh_stl' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_mesh_uv_layout' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_scene_fbx' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_scene_gltf2' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_scene_obj' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_scene_x3d' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'pose_library' Writing: /data/data/com.termux/files/usr/tmp/blender.crash.txt client failed: VTEST_CLIENT_ERROR_INPUT_READ Segmentation fault ```

blender.crash.txt

``` # Blender 3.6.0, Commit date: 2023-04-29 01:31, Hash d145dfdae010 # backtrace # Python backtrace ```

What steps will reproduce the bug?

  1. Download "termux-companion packages" and "termux-x11-universal-debug" archives from termux-x11 GitHub Actions
  2. unzip termux-companion\ packages.zip
    unzip termux-x11-universal-debug.zip
    pkg install x11-repo tur-repo
    pkg install ./termux-x11-nightly-1.02.12-0-all.deb
    pkg install virglrenderer-android xfce xwayland xorg-server-xvfb blender
    echo "allow-external-apps = true" >> ~/.termux/termux.properties
    termux-reload-settings
  3. Go to a SurfaceFlinger File Browser and touch app-universal-debug.apk to install SurfaceFlinger component of termux-x11, then launch it
  4. MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 virgl_test_server_android &
    termux-x11 :0 &
    DISPLAY=:0 MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_EXTENSION_OVERRIDE=GL_EXT_polygon_offset_clamp GALLIUM_DRIVER=virpipe dbus-launch --exit-with-session startxfce4 &
    DISPLAY=:0 MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_EXTENSION_OVERRIDE=GL_EXT_polygon_offset_clamp GALLIUM_DRIVER=virpipe blender

What is the expected behavior?

Blender Eevee being able to use OpenGL to surpass the extremely slow llvmpipe performance of the modeling viewport

System information

termux-info:

Termux Variables:
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=8940
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main/ stable main
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
# x11-repo (sources.list.d/x11.list)
deb https://packages-cf.termux.dev/apt/termux-x11/ x11 main
Updatable packages:
All packages up to date
termux-tools version:
1.38.3
Android version:
13
Kernel build information:
Linux localhost 4.4.302-g051e3314 #1 SMP PREEMPT Tue Apr 11 14:48:25 UTC 2023 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-G955F
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.x11 versionCode:13
IntinteDAO commented 1 year ago

Is it working without parameters like: MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_EXTENSION_OVERRIDE=GL_EXT_polygon_offset_clamp

?

robertkirkman commented 1 year ago

Is it working without parameters like: MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_GLES_VERSION_OVERRIDE=3.2 MESA_NO_ERROR=1 MESA_GL_VERSION_OVERRIDE=4.3COMPAT MESA_EXTENSION_OVERRIDE=GL_EXT_polygon_offset_clamp

?

No. If I use

virgl_test_server_android &
termux-x11 :0 &
DISPLAY=:0 dbus-launch --exit-with-session startxfce4 &
DISPLAY=:0 GALLIUM_DRIVER=virpipe blender

I see

EGL major/minor: 1.4
EGL version: 1.4 Android META-EGL
EGL vendor: Android
EGL extensions: EGL_ANDROID_front_buffer_auto_refresh EGL_ANDROID_get_frame_timestamps EGL_ANDROID_get_native_client_buffer EGL_ANDROID_presentation_time EGL_EXT_surface_CTA861_3_metadata EGL_EXT_surface_SMPTE2086_metadata EGL_KHR_get_all_proc_addresses EGL_KHR_swap_buffers_with_damage EGL_ANDROID_image_native_buffer EGL_ANDROID_native_fence_sync EGL_ANDROID_recordable EGL_EXT_create_context_robustness EGL_EXT_image_gl_colorspace EGL_EXT_pixel_format_float EGL_EXT_protected_content EGL_IMG_context_priority EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_fence_sync EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_mutable_render_buffer EGL_KHR_no_config_context EGL_KHR_partial_update EGL_KHR_surfaceless_context EGL_KHR_wait_sync 
gl_version 32 - es profile enabled
vtest_client_dispatch_commands: client context created.
GLSL feature level 430
GLSL feature level 430
Error! Unsupported graphics card or driver.
A graphics card and driver with support for OpenGL 3.3 or higher is required.
The program will now close.
client failed: VTEST_CLIENT_ERROR_INPUT_READ
licy183 commented 1 year ago

This is not a bug. Overriding GL version using environment variables will definitely cause problems and I don't think it is possible to fix it either.

IntinteDAO commented 1 year ago

Well, I run with your command to override GL version and it works for me, except I don't have any fonts and I think the Window doesn't look like it should.

robertkirkman commented 1 year ago

Well, I run with your command to override GL version and it works for me, except I don't have any fonts and I think the Window doesn't look like it should.

what exact device model and version of Android do you have so I can try to make my environment closer to your device for a workaround?

IntinteDAO commented 1 year ago

Motorola G100, Stock ROM Android 12 Termux X11 as a X11 Server

robertkirkman commented 1 year ago

Motorola G100, Stock ROM Android 12 Termux X11 as a X11 Server

I noticed that has Adreno GPU, so I tried an Adreno GPU device (SM-G960U) and I see the same result you do and my viewport performance is much better than llvmpipe, but like you said now there are artifacts instead of an instant crash.

image

robertkirkman commented 1 year ago

Seeing that the new mesa-vulkan-icd-freedreno and mesa-zink packages allow glmark2 to work on this Adreno 630 device with GALLIUM_DRIVER=zink as well, I tried Blender on zink like this:

pkg install mesa-vulkan-icd-freedreno mesa-zink
termux-x11 :0 &
DISPLAY=:0 dbus-launch --exit-with-session startxfce4 &
DISPLAY=:0 MESA_GL_VERSION_OVERRIDE=4.3COMPAT GALLIUM_DRIVER=zink blender
But this produced a large error and another crash

``` Read prefs: "/data/data/com.termux/files/home/.config/blender/3.6/config/userpref.blend" WARNING: Some incorrect rendering might occur because the selected Vulkan device (Adreno (TM) 630) doesn't support base Zink requirements: feats.features.logicOp have_EXT_custom_border_color have_EXT_line_rasterization Warning: Could not find a matching GPU name. Things may not behave as expected. Detected OpenGL configuration: Vendor: Collabora Ltd Renderer: zink (Adreno (TM) 630) Mesa: User error: GL_INVALID_ENUM in glDisable(GL_RASTERIZER_DISCARD) Mesa: User error: GL_INVALID_ENUM in glDisable(GL_RASTERIZER_DISCARD) Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_anim_bvh' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_curve_svg' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_mesh_ply' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_mesh_stl' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_mesh_uv_layout' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_scene_fbx' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_scene_gltf2' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_scene_obj' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'io_scene_x3d' Traceback (most recent call last): File "/data/data/com.termux/files/usr/share/blender/3.6/scripts/modules/addon_utils.py", line 333, in enable mod = __import__(module_name) ^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'pose_library' ERROR (gpu.shader): gpu_shader_2D_widget_base VertShader: | 1 | #version 430 | | Error: invalid xfb_buffer specified 0 is larger than MAX_TRANSFORM_FEEDBACK_BUFFERS - 1 (-1). | 2 | #extension GL_ARB_texture_gather: enable | | Error: `lineWidth' undeclared | Error: value of type float cannot be assigned to variable of type error | 31 | #define depth2DMS sampler2DMS | | Error: `lineWidth' undeclared | 30 | #define depth2DArray sampler2DArray | | Error: operands to arithmetic operators must be numeric | 20 | | | Error: cannot construct `vec2' from a non-numeric data type | 36 | | | `emboss_ofs' used uninitialized | `emboss_ofs' used uninitialized | 2 | #extension GL_ARB_texture_gather: enable | | Error: `uvInterp' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `outRectSize' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `outRoundCorners' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | 12 | #define GPU_ARB_texture_cube_map_array | | Error: `uvInterp' undeclared | 23 | # define textureLod_cubemapArray(tex, co, lod) textureLod(tex, co, lod) | | Error: `outRectSize' undeclared | 12 | #define GPU_ARB_texture_cube_map_array | | Error: operands to arithmetic operators must be numeric | 56 | bool is_zero(vec4 A) | | `uv' used uninitialized | 63 | #define GPU_OPENGL | | `uv' used uninitialized | 2 | #extension GL_ARB_texture_gather: enable | | Error: `innerColor' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `butCo' undeclared | 10 | #define GPU_ARB_gpu_shader5 | | `uv' used uninitialized | 2 | #extension GL_ARB_texture_gather: enable | | Error: value of type float cannot be assigned to variable of type error | Error: `innerColor' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `butCo' undeclared | 15 | #extension GL_ARB_shading_language_420pack: enable | | `uv' used uninitialized | 2 | #extension GL_ARB_texture_gather: enable | | Error: value of type float cannot be assigned to variable of type error | Error: `borderColor' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `embossColor' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `outRectSize' undeclared | 16 | #define gpu_InstanceIndex (gl_InstanceID + gpu_BaseInstance) | | Error: `uvInterp' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | 2 | #extension GL_ARB_texture_gather: enable | | Error: `outRoundCorners' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: `outRectSize' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `outRoundCorners' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `outRectSize' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `outRoundCorners' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: `outRectSize' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `outRoundCorners' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: `outRectSize' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `outRoundCorners' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: `outRectSize' undeclared | Error: value of type vec2 cannot be assigned to variable of type error | Error: `outRoundCorners' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `uvInterp' undeclared | Error: `outRectSize' undeclared | Error: `outRoundCorners' undeclared | Error: `innerColor' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `lineWidth' undeclared | Error: value of type float cannot be assigned to variable of type error | Error: `borderColor' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `embossColor' undeclared | Error: value of type vec4 cannot be assigned to variable of type error | Error: `butCo' undeclared | Error: value of type float cannot be assigned to variable of type error ERROR (gpu.shader): gpu_shader_2D_widget_base FragShader: | 1 | #version 430 | | Error: invalid xfb_buffer specified 0 is larger than MAX_TRANSFORM_FEEDBACK_BUFFERS - 1 (-1). | 27 | | | Error: `outRectSize' undeclared | Error: type mismatch | Error: operands to arithmetic operators must be numeric | 20 | | | Error: operands to relational operators must be scalar and numeric | 27 | | | Error: `outRectSize' undeclared | Error: type mismatch | Error: operands to arithmetic operators must be numeric | 20 | | | Error: operands to relational operators must be scalar and numeric | 17 | #define gpu_Array(_type) _type[] | | Error: `butCo' undeclared | Error: operands of `!=' must have the same type | 6 | #extension GL_ARB_shader_draw_parameters : enable | | `right_half' used uninitialized | 13 | #extension GL_ARB_conservative_depth : enable | | Error: `outRectSize' undeclared | Error: type mismatch | Error: operands to arithmetic operators must be numeric | Error: operands to arithmetic operators must be numeric | 6 | #extension GL_ARB_shader_draw_parameters : enable | | `upper_half' used uninitialized | 13 | #extension GL_ARB_conservative_depth : enable | | Error: `outRectSize' undeclared | Error: type mismatch | Error: operands to arithmetic operators must be numeric | 15 | #extension GL_ARB_shading_language_420pack: enable | | `right_half' used uninitialized | 28 | /* Texture format tokens -- Type explicitness required by other Graphics APIs. */ | | Error: `outRoundCorners' undeclared | Error: type mismatch | 48 | return all(equal(A, vec2(0.0))); | | Error: `outRoundCorners' undeclared | Error: type mismatch | 15 | #extension GL_ARB_shading_language_420pack: enable | | Error: type mismatch | `right_half' used uninitialized | 28 | /* Texture format tokens -- Type explicitness required by other Graphics APIs. */ | | Error: `outRoundCorners' undeclared | Error: type mismatch | 48 | return all(equal(A, vec2(0.0))); | | Error: `outRoundCorners' undeclared | Error: type mismatch | 15 | #extension GL_ARB_shading_language_420pack: enable | | Error: type mismatch | 22 | #ifdef GPU_ARB_texture_cube_map_array | | `upper_half' used uninitialized | Error: `lineWidth' undeclared | Error: operands to relational operators must be scalar and numeric | Error: condition of `?:' must be scalar boolean | 59 | } | | Error: `lineWidth' undeclared | 41 | #define OUT(type, name, array_len) out type name[array_len] | | Error: no matching function for call to `max(float, error)'; candidates are: | Error: float max(float, float) | Error: vec2 max(vec2, float) | Error: vec3 max(vec3, float) | Error: vec4 max(vec4, float) | Error: vec2 max(vec2, vec2) | Error: vec3 max(vec3, vec3) | Error: vec4 max(vec4, vec4) | Error: int max(int, int) | Error: ivec2 max(ivec2, int) | Error: ivec3 max(ivec3, int) | Error: ivec4 max(ivec4, int) | Error: ivec2 max(ivec2, ivec2) | Error: ivec3 max(ivec3, ivec3) | Error: ivec4 max(ivec4, ivec4) | Error: uint max(uint, uint) | Error: uvec2 max(uvec2, uint) | Error: uvec3 max(uvec3, uint) | Error: uvec4 max(uvec4, uint) | Error: uvec2 max(uvec2, uvec2) | Error: uvec3 max(uvec3, uvec3) | Error: uvec4 max(uvec4, uvec4) | Error: double max(double, double) | Error: dvec2 max(dvec2, double) | Error: dvec3 max(dvec3, double) | Error: dvec4 max(dvec4, double) | Error: dvec2 max(dvec2, dvec2) | Error: dvec3 max(dvec3, dvec3) | Error: dvec4 max(dvec4, dvec4) | Error: second and third operands of ?: operator must have matching types | 52 | { | | `line_width' used uninitialized | `line_width' used uninitialized | 16 | #define gpu_InstanceIndex (gl_InstanceID + gpu_BaseInstance) | | Error: `butCo' undeclared | 15 | #extension GL_ARB_shading_language_420pack: enable | | Error: operands to arithmetic operators must be numeric | 6 | #extension GL_ARB_shader_draw_parameters : enable | | Error: no matching function for call to `min(float, error)'; candidates are: | Error: float min(float, float) | Error: vec2 min(vec2, float) | Error: vec3 min(vec3, float) | Error: vec4 min(vec4, float) | Error: vec2 min(vec2, vec2) | Error: vec3 min(vec3, vec3) | Error: vec4 min(vec4, vec4) | Error: int min(int, int) | Error: ivec2 min(ivec2, int) | Error: ivec3 min(ivec3, int) | Error: ivec4 min(ivec4, int) | Error: ivec2 min(ivec2, ivec2) | Error: ivec3 min(ivec3, ivec3) | Error: ivec4 min(ivec4, ivec4) | Error: uint min(uint, uint) | Error: uvec2 min(uvec2, uint) | Error: uvec3 min(uvec3, uint) | Error: uvec4 min(uvec4, uint) | Error: uvec2 min(uvec2, uvec2) | Error: uvec3 min(uvec3, uvec3) | Error: uvec4 min(uvec4, uvec4) | Error: double min(double, double) | Error: dvec2 min(dvec2, double) | Error: dvec3 min(dvec3, double) | Error: dvec4 min(dvec4, double) | Error: dvec2 min(dvec2, dvec2) | Error: dvec3 min(dvec3, dvec3) | Error: dvec4 min(dvec4, dvec4) | 25 | # define samplerCubeArray sampler2DArray | | Error: `discardFac' undeclared | 6 | #extension GL_ARB_shader_draw_parameters : enable | | Error: operands to relational operators must be scalar and numeric | Error: if-statement condition must be scalar boolean | 29 | #define depth2D sampler2D | | Error: `uvInterp' undeclared Writing: /data/data/com.termux/files/usr/tmp/blender.crash.txt Segmentation fault ```

I hope someday there will be a more stable method to connect Blender to GPU on Android but for now I will try to use the Adreno device with virgl_test_server_android

IntinteDAO commented 1 year ago

but like you said now there are artifacts instead of an instant crash.

Yep, it's MESA_GL_VERSION_OVERRIDE bug, but Blender requires GL3.0, but virgl can only provide 2.x?

mesa-zink

I think you should check for mesa with Zink using newest Mesa instead 22.0.5, but it's not ready yet ;(

robertkirkman commented 1 year ago

but like you said now there are artifacts instead of an instant crash.

Yep, it's MESA_GL_VERSION_OVERRIDE bug, but Blender requires GL3.0, but virgl can only provide 2.x?

mesa-zink

I think you should check for mesa with Zink using newest Mesa instead 22.0.5, but it's not ready yet ;(

After checking that mesa-vulkan-icd-freedreno indeed provides VK_KHR_xbc_surface, VK_KHR_imageless_framebuffer, VK_KHR_timeline_semaphore and VK_KHR_create_renderpass2 where they were previously not present, I have successfully used zink from mesa git main upstream, instead of mesa-zink, to run Blender with fewer artifacts on Samsung Galaxy S9 SM-G960U by doing this:

git clone https://github.com/termux/termux-packages.git
cd termux-packages
curl https://clbin.com/0oysF | git apply -v
./scripts/setup-termux.sh
./build-package.sh -I -f mesa
cd output
pkg install ./mesa-vulkan-icd-freedreno_23.3.0-devel-0_aarch64.deb ./mesa_23.3.0-devel-0_aarch64.deb
termux-x11 :0 &
DISPLAY=:0 dbus-launch --exit-with-session startxfce4 &
DISPLAY=:0 MESA_LOADER_DRIVER_OVERRIDE=zink MESA_VK_WSI_DEBUG=sw blender

With this I get OpenGL version string: 4.6 in glxinfo so I assume that is why Blender now runs with fewer artifacts. I will continue to use this to check if any problems appear. Unfortunately I think this driver cannot work with as many devices as virglrenderer-android seems to be able to, but I have just been informed that mesa-vulkan-icd-freedreno should begin to work on Adreno 612, of which I was previously unaware, so I will test this on one of those next.

image