Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

RenderingDevice

Inherits: Object

Abstraction for working with modern low-level graphics APIs.

Description

RenderingDevice is an abstraction for working with modern low-level graphics APIs such as Vulkan. Compared to RenderingServer (which works with Godot's own rendering subsystems), RenderingDevice is much lower-level and allows working more directly with the underlying graphics APIs. RenderingDevice is used in Godot to provide support for several modern low-level graphics APIs while reducing the amount of code duplication required. RenderingDevice can also be used in your own projects to perform things that are not exposed by RenderingServer or high-level nodes, such as using compute shaders.

On startup, Godot creates a global RenderingDevice which can be retrieved using RenderingServer.get_rendering_device. This global RenderingDevice performs drawing to the screen.

Local RenderingDevices: Using RenderingServer.create_local_rendering_device, you can create "secondary" rendering devices to perform drawing and GPU compute operations on separate threads.

Note: RenderingDevice assumes intermediate knowledge of modern graphics APIs such as Vulkan, Direct3D 12, Metal or WebGPU. These graphics APIs are lower-level than OpenGL or Direct3D 11, requiring you to perform what was previously done by the graphics driver itself. If you have difficulty understanding the concepts used in this class, follow the Vulkan Tutorial or Vulkan Guide. It's recommended to have existing modern OpenGL or Direct3D 11 knowledge before attempting to learn a low-level graphics API.

Note: RenderingDevice is not available when running in headless mode or when using the Compatibility rendering method.

Tutorials

Methods

void

barrier(from: BitField[BarrierMask] = 32767, to: BitField[BarrierMask] = 32767)

Error

buffer_clear(buffer: RID, offset: int, size_bytes: int)

Error

buffer_copy(src_buffer: RID, dst_buffer: RID, src_offset: int, dst_offset: int, size: int)

PackedByteArray

buffer_get_data(buffer: RID, offset_bytes: int = 0, size_bytes: int = 0)

Error

buffer_update(buffer: RID, offset: int, size_bytes: int, data: PackedByteArray)

void

capture_timestamp(name: String)

void

compute_list_add_barrier(compute_list: int)

int

compute_list_begin()

void

compute_list_bind_compute_pipeline(compute_list: int, compute_pipeline: RID)

void

compute_list_bind_uniform_set(compute_list: int, uniform_set: RID, set_index: int)

void

compute_list_dispatch(compute_list: int, x_groups: int, y_groups: int, z_groups: int)

void

compute_list_end()

void

compute_list_set_push_constant(compute_list: int, buffer: PackedByteArray, size_bytes: int)

RID

compute_pipeline_create(shader: RID, specialization_constants: Array[RDPipelineSpecializationConstant] = [])

bool

compute_pipeline_is_valid(compute_pipeline: RID)

RenderingDevice

create_local_device()

void

draw_command_begin_label(name: String, color: Color)

void

draw_command_end_label()

void

draw_command_insert_label(name: String, color: Color)

int

draw_list_begin(framebuffer: RID, initial_color_action: InitialAction, final_color_action: FinalAction, initial_depth_action: InitialAction, final_depth_action: FinalAction, clear_color_values: PackedColorArray = PackedColorArray(), clear_depth: float = 1.0, clear_stencil: int = 0, region: Rect2 = Rect2(0, 0, 0, 0