summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/rasterizer_dummy.cpp6
-rw-r--r--servers/visual/rasterizer_dummy.h3
-rw-r--r--servers/visual/visual_server_raster.cpp6
-rw-r--r--servers/visual/visual_server_wrap_mt.cpp2
-rw-r--r--servers/visual/visual_server_wrap_mt.h28
-rw-r--r--servers/visual_server.h5
7 files changed, 45 insertions, 7 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 0aa7fc2650..2e94f3fe9d 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -167,6 +167,7 @@ public:
};
+
/* TEXTURE API */
virtual RID texture_create()=0;
@@ -455,6 +456,7 @@ public:
virtual int light_instance_get_shadow_passes(RID p_light_instance) const=0;
virtual void light_instance_set_shadow_transform(RID p_light_instance, int p_index, const CameraMatrix& p_camera, const Transform& p_transform, float p_split_near=0,float p_split_far=0)=0;
virtual int light_instance_get_shadow_size(RID p_light_instance, int p_index=0) const=0;
+ virtual bool light_instance_get_pssm_shadow_overlap(RID p_light_instance) const=0;
/* SHADOWS */
diff --git a/servers/visual/rasterizer_dummy.cpp b/servers/visual/rasterizer_dummy.cpp
index 1d55693bfb..3a04ba7504 100644
--- a/servers/visual/rasterizer_dummy.cpp
+++ b/servers/visual/rasterizer_dummy.cpp
@@ -1371,6 +1371,12 @@ int RasterizerDummy::light_instance_get_shadow_passes(RID p_light_instance) cons
return 0;
}
+bool RasterizerDummy::light_instance_get_pssm_shadow_overlap(RID p_light_instance) const {
+
+ return false;
+}
+
+
void RasterizerDummy::light_instance_set_custom_transform(RID p_light_instance, int p_index, const CameraMatrix& p_camera, const Transform& p_transform, float p_split_near,float p_split_far) {
LightInstance *lighti = light_instance_owner.get( p_light_instance );
diff --git a/servers/visual/rasterizer_dummy.h b/servers/visual/rasterizer_dummy.h
index b683a25bdc..a837d54b9b 100644
--- a/servers/visual/rasterizer_dummy.h
+++ b/servers/visual/rasterizer_dummy.h
@@ -345,7 +345,7 @@ class RasterizerDummy : public Rasterizer {
fx_param[VS::ENV_FX_PARAM_BCS_BRIGHTNESS]=1.0;
fx_param[VS::ENV_FX_PARAM_BCS_CONTRAST]=1.0;
fx_param[VS::ENV_FX_PARAM_BCS_SATURATION]=1.0;
- fx_param[VS::ENV_FX_PARAM_GAMMA]=1.0;
+
}
@@ -628,6 +628,7 @@ public:
virtual bool light_instance_assign_shadow(RID p_light_instance);
virtual ShadowType light_instance_get_shadow_type(RID p_light_instance) const;
virtual int light_instance_get_shadow_passes(RID p_light_instance) const;
+ virtual bool light_instance_get_pssm_shadow_overlap(RID p_light_instance) const;
virtual void light_instance_set_custom_transform(RID p_light_instance, int p_index, const CameraMatrix& p_camera, const Transform& p_transform, float p_split_near=0,float p_split_far=0);
virtual int light_instance_get_shadow_size(RID p_light_instance, int p_index=0) const { return 1; }
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 519e697ab2..8f1d444185 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -3970,6 +3970,8 @@ void VisualServerRaster::_light_instance_update_pssm_shadow(Instance *p_light,Sc
//float cull_max=p_cull_range.max;
+ bool overlap = rasterizer->light_instance_get_pssm_shadow_overlap(p_light->light_info->instance);
+
float cull_min=p_camera->znear;
float cull_max=p_camera->zfar;
float max_dist = rasterizer->light_directional_get_shadow_param(p_light->base_rid,VS::LIGHT_DIRECTIONAL_SHADOW_PARAM_MAX_DISTANCE);
@@ -3999,7 +4001,7 @@ void VisualServerRaster::_light_instance_update_pssm_shadow(Instance *p_light,Sc
camera_matrix.set_orthogonal(
p_camera->size,
viewport_rect.width / (float)viewport_rect.height,
- distances[i],
+ distances[(i==0 || !overlap )?i:i-1],
distances[i+1],
p_camera->vaspect
@@ -4011,7 +4013,7 @@ void VisualServerRaster::_light_instance_update_pssm_shadow(Instance *p_light,Sc
camera_matrix.set_perspective(
p_camera->fov,
viewport_rect.width / (float)viewport_rect.height,
- distances[i],
+ distances[(i==0 || !overlap )?i:i-1],
distances[i+1],
p_camera->vaspect
diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp
index 919656fe04..62f18b9e81 100644
--- a/servers/visual/visual_server_wrap_mt.cpp
+++ b/servers/visual/visual_server_wrap_mt.cpp
@@ -165,6 +165,7 @@ void VisualServerWrapMT::finish() {
texture_free_cached_ids();
+ mesh_free_cached_ids();
thread=NULL;
} else {
@@ -187,6 +188,7 @@ VisualServerWrapMT::VisualServerWrapMT(VisualServer* p_contained,bool p_create_t
draw_thread_up=false;
alloc_mutex=Mutex::create();
texture_pool_max_size=GLOBAL_DEF("render/thread_textures_prealloc",20);
+ mesh_pool_max_size=GLOBAL_DEF("render/thread_meshes_prealloc",20);
if (!p_create_thread) {
server_thread=Thread::get_caller_ID();
} else {
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 0b7721cf8b..f807a4b3a9 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -66,6 +66,16 @@ class VisualServerWrapMT : public VisualServer {
int texture_pool_max_size;
List<RID> texture_id_pool;
+ int mesh_pool_max_size;
+ List<RID> mesh_id_pool;
+
+//#define DEBUG_SYNC
+
+#ifdef DEBUG_SYNC
+#define SYNC_DEBUG print_line("sync on: "+String(__FUNCTION__));
+#else
+#define SYNC_DEBUG
+#endif
public:
@@ -74,6 +84,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type();\
@@ -115,6 +126,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type();\
@@ -168,6 +180,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1);\
@@ -179,6 +192,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1);\
@@ -231,6 +245,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2);\
@@ -242,6 +257,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2);\
@@ -294,6 +310,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2, p3,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2, p3);\
@@ -357,6 +374,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2, p3, p4,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2, p3, p4);\
@@ -368,6 +386,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2, p3, p4,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2, p3, p4);\
@@ -420,6 +439,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2, p3, p4, p5,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2, p3, p4, p5);\
@@ -431,6 +451,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2, p3, p4, p5,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2, p3, p4, p5);\
@@ -483,6 +504,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2, p3, p4, p5, p6,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2, p3, p4, p5, p6);\
@@ -546,6 +568,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2, p3, p4, p5, p6, p7,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2, p3, p4, p5, p6, p7);\
@@ -557,6 +580,7 @@ public:
if (Thread::get_caller_ID()!=server_thread) {\
m_r ret;\
command_queue.push_and_ret( visual_server, &VisualServer::m_type,p1, p2, p3, p4, p5, p6, p7,&ret);\
+ SYNC_DEBUG\
return ret;\
} else {\
return visual_server->m_type(p1, p2, p3, p4, p5, p6, p7);\
@@ -691,7 +715,7 @@ public:
FUNC1RC(float,fixed_material_get_point_size,RID);
/* SURFACE API */
- FUNC0R(RID,mesh_create);
+ FUNCRID(mesh);
FUNC2(mesh_set_morph_target_count,RID,int);
FUNC1RC(int,mesh_get_morph_target_count,RID);
@@ -1122,7 +1146,7 @@ public:
/* RENDER INFO */
FUNC1R(int,get_render_info,RenderInfo );
- FUNC1RC(bool,has_feature,Features );
+ virtual bool has_feature(Features p_feature) const { return visual_server->has_feature(p_feature); }
FUNC2(set_boot_image,const Image& , const Color& );
FUNC1(set_default_clear_color,const Color& );
diff --git a/servers/visual_server.h b/servers/visual_server.h
index f01685890f..fa4090d39e 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -481,6 +481,8 @@ public:
LIGHT_PARAM_SHADOW_DARKENING,
LIGHT_PARAM_SHADOW_Z_OFFSET,
LIGHT_PARAM_SHADOW_Z_SLOPE_SCALE,
+ LIGHT_PARAM_SHADOW_ESM_MULTIPLIER,
+ LIGHT_PARAM_SHADOW_BLUR_PASSES,
LIGHT_PARAM_MAX
};
@@ -728,7 +730,7 @@ public:
ENV_FX_HDR,
ENV_FX_FOG,
ENV_FX_BCS,
- ENV_FX_GAMMA,
+ ENV_FX_SRGB,
ENV_FX_MAX
};
@@ -768,7 +770,6 @@ public:
ENV_FX_PARAM_BCS_BRIGHTNESS,
ENV_FX_PARAM_BCS_CONTRAST,
ENV_FX_PARAM_BCS_SATURATION,
- ENV_FX_PARAM_GAMMA,
ENV_FX_PARAM_MAX
};