Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLES2: Convert unsupported float texture types to 8-bit types #26943

Merged

Conversation

akien-mga
Copy link
Member

@akien-mga akien-mga commented Mar 12, 2019

Converting, when unsupported:

  • RF, RGF, RGBF to RGB8
  • RG to RGB8
  • RGBAF to RGBA8
    as discussed with @reduz.

Aims at fixing #26902, but needs testing for confirmation.

Note that CurveTextures (which use FORMAT_RF) will no longer fail to load, but they will not work as expected. So e.g. a CPUParticles using a CurveTexture to change the scale will fail to render anything (but shouldn't crash). This should be addressed in a second step.

@akien-mga akien-mga added this to the 3.1 milestone Mar 12, 2019
@akien-mga akien-mga requested a review from reduz as a code owner March 12, 2019 00:02
@akien-mga akien-mga changed the title GLES2: Convert unsupported float texture types to 8-bit types WIP: GLES2: Convert unsupported float texture types to 8-bit types Mar 12, 2019
@akien-mga
Copy link
Member Author

Do not merge for now, it doesn't fix #26902 yet and might introduce bugs.

Log output on my Samsung Galaxy S3 which also doesn't support float textures:

03-12 10:45:04.361 31285 31304 E godot   : **ERROR**: R float texture not supported, converting to RGB8.
03-12 10:45:04.361 31285 31304 E godot   :    At: drivers/gles2/rasterizer_storage_gles2.cpp:161:_get_gl_image_and_format() - R float texture not supported, converting to RGB8.
03-12 10:45:04.366 31285 31304 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xcc in tid 31304 (GLThread 1703)

(no backtrace sadly)

@akien-mga
Copy link
Member Author

Finally managed to get a backtrace with a target=debug binary, and without the "Debug OpenGL" export option which seems to break things earlier.

03-12 12:00:57.728  6144  6162 E godot   : **ERROR**: R float texture not supported, converting to RGB8.
03-12 12:00:57.728  6144  6162 E godot   :    At: drivers/gles2/rasterizer_storage_gles2.cpp:161:_get_gl_image_and_format() - R float texture not supported, converting to RGB8.
03-12 12:00:57.732  6144  6162 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xcc in tid 6162 (GLThread 307)
03-12 12:00:57.735  1946  1946 W         : debuggerd: handling request: pid=6144 uid=10148 gid=10148 tid=6162
03-12 12:00:57.779  6215  6215 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-12 12:00:57.779  6215  6215 F DEBUG   : LineageOS Version: '14.1-20181117-NIGHTLY-i9300'
03-12 12:00:57.779  6215  6215 F DEBUG   : Build fingerprint: 'samsung/m0xx/m0:4.3/JSS15J/I9300XXUGMJ9:user/release-keys'
03-12 12:00:57.779  6215  6215 F DEBUG   : Revision: '0'
03-12 12:00:57.779  6215  6215 F DEBUG   : ABI: 'arm'
03-12 12:00:57.780  6215  6215 F DEBUG   : pid: 6144, tid: 6162, name: GLThread 307  >>> org.godotengine.platformer3d <<<
03-12 12:00:57.780  6215  6215 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xcc
03-12 12:00:57.780  6215  6215 F DEBUG   :     r0 000000cc  r1 00000000  r2 3457b9b1  r3 00001812
03-12 12:00:57.780  6215  6215 F DEBUG   :     r4 5197df44  r5 5197df48  r6 5197df4c  r7 5197df2c
03-12 12:00:57.780  6215  6215 F DEBUG   :     r8 00000004  r9 3457b9b1  sl 4ffeb920  fp 5197dae8
03-12 12:00:57.780  6215  6215 F DEBUG   :     ip 5186a7d8  sp 5197dad8  lr 50ff480c  pc 4f742df0  cpsr 40010010
03-12 12:00:58.238  6215  6215 F DEBUG   : 
03-12 12:00:58.238  6215  6215 F DEBUG   : backtrace:
03-12 12:00:58.238  6215  6215 F DEBUG   :     #00 pc 000a7df0  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZNK10PoolVectorIhE4sizeEv+24)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #01 pc 01959808  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN5Image7convertENS_6FormatE+52)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #02 pc 0094fa3c  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZNK22RasterizerStorageGLES224_get_gl_image_and_formatERK3RefI5ImageENS1_6FormatEjRS5_RjS7_S7_Rbb+872)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #03 pc 00950df0  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN22RasterizerStorageGLES216texture_allocateE3RIDiiiN5Image6FormatEN12VisualServer11TextureTypeEj+1232)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #04 pc 01737148  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN18VisualServerRaster16texture_allocateE3RIDiiiN5Image6FormatEN12VisualServer11TextureTypeEj+188)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #05 pc 0177cfcc  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN18VisualServerWrapMT16texture_allocateE3RIDiiiN5Image6FormatEN12VisualServer11TextureTypeEj+328)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #06 pc 0141b6b4  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN12CurveTexture7_updateEv+652)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #07 pc 0141b034  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN12CurveTexture9set_widthEi+168)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #08 pc 0026d93c  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN11MethodBind1IiE4callEP6ObjectPPK7VariantiRNS3_9CallErrorE+728)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #09 pc 01918208  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN7ClassDB12set_propertyEP6ObjectRK10StringNameRK7VariantPb+620)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #10 pc 0199fbec  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN6Object3setERK10StringNameRK7VariantPb+168)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #11 pc 01bd6198  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN31ResourceInteractiveLoaderBinary4pollEv+3520)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #12 pc 01beb860  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN20ResourceFormatLoader4loadERK6StringS2_P5Error+1088)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #13 pc 01bed168  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN14ResourceLoader5_loadERK6StringS2_S2_bP5Error+372)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #14 pc 01bee0fc  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN14ResourceLoader4loadERK6StringS2_bP5Error+1676)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #15 pc 01bd5508  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN31ResourceInteractiveLoaderBinary4pollEv+304)
03-12 12:00:58.238  6215  6215 F DEBUG   :     #16 pc 01beb860  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN20ResourceFormatLoader4loadERK6StringS2_P5Error+1088)
03-12 12:00:58.240  6215  6215 F DEBUG   :     #17 pc 01bed168  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN14ResourceLoader5_loadERK6StringS2_S2_bP5Error+372)
03-12 12:00:58.240  6215  6215 F DEBUG   :     #18 pc 01bee0fc  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN14ResourceLoader4loadERK6StringS2_bP5Error+1676)
03-12 12:00:58.240  6215  6215 F DEBUG   :     #19 pc 000f3d80  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN4Main5startEv+20044)
03-12 12:00:58.240  6215  6215 F DEBUG   :     #20 pc 000ad27c  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (Java_org_godotengine_godot_GodotLib_step+120)
03-12 12:00:58.240  6215  6215 F DEBUG   :     #21 pc 001157cd  /data/app/org.godotengine.platformer3d-1/oat/arm/base.odex (offset 0x109000)

@akien-mga akien-mga force-pushed the gles2-unsupported-float-types branch from 5976a52 to ac48334 Compare March 12, 2019 11:20
@akien-mga akien-mga changed the title WIP: GLES2: Convert unsupported float texture types to 8-bit types GLES2: Convert unsupported float texture types to 8-bit types Mar 12, 2019
@akien-mga
Copy link
Member Author

Got it to work! Now the Platformer 3D demo starts on my Samsung Galaxy S3, I can hear the robots and the terrible reverb of that demo :)

It then crashes at a different place, but I think it's unrelated to this PR and just another GLES2 bug for those drivers:

03-12 12:19:12.653  6405  6423 E godot   : **ERROR**: R float texture not supported, converting to RGB8.
03-12 12:19:12.653  6405  6423 E godot   :    At: drivers/gles2/rasterizer_storage_gles2.cpp:162:_get_gl_image_and_format() - R float texture not supported, converting to RGB8.
03-12 12:19:12.653  6405  6423 E godot   : **ERROR**: R float texture not supported, converting to RGB8.
03-12 12:19:12.653  6405  6423 E godot   :    At: drivers/gles2/rasterizer_storage_gles2.cpp:162:_get_gl_image_and_format() - R float texture not supported, converting to RGB8.
03-12 12:19:12.661  6405  6423 E godot   : **ERROR**: R float texture not supported, converting to RGB8.
03-12 12:19:12.661  6405  6423 E godot   :    At: drivers/gles2/rasterizer_storage_gles2.cpp:162:_get_gl_image_and_format() - R float texture not supported, converting to RGB8.
03-12 12:19:12.661  6405  6423 E godot   : **ERROR**: R float texture not supported, converting to RGB8.
03-12 12:19:12.661  6405  6423 E godot   :    At: drivers/gles2/rasterizer_storage_gles2.cpp:162:_get_gl_image_and_format() - R float texture not supported, converting to RGB8.
03-12 12:19:13.096  6405  6423 E godot   : **WARNING**: The method set_friction has been deprecated and will be removed in the future, use physics material instead.
03-12 12:19:13.096  6405  6423 E godot   :    At: scene/3d/physics_body.cpp:640:set_friction() - This method has been deprecated and will be removed in the future
03-12 12:19:13.096  6405  6423 E godot   : **WARNING**: The method set_bounce has been deprecated and will be removed in the future, use physics material instead.
03-12 12:19:13.096  6405  6423 E godot   :    At: scene/3d/physics_body.cpp:669:set_bounce() - This method has been deprecated and will be removed in the future
03-12 12:19:13.227  6405  6423 E godot   : **WARNING**: AnimationTreePlayer has been deprecated. Use AnimationTree instead.
03-12 12:19:13.227  6405  6423 E godot   :    At: scene/animation/animation_tree_player.cpp:405:_notification() - This method has been deprecated and will be removed in the future
03-12 12:19:14.133  6405  6423 E godot   : **ERROR**: Condition ' !p_axis.is_normalized() ' is true.
03-12 12:19:14.133  6405  6423 E godot   :    At: core/math/basis.cpp:799:set_axis_angle() - Condition ' !p_axis.is_normalized() ' is true.
03-12 12:19:14.133  6405  6423 E godot   : **ERROR**: Condition ' p_eye == p_target ' is true.
03-12 12:19:14.133  6405  6423 E godot   :    At: core/math/transform.cpp:88:set_look_at() - Condition ' p_eye == p_target ' is true.
03-12 12:19:14.134  6405  6423 E godot   : **ERROR**: Condition ' !p_axis.is_normalized() ' is true.
03-12 12:19:14.134  6405  6423 E godot   :    At: core/math/basis.cpp:799:set_axis_angle() - Condition ' !p_axis.is_normalized() ' is true.
03-12 12:19:14.134  6405  6423 E godot   : **ERROR**: Condition ' p_eye == p_target ' is true.
03-12 12:19:14.134  6405  6423 E godot   :    At: core/math/transform.cpp:88:set_look_at() - Condition ' p_eye == p_target ' is true.
03-12 12:19:14.134  6405  6423 E godot   : **ERROR**: Condition ' !p_axis.is_normalized() ' is true.
03-12 12:19:14.134  6405  6423 E godot   :    At: core/math/basis.cpp:799:set_axis_angle() - Condition ' !p_axis.is_normalized() ' is true.
03-12 12:19:14.134  6405  6423 E godot   : **ERROR**: Condition ' p_eye == p_target ' is true.
03-12 12:19:14.134  6405  6423 E godot   :    At: core/math/transform.cpp:88:set_look_at() - Condition ' p_eye == p_target ' is true.
03-12 12:19:14.134  6405  6423 E godot   : **ERROR**: Condition ' !p_axis.is_normalized() ' is true.
03-12 12:19:14.135  6405  6423 E godot   :    At: core/math/basis.cpp:799:set_axis_angle() - Condition ' !p_axis.is_normalized() ' is true.
03-12 12:19:14.135  6405  6423 E godot   : **ERROR**: Condition ' p_eye == p_target ' is true.
03-12 12:19:14.135  6405  6423 E godot   :    At: core/math/transform.cpp:88:set_look_at() - Condition ' p_eye == p_target ' is true.
03-12 12:19:14.716  6405  6423 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 6423 (GLThread 311)
03-12 12:19:14.719  1946  1946 W         : debuggerd: handling request: pid=6405 uid=10149 gid=10149 tid=6423
03-12 12:19:14.750  6443  6443 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-12 12:19:14.750  6443  6443 F DEBUG   : LineageOS Version: '14.1-20181117-NIGHTLY-i9300'
03-12 12:19:14.750  6443  6443 F DEBUG   : Build fingerprint: 'samsung/m0xx/m0:4.3/JSS15J/I9300XXUGMJ9:user/release-keys'
03-12 12:19:14.750  6443  6443 F DEBUG   : Revision: '0'
03-12 12:19:14.750  6443  6443 F DEBUG   : ABI: 'arm'
03-12 12:19:14.751  6443  6443 F DEBUG   : pid: 6405, tid: 6423, name: GLThread 311  >>> org.godotengine.platformer3d <<<
03-12 12:19:14.751  6443  6443 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
03-12 12:19:14.751  6443  6443 F DEBUG   :     r0 0000000c  r1 00000000  r2 00000018  r3 00000000
03-12 12:19:14.751  6443  6443 F DEBUG   :     r4 42cef234  r5 00000007  r6 00000000  r7 00000000
03-12 12:19:14.751  6443  6443 F DEBUG   :     r8 518f3238  r9 518f2f00  sl 3457b9b1  fp 518f2d38
03-12 12:19:14.751  6443  6443 F DEBUG   :     ip 00fc26a1  sp 518f2928  lr 4fec33a4  pc 4fec3408  cpsr 600f0010
03-12 12:19:15.118  6443  6443 F DEBUG   : 
03-12 12:19:15.118  6443  6443 F DEBUG   : backtrace:
03-12 12:19:15.118  6443  6443 F DEBUG   :     #00 pc 00941408  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN20RasterizerSceneGLES215_setup_geometryEPNS_10RenderList7ElementEPN22RasterizerStorageGLES28SkeletonE+1112)
03-12 12:19:15.118  6443  6443 F DEBUG   :     #01 pc 0093fb9c  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN20RasterizerSceneGLES219_render_render_listEPPNS_10RenderList7ElementEiRK9TransformRK12CameraMatrix3RIDPNS_11EnvironmentEjffbbb+4092)
03-12 12:19:15.118  6443  6443 F DEBUG   :     #02 pc 00947d80  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN20RasterizerSceneGLES213render_shadowE3RIDS0_iPPN15RasterizerScene12InstanceBaseEi+4084)
03-12 12:19:15.118  6443  6443 F DEBUG   :     #03 pc 017517c4  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN17VisualServerScene29_light_instance_update_shadowEPNS_8InstanceE9TransformRK12CameraMatrixb3RIDPNS_8ScenarioE+5636)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #04 pc 0174e7d8  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN17VisualServerScene14_prepare_sceneE9TransformRK12CameraMatrixb3RIDjS4_S4_S4_+4048)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #05 pc 0174d558  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN17VisualServerScene13render_cameraE3RIDS0_7Vector2S0_+744)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #06 pc 01770d58  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN20VisualServerViewport14_draw_viewportEPNS_8ViewportEN13ARVRInterface4EyesE+984)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #07 pc 01772a50  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN20VisualServerViewport14draw_viewportsEv+1644)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #08 pc 017361a0  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN18VisualServerRaster4drawEbd+380)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #09 pc 0177af10  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN18VisualServerWrapMT4drawEbd+240)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #10 pc 000f5810  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN4Main9iterationEv+1560)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #11 pc 000992a8  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (_ZN10OS_Android17main_loop_iterateEv+52)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #12 pc 000ad31c  /data/app/org.godotengine.platformer3d-1/lib/arm/libgodot_android.so (Java_org_godotengine_godot_GodotLib_step+280)
03-12 12:19:15.119  6443  6443 F DEBUG   :     #13 pc 001157cd  /data/app/org.godotengine.platformer3d-1/oat/arm/base.odex (offset 0x109000)

I'll try with a simpler demo with just a CurveTexture (which uses Image::FORMAT_RF) to see if it works.

@akien-mga
Copy link
Member Author

Tested on a simple demo with a CurveTexutre, seems to work fine!
Works both on Samsung Galaxy S4 (no float textures) and Xiaomi Pocophone F1 (has float textures).

The Platformer 3D demo crashes on the S4 with above backtrace, but it's not related to this PR (this PR just fixes another crash that would happen before that). On the Pocophone, it works well when using the GodotPhysics backend (crashes inside Bullet otherwise...).

@akien-mga akien-mga merged commit fa416b3 into godotengine:master Mar 12, 2019
@akien-mga akien-mga deleted the gles2-unsupported-float-types branch March 12, 2019 15:26
@akien-mga
Copy link
Member Author

I opened #26972 to follow-up on the other (unrelated) crash I'm getting after this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant