|
@@ -889,7 +889,11 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
|
|
|
|
|
|
// fill our render lists early so we can find out if we use various features
|
|
// fill our render lists early so we can find out if we use various features
|
|
_fill_render_list(RENDER_LIST_OPAQUE, p_render_data, PASS_MODE_COLOR);
|
|
_fill_render_list(RENDER_LIST_OPAQUE, p_render_data, PASS_MODE_COLOR);
|
|
- render_list[RENDER_LIST_OPAQUE].sort_by_key();
|
|
|
|
|
|
+ if (scene_state.used_opaque_stencil) {
|
|
|
|
+ render_list[RENDER_LIST_OPAQUE].sort_by_key_and_stencil();
|
|
|
|
+ } else {
|
|
|
|
+ render_list[RENDER_LIST_OPAQUE].sort_by_key();
|
|
|
|
+ }
|
|
render_list[RENDER_LIST_ALPHA].sort_by_reverse_depth_and_priority();
|
|
render_list[RENDER_LIST_ALPHA].sort_by_reverse_depth_and_priority();
|
|
_fill_instance_data(RENDER_LIST_OPAQUE);
|
|
_fill_instance_data(RENDER_LIST_OPAQUE);
|
|
_fill_instance_data(RENDER_LIST_ALPHA);
|
|
_fill_instance_data(RENDER_LIST_ALPHA);
|
|
@@ -2149,6 +2153,9 @@ void RenderForwardMobile::_fill_render_list(RenderListType p_render_list, const
|
|
if (surf->flags & GeometryInstanceSurfaceDataCache::FLAG_USES_DEPTH_TEXTURE) {
|
|
if (surf->flags & GeometryInstanceSurfaceDataCache::FLAG_USES_DEPTH_TEXTURE) {
|
|
scene_state.used_depth_texture = true;
|
|
scene_state.used_depth_texture = true;
|
|
}
|
|
}
|
|
|
|
+ if ((surf->flags & GeometryInstanceSurfaceDataCache::FLAG_USES_STENCIL) && !force_alpha && (surf->flags & (GeometryInstanceSurfaceDataCache::FLAG_PASS_DEPTH | GeometryInstanceSurfaceDataCache::FLAG_PASS_OPAQUE))) {
|
|
|
|
+ scene_state.used_opaque_stencil = true;
|
|
|
|
+ }
|
|
|
|
|
|
} else if (p_pass_mode == PASS_MODE_SHADOW || p_pass_mode == PASS_MODE_SHADOW_DP) {
|
|
} else if (p_pass_mode == PASS_MODE_SHADOW || p_pass_mode == PASS_MODE_SHADOW_DP) {
|
|
if (surf->flags & GeometryInstanceSurfaceDataCache::FLAG_PASS_SHADOW) {
|
|
if (surf->flags & GeometryInstanceSurfaceDataCache::FLAG_PASS_SHADOW) {
|
|
@@ -2672,6 +2679,10 @@ void RenderForwardMobile::_geometry_instance_add_surface_with_material(GeometryI
|
|
flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_DOUBLE_SIDED_SHADOWS;
|
|
flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_DOUBLE_SIDED_SHADOWS;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (p_material->shader_data->stencil_enabled) {
|
|
|
|
+ flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_STENCIL;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (p_material->shader_data->uses_alpha_pass()) {
|
|
if (p_material->shader_data->uses_alpha_pass()) {
|
|
flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_ALPHA;
|
|
flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_ALPHA;
|
|
if (p_material->shader_data->uses_depth_in_alpha_pass()) {
|
|
if (p_material->shader_data->uses_depth_in_alpha_pass()) {
|