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

create_from_surface is broken on Android #85913

Closed
aahmyu opened this issue Dec 8, 2023 · 2 comments
Closed

create_from_surface is broken on Android #85913

aahmyu opened this issue Dec 8, 2023 · 2 comments

Comments

@aahmyu
Copy link

aahmyu commented Dec 8, 2023

Tested versions

Godot 4.2 stable

System information

Godot v4.2.stable.mono - Windows 10.0.22631 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.4629) - Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz (16 Threads)

Issue description

Createing a mesh from surface throw an error in logcat

12-08 09:38:07.589 12534 13291 E godot   : USER ERROR: Index r[i] = 16128 is out of bounds (vcount = 9).
12-08 09:38:07.589 12534 13291 E godot   :    at: create_from_surface (scene/resources/mesh_data_tool.cpp:73)

I discovered this issue first on a Pico 4 VR headset, then I managed to reproduce on my Xiamoi MI pad 5.
in the logcat the mi pad logs
Vulkan API 1.1.128 - Forward Mobile - Using Vulkan Device #0: Qualcomm - Adreno (TM) 640
I think this is the same GPU as my VR headset.

My samsung s23 ultra works fine wit this gpu

Vulkan API 1.3.128 - Forward Mobile - Using Vulkan Device #0: Qualcomm - Adreno (TM) 740

Steps to reproduce

Can be reproduced with this code

@tool
extends Node3D

@onready var rigid_body_3d: RigidBody3D = %RigidBody3D
@onready var mesh_instance_3d: MeshInstance3D = $RigidBody3D/MeshInstance3D

@export_range(1, 512) var size: int = 100
var mdt = MeshDataTool.new()

# Called when the node enters the scene tree for the first time.
func _ready():
	_setPlaneSize()
#
#
func _setPlaneSize():
	var mdt = MeshDataTool.new()
	var st = SurfaceTool.new()
	var plane_mesh = PlaneMesh.new()
	plane_mesh.subdivide_width = size
	plane_mesh.subdivide_depth = size
	plane_mesh.size = Vector2(size, size)
	st.create_from(plane_mesh, 0)
	var array_plane = st.commit()
	var error = mdt.create_from_surface(array_plane, 0)
	for i in range(mdt.get_vertex_count()):
		var vtx = mdt.get_vertex(i)
		vtx.y = randf() * 1
		mdt.set_vertex(i, vtx)

	mdt.commit_to_surface(array_plane)
	st.create_from(array_plane, 0)
	st.generate_normals()
	$MeshInstance3D.mesh = st.commit()

Minimal reproduction project (MRP)

CreateFromSurface.zip

If there are workarounds plesae let me know, i've been dealing with this issue for 2 days :/

Regards

@bitsawer
Copy link
Member

bitsawer commented Dec 8, 2023

Thanks for the report. This is most likely a duplicate of #75599, which has been fixed in master by #84852. The fix should be in next 4.2.1 release. Closing as duplicate / completed.

@aahmyu
Copy link
Author

aahmyu commented Dec 8, 2023

Yes I just tested it on 4.2.1 RC and it works as intended thanks.

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

No branches or pull requests

3 participants