diff options
Diffstat (limited to 'servers/rendering')
38 files changed, 230 insertions, 0 deletions
diff --git a/servers/rendering/rasterizer.cpp b/servers/rendering/rasterizer.cpp index e7b5d81bf1..566a14b655 100644 --- a/servers/rendering/rasterizer.cpp +++ b/servers/rendering/rasterizer.cpp @@ -40,6 +40,7 @@ void RasterizerScene::InstanceDependency::instance_notify_changed(bool p_aabb, b E->key()->dependency_changed(p_aabb, p_dependencies); } } + void RasterizerScene::InstanceDependency::instance_notify_deleted(RID p_deleted) { for (Map<InstanceBase *, uint32_t>::Element *E = instances.front(); E; E = E->next()) { E->key()->dependency_deleted(p_deleted); diff --git a/servers/rendering/rasterizer_rd/light_cluster_builder.cpp b/servers/rendering/rasterizer_rd/light_cluster_builder.cpp index 260c0f3760..efb48e6df7 100644 --- a/servers/rendering/rasterizer_rd/light_cluster_builder.cpp +++ b/servers/rendering/rasterizer_rd/light_cluster_builder.cpp @@ -203,6 +203,7 @@ void LightClusterBuilder::setup(uint32_t p_width, uint32_t p_height, uint32_t p_ RID LightClusterBuilder::get_cluster_texture() const { return cluster_texture; } + RID LightClusterBuilder::get_cluster_indices_buffer() const { return items_buffer; } @@ -226,6 +227,7 @@ LightClusterBuilder::LightClusterBuilder() { items_buffer = RD::get_singleton()->storage_buffer_create(sizeof(uint32_t) * 1024); item_max = 1024; } + LightClusterBuilder::~LightClusterBuilder() { if (cluster_data.size()) { RD::get_singleton()->free(cluster_texture); diff --git a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp index f328bab7d1..4c477ca5f4 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp @@ -1545,6 +1545,7 @@ void RasterizerCanvasRD::light_set_texture(RID p_rid, RID p_texture) { cl->texture = p_texture; } + void RasterizerCanvasRD::light_set_use_shadow(RID p_rid, bool p_enable, int p_resolution) { CanvasLight *cl = canvas_light_owner.getornull(p_rid); ERR_FAIL_COND(!cl); @@ -1758,6 +1759,7 @@ void RasterizerCanvasRD::occluder_polygon_set_shape_as_lines(RID p_occluder, con } } } + void RasterizerCanvasRD::occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) { OccluderPolygon *oc = occluder_polygon_owner.getornull(p_occluder); ERR_FAIL_COND(!oc); @@ -1955,6 +1957,7 @@ void RasterizerCanvasRD::ShaderData::set_default_texture_param(const StringName default_texture_params[p_name] = p_texture; } } + void RasterizerCanvasRD::ShaderData::get_param_list(List<PropertyInfo> *p_param_list) const { Map<int, StringName> order; @@ -2002,9 +2005,11 @@ bool RasterizerCanvasRD::ShaderData::is_param_texture(const StringName &p_param) bool RasterizerCanvasRD::ShaderData::is_animated() const { return false; } + bool RasterizerCanvasRD::ShaderData::casts_shadows() const { return false; } + Variant RasterizerCanvasRD::ShaderData::get_default_parameter(const StringName &p_parameter) const { if (uniforms.has(p_parameter)) { ShaderLanguage::ShaderNode::Uniform uniform = uniforms[p_parameter]; @@ -2033,6 +2038,7 @@ RasterizerStorageRD::ShaderData *RasterizerCanvasRD::_create_shader_func() { ShaderData *shader_data = memnew(ShaderData); return shader_data; } + void RasterizerCanvasRD::MaterialData::update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) { RasterizerCanvasRD *canvas_singleton = (RasterizerCanvasRD *)RasterizerCanvas::singleton; @@ -2134,6 +2140,7 @@ void RasterizerCanvasRD::MaterialData::update_parameters(const Map<StringName, V uniform_set = RD::get_singleton()->uniform_set_create(uniforms, canvas_singleton->shader.canvas_shader.version_get_shader(shader_data->version, 0), 1); } + RasterizerCanvasRD::MaterialData::~MaterialData() { if (uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { RD::get_singleton()->free(uniform_set); diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp index 26d7090fbc..2b747cd04a 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_high_end_rd.cpp @@ -414,6 +414,7 @@ bool RasterizerSceneHighEndRD::ShaderData::is_animated() const { bool RasterizerSceneHighEndRD::ShaderData::casts_shadows() const { return false; } + Variant RasterizerSceneHighEndRD::ShaderData::get_default_parameter(const StringName &p_parameter) const { if (uniforms.has(p_parameter)) { ShaderLanguage::ShaderNode::Uniform uniform = uniforms[p_parameter]; diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp index 3ea89d643f..ac986fab58 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp @@ -1130,36 +1130,43 @@ void RasterizerSceneRD::environment_set_background(RID p_env, RS::EnvironmentBG ERR_FAIL_COND(!env); env->background = p_bg; } + void RasterizerSceneRD::environment_set_sky(RID p_env, RID p_sky) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sky = p_sky; } + void RasterizerSceneRD::environment_set_sky_custom_fov(RID p_env, float p_scale) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sky_custom_fov = p_scale; } + void RasterizerSceneRD::environment_set_sky_orientation(RID p_env, const Basis &p_orientation) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sky_orientation = p_orientation; } + void RasterizerSceneRD::environment_set_bg_color(RID p_env, const Color &p_color) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->bg_color = p_color; } + void RasterizerSceneRD::environment_set_bg_energy(RID p_env, float p_energy) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->bg_energy = p_energy; } + void RasterizerSceneRD::environment_set_canvas_max_layer(RID p_env, int p_max_layer) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->canvas_max_layer = p_max_layer; } + void RasterizerSceneRD::environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient, float p_energy, float p_sky_contribution, RS::EnvironmentReflectionSource p_reflection_source, const Color &p_ao_color) { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); @@ -1176,56 +1183,67 @@ RS::EnvironmentBG RasterizerSceneRD::environment_get_background(RID p_env) const ERR_FAIL_COND_V(!env, RS::ENV_BG_MAX); return env->background; } + RID RasterizerSceneRD::environment_get_sky(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RID()); return env->sky; } + float RasterizerSceneRD::environment_get_sky_custom_fov(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->sky_custom_fov; } + Basis RasterizerSceneRD::environment_get_sky_orientation(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Basis()); return env->sky_orientation; } + Color RasterizerSceneRD::environment_get_bg_color(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Color()); return env->bg_color; } + float RasterizerSceneRD::environment_get_bg_energy(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->bg_energy; } + int RasterizerSceneRD::environment_get_canvas_max_layer(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->canvas_max_layer; } + Color RasterizerSceneRD::environment_get_ambient_light_color(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Color()); return env->ambient_light; } + RS::EnvironmentAmbientSource RasterizerSceneRD::environment_get_ambient_source(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RS::ENV_AMBIENT_SOURCE_BG); return env->ambient_source; } + float RasterizerSceneRD::environment_get_ambient_light_energy(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->ambient_light_energy; } + float RasterizerSceneRD::environment_get_ambient_sky_contribution(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->ambient_sky_contribution; } + RS::EnvironmentReflectionSource RasterizerSceneRD::environment_get_reflection_source(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RS::ENV_REFLECTION_SOURCE_DISABLED); @@ -1321,6 +1339,7 @@ float RasterizerSceneRD::environment_get_ssao_ao_affect(RID p_env) const { ERR_FAIL_COND_V(!env, false); return env->ssao_ao_channel_affect; } + float RasterizerSceneRD::environment_get_ssao_light_affect(RID p_env) const { Environent *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, false); diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp index 63abe6b215..c04bbc6c06 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.cpp @@ -713,6 +713,7 @@ RID RasterizerStorageRD::texture_2d_layered_create(const Vector<Ref<Image>> &p_l return texture_owner.make_rid(texture); } + RID RasterizerStorageRD::texture_3d_create(const Vector<Ref<Image>> &p_slices) { return RID(); } @@ -765,9 +766,11 @@ void RasterizerStorageRD::_texture_2d_update(RID p_texture, const Ref<Image> &p_ void RasterizerStorageRD::texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer) { _texture_2d_update(p_texture, p_image, p_layer, true); } + void RasterizerStorageRD::texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer) { _texture_2d_update(p_texture, p_image, p_layer, false); } + void RasterizerStorageRD::texture_3d_update(RID p_texture, const Ref<Image> &p_image, int p_depth, int p_mipmap) { } @@ -826,6 +829,7 @@ RID RasterizerStorageRD::texture_2d_placeholder_create() { return texture_2d_create(image); } + RID RasterizerStorageRD::texture_2d_layered_placeholder_create(RS::TextureLayeredType p_layered_type) { //this could be better optimized to reuse an existing image , done this way //for now to get it working @@ -851,6 +855,7 @@ RID RasterizerStorageRD::texture_2d_layered_placeholder_create(RS::TextureLayere return texture_2d_layered_create(images, p_layered_type); } + RID RasterizerStorageRD::texture_3d_placeholder_create() { return RID(); } @@ -882,9 +887,11 @@ Ref<Image> RasterizerStorageRD::texture_2d_get(RID p_texture) const { return image; } + Ref<Image> RasterizerStorageRD::texture_2d_layer_get(RID p_texture, int p_layer) const { return Ref<Image>(); } + Ref<Image> RasterizerStorageRD::texture_3d_slice_get(RID p_texture, int p_depth, int p_mipmap) const { return Ref<Image>(); } @@ -928,6 +935,7 @@ void RasterizerStorageRD::texture_replace(RID p_texture, RID p_by_texture) { decal_atlas.dirty = true; //mark it dirty since it was most likely modified } } + void RasterizerStorageRD::texture_set_size_override(RID p_texture, int p_width, int p_height) { Texture *tex = texture_owner.getornull(p_texture); ERR_FAIL_COND(!tex); @@ -941,6 +949,7 @@ void RasterizerStorageRD::texture_set_path(RID p_texture, const String &p_path) ERR_FAIL_COND(!tex); tex->path = p_path; } + String RasterizerStorageRD::texture_get_path(RID p_texture) const { return String(); } @@ -951,23 +960,27 @@ void RasterizerStorageRD::texture_set_detect_3d_callback(RID p_texture, RS::Text tex->detect_3d_callback_ud = p_userdata; tex->detect_3d_callback = p_callback; } + void RasterizerStorageRD::texture_set_detect_normal_callback(RID p_texture, RS::TextureDetectCallback p_callback, void *p_userdata) { Texture *tex = texture_owner.getornull(p_texture); ERR_FAIL_COND(!tex); tex->detect_normal_callback_ud = p_userdata; tex->detect_normal_callback = p_callback; } + void RasterizerStorageRD::texture_set_detect_roughness_callback(RID p_texture, RS::TextureDetectRoughnessCallback p_callback, void *p_userdata) { Texture *tex = texture_owner.getornull(p_texture); ERR_FAIL_COND(!tex); tex->detect_roughness_callback_ud = p_userdata; tex->detect_roughness_callback = p_callback; } + void RasterizerStorageRD::texture_debug_usage(List<RS::TextureInfo> *r_info) { } void RasterizerStorageRD::texture_set_proxy(RID p_proxy, RID p_base) { } + void RasterizerStorageRD::texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) { } @@ -1055,6 +1068,7 @@ String RasterizerStorageRD::shader_get_code(RID p_shader) const { ERR_FAIL_COND_V(!shader, String()); return shader->code; } + void RasterizerStorageRD::shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const { Shader *shader = shader_owner.getornull(p_shader); ERR_FAIL_COND(!shader); @@ -1088,6 +1102,7 @@ RID RasterizerStorageRD::shader_get_default_texture_param(RID p_shader, const St return RID(); } + Variant RasterizerStorageRD::shader_get_param_default(RID p_shader, const StringName &p_param) const { Shader *shader = shader_owner.getornull(p_shader); ERR_FAIL_COND_V(!shader, Variant()); @@ -1096,6 +1111,7 @@ Variant RasterizerStorageRD::shader_get_param_default(RID p_shader, const String } return Variant(); } + void RasterizerStorageRD::shader_set_data_request_function(ShaderType p_shader_type, ShaderDataRequestFunction p_function) { ERR_FAIL_INDEX(p_shader_type, SHADER_TYPE_MAX); shader_data_request_func[p_shader_type] = p_function; @@ -1217,6 +1233,7 @@ void RasterizerStorageRD::material_set_next_pass(RID p_material, RID p_next_mate material->instance_dependency.instance_notify_changed(false, true); } + void RasterizerStorageRD::material_set_render_priority(RID p_material, int priority) { Material *material = material_owner.getornull(p_material); ERR_FAIL_COND(!material); @@ -1238,6 +1255,7 @@ bool RasterizerStorageRD::material_is_animated(RID p_material) { } return false; //by default nothing is animated } + bool RasterizerStorageRD::material_casts_shadows(RID p_material) { Material *material = material_owner.getornull(p_material); ERR_FAIL_COND_V(!material, true); @@ -1978,6 +1996,7 @@ void RasterizerStorageRD::_update_queued_materials() { } material_update_list = nullptr; } + /* MESH API */ RID RasterizerStorageRD::mesh_create() { @@ -2142,6 +2161,7 @@ void RasterizerStorageRD::mesh_set_blend_shape_mode(RID p_mesh, RS::BlendShapeMo mesh->blend_shape_mode = p_mode; } + RS::BlendShapeMode RasterizerStorageRD::mesh_get_blend_shape_mode(RID p_mesh) const { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!mesh, RS::BLEND_SHAPE_MODE_NORMALIZED); @@ -2168,6 +2188,7 @@ void RasterizerStorageRD::mesh_surface_set_material(RID p_mesh, int p_surface, R mesh->instance_dependency.instance_notify_changed(false, true); mesh->material_cache.clear(); } + RID RasterizerStorageRD::mesh_surface_get_material(RID p_mesh, int p_surface) const { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!mesh, RID()); @@ -2222,6 +2243,7 @@ void RasterizerStorageRD::mesh_set_custom_aabb(RID p_mesh, const AABB &p_aabb) { ERR_FAIL_COND(!mesh); mesh->custom_aabb = p_aabb; } + AABB RasterizerStorageRD::mesh_get_custom_aabb(RID p_mesh) const { Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND_V(!mesh, AABB()); @@ -2772,6 +2794,7 @@ void RasterizerStorageRD::multimesh_instance_set_transform_2d(RID p_multimesh, i _multimesh_mark_dirty(multimesh, p_index, true); } + void RasterizerStorageRD::multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND(!multimesh); @@ -2793,6 +2816,7 @@ void RasterizerStorageRD::multimesh_instance_set_color(RID p_multimesh, int p_in _multimesh_mark_dirty(multimesh, p_index, false); } + void RasterizerStorageRD::multimesh_instance_set_custom_data(RID p_multimesh, int p_index, const Color &p_color) { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND(!multimesh); @@ -2852,6 +2876,7 @@ Transform RasterizerStorageRD::multimesh_instance_get_transform(RID p_multimesh, return t; } + Transform2D RasterizerStorageRD::multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND_V(!multimesh, Transform2D()); @@ -2876,6 +2901,7 @@ Transform2D RasterizerStorageRD::multimesh_instance_get_transform_2d(RID p_multi return t; } + Color RasterizerStorageRD::multimesh_instance_get_color(RID p_multimesh, int p_index) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND_V(!multimesh, Color()); @@ -2898,6 +2924,7 @@ Color RasterizerStorageRD::multimesh_instance_get_color(RID p_multimesh, int p_i return c; } + Color RasterizerStorageRD::multimesh_instance_get_custom_data(RID p_multimesh, int p_index) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND_V(!multimesh, Color()); @@ -2992,6 +3019,7 @@ void RasterizerStorageRD::multimesh_set_visible_instances(RID p_multimesh, int p multimesh->visible_instances = p_visible; } + int RasterizerStorageRD::multimesh_get_visible_instances(RID p_multimesh) const { MultiMesh *multimesh = multimesh_owner.getornull(p_multimesh); ERR_FAIL_COND_V(!multimesh, 0); @@ -3102,6 +3130,7 @@ void RasterizerStorageRD::skeleton_allocate(RID p_skeleton, int p_bones, bool p_ _skeleton_make_dirty(skeleton); } } + int RasterizerStorageRD::skeleton_get_bone_count(RID p_skeleton) const { Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); ERR_FAIL_COND_V(!skeleton, 0); @@ -3160,6 +3189,7 @@ Transform RasterizerStorageRD::skeleton_bone_get_transform(RID p_skeleton, int p return t; } + void RasterizerStorageRD::skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) { Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); @@ -3180,6 +3210,7 @@ void RasterizerStorageRD::skeleton_bone_set_transform_2d(RID p_skeleton, int p_b _skeleton_make_dirty(skeleton); } + Transform2D RasterizerStorageRD::skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const { Skeleton *skeleton = skeleton_owner.getornull(p_skeleton); @@ -3258,6 +3289,7 @@ void RasterizerStorageRD::light_set_color(RID p_light, const Color &p_color) { light->color = p_color; } + void RasterizerStorageRD::light_set_param(RID p_light, RS::LightParam p_param, float p_value) { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); @@ -3282,6 +3314,7 @@ void RasterizerStorageRD::light_set_param(RID p_light, RS::LightParam p_param, f light->param[p_param] = p_value; } + void RasterizerStorageRD::light_set_shadow(RID p_light, bool p_enabled) { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); @@ -3322,6 +3355,7 @@ void RasterizerStorageRD::light_set_negative(RID p_light, bool p_enable) { light->negative = p_enable; } + void RasterizerStorageRD::light_set_cull_mask(RID p_light, uint32_t p_mask) { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); @@ -3351,6 +3385,7 @@ void RasterizerStorageRD::light_set_use_gi(RID p_light, bool p_enabled) { light->version++; light->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) { Light *light = light_owner.getornull(p_light); ERR_FAIL_COND(!light); @@ -3500,6 +3535,7 @@ void RasterizerStorageRD::reflection_probe_set_max_distance(RID p_probe, float p reflection_probe->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) { ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND(!reflection_probe); @@ -3507,6 +3543,7 @@ void RasterizerStorageRD::reflection_probe_set_extents(RID p_probe, const Vector reflection_probe->extents = p_extents; reflection_probe->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) { ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND(!reflection_probe); @@ -3522,6 +3559,7 @@ void RasterizerStorageRD::reflection_probe_set_as_interior(RID p_probe, bool p_e reflection_probe->interior = p_enable; reflection_probe->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) { ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND(!reflection_probe); @@ -3536,6 +3574,7 @@ void RasterizerStorageRD::reflection_probe_set_enable_shadows(RID p_probe, bool reflection_probe->enable_shadows = p_enable; reflection_probe->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) { ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND(!reflection_probe); @@ -3562,6 +3601,7 @@ AABB RasterizerStorageRD::reflection_probe_get_aabb(RID p_probe) const { return aabb; } + RS::ReflectionProbeUpdateMode RasterizerStorageRD::reflection_probe_get_update_mode(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, RS::REFLECTION_PROBE_UPDATE_ALWAYS); @@ -3582,6 +3622,7 @@ Vector3 RasterizerStorageRD::reflection_probe_get_extents(RID p_probe) const { return reflection_probe->extents; } + Vector3 RasterizerStorageRD::reflection_probe_get_origin_offset(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, Vector3()); @@ -3616,12 +3657,14 @@ float RasterizerStorageRD::reflection_probe_get_intensity(RID p_probe) const { return reflection_probe->intensity; } + bool RasterizerStorageRD::reflection_probe_is_interior(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, false); return reflection_probe->interior; } + bool RasterizerStorageRD::reflection_probe_is_box_projection(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, false); @@ -3635,12 +3678,14 @@ Color RasterizerStorageRD::reflection_probe_get_interior_ambient(RID p_probe) co return reflection_probe->interior_ambient; } + float RasterizerStorageRD::reflection_probe_get_interior_ambient_energy(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, 0); return reflection_probe->interior_ambient_energy; } + float RasterizerStorageRD::reflection_probe_get_interior_ambient_probe_contribution(RID p_probe) const { const ReflectionProbe *reflection_probe = reflection_probe_owner.getornull(p_probe); ERR_FAIL_COND_V(!reflection_probe, 0); @@ -3658,6 +3703,7 @@ void RasterizerStorageRD::decal_set_extents(RID p_decal, const Vector3 &p_extent decal->extents = p_extents; decal->instance_dependency.instance_notify_changed(true, false); } + void RasterizerStorageRD::decal_set_texture(RID p_decal, RS::DecalTexture p_type, RID p_texture) { Decal *decal = decal_owner.getornull(p_decal); ERR_FAIL_COND(!decal); @@ -3681,6 +3727,7 @@ void RasterizerStorageRD::decal_set_texture(RID p_decal, RS::DecalTexture p_type decal->instance_dependency.instance_notify_changed(false, true); } + void RasterizerStorageRD::decal_set_emission_energy(RID p_decal, float p_energy) { Decal *decal = decal_owner.getornull(p_decal); ERR_FAIL_COND(!decal); @@ -3698,6 +3745,7 @@ void RasterizerStorageRD::decal_set_modulate(RID p_decal, const Color &p_modulat ERR_FAIL_COND(!decal); decal->modulate = p_modulate; } + void RasterizerStorageRD::decal_set_cull_mask(RID p_decal, uint32_t p_layers) { Decal *decal = decal_owner.getornull(p_decal); ERR_FAIL_COND(!decal); @@ -3875,6 +3923,7 @@ Vector3i RasterizerStorageRD::gi_probe_get_octree_size(RID p_gi_probe) const { ERR_FAIL_COND_V(!gi_probe, Vector3i()); return gi_probe->octree_size; } + Vector<uint8_t> RasterizerStorageRD::gi_probe_get_octree_cells(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); @@ -3884,6 +3933,7 @@ Vector<uint8_t> RasterizerStorageRD::gi_probe_get_octree_cells(RID p_gi_probe) c } return Vector<uint8_t>(); } + Vector<uint8_t> RasterizerStorageRD::gi_probe_get_data_cells(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); @@ -3893,6 +3943,7 @@ Vector<uint8_t> RasterizerStorageRD::gi_probe_get_data_cells(RID p_gi_probe) con } return Vector<uint8_t>(); } + Vector<uint8_t> RasterizerStorageRD::gi_probe_get_distance_field(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Vector<uint8_t>()); @@ -3902,12 +3953,14 @@ Vector<uint8_t> RasterizerStorageRD::gi_probe_get_distance_field(RID p_gi_probe) } return Vector<uint8_t>(); } + Vector<int> RasterizerStorageRD::gi_probe_get_level_counts(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Vector<int>()); return gi_probe->level_counts; } + Transform RasterizerStorageRD::gi_probe_get_to_cell_xform(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, Transform()); @@ -3922,6 +3975,7 @@ void RasterizerStorageRD::gi_probe_set_dynamic_range(RID p_gi_probe, float p_ran gi_probe->dynamic_range = p_range; gi_probe->version++; } + float RasterizerStorageRD::gi_probe_get_dynamic_range(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3936,6 +3990,7 @@ void RasterizerStorageRD::gi_probe_set_propagation(RID p_gi_probe, float p_range gi_probe->propagation = p_range; gi_probe->version++; } + float RasterizerStorageRD::gi_probe_get_propagation(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3948,6 +4003,7 @@ void RasterizerStorageRD::gi_probe_set_energy(RID p_gi_probe, float p_energy) { gi_probe->energy = p_energy; } + float RasterizerStorageRD::gi_probe_get_energy(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3960,6 +4016,7 @@ void RasterizerStorageRD::gi_probe_set_ao(RID p_gi_probe, float p_ao) { gi_probe->ao = p_ao; } + float RasterizerStorageRD::gi_probe_get_ao(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3985,6 +4042,7 @@ void RasterizerStorageRD::gi_probe_set_bias(RID p_gi_probe, float p_bias) { gi_probe->bias = p_bias; } + float RasterizerStorageRD::gi_probe_get_bias(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -3997,6 +4055,7 @@ void RasterizerStorageRD::gi_probe_set_normal_bias(RID p_gi_probe, float p_norma gi_probe->normal_bias = p_normal_bias; } + float RasterizerStorageRD::gi_probe_get_normal_bias(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, 0); @@ -4060,6 +4119,7 @@ RID RasterizerStorageRD::gi_probe_get_octree_buffer(RID p_gi_probe) const { ERR_FAIL_COND_V(!gi_probe, RID()); return gi_probe->octree_buffer; } + RID RasterizerStorageRD::gi_probe_get_data_buffer(RID p_gi_probe) const { GIProbe *gi_probe = gi_probe_owner.getornull(p_gi_probe); ERR_FAIL_COND_V(!gi_probe, RID()); @@ -4072,6 +4132,7 @@ RID RasterizerStorageRD::gi_probe_get_sdf_texture(RID p_gi_probe) { return gi_probe->sdf_texture; } + /* LIGHTMAP API */ RID RasterizerStorageRD::lightmap_create() { @@ -4160,16 +4221,19 @@ PackedVector3Array RasterizerStorageRD::lightmap_get_probe_capture_points(RID p_ return lm->points; } + PackedColorArray RasterizerStorageRD::lightmap_get_probe_capture_sh(RID p_lightmap) const { Lightmap *lm = lightmap_owner.getornull(p_lightmap); ERR_FAIL_COND_V(!lm, PackedColorArray()); return lm->point_sh; } + PackedInt32Array RasterizerStorageRD::lightmap_get_probe_capture_tetrahedra(RID p_lightmap) const { Lightmap *lm = lightmap_owner.getornull(p_lightmap); ERR_FAIL_COND_V(!lm, PackedInt32Array()); return lm->tetrahedra; } + PackedInt32Array RasterizerStorageRD::lightmap_get_probe_capture_bsp_tree(RID p_lightmap) const { Lightmap *lm = lightmap_owner.getornull(p_lightmap); ERR_FAIL_COND_V(!lm, PackedInt32Array()); @@ -4235,6 +4299,7 @@ bool RasterizerStorageRD::lightmap_is_interior(RID p_lightmap) const { ERR_FAIL_COND_V(!lm, false); return lm->interior; } + AABB RasterizerStorageRD::lightmap_get_aabb(RID p_lightmap) const { const Lightmap *lm = lightmap_owner.getornull(p_lightmap); ERR_FAIL_COND_V(!lm, AABB()); @@ -4463,12 +4528,14 @@ RID RasterizerStorageRD::render_target_get_rd_framebuffer(RID p_render_target) { return rt->framebuffer; } + RID RasterizerStorageRD::render_target_get_rd_texture(RID p_render_target) { RenderTarget *rt = render_target_owner.getornull(p_render_target); ERR_FAIL_COND_V(!rt, RID()); return rt->color; } + void RasterizerStorageRD::render_target_request_clear(RID p_render_target, const Color &p_clear_color) { RenderTarget *rt = render_target_owner.getornull(p_render_target); ERR_FAIL_COND(!rt); @@ -5227,6 +5294,7 @@ void RasterizerStorageRD::global_variable_remove(const StringName &p_name) { global_variables.variables.erase(p_name); } + Vector<StringName> RasterizerStorageRD::global_variable_get_list() const { if (!Engine::get_singleton()->is_editor_hint()) { ERR_FAIL_V_MSG(Vector<StringName>(), "This function should never be used outside the editor, it can severely damage performance."); @@ -5260,6 +5328,7 @@ void RasterizerStorageRD::global_variable_set(const StringName &p_name, const Va } } } + void RasterizerStorageRD::global_variable_set_override(const StringName &p_name, const Variant &p_value) { if (!global_variables.variables.has(p_name)) { return; //variable may not exist @@ -5422,6 +5491,7 @@ void RasterizerStorageRD::global_variables_instance_free(RID p_instance) { } global_variables.instance_buffer_pos.erase(p_instance); } + void RasterizerStorageRD::global_variables_instance_update(RID p_instance, int p_index, const Variant &p_value) { if (!global_variables.instance_buffer_pos.has(p_instance)) { return; //just not allocated, ignore @@ -5546,6 +5616,7 @@ bool RasterizerStorageRD::has_os_feature(const String &p_feature) const { return false; } + bool RasterizerStorageRD::free(RID p_rid) { if (texture_owner.owns(p_rid)) { Texture *t = texture_owner.getornull(p_rid); @@ -5683,6 +5754,7 @@ void RasterizerStorageRD::capture_timestamp(const String &p_name) { uint32_t RasterizerStorageRD::get_captured_timestamps_count() const { return RD::get_singleton()->get_captured_timestamps_count(); } + uint64_t RasterizerStorageRD::get_captured_timestamps_frame() const { return RD::get_singleton()->get_captured_timestamps_frame(); } @@ -5690,9 +5762,11 @@ uint64_t RasterizerStorageRD::get_captured_timestamps_frame() const { uint64_t RasterizerStorageRD::get_captured_timestamp_gpu_time(uint32_t p_index) const { return RD::get_singleton()->get_captured_timestamp_gpu_time(p_index); } + uint64_t RasterizerStorageRD::get_captured_timestamp_cpu_time(uint32_t p_index) const { return RD::get_singleton()->get_captured_timestamp_cpu_time(p_index); } + String RasterizerStorageRD::get_captured_timestamp_name(uint32_t p_index) const { return RD::get_singleton()->get_captured_timestamp_name(p_index); } diff --git a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp index 310fa1bed4..b24874345e 100644 --- a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp +++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp @@ -202,6 +202,7 @@ static int _get_datatype_alignment(SL::DataType p_type) { ERR_FAIL_V(0); } + static String _interpstr(SL::DataInterpolation p_interp) { switch (p_interp) { case SL::INTERPOLATION_FLAT: diff --git a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl index dbeccbfff4..18555d9672 100644 --- a/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl +++ b/servers/rendering/rasterizer_rd/shaders/bokeh_dof.glsl @@ -51,6 +51,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float jitter_seed; uint pad[2]; } + params; //used to work around downsampling filter diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl index 8c2b0c925d..3e0d5c4ffc 100644 --- a/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl +++ b/servers/rendering/rasterizer_rd/shaders/canvas_occlusion.glsl @@ -12,6 +12,7 @@ layout(push_constant, binding = 0, std430) uniform Constants { vec2 direction; vec2 pad; } + constants; layout(location = 0) out highp float depth; diff --git a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl index a39866004b..ba05b8b2fb 100644 --- a/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl +++ b/servers/rendering/rasterizer_rd/shaders/canvas_uniforms_inc.glsl @@ -51,6 +51,7 @@ layout(push_constant, binding = 0, std430) uniform DrawData { vec2 color_texture_pixel_size; uint lights[4]; } + draw_data; // The values passed per draw primitives are cached within it @@ -82,6 +83,7 @@ layout(set = 2, binding = 0, std140) uniform CanvasData { float time_pad; //uint light_count; } + canvas_data; layout(set = 2, binding = 1) uniform textureBuffer skeleton_buffer; @@ -90,6 +92,7 @@ layout(set = 2, binding = 2, std140) uniform SkeletonData { mat4 skeleton_transform; //in world coordinates mat4 skeleton_transform_inverse; } + skeleton_data; #ifdef USE_LIGHTING @@ -123,6 +126,7 @@ struct Light { layout(set = 2, binding = 3, std140) uniform LightData { Light data[MAX_LIGHTS]; } + light_array; layout(set = 2, binding = 4) uniform texture2D light_textures[MAX_LIGHT_TEXTURES]; @@ -135,6 +139,7 @@ layout(set = 2, binding = 6) uniform sampler shadow_sampler; layout(set = 2, binding = 7, std430) restrict readonly buffer GlobalVariableData { vec4 data[]; } + global_variables; /* SET3: Render Target Data */ diff --git a/servers/rendering/rasterizer_rd/shaders/copy.glsl b/servers/rendering/rasterizer_rd/shaders/copy.glsl index c8a8b027c8..249e7963d0 100644 --- a/servers/rendering/rasterizer_rd/shaders/copy.glsl +++ b/servers/rendering/rasterizer_rd/shaders/copy.glsl @@ -37,6 +37,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float camera_z_near; uint pad2[2]; } + params; #ifdef MODE_CUBEMAP_ARRAY_TO_PANORAMA diff --git a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl index 2308f58e00..5f53045afd 100644 --- a/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl +++ b/servers/rendering/rasterizer_rd/shaders/copy_to_fb.glsl @@ -17,6 +17,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool force_luminance; uint pad[3]; } + params; void main() { diff --git a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl index 2fd2e05ae1..133d97ffcb 100644 --- a/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cube_to_dp.glsl @@ -18,6 +18,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float z_near; bool z_flip; } + params; layout(r32f, set = 1, binding = 0) uniform restrict writeonly image2D depth_buffer; diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl index 9f3ecf6053..8d88e46727 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_downsampler.glsl @@ -37,6 +37,7 @@ layout(rgba16f, set = 1, binding = 0) uniform restrict writeonly imageCube dest_ layout(push_constant, binding = 1, std430) uniform Params { uint face_size; } + params; #define M_PI 3.14159265359 @@ -46,26 +47,31 @@ void get_dir_0(out vec3 dir, in float u, in float v) { dir[1] = v; dir[2] = -u; } + void get_dir_1(out vec3 dir, in float u, in float v) { dir[0] = -1.0; dir[1] = v; dir[2] = u; } + void get_dir_2(out vec3 dir, in float u, in float v) { dir[0] = u; dir[1] = 1.0; dir[2] = -v; } + void get_dir_3(out vec3 dir, in float u, in float v) { dir[0] = u; dir[1] = -1.0; dir[2] = v; } + void get_dir_4(out vec3 dir, in float u, in float v) { dir[0] = u; dir[1] = v; dir[2] = 1.0; } + void get_dir_5(out vec3 dir, in float u, in float v) { dir[0] = -u; dir[1] = v; diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl index 193d0a8a3c..20bc0e2d0d 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_filter.glsl @@ -51,11 +51,13 @@ layout(rgba16f, set = 2, binding = 6) uniform restrict writeonly imageCube dest_ layout(set = 1, binding = 0, std430) buffer restrict readonly Data { vec4[7][5][3][24] coeffs; } + data; #else layout(set = 1, binding = 0, std430) buffer restrict readonly Data { vec4[7][5][6] coeffs; } + data; #endif diff --git a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl index 36dba6df3d..0e6e51f0de 100644 --- a/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl +++ b/servers/rendering/rasterizer_rd/shaders/cubemap_roughness.glsl @@ -21,6 +21,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool use_direct_write; float face_size; } + params; #define M_PI 3.14159265359 diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl index e4449afbd0..60c4032d80 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe.glsl @@ -24,6 +24,7 @@ struct CellChildren { layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer { CellChildren data[]; } + cell_children; struct CellData { @@ -36,6 +37,7 @@ struct CellData { layout(set = 0, binding = 2, std430) buffer CellDataBuffer { CellData data[]; } + cell_data; #endif // MODE DYNAMIC @@ -65,6 +67,7 @@ struct Light { layout(set = 0, binding = 3, std140) uniform Lights { Light data[MAX_LIGHTS]; } + lights; #endif // MODE COMPUTE LIGHT @@ -96,11 +99,13 @@ layout(push_constant, binding = 0, std430) uniform Params { float aniso_strength; uint pad; } + params; layout(set = 0, binding = 4, std430) buffer Outputs { vec4 data[]; } + outputs; #endif // MODE DYNAMIC @@ -143,6 +148,7 @@ layout(push_constant, binding = 0, std430) uniform Params { float propagation; float pad[3]; } + params; #ifdef MODE_DYNAMIC_LIGHTING diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl index dd347c86a7..db3043fb28 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_debug.glsl @@ -16,6 +16,7 @@ struct CellData { layout(set = 0, binding = 1, std140) buffer CellDataBuffer { CellData data[]; } + cell_data; layout(set = 0, binding = 2) uniform texture3D color_tex; @@ -36,6 +37,7 @@ layout(push_constant, binding = 0, std430) uniform Params { ivec3 bounds; uint pad; } + params; layout(location = 0) out vec4 color_interp; diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl index 5e54c8b4de..37ea673fbe 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_sdf.glsl @@ -20,6 +20,7 @@ struct CellChildren { layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer { CellChildren data[]; } + cell_children; struct CellData { @@ -32,6 +33,7 @@ struct CellData { layout(set = 0, binding = 2, std430) buffer CellDataBuffer { CellData data[]; } + cell_data; layout(r8ui, set = 0, binding = 3) uniform restrict writeonly uimage3D sdf_tex; @@ -42,6 +44,7 @@ layout(push_constant, binding = 0, std430) uniform Params { uint pad0; uint pad1; } + params; void main() { @@ -81,6 +84,7 @@ float distance_to_aabb(ivec3 pos, ivec3 aabb_pos, ivec3 aabb_size) { return length(delta); } + void main() { ivec3 pos = ivec3(gl_GlobalInvocationID); diff --git a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl index d0f2703214..7a79f6a3ac 100644 --- a/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl +++ b/servers/rendering/rasterizer_rd/shaders/giprobe_write.glsl @@ -18,6 +18,7 @@ struct CellChildren { layout(set = 0, binding = 1, std430) buffer CellChildrenBuffer { CellChildren data[]; } + cell_children; struct CellData { @@ -30,6 +31,7 @@ struct CellData { layout(set = 0, binding = 2, std430) buffer CellDataBuffer { CellData data[]; } + cell_data; #define LIGHT_TYPE_DIRECTIONAL 0 @@ -57,6 +59,7 @@ struct Light { layout(set = 0, binding = 3, std140) uniform Lights { Light data[MAX_LIGHTS]; } + lights; #endif @@ -74,11 +77,13 @@ layout(push_constant, binding = 0, std430) uniform Params { uint cell_count; uint pad[2]; } + params; layout(set = 0, binding = 4, std140) uniform Outputs { vec4 data[]; } + output; #ifdef MODE_COMPUTE_LIGHT diff --git a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl index 979fdb2dc1..060b1a3101 100644 --- a/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl +++ b/servers/rendering/rasterizer_rd/shaders/luminance_reduce.glsl @@ -37,6 +37,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float exposure_adjust; float pad[3]; } + params; void main() { diff --git a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl index 6969a967b9..e59424e3d6 100644 --- a/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/roughness_limiter.glsl @@ -16,6 +16,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float curve; uint pad; } + params; #define HALF_PI 1.5707963267948966 diff --git a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl index 4c2fb296e6..93ddcc9dbc 100644 --- a/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl +++ b/servers/rendering/rasterizer_rd/shaders/scene_high_end_inc.glsl @@ -6,6 +6,7 @@ layout(push_constant, binding = 0, std430) uniform DrawCall { uint pad; //16 bits minimum size vec2 bake_uv2_offset; //used for bake to uv2, ignored otherwise } + draw_call; /* Set 0 Scene data that never changes, ever */ @@ -117,6 +118,7 @@ layout(set = 0, binding = 3, std140) uniform SceneData { float fog_height_curve; #endif } + scene_data; #define INSTANCE_FLAGS_USE_LIGHTMAP_CAPTURE (1 << 8) @@ -146,6 +148,7 @@ struct InstanceData { layout(set = 0, binding = 4, std430) restrict readonly buffer Instances { InstanceData data[]; } + instances; struct LightData { //this structure needs to be as packed as possible @@ -172,6 +175,7 @@ struct LightData { //this structure needs to be as packed as possible layout(set = 0, binding = 5, std430) restrict readonly buffer Lights { LightData data[]; } + lights; struct ReflectionData { @@ -188,6 +192,7 @@ struct ReflectionData { layout(set = 0, binding = 6, std140) uniform ReflectionProbeData { ReflectionData data[MAX_REFLECTION_DATA_STRUCTS]; } + reflections; struct DirectionalLightData { @@ -226,6 +231,7 @@ struct DirectionalLightData { layout(set = 0, binding = 7, std140) uniform DirectionalLights { DirectionalLightData data[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS]; } + directional_lights; struct GIProbeData { @@ -247,6 +253,7 @@ struct GIProbeData { layout(set = 0, binding = 8, std140) uniform GIProbes { GIProbeData data[MAX_GI_PROBES]; } + gi_probes; layout(set = 0, binding = 9) uniform texture3D gi_probe_textures[MAX_GI_PROBE_TEXTURES]; @@ -261,6 +268,7 @@ struct Lightmap { layout(set = 0, binding = 10, std140) restrict readonly buffer Lightmaps { Lightmap data[]; } + lightmaps; layout(set = 0, binding = 11) uniform texture2DArray lightmap_textures[MAX_LIGHTMAP_TEXTURES]; @@ -272,6 +280,7 @@ struct LightmapCapture { layout(set = 0, binding = 12, std140) restrict readonly buffer LightmapCaptures { LightmapCapture data[]; } + lightmap_captures; #define CLUSTER_COUNTER_SHIFT 20 @@ -302,6 +311,7 @@ struct DecalData { layout(set = 0, binding = 15, std430) restrict readonly buffer Decals { DecalData data[]; } + decals; layout(set = 0, binding = 16) uniform utexture3D cluster_texture; @@ -309,6 +319,7 @@ layout(set = 0, binding = 16) uniform utexture3D cluster_texture; layout(set = 0, binding = 17, std430) restrict readonly buffer ClusterData { uint indices[]; } + cluster_data; layout(set = 0, binding = 18) uniform texture2D directional_shadow_atlas; @@ -316,6 +327,7 @@ layout(set = 0, binding = 18) uniform texture2D directional_shadow_atlas; layout(set = 0, binding = 19, std430) restrict readonly buffer GlobalVariableData { vec4 data[]; } + global_variables; // decal atlas @@ -351,6 +363,7 @@ layout(set = 3, binding = 4) uniform texture2D ao_buffer; layout(set = 4, binding = 0, std430) restrict readonly buffer Transforms { vec4 data[]; } + transforms; /* Set 5 User Material */ diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl index fcde6b9d7a..39b10871ac 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl @@ -42,6 +42,7 @@ layout(push_constant, binding = 2, std430) uniform Params { mat4 projection; } + params; vec2 view_to_screen(vec3 view_pos, out float w) { diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl index a4ff2ba815..c36143039c 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_filter.glsl @@ -33,6 +33,7 @@ layout(push_constant, binding = 2, std430) uniform Params { bool vertical; uint steps; } + params; #define GAUSS_TABLE_SIZE 15 diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl index 3c6b3748d8..072f57eb40 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection_scale.glsl @@ -26,6 +26,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool filtered; uint pad[2]; } + params; void main() { diff --git a/servers/rendering/rasterizer_rd/shaders/sky.glsl b/servers/rendering/rasterizer_rd/shaders/sky.glsl index f8e2257480..b0be03fe44 100644 --- a/servers/rendering/rasterizer_rd/shaders/sky.glsl +++ b/servers/rendering/rasterizer_rd/shaders/sky.glsl @@ -14,6 +14,7 @@ layout(push_constant, binding = 1, std430) uniform Params { vec4 position_multiplier; float time; } + params; void main() { @@ -40,6 +41,7 @@ layout(push_constant, binding = 1, std430) uniform Params { vec4 position_multiplier; float time; //TODO consider adding vec2 screen res, and float radiance size } + params; #define SAMPLER_NEAREST_CLAMP 0 @@ -60,6 +62,7 @@ layout(set = 0, binding = 0) uniform sampler material_samplers[12]; layout(set = 0, binding = 1, std430) restrict readonly buffer GlobalVariableData { vec4 data[]; } + global_variables; #ifdef USE_MATERIAL_UNIFORMS @@ -108,6 +111,7 @@ struct DirectionalLightData { layout(set = 3, binding = 0, std140) uniform DirectionalLights { DirectionalLightData data[MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS]; } + directional_lights; /* clang-format off */ diff --git a/servers/rendering/rasterizer_rd/shaders/ssao.glsl b/servers/rendering/rasterizer_rd/shaders/ssao.glsl index 0175e26b85..764d7eeeac 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao.glsl @@ -78,6 +78,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float proj_scale; uint pad; } + params; vec3 reconstructCSPosition(vec2 S, float z) { diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl index 642a051ba0..ca7cc7d71b 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao_blur.glsl @@ -31,6 +31,7 @@ layout(push_constant, binding = 1, std430) uniform Params { ivec2 axis; /** (1, 0) or (0, 1) */ ivec2 screen_size; } + params; /** Filter radius in pixels. This will be multiplied by SCALE. */ diff --git a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl index db50ce1893..c590e406f3 100644 --- a/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl +++ b/servers/rendering/rasterizer_rd/shaders/ssao_minify.glsl @@ -16,6 +16,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool orthogonal; uint pad; } + params; #ifdef MINIFY_START diff --git a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl index c91ef49c78..9d660c5865 100644 --- a/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl +++ b/servers/rendering/rasterizer_rd/shaders/subsurface_scattering.glsl @@ -105,6 +105,7 @@ layout(push_constant, binding = 1, std430) uniform Params { float depth_scale; uint pad[3]; } + params; layout(set = 0, binding = 0) uniform sampler2D source_image; diff --git a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl index 780d961197..f4754bfea7 100644 --- a/servers/rendering/rasterizer_rd/shaders/tonemap.glsl +++ b/servers/rendering/rasterizer_rd/shaders/tonemap.glsl @@ -52,6 +52,7 @@ layout(push_constant, binding = 1, std430) uniform Params { bool use_fxaa; uint pad; } + params; layout(location = 0) out vec4 frag_color; diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp index fa9f095585..55b65d2747 100644 --- a/servers/rendering/rendering_device.cpp +++ b/servers/rendering/rendering_device.cpp @@ -44,6 +44,7 @@ RenderingDevice::ShaderCacheFunction RenderingDevice::cache_function = nullptr; void RenderingDevice::shader_set_compile_function(ShaderCompileFunction p_function) { compile_function = p_function; } + void RenderingDevice::shader_set_cache_function(ShaderCacheFunction p_function) { cache_function = p_function; } diff --git a/servers/rendering/rendering_server_canvas.cpp b/servers/rendering/rendering_server_canvas.cpp index 809e9700c4..324765a217 100644 --- a/servers/rendering/rendering_server_canvas.cpp +++ b/servers/rendering/rendering_server_canvas.cpp @@ -297,6 +297,7 @@ void RenderingServerCanvas::canvas_set_item_mirroring(RID p_canvas, RID p_item, ERR_FAIL_COND(idx == -1); canvas->child_items.write[idx].mirror = p_mirroring; } + void RenderingServerCanvas::canvas_set_modulate(RID p_canvas, const Color &p_color) { Canvas *canvas = canvas_owner.getornull(p_canvas); ERR_FAIL_COND(!canvas); @@ -365,6 +366,7 @@ void RenderingServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) { canvas_item->parent = p_parent; } + void RenderingServerCanvas::canvas_item_set_visible(RID p_item, bool p_visible) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -373,6 +375,7 @@ void RenderingServerCanvas::canvas_item_set_visible(RID p_item, bool p_visible) _mark_ysort_dirty(canvas_item, canvas_item_owner); } + void RenderingServerCanvas::canvas_item_set_light_mask(RID p_item, int p_mask) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -386,18 +389,21 @@ void RenderingServerCanvas::canvas_item_set_transform(RID p_item, const Transfor canvas_item->xform = p_transform; } + void RenderingServerCanvas::canvas_item_set_clip(RID p_item, bool p_clip) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); canvas_item->clip = p_clip; } + void RenderingServerCanvas::canvas_item_set_distance_field_mode(RID p_item, bool p_enable) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); canvas_item->distance_field = p_enable; } + void RenderingServerCanvas::canvas_item_set_custom_rect(RID p_item, bool p_custom_rect, const Rect2 &p_rect) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -405,12 +411,14 @@ void RenderingServerCanvas::canvas_item_set_custom_rect(RID p_item, bool p_custo canvas_item->custom_rect = p_custom_rect; canvas_item->rect = p_rect; } + void RenderingServerCanvas::canvas_item_set_modulate(RID p_item, const Color &p_color) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); canvas_item->modulate = p_color; } + void RenderingServerCanvas::canvas_item_set_self_modulate(RID p_item, const Color &p_color) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -716,6 +724,7 @@ void RenderingServerCanvas::canvas_item_add_nine_patch(RID p_item, const Rect2 & style->axis_x = p_x_axis_mode; style->axis_y = p_y_axis_mode; } + void RenderingServerCanvas::canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) { uint32_t pc = p_points.size(); ERR_FAIL_COND(pc == 0 || pc > 4); @@ -811,6 +820,7 @@ void RenderingServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, m->transform = p_transform; m->modulate = p_modulate; } + void RenderingServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, RID p_specular_map, const Color &p_specular_color_shininess, RenderingServer::CanvasItemTextureFilter p_filter, RenderingServer::CanvasItemTextureRepeat p_repeat) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -844,6 +854,7 @@ void RenderingServerCanvas::canvas_item_add_clip_ignore(RID p_item, bool p_ignor ERR_FAIL_COND(!ci); ci->ignore = p_ignore; } + void RenderingServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -852,6 +863,7 @@ void RenderingServerCanvas::canvas_item_set_sort_children_by_y(RID p_item, bool _mark_ysort_dirty(canvas_item, canvas_item_owner); } + void RenderingServerCanvas::canvas_item_set_z_index(RID p_item, int p_z) { ERR_FAIL_COND(p_z < RS::CANVAS_ITEM_Z_MIN || p_z > RS::CANVAS_ITEM_Z_MAX); @@ -860,6 +872,7 @@ void RenderingServerCanvas::canvas_item_set_z_index(RID p_item, int p_z) { canvas_item->z_index = p_z; } + void RenderingServerCanvas::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -898,6 +911,7 @@ void RenderingServerCanvas::canvas_item_clear(RID p_item) { canvas_item->clear(); } + void RenderingServerCanvas::canvas_item_set_draw_index(RID p_item, int p_index) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -936,6 +950,7 @@ RID RenderingServerCanvas::canvas_light_create() { clight->light_internal = RSG::canvas_render->light_create(); return canvas_light_owner.make_rid(clight); } + void RenderingServerCanvas::canvas_light_attach_to_canvas(RID p_light, RID p_canvas) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -962,18 +977,21 @@ void RenderingServerCanvas::canvas_light_set_enabled(RID p_light, bool p_enabled clight->enabled = p_enabled; } + void RenderingServerCanvas::canvas_light_set_scale(RID p_light, float p_scale) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->scale = p_scale; } + void RenderingServerCanvas::canvas_light_set_transform(RID p_light, const Transform2D &p_transform) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->xform = p_transform; } + void RenderingServerCanvas::canvas_light_set_texture(RID p_light, RID p_texture) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -982,30 +1000,35 @@ void RenderingServerCanvas::canvas_light_set_texture(RID p_light, RID p_texture) clight->version++; RSG::canvas_render->light_set_texture(clight->light_internal, p_texture); } + void RenderingServerCanvas::canvas_light_set_texture_offset(RID p_light, const Vector2 &p_offset) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->texture_offset = p_offset; } + void RenderingServerCanvas::canvas_light_set_color(RID p_light, const Color &p_color) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->color = p_color; } + void RenderingServerCanvas::canvas_light_set_height(RID p_light, float p_height) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->height = p_height; } + void RenderingServerCanvas::canvas_light_set_energy(RID p_light, float p_energy) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->energy = p_energy; } + void RenderingServerCanvas::canvas_light_set_z_range(RID p_light, int p_min_z, int p_max_z) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -1013,6 +1036,7 @@ void RenderingServerCanvas::canvas_light_set_z_range(RID p_light, int p_min_z, i clight->z_min = p_min_z; clight->z_max = p_max_z; } + void RenderingServerCanvas::canvas_light_set_layer_range(RID p_light, int p_min_layer, int p_max_layer) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -1020,18 +1044,21 @@ void RenderingServerCanvas::canvas_light_set_layer_range(RID p_light, int p_min_ clight->layer_max = p_max_layer; clight->layer_min = p_min_layer; } + void RenderingServerCanvas::canvas_light_set_item_cull_mask(RID p_light, int p_mask) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->item_mask = p_mask; } + void RenderingServerCanvas::canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); clight->item_shadow_mask = p_mask; } + void RenderingServerCanvas::canvas_light_set_mode(RID p_light, RS::CanvasLightMode p_mode) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -1073,6 +1100,7 @@ void RenderingServerCanvas::canvas_light_set_shadow_filter(RID p_light, RS::Canv clight->shadow_filter = p_filter; } + void RenderingServerCanvas::canvas_light_set_shadow_color(RID p_light, const Color &p_color) { RasterizerCanvas::Light *clight = canvas_light_owner.getornull(p_light); ERR_FAIL_COND(!clight); @@ -1091,6 +1119,7 @@ RID RenderingServerCanvas::canvas_light_occluder_create() { return canvas_light_occluder_owner.make_rid(occluder); } + void RenderingServerCanvas::canvas_light_occluder_attach_to_canvas(RID p_occluder, RID p_canvas) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); @@ -1110,12 +1139,14 @@ void RenderingServerCanvas::canvas_light_occluder_attach_to_canvas(RID p_occlude canvas->occluders.insert(occluder); } } + void RenderingServerCanvas::canvas_light_occluder_set_enabled(RID p_occluder, bool p_enabled) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); occluder->enabled = p_enabled; } + void RenderingServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder, RID p_polygon) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); @@ -1143,12 +1174,14 @@ void RenderingServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder, RI } } } + void RenderingServerCanvas::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); occluder->xform = p_xform; } + void RenderingServerCanvas::canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) { RasterizerCanvas::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder); ERR_FAIL_COND(!occluder); @@ -1161,6 +1194,7 @@ RID RenderingServerCanvas::canvas_occluder_polygon_create() { occluder_poly->occluder = RSG::canvas_render->occluder_polygon_create(); return canvas_light_occluder_polygon_owner.make_rid(occluder_poly); } + void RenderingServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) { if (p_shape.size() < 3) { canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, p_shape); @@ -1189,6 +1223,7 @@ void RenderingServerCanvas::canvas_occluder_polygon_set_shape(RID p_occluder_pol canvas_occluder_polygon_set_shape_as_lines(p_occluder_polygon, lines); } + void RenderingServerCanvas::canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const Vector<Vector2> &p_shape) { LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_occluder_polygon); ERR_FAIL_COND(!occluder_poly); diff --git a/servers/rendering/rendering_server_raster.cpp b/servers/rendering/rendering_server_raster.cpp index 6aaf197062..a301d81691 100644 --- a/servers/rendering/rendering_server_raster.cpp +++ b/servers/rendering/rendering_server_raster.cpp @@ -156,14 +156,18 @@ void RenderingServerRaster::draw(bool p_swap_buffers, double frame_step) { frame_profile_frame = RSG::storage->get_captured_timestamps_frame(); } + void RenderingServerRaster::sync() { } + bool RenderingServerRaster::has_changed() const { return changes > 0; } + void RenderingServerRaster::init() { RSG::rasterizer->initialize(); } + void RenderingServerRaster::finish() { if (test_cube.is_valid()) { free(test_cube); @@ -204,6 +208,7 @@ void RenderingServerRaster::set_boot_image(const Ref<Image> &p_image, const Colo redraw_request(); RSG::rasterizer->set_boot_image(p_image, p_color, p_scale, p_use_filter); } + void RenderingServerRaster::set_default_clear_color(const Color &p_color) { RSG::viewport->set_default_clear_color(p_color); } @@ -238,6 +243,7 @@ bool RenderingServerRaster::is_low_end() const { //return RSG::rasterizer->is_low_end(); return false; } + RenderingServerRaster::RenderingServerRaster() { RSG::canvas = memnew(RenderingServerCanvas); RSG::viewport = memnew(RenderingServerViewport); diff --git a/servers/rendering/rendering_server_scene.cpp b/servers/rendering/rendering_server_scene.cpp index 0f8c4b6935..06217b3f0e 100644 --- a/servers/rendering/rendering_server_scene.cpp +++ b/servers/rendering/rendering_server_scene.cpp @@ -197,6 +197,7 @@ void *RenderingServerScene::_instance_pair(void *p_self, OctreeElementID, Instan return nullptr; } + void RenderingServerScene::_instance_unpair(void *p_self, OctreeElementID, Instance *p_A, int, OctreeElementID, Instance *p_B, int, void *udata) { //RenderingServerScene *self = (RenderingServerScene*)p_self; Instance *A = p_A; @@ -499,6 +500,7 @@ void RenderingServerScene::instance_set_base(RID p_instance, RID p_base) { _instance_queue_update(instance, true, true); } + void RenderingServerScene::instance_set_scenario(RID p_instance, RID p_scenario) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -583,12 +585,14 @@ void RenderingServerScene::instance_set_scenario(RID p_instance, RID p_scenario) _instance_queue_update(instance, true, true); } } + void RenderingServerScene::instance_set_layer_mask(RID p_instance, uint32_t p_mask) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); instance->layer_mask = p_mask; } + void RenderingServerScene::instance_set_transform(RID p_instance, const Transform &p_transform) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -612,12 +616,14 @@ void RenderingServerScene::instance_set_transform(RID p_instance, const Transfor instance->transform = p_transform; _instance_queue_update(instance, true); } + void RenderingServerScene::instance_attach_object_instance_id(RID p_instance, ObjectID p_id) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); instance->object_id = p_id; } + void RenderingServerScene::instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -690,6 +696,7 @@ void RenderingServerScene::instance_set_visible(RID p_instance, bool p_visible) } } } + inline bool is_geometry_instance(RenderingServer::InstanceType p_type) { return p_type == RS::INSTANCE_MESH || p_type == RS::INSTANCE_MULTIMESH || p_type == RS::INSTANCE_PARTICLES || p_type == RS::INSTANCE_IMMEDIATE; } @@ -766,6 +773,7 @@ Vector<ObjectID> RenderingServerScene::instances_cull_aabb(const AABB &p_aabb, R return instances; } + Vector<ObjectID> RenderingServerScene::instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario) const { Vector<ObjectID> instances; Scenario *scenario = scenario_owner.getornull(p_scenario); @@ -787,6 +795,7 @@ Vector<ObjectID> RenderingServerScene::instances_cull_ray(const Vector3 &p_from, return instances; } + Vector<ObjectID> RenderingServerScene::instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario) const { Vector<ObjectID> instances; Scenario *scenario = scenario_owner.getornull(p_scenario); @@ -846,6 +855,7 @@ void RenderingServerScene::instance_geometry_set_flag(RID p_instance, RS::Instan } } } + void RenderingServerScene::instance_geometry_set_cast_shadows_setting(RID p_instance, RS::ShadowCastingSetting p_shadow_casting_setting) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -853,6 +863,7 @@ void RenderingServerScene::instance_geometry_set_cast_shadows_setting(RID p_inst instance->cast_shadows = p_shadow_casting_setting; _instance_queue_update(instance, false, true); } + void RenderingServerScene::instance_geometry_set_material_override(RID p_instance, RID p_material) { Instance *instance = instance_owner.getornull(p_instance); ERR_FAIL_COND(!instance); @@ -863,6 +874,7 @@ void RenderingServerScene::instance_geometry_set_material_override(RID p_instanc void RenderingServerScene::instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) { } + void RenderingServerScene::instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) { } diff --git a/servers/rendering/rendering_server_viewport.cpp b/servers/rendering/rendering_server_viewport.cpp index 660c96e441..4491f699dc 100644 --- a/servers/rendering/rendering_server_viewport.cpp +++ b/servers/rendering/rendering_server_viewport.cpp @@ -589,12 +589,14 @@ void RenderingServerViewport::viewport_set_hide_scenario(RID p_viewport, bool p_ viewport->hide_scenario = p_hide; } + void RenderingServerViewport::viewport_set_hide_canvas(RID p_viewport, bool p_hide) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); viewport->hide_canvas = p_hide; } + void RenderingServerViewport::viewport_set_disable_environment(RID p_viewport, bool p_disable) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); @@ -608,12 +610,14 @@ void RenderingServerViewport::viewport_attach_camera(RID p_viewport, RID p_camer viewport->camera = p_camera; } + void RenderingServerViewport::viewport_set_scenario(RID p_viewport, RID p_scenario) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); viewport->scenario = p_scenario; } + void RenderingServerViewport::viewport_attach_canvas(RID p_viewport, RID p_canvas) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); @@ -639,6 +643,7 @@ void RenderingServerViewport::viewport_remove_canvas(RID p_viewport, RID p_canva viewport->canvas_map.erase(p_canvas); canvas->viewports.erase(p_viewport); } + void RenderingServerViewport::viewport_set_canvas_transform(RID p_viewport, RID p_canvas, const Transform2D &p_offset) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); @@ -646,6 +651,7 @@ void RenderingServerViewport::viewport_set_canvas_transform(RID p_viewport, RID ERR_FAIL_COND(!viewport->canvas_map.has(p_canvas)); viewport->canvas_map[p_canvas].transform = p_offset; } + void RenderingServerViewport::viewport_set_transparent_background(RID p_viewport, bool p_enabled) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); @@ -660,6 +666,7 @@ void RenderingServerViewport::viewport_set_global_canvas_transform(RID p_viewpor viewport->global_transform = p_transform; } + void RenderingServerViewport::viewport_set_canvas_stacking(RID p_viewport, RID p_canvas, int p_layer, int p_sublayer) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index e71c084aab..5db9e44084 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -3093,6 +3093,7 @@ bool ShaderLanguage::_propagate_function_call_sampler_uniform_settings(StringNam } ERR_FAIL_V(false); //bug? function not found } + bool ShaderLanguage::_propagate_function_call_sampler_builtin_reference(StringName p_name, int p_argument, const StringName &p_builtin) { for (int i = 0; shader->functions.size(); i++) { if (shader->functions[i].name == p_name) { |