summaryrefslogtreecommitdiffstats
path: root/servers/rendering/rendering_device.compat.inc
diff options
context:
space:
mode:
authorPatrick Dawson <pat@dw.is>2023-09-05 22:25:59 +0200
committerPatrick Dawson <pat@dw.is>2023-09-27 10:22:03 -0400
commitd80dc0ff583467a1a7fe839e8263e40eec64e6b8 (patch)
tree256e59013fb8e06eb95ef4eb121ae591ab850f03 /servers/rendering/rendering_device.compat.inc
parentc12d63556b5c1da03a00dd4c45c40e60bd8d68c2 (diff)
downloadredot-engine-d80dc0ff583467a1a7fe839e8263e40eec64e6b8.tar.gz
Add compatibility methods for RenderingDevice BarrierMask
Diffstat (limited to 'servers/rendering/rendering_device.compat.inc')
-rw-r--r--servers/rendering/rendering_device.compat.inc38
1 files changed, 38 insertions, 0 deletions
diff --git a/servers/rendering/rendering_device.compat.inc b/servers/rendering/rendering_device.compat.inc
index dc7817e66b..8e7beda6f3 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::BarrierMask> RenderingDevice::_convert_barrier_mask_81356(BitField<BarrierMask> 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<BarrierMask> 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<BarrierMask> p_post_barrier) {
+ draw_list_end(_convert_barrier_mask_81356(p_post_barrier));
+}
+
+void RenderingDevice::_compute_list_end_bind_compat_81356(BitField<BarrierMask> p_post_barrier) {
+ compute_list_end(_convert_barrier_mask_81356(p_post_barrier));
+}
+
+void RenderingDevice::_barrier_bind_compat_81356(BitField<BarrierMask> p_from, BitField<BarrierMask> 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