2019-06-23 00:34:26 +08:00
/*************************************************************************/
2020-12-05 02:26:24 +08:00
/* renderer_canvas_render_rd.h */
2019-06-23 00:34:26 +08:00
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
2022-01-04 04:27:34 +08:00
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
2019-06-23 00:34:26 +08:00
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
2022-07-24 05:41:51 +08:00
# ifndef RENDERER_CANVAS_RENDER_RD_H
# define RENDERER_CANVAS_RENDER_RD_H
2019-06-12 02:43:37 +08:00
2020-12-05 02:26:24 +08:00
# include "servers/rendering/renderer_canvas_render.h"
# include "servers/rendering/renderer_compositor.h"
# include "servers/rendering/renderer_rd/pipeline_cache_rd.h"
# include "servers/rendering/renderer_rd/shaders/canvas.glsl.gen.h"
# include "servers/rendering/renderer_rd/shaders/canvas_occlusion.glsl.gen.h"
2022-06-21 08:08:33 +08:00
# include "servers/rendering/renderer_rd/storage_rd/material_storage.h"
2020-03-28 02:21:27 +08:00
# include "servers/rendering/rendering_device.h"
2021-11-16 23:25:42 +08:00
# include "servers/rendering/shader_compiler.h"
2019-06-12 02:43:37 +08:00
2020-12-05 02:26:24 +08:00
class RendererCanvasRenderRD : public RendererCanvasRender {
2020-10-24 23:15:43 +08:00
enum {
BASE_UNIFORM_SET = 0 ,
MATERIAL_UNIFORM_SET = 1 ,
TRANSFORMS_UNIFORM_SET = 2 ,
CANVAS_TEXTURE_UNIFORM_SET = 3 ,
} ;
2019-06-16 10:45:24 +08:00
enum ShaderVariant {
SHADER_VARIANT_QUAD ,
SHADER_VARIANT_NINEPATCH ,
2019-06-25 03:13:06 +08:00
SHADER_VARIANT_PRIMITIVE ,
SHADER_VARIANT_PRIMITIVE_POINTS ,
SHADER_VARIANT_ATTRIBUTES ,
SHADER_VARIANT_ATTRIBUTES_POINTS ,
2019-07-11 04:44:55 +08:00
SHADER_VARIANT_QUAD_LIGHT ,
SHADER_VARIANT_NINEPATCH_LIGHT ,
SHADER_VARIANT_PRIMITIVE_LIGHT ,
SHADER_VARIANT_PRIMITIVE_POINTS_LIGHT ,
SHADER_VARIANT_ATTRIBUTES_LIGHT ,
SHADER_VARIANT_ATTRIBUTES_POINTS_LIGHT ,
2019-06-16 10:45:24 +08:00
SHADER_VARIANT_MAX
} ;
enum {
2021-05-11 00:12:44 +08:00
FLAGS_INSTANCING_MASK = 0x7F ,
FLAGS_INSTANCING_HAS_COLORS = ( 1 < < 7 ) ,
FLAGS_INSTANCING_HAS_CUSTOM_DATA = ( 1 < < 8 ) ,
2019-06-16 10:45:24 +08:00
FLAGS_CLIP_RECT_UV = ( 1 < < 9 ) ,
FLAGS_TRANSPOSE_RECT = ( 1 < < 10 ) ,
2019-07-05 09:54:32 +08:00
2019-06-16 10:45:24 +08:00
FLAGS_NINEPACH_DRAW_CENTER = ( 1 < < 12 ) ,
FLAGS_USING_PARTICLES = ( 1 < < 13 ) ,
2019-06-20 04:03:19 +08:00
FLAGS_USE_SKELETON = ( 1 < < 15 ) ,
FLAGS_NINEPATCH_H_MODE_SHIFT = 16 ,
2019-07-05 09:54:32 +08:00
FLAGS_NINEPATCH_V_MODE_SHIFT = 18 ,
FLAGS_LIGHT_COUNT_SHIFT = 20 ,
FLAGS_DEFAULT_NORMAL_MAP_USED = ( 1 < < 26 ) ,
2020-12-27 21:30:33 +08:00
FLAGS_DEFAULT_SPECULAR_MAP_USED = ( 1 < < 27 ) ,
2019-07-05 09:54:32 +08:00
2020-12-27 21:30:33 +08:00
FLAGS_USE_MSDF = ( 1 < < 28 ) ,
2022-08-12 19:03:28 +08:00
FLAGS_USE_LCD = ( 1 < < 29 ) ,
2019-07-05 09:54:32 +08:00
} ;
enum {
LIGHT_FLAGS_TEXTURE_MASK = 0xFFFF ,
LIGHT_FLAGS_BLEND_SHIFT = 16 ,
LIGHT_FLAGS_BLEND_MASK = ( 3 < < 16 ) ,
LIGHT_FLAGS_BLEND_MODE_ADD = ( 0 < < 16 ) ,
LIGHT_FLAGS_BLEND_MODE_SUB = ( 1 < < 16 ) ,
LIGHT_FLAGS_BLEND_MODE_MIX = ( 2 < < 16 ) ,
2019-07-07 12:49:40 +08:00
LIGHT_FLAGS_BLEND_MODE_MASK = ( 3 < < 16 ) ,
LIGHT_FLAGS_HAS_SHADOW = ( 1 < < 20 ) ,
LIGHT_FLAGS_FILTER_SHIFT = 22
2019-07-05 09:54:32 +08:00
} ;
enum {
MAX_RENDER_ITEMS = 256 * 1024 ,
MAX_LIGHT_TEXTURES = 1024 ,
2020-10-24 23:15:43 +08:00
MAX_LIGHTS_PER_ITEM = 16 ,
2019-07-11 04:44:55 +08:00
DEFAULT_MAX_LIGHTS_PER_RENDER = 256
2019-06-16 10:45:24 +08:00
} ;
/****************/
/**** SHADER ****/
/****************/
enum PipelineVariant {
PIPELINE_VARIANT_QUAD ,
PIPELINE_VARIANT_NINEPATCH ,
2019-06-25 03:13:06 +08:00
PIPELINE_VARIANT_PRIMITIVE_TRIANGLES ,
PIPELINE_VARIANT_PRIMITIVE_LINES ,
PIPELINE_VARIANT_PRIMITIVE_POINTS ,
PIPELINE_VARIANT_ATTRIBUTE_TRIANGLES ,
2019-08-19 06:40:52 +08:00
PIPELINE_VARIANT_ATTRIBUTE_TRIANGLE_STRIP ,
2019-06-25 03:13:06 +08:00
PIPELINE_VARIANT_ATTRIBUTE_LINES ,
2019-08-19 06:40:52 +08:00
PIPELINE_VARIANT_ATTRIBUTE_LINES_STRIP ,
2019-06-25 03:13:06 +08:00
PIPELINE_VARIANT_ATTRIBUTE_POINTS ,
2022-08-12 19:03:28 +08:00
PIPELINE_VARIANT_QUAD_LCD_BLEND ,
2019-06-16 10:45:24 +08:00
PIPELINE_VARIANT_MAX
} ;
2019-07-11 04:44:55 +08:00
enum PipelineLightMode {
PIPELINE_LIGHT_MODE_DISABLED ,
PIPELINE_LIGHT_MODE_ENABLED ,
PIPELINE_LIGHT_MODE_MAX
} ;
2019-06-16 10:45:24 +08:00
struct PipelineVariants {
2020-12-05 02:26:24 +08:00
PipelineCacheRD variants [ PIPELINE_LIGHT_MODE_MAX ] [ PIPELINE_VARIANT_MAX ] ;
2019-06-16 10:45:24 +08:00
} ;
struct {
CanvasShaderRD canvas_shader ;
RID default_version ;
RID default_version_rd_shader ;
2019-06-25 03:13:06 +08:00
RID quad_index_buffer ;
2019-06-16 10:45:24 +08:00
RID quad_index_array ;
PipelineVariants pipeline_variants ;
// default_skeleton uniform set
2019-07-11 04:44:55 +08:00
RID default_skeleton_uniform_buffer ;
RID default_skeleton_texture_buffer ;
2019-06-16 10:45:24 +08:00
2021-11-16 23:25:42 +08:00
ShaderCompiler compiler ;
2019-06-16 10:45:24 +08:00
} shader ;
2022-08-01 09:59:14 +08:00
struct CanvasShaderData : public RendererRD : : MaterialStorage : : ShaderData {
2019-07-21 22:31:30 +08:00
enum BlendMode { //used internally
BLEND_MODE_MIX ,
BLEND_MODE_ADD ,
BLEND_MODE_SUB ,
BLEND_MODE_MUL ,
BLEND_MODE_PMALPHA ,
BLEND_MODE_DISABLED ,
} ;
2022-05-02 22:28:25 +08:00
bool valid = false ;
2019-07-21 22:31:30 +08:00
RID version ;
PipelineVariants pipeline_variants ;
String path ;
2022-05-13 21:04:37 +08:00
HashMap < StringName , ShaderLanguage : : ShaderNode : : Uniform > uniforms ;
2021-11-16 23:25:42 +08:00
Vector < ShaderCompiler : : GeneratedCode : : Texture > texture_uniforms ;
2019-07-21 22:31:30 +08:00
Vector < uint32_t > ubo_offsets ;
2022-05-02 22:28:25 +08:00
uint32_t ubo_size = 0 ;
2019-07-21 22:31:30 +08:00
String code ;
2022-05-13 21:04:37 +08:00
HashMap < StringName , HashMap < int , RID > > default_texture_params ;
2019-07-21 22:31:30 +08:00
2020-11-26 20:50:21 +08:00
bool uses_screen_texture = false ;
2022-08-10 00:29:49 +08:00
bool uses_screen_texture_mipmaps = false ;
2020-11-26 20:50:21 +08:00
bool uses_sdf = false ;
2021-05-20 22:25:06 +08:00
bool uses_time = false ;
2019-07-21 22:31:30 +08:00
virtual void set_code ( const String & p_Code ) ;
2022-06-29 17:31:18 +08:00
virtual void set_path_hint ( const String & p_path ) ;
2022-08-27 17:22:43 +08:00
virtual void set_default_texture_parameter ( const StringName & p_name , RID p_texture , int p_index ) ;
2022-04-04 01:09:09 +08:00
virtual void get_shader_uniform_list ( List < PropertyInfo > * p_param_list ) const ;
2022-03-21 19:25:25 +08:00
virtual void get_instance_param_list ( List < RendererMaterialStorage : : InstanceShaderParam > * p_param_list ) const ;
2020-04-17 10:52:00 +08:00
2022-08-27 17:22:43 +08:00
virtual bool is_parameter_texture ( const StringName & p_param ) const ;
2019-07-21 22:31:30 +08:00
virtual bool is_animated ( ) const ;
virtual bool casts_shadows ( ) const ;
virtual Variant get_default_parameter ( const StringName & p_parameter ) const ;
2021-01-06 07:01:50 +08:00
virtual RS : : ShaderNativeSourceCode get_native_source_code ( ) const ;
2022-05-02 22:28:25 +08:00
CanvasShaderData ( ) { }
2022-03-21 19:25:25 +08:00
virtual ~ CanvasShaderData ( ) ;
2019-07-21 22:31:30 +08:00
} ;
2022-08-01 09:59:14 +08:00
RendererRD : : MaterialStorage : : ShaderData * _create_shader_func ( ) ;
static RendererRD : : MaterialStorage : : ShaderData * _create_shader_funcs ( ) {
2020-12-05 02:26:24 +08:00
return static_cast < RendererCanvasRenderRD * > ( singleton ) - > _create_shader_func ( ) ;
2019-07-21 22:31:30 +08:00
}
2022-08-01 09:59:14 +08:00
struct CanvasMaterialData : public RendererRD : : MaterialStorage : : MaterialData {
2022-04-04 21:06:57 +08:00
CanvasShaderData * shader_data = nullptr ;
2019-07-21 22:31:30 +08:00
RID uniform_set ;
virtual void set_render_priority ( int p_priority ) { }
virtual void set_next_pass ( RID p_pass ) { }
2022-05-13 21:04:37 +08:00
virtual bool update_parameters ( const HashMap < StringName , Variant > & p_parameters , bool p_uniform_dirty , bool p_textures_dirty ) ;
2022-03-21 19:25:25 +08:00
virtual ~ CanvasMaterialData ( ) ;
2019-07-21 22:31:30 +08:00
} ;
2022-08-01 09:59:14 +08:00
RendererRD : : MaterialStorage : : MaterialData * _create_material_func ( CanvasShaderData * p_shader ) ;
static RendererRD : : MaterialStorage : : MaterialData * _create_material_funcs ( RendererRD : : MaterialStorage : : ShaderData * p_shader ) {
2022-03-21 19:25:25 +08:00
return static_cast < RendererCanvasRenderRD * > ( singleton ) - > _create_material_func ( static_cast < CanvasShaderData * > ( p_shader ) ) ;
2019-07-21 22:31:30 +08:00
}
2019-06-16 10:45:24 +08:00
/**************************/
2020-10-24 23:15:43 +08:00
/**** CANVAS TEXTURES *****/
2019-06-16 10:45:24 +08:00
/**************************/
struct {
2020-03-28 02:21:27 +08:00
RS : : CanvasItemTextureFilter default_filter ;
RS : : CanvasItemTextureRepeat default_repeat ;
2019-06-16 10:45:24 +08:00
} default_samplers ;
2019-06-25 03:13:06 +08:00
/******************/
/**** POLYGONS ****/
/******************/
struct PolygonBuffers {
RD : : VertexFormatID vertex_format_id ;
RID vertex_buffer ;
RID vertex_array ;
RID index_buffer ;
RID indices ;
} ;
struct {
HashMap < PolygonID , PolygonBuffers > polygons ;
PolygonID last_id ;
} polygon_buffers ;
/********************/
/**** PRIMITIVES ****/
/********************/
struct {
RID index_array [ 4 ] ;
} primitive_arrays ;
2019-06-16 10:45:24 +08:00
/*******************/
/**** MATERIALS ****/
/*******************/
2019-06-27 02:11:52 +08:00
/******************/
/**** LIGHTING ****/
/******************/
2019-07-05 09:54:32 +08:00
struct CanvasLight {
RID texture ;
struct {
2020-10-24 23:15:43 +08:00
bool enabled = false ;
float z_far ;
float y_offset ;
2020-11-04 03:51:53 +08:00
Transform2D directional_xform ;
2019-07-05 09:54:32 +08:00
} shadow ;
2019-06-27 02:11:52 +08:00
} ;
2019-07-05 09:54:32 +08:00
RID_Owner < CanvasLight > canvas_light_owner ;
struct ShadowRenderPushConstant {
float projection [ 16 ] ;
2019-07-07 12:49:40 +08:00
float modelview [ 8 ] ;
float direction [ 2 ] ;
2020-10-24 23:15:43 +08:00
float z_far ;
float pad ;
2019-07-07 12:49:40 +08:00
} ;
2019-07-05 09:54:32 +08:00
struct OccluderPolygon {
2020-03-28 02:21:27 +08:00
RS : : CanvasOccluderPolygonCullMode cull_mode ;
2020-11-26 20:50:21 +08:00
int line_point_count ;
2019-07-05 09:54:32 +08:00
RID vertex_buffer ;
RID vertex_array ;
RID index_buffer ;
RID index_array ;
2020-11-26 20:50:21 +08:00
int sdf_point_count ;
int sdf_index_count ;
RID sdf_vertex_buffer ;
RID sdf_vertex_array ;
RID sdf_index_buffer ;
RID sdf_index_array ;
bool sdf_is_lines ;
2019-07-05 09:54:32 +08:00
} ;
struct LightUniform {
float matrix [ 8 ] ; //light to texture coordinate matrix
2019-07-07 12:49:40 +08:00
float shadow_matrix [ 8 ] ; //light to shadow coordinate matrix
2019-07-05 09:54:32 +08:00
float color [ 4 ] ;
2020-10-24 23:15:43 +08:00
uint8_t shadow_color [ 4 ] ;
2019-07-05 09:54:32 +08:00
uint32_t flags ; //index to light texture
float shadow_pixel_size ;
2020-10-24 23:15:43 +08:00
float height ;
float position [ 2 ] ;
float shadow_z_far_inv ;
float shadow_y_ofs ;
float atlas_rect [ 4 ] ;
2019-07-05 09:54:32 +08:00
} ;
RID_Owner < OccluderPolygon > occluder_polygon_owner ;
2020-11-26 20:50:21 +08:00
enum ShadowRenderMode {
SHADOW_RENDER_MODE_SHADOW ,
SHADOW_RENDER_MODE_SDF ,
} ;
enum {
SHADOW_RENDER_SDF_TRIANGLES ,
SHADOW_RENDER_SDF_LINES ,
} ;
2019-06-27 02:11:52 +08:00
struct {
2019-07-05 09:54:32 +08:00
CanvasOcclusionShaderRD shader ;
RID shader_version ;
RID render_pipelines [ 3 ] ;
2020-11-26 20:50:21 +08:00
RID sdf_render_pipelines [ 2 ] ;
2019-07-05 09:54:32 +08:00
RD : : VertexFormatID vertex_format ;
2020-11-26 20:50:21 +08:00
RD : : VertexFormatID sdf_vertex_format ;
2019-07-05 09:54:32 +08:00
RD : : FramebufferFormatID framebuffer_format ;
2020-11-26 20:50:21 +08:00
RD : : FramebufferFormatID sdf_framebuffer_format ;
2019-07-05 09:54:32 +08:00
} shadow_render ;
2019-06-27 02:11:52 +08:00
2019-06-16 10:45:24 +08:00
/***************/
/**** STATE ****/
/***************/
//state that does not vary across rendering all items
struct State {
//state buffer
struct Buffer {
float canvas_transform [ 16 ] ;
float screen_transform [ 16 ] ;
2019-07-05 09:54:32 +08:00
float canvas_normal_transform [ 16 ] ;
float canvas_modulate [ 4 ] ;
2020-11-04 03:51:53 +08:00
2019-07-27 21:23:24 +08:00
float screen_pixel_size [ 2 ] ;
2019-07-21 22:31:30 +08:00
float time ;
2020-10-30 05:09:16 +08:00
uint32_t use_pixel_snap ;
2019-07-27 21:23:24 +08:00
2020-11-26 20:50:21 +08:00
float sdf_to_tex [ 4 ] ;
float sdf_to_screen [ 2 ] ;
float screen_to_sdf [ 2 ] ;
2020-11-04 03:51:53 +08:00
uint32_t directional_light_count ;
2020-11-26 20:50:21 +08:00
float tex_to_sdf ;
uint32_t pad1 ;
uint32_t pad2 ;
2019-06-16 10:45:24 +08:00
} ;
2019-07-05 09:54:32 +08:00
2022-04-04 21:06:57 +08:00
LightUniform * light_uniforms = nullptr ;
2019-07-05 09:54:32 +08:00
RID lights_uniform_buffer ;
2019-06-16 10:45:24 +08:00
RID canvas_state_buffer ;
2019-07-08 20:53:40 +08:00
RID shadow_sampler ;
2020-10-24 23:15:43 +08:00
RID shadow_texture ;
RID shadow_depth_texture ;
RID shadow_fb ;
int shadow_texture_size = 2048 ;
RID default_transforms_uniform_set ;
2019-06-16 10:45:24 +08:00
2019-07-11 04:44:55 +08:00
uint32_t max_lights_per_render ;
uint32_t max_lights_per_item ;
2019-07-21 22:31:30 +08:00
double time ;
2020-11-04 03:51:53 +08:00
2019-06-16 10:45:24 +08:00
} state ;
struct PushConstant {
2019-06-25 03:13:06 +08:00
float world [ 6 ] ;
2019-06-16 10:45:24 +08:00
uint32_t flags ;
uint32_t specular_shininess ;
2019-06-25 03:13:06 +08:00
union {
//rect
struct {
float modulation [ 4 ] ;
2020-12-27 21:30:33 +08:00
union {
float msdf [ 4 ] ;
float ninepatch_margins [ 4 ] ;
} ;
2019-06-25 03:13:06 +08:00
float dst_rect [ 4 ] ;
float src_rect [ 4 ] ;
2019-06-27 02:11:52 +08:00
float pad [ 2 ] ;
2019-06-25 03:13:06 +08:00
} ;
//primitive
struct {
2019-07-05 09:54:32 +08:00
float points [ 6 ] ; // vec2 points[3]
float uvs [ 6 ] ; // vec2 points[3]
2019-06-27 02:11:52 +08:00
uint32_t colors [ 6 ] ; // colors encoded as half
2019-06-25 03:13:06 +08:00
} ;
} ;
2019-06-27 02:11:52 +08:00
float color_texture_pixel_size [ 2 ] ;
uint32_t lights [ 4 ] ;
2019-06-16 10:45:24 +08:00
} ;
struct SkeletonUniform {
float skeleton_transform [ 16 ] ;
float skeleton_inverse [ 16 ] ;
} ;
Item * items [ MAX_RENDER_ITEMS ] ;
2020-11-04 03:51:53 +08:00
bool using_directional_lights = false ;
2020-10-24 23:15:43 +08:00
RID default_canvas_texture ;
2020-10-29 02:34:27 +08:00
RID default_canvas_group_shader ;
RID default_canvas_group_material ;
2022-10-07 06:27:11 +08:00
RID default_clip_children_material ;
RID default_clip_children_shader ;
2020-10-29 02:34:27 +08:00
2020-10-24 23:15:43 +08:00
RS : : CanvasItemTextureFilter default_filter = RS : : CANVAS_ITEM_TEXTURE_FILTER_LINEAR ;
RS : : CanvasItemTextureRepeat default_repeat = RS : : CANVAS_ITEM_TEXTURE_REPEAT_DISABLED ;
RID _create_base_uniform_set ( RID p_to_render_target , bool p_backbuffer ) ;
inline void _bind_canvas_texture ( RD : : DrawListID p_draw_list , RID p_texture , RS : : CanvasItemTextureFilter p_base_filter , RS : : CanvasItemTextureRepeat p_base_repeat , RID & r_last_texture , PushConstant & push_constant , Size2 & r_texpixel_size ) ; //recursive, so regular inline used instead.
2021-05-20 22:25:06 +08:00
void _render_item ( RenderingDevice : : DrawListID p_draw_list , RID p_render_target , const Item * p_item , RenderingDevice : : FramebufferFormatID p_framebuffer_format , const Transform2D & p_canvas_transform_inverse , Item * & current_clip , Light * p_lights , PipelineVariants * p_pipeline_variants ) ;
2020-10-29 02:34:27 +08:00
void _render_items ( RID p_to_render_target , int p_item_count , const Transform2D & p_canvas_transform_inverse , Light * p_lights , bool p_to_backbuffer = false ) ;
2019-06-16 10:45:24 +08:00
2019-07-05 09:54:32 +08:00
_FORCE_INLINE_ void _update_transform_2d_to_mat2x4 ( const Transform2D & p_transform , float * p_mat2x4 ) ;
_FORCE_INLINE_ void _update_transform_2d_to_mat2x3 ( const Transform2D & p_transform , float * p_mat2x3 ) ;
2019-06-16 10:45:24 +08:00
2019-07-05 09:54:32 +08:00
_FORCE_INLINE_ void _update_transform_2d_to_mat4 ( const Transform2D & p_transform , float * p_mat4 ) ;
2020-10-17 13:08:21 +08:00
_FORCE_INLINE_ void _update_transform_to_mat4 ( const Transform3D & p_transform , float * p_mat4 ) ;
2019-07-05 09:54:32 +08:00
2020-11-04 03:51:53 +08:00
void _update_shadow_atlas ( ) ;
2019-06-12 02:43:37 +08:00
public :
2019-06-25 03:13:06 +08:00
PolygonID request_polygon ( const Vector < int > & p_indices , const Vector < Point2 > & p_points , const Vector < Color > & p_colors , const Vector < Point2 > & p_uvs = Vector < Point2 > ( ) , const Vector < int > & p_bones = Vector < int > ( ) , const Vector < float > & p_weights = Vector < float > ( ) ) ;
void free_polygon ( PolygonID p_polygon ) ;
2019-07-05 09:54:32 +08:00
RID light_create ( ) ;
void light_set_texture ( RID p_rid , RID p_texture ) ;
2020-10-24 23:15:43 +08:00
void light_set_use_shadow ( RID p_rid , bool p_enable ) ;
void light_update_shadow ( RID p_rid , int p_shadow_index , const Transform2D & p_light_xform , int p_light_mask , float p_near , float p_far , LightOccluderInstance * p_occluders ) ;
2020-11-04 03:51:53 +08:00
void light_update_directional_shadow ( RID p_rid , int p_shadow_index , const Transform2D & p_light_xform , int p_light_mask , float p_cull_distance , const Rect2 & p_clip_rect , LightOccluderInstance * p_occluders ) ;
2019-07-05 09:54:32 +08:00
2020-11-26 20:50:21 +08:00
virtual void render_sdf ( RID p_render_target , LightOccluderInstance * p_occluders ) ;
2019-07-05 09:54:32 +08:00
RID occluder_polygon_create ( ) ;
2020-11-26 20:50:21 +08:00
void occluder_polygon_set_shape ( RID p_occluder , const Vector < Vector2 > & p_points , bool p_closed ) ;
2020-03-28 02:21:27 +08:00
void occluder_polygon_set_cull_mode ( RID p_occluder , RS : : CanvasOccluderPolygonCullMode p_mode ) ;
2019-06-12 02:43:37 +08:00
2020-11-26 20:50:21 +08:00
void canvas_render_items ( RID p_to_render_target , Item * p_item_list , const Color & p_modulate , Light * p_light_list , Light * p_directional_light_list , const Transform2D & p_canvas_transform , RS : : CanvasItemTextureFilter p_default_filter , RS : : CanvasItemTextureRepeat p_default_repeat , bool p_snap_2d_vertices_to_pixel , bool & r_sdf_used ) ;
2019-06-12 02:43:37 +08:00
2020-10-24 23:15:43 +08:00
virtual void set_shadow_texture_size ( int p_size ) ;
2019-07-21 22:31:30 +08:00
void set_time ( double p_time ) ;
2019-06-16 10:45:24 +08:00
void update ( ) ;
2019-07-05 09:54:32 +08:00
bool free ( RID p_rid ) ;
2022-06-21 08:08:33 +08:00
RendererCanvasRenderRD ( ) ;
2020-12-05 02:26:24 +08:00
~ RendererCanvasRenderRD ( ) ;
2019-06-12 02:43:37 +08:00
} ;
2022-07-24 05:41:51 +08:00
# endif // RENDERER_CANVAS_RENDER_RD_H