diff --git a/misc/extension_api_validation/4.1-stable.expected b/misc/extension_api_validation/4.1-stable.expected index 0fb834bbbf2..e28f24bbaa0 100644 --- a/misc/extension_api_validation/4.1-stable.expected +++ b/misc/extension_api_validation/4.1-stable.expected @@ -20,12 +20,9 @@ Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/texture_r Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/buffer_update/arguments/4': default_value changed value in new API, from "7" to "32767". Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/buffer_clear/arguments/3': default_value changed value in new API, from "7" to "32767". Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/draw_list_end/arguments/0': default_value changed value in new API, from "7" to "32767". -Validate extension JSON: Error: Hash changed for 'classes/RenderingDevice/methods/draw_list_end', from 19365687 to E9B4FA8E. This means that the function has changed and no compatibility function was provided. Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/compute_list_end/arguments/0': default_value changed value in new API, from "7" to "32767". -Validate extension JSON: Error: Hash changed for 'classes/RenderingDevice/methods/compute_list_end', from 19365687 to E9B4FA8E. This means that the function has changed and no compatibility function was provided. Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/barrier/arguments/0': default_value changed value in new API, from "7" to "32767". Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/barrier/arguments/1': default_value changed value in new API, from "7" to "32767". -Validate extension JSON: Error: Hash changed for 'classes/RenderingDevice/methods/barrier', from 0FE50041 to DD9E8DAB. This means that the function has changed and no compatibility function was provided. Raster barrier was split into vertex and fragment barriers for use in mobile renderer. diff --git a/servers/rendering/rendering_device.compat.inc b/servers/rendering/rendering_device.compat.inc index dc7817e66bd..8e7beda6f31 100644 --- a/servers/rendering/rendering_device.compat.inc +++ b/servers/rendering/rendering_device.compat.inc @@ -34,8 +34,46 @@ RID RenderingDevice::_shader_create_from_bytecode_bind_compat_79606(const Vector return shader_create_from_bytecode(p_shader_binary, RID()); } +BitField RenderingDevice::_convert_barrier_mask_81356(BitField p_old_barrier) { + if (p_old_barrier == 7) { + return BARRIER_MASK_ALL_BARRIERS; + } else if (p_old_barrier == 16) { + return BARRIER_MASK_NO_BARRIER; + } + + BitField new_barrier; + if (p_old_barrier & 1) { + new_barrier.set_flag(BARRIER_MASK_VERTEX); + } + if (p_old_barrier & 2) { + new_barrier.set_flag(BARRIER_MASK_FRAGMENT); + } + if (p_old_barrier & 4) { + new_barrier.set_flag(BARRIER_MASK_COMPUTE); + } + if (p_old_barrier & 8) { + new_barrier.set_flag(BARRIER_MASK_TRANSFER); + } + return new_barrier; +} + +void RenderingDevice::_draw_list_end_bind_compat_81356(BitField p_post_barrier) { + draw_list_end(_convert_barrier_mask_81356(p_post_barrier)); +} + +void RenderingDevice::_compute_list_end_bind_compat_81356(BitField p_post_barrier) { + compute_list_end(_convert_barrier_mask_81356(p_post_barrier)); +} + +void RenderingDevice::_barrier_bind_compat_81356(BitField p_from, BitField p_to) { + barrier(_convert_barrier_mask_81356(p_from), _convert_barrier_mask_81356(p_to)); +} + void RenderingDevice::_bind_compatibility_methods() { ClassDB::bind_compatibility_method(D_METHOD("shader_create_from_bytecode", "binary_data"), &RenderingDevice::_shader_create_from_bytecode_bind_compat_79606); + ClassDB::bind_compatibility_method(D_METHOD("draw_list_end", "post_barrier"), &RenderingDevice::_draw_list_end_bind_compat_81356, DEFVAL(7)); + ClassDB::bind_compatibility_method(D_METHOD("compute_list_end", "post_barrier"), &RenderingDevice::_compute_list_end_bind_compat_81356, DEFVAL(7)); + ClassDB::bind_compatibility_method(D_METHOD("barrier", "from", "to"), &RenderingDevice::_barrier_bind_compat_81356, DEFVAL(7), DEFVAL(7)); } #endif diff --git a/servers/rendering/rendering_device.h b/servers/rendering/rendering_device.h index 80c5cda6d12..b4bca054e2c 100644 --- a/servers/rendering/rendering_device.h +++ b/servers/rendering/rendering_device.h @@ -1401,6 +1401,13 @@ protected: }; Error _reflect_spirv(const Vector &p_spirv, SpirvReflectionData &r_reflection_data); + +#ifndef DISABLE_DEPRECATED + BitField _convert_barrier_mask_81356(BitField p_old_barrier); + void _draw_list_end_bind_compat_81356(BitField p_post_barrier); + void _compute_list_end_bind_compat_81356(BitField p_post_barrier); + void _barrier_bind_compat_81356(BitField p_from, BitField p_to); +#endif }; VARIANT_ENUM_CAST(RenderingDevice::DeviceType)