Up to date
This page is up to date for Godot 4.1
.
If you still find outdated information, please open an issue.
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 ( BitField<BarrierMask> from=7, BitField<BarrierMask> to=7 ) |
buffer_clear ( RID buffer, int offset, int size_bytes, BitField<BarrierMask> post_barrier=7 ) |
|
buffer_get_data ( RID buffer, int offset_bytes=0, int size_bytes=0 ) |
|
buffer_update ( RID buffer, int offset, int size_bytes, PackedByteArray data, BitField<BarrierMask> post_barrier=7 ) |
|
void |
capture_timestamp ( String name ) |
void |
compute_list_add_barrier ( int compute_list ) |
compute_list_begin ( bool allow_draw_overlap=false ) |
|
void |
compute_list_bind_compute_pipeline ( int compute_list, RID compute_pipeline ) |
void |
compute_list_bind_uniform_set ( int compute_list, RID uniform_set, int set_index ) |
void |
compute_list_dispatch ( int compute_list, int x_groups, int y_groups, int z_groups ) |
void |
compute_list_end ( BitField<BarrierMask> post_barrier=7 ) |
void |
compute_list_set_push_constant ( int compute_list, PackedByteArray buffer, int size_bytes ) |
compute_pipeline_create ( RID shader, RDPipelineSpecializationConstant[] specialization_constants=[] ) |
|
compute_pipeline_is_valid ( RID compute_pipeline ) |
|
void |
draw_command_begin_label ( String name, Color color ) |
void |
|
void |
draw_command_insert_label ( String name, Color color ) |
draw_list_begin ( RID framebuffer, InitialAction initial_color_action, FinalAction final_color_action, InitialAction initial_depth_action, FinalAction final_depth_action, PackedColorArray clear_color_values=PackedColorArray(), float clear_depth=1.0, int clear_stencil=0, Rect2 region=Rect2(0, 0, 0, 0), RID[] storage_textures=[] ) |
|
draw_list_begin_for_screen ( int screen=0, Color clear_color=Color(0, 0, 0, 1) ) |
|
draw_list_begin_split ( RID framebuffer, int splits, InitialAction initial_color_action, FinalAction final_color_action, InitialAction initial_depth_action, FinalAction final_depth_action, PackedColorArray clear_color_values=PackedColorArray(), float clear_depth=1.0, int clear_stencil=0, Rect2 region=Rect2(0, 0, 0, 0), RID[] storage_textures=[] ) |
|
void |
draw_list_bind_index_array ( int draw_list, RID index_array ) |
void |
draw_list_bind_render_pipeline ( int draw_list, RID render_pipeline ) |
void |
draw_list_bind_uniform_set ( int draw_list, RID uniform_set, int set_index ) |
void |
draw_list_bind_vertex_array ( int draw_list, RID vertex_array ) |
void |
draw_list_disable_scissor ( int draw_list ) |
void |
draw_list_draw ( int draw_list, bool use_indices, int instances, int procedural_vertex_count=0 ) |
void |
draw_list_enable_scissor ( int draw_list, Rect2 rect=Rect2(0, 0, 0, 0) ) |
void |
draw_list_end ( BitField<BarrierMask> post_barrier=7 ) |
void |
draw_list_set_blend_constants ( int draw_list, Color color ) |
void |
draw_list_set_push_constant ( int draw_list, PackedByteArray buffer, int size_bytes ) |
draw_list_switch_to_next_pass_split ( int splits ) |
|
framebuffer_create ( RID[] textures, int validate_with_format=-1, int view_count=1 ) |
|
framebuffer_create_empty ( Vector2i size, TextureSamples samples=0, int validate_with_format=-1 ) |
|
framebuffer_create_multipass ( RID[] textures, RDFramebufferPass[] passes, int validate_with_format=-1, int view_count=1 ) |
|
framebuffer_format_create ( RDAttachmentFormat[] attachments, int view_count=1 ) |
|
framebuffer_format_create_empty ( TextureSamples samples=0 ) |
|
framebuffer_format_create_multipass ( RDAttachmentFormat[] attachments, RDFramebufferPass[] passes, int view_count=1 ) |
|
framebuffer_format_get_texture_samples ( int format, int render_pass=0 ) |
|
framebuffer_get_format ( RID framebuffer ) |
|
framebuffer_is_valid ( RID framebuffer ) const |
|
void |
|
void |
full_barrier ( ) |
get_captured_timestamp_cpu_time ( int index ) const |
|
get_captured_timestamp_gpu_time ( int index ) const |
|
get_captured_timestamp_name ( int index ) const |
|
get_captured_timestamps_count ( ) const |
|
get_captured_timestamps_frame ( ) const |
|
get_device_name ( ) const |
|
get_device_pipeline_cache_uuid ( ) const |
|
get_device_vendor_name ( ) const |
|
get_driver_resource ( DriverResource resource, RID rid, int index ) |
|
get_frame_delay ( ) const |
|
get_memory_usage ( MemoryType type ) const |
|
index_array_create ( RID index_buffer, int index_offset, int index_count ) |
|
index_buffer_create ( int size_indices, IndexBufferFormat format, PackedByteArray data=PackedByteArray(), bool use_restart_indices=false ) |
|
render_pipeline_create ( RID shader, int framebuffer_format, int vertex_format, RenderPrimitive primitive, RDPipelineRasterizationState rasterization_state, RDPipelineMultisampleState multisample_state, RDPipelineDepthStencilState stencil_state, RDPipelineColorBlendState color_blend_state, BitField<PipelineDynamicStateFlags> dynamic_state_flags=0, int for_render_pass=0, RDPipelineSpecializationConstant[] specialization_constants=[] ) |
|
render_pipeline_is_valid ( RID render_pipeline ) |
|
sampler_create ( RDSamplerState state ) |
|
sampler_is_format_supported_for_filter ( DataFormat format, SamplerFilter sampler_filter ) const |
|
screen_get_framebuffer_format ( ) const |
|
screen_get_height ( int screen=0 ) const |
|
screen_get_width ( int screen=0 ) const |
|
void |
set_resource_name ( RID id, String name ) |
shader_compile_binary_from_spirv ( RDShaderSPIRV spirv_data, String name="" ) |
|
shader_compile_spirv_from_source ( RDShaderSource shader_source, bool allow_cache=true ) |
|
shader_create_from_bytecode ( PackedByteArray binary_data ) |
|
shader_create_from_spirv ( RDShaderSPIRV spirv_data, String name="" ) |
|
shader_get_vertex_input_attribute_mask ( RID shader ) |
|
storage_buffer_create ( int size_bytes, PackedByteArray data=PackedByteArray(), BitField<StorageBufferUsage> usage=0 ) |
|
void |
submit ( ) |
void |
sync ( ) |
texture_buffer_create ( int size_bytes, DataFormat format, PackedByteArray data=PackedByteArray() ) |
|
texture_clear ( RID texture, Color color, int base_mipmap, int mipmap_count, int base_layer, int layer_count, BitField<BarrierMask> post_barrier=7 ) |
|
texture_copy ( RID from_texture, RID to_texture, Vector3 from_pos, Vector3 to_pos, Vector3 size, int src_mipmap, int dst_mipmap, int src_layer, int dst_layer, BitField<BarrierMask> post_barrier=7 ) |
|
texture_create ( RDTextureFormat format, RDTextureView view, PackedByteArray[] data=[] ) |
|
texture_create_shared ( RDTextureView view, RID with_texture ) |
|
texture_create_shared_from_slice ( RDTextureView view, RID with_texture, int layer, int mipmap, int mipmaps=1, TextureSliceType slice_type=0 ) |
|
texture_get_data ( RID texture, int layer ) |
|
texture_get_native_handle ( RID texture ) |
|
texture_is_format_supported_for_usage ( DataFormat format, BitField<TextureUsageBits> usage_flags ) const |
|
texture_is_shared ( RID texture ) |
|
texture_is_valid ( RID texture ) |
|
texture_resolve_multisample ( RID from_texture, RID to_texture, BitField<BarrierMask> post_barrier=7 ) |
|
texture_update ( RID texture, int layer, PackedByteArray data, BitField<BarrierMask> post_barrier=7 ) |
|
uniform_buffer_create ( int size_bytes, PackedByteArray data=PackedByteArray() ) |
|
uniform_set_create ( RDUniform[] uniforms, RID shader, int shader_set ) |
|
uniform_set_is_valid ( RID uniform_set ) |
|
vertex_array_create ( int vertex_count |