You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using BackBufferCopy with screen-reading shaders, the builtin backbuffer mipmap (i.e. RenderTarget::BackbufferMipmap) uses wrong mipmap size: [1px x 0px].
ERROR: Height must be equal or greater than 1 for 2D and 3D textures
at: (drivers\vulkan\rendering_device_vulkan.cpp:1756)
intImage::_get_dst_image_size(int p_width, int p_height, Format p_format, int &r_mipmaps, int p_mipmaps, int *r_mm_width, int *r_mm_height) {
Looking at git blame, most of the lines are more than 3 years old, except for those introduced in the commit 81ed9fa (PR #49421).
Proposed fix
I assume that RendererStorageRD::_create_render_target_backbuffer must never use the invalid height of 0, regardless of backbuffer resolution.
If I understand correctly, the smallest reasonable mipmap size is [1px x 1px]. I have not checked if other mipmap variants' dimensions are calculated correctly.
I am not sure if current implementation is bugged specifically for BackBufferCopy or Image::_get_dst_image_size. There could be other root cause which secondarily makes Image::_get_dst_image_size calculate the wrong size. I've read the function, but I am not confident about showing alternate implementation code (which should involve debugging bitwise operation).
Note that the same output was initially reported in #55097, but the ticket was (mistakenly) marked as duplicate of #50976. I believe that the error spam actually is not a single bug, but it is a mixture of 2 bugs:
Godot version
master (2c7fcdd)
System information
Windows 10, GTX1080Ti (497.09), Vulkan
Issue description
When using
BackBufferCopy
with screen-reading shaders, the builtin backbuffer mipmap (i.e.RenderTarget::BackbufferMipmap
) uses wrong mipmap size: [1px x 0px].Following backtraces
The error comes from this section:
godot/drivers/vulkan/rendering_device_vulkan.cpp
Lines 1754 to 1760 in 2c7fcdd
Which goes to:
godot/servers/rendering/renderer_rd/renderer_storage_rd.cpp
Lines 7752 to 7759 in 2c7fcdd
Image::get_image_mipmap_size
redirects toImage::_get_dst_image_size
:godot/core/io/image.cpp
Line 1426 in 2c7fcdd
Looking at
git blame
, most of the lines are more than 3 years old, except for those introduced in the commit 81ed9fa (PR #49421).Proposed fix
I assume that
RendererStorageRD::_create_render_target_backbuffer
must never use the invalid height of0
, regardless of backbuffer resolution.If I understand correctly, the smallest reasonable mipmap size is [1px x 1px]. I have not checked if other mipmap variants' dimensions are calculated correctly.
I am not sure if current implementation is bugged specifically for
BackBufferCopy
orImage::_get_dst_image_size
. There could be other root cause which secondarily makesImage::_get_dst_image_size
calculate the wrong size. I've read the function, but I am not confident about showing alternate implementation code (which should involve debugging bitwise operation).Workaround
Similar reports
Note that the same output was initially reported in #55097, but the ticket was (mistakenly) marked as duplicate of #50976. I believe that the error spam actually is not a single bug, but it is a mixture of 2 bugs:
The behavior (2) is currently not tracked, so I'm hereby opening a new issue.
Steps to reproduce
Scene tree:
Shader on Sprite2D:
Since the minimal scene is pretty much trivial, I suppose many other developers are seeing similar errors...
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: