diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 13 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_gles2.h | 2 | ||||
-rw-r--r-- | drivers/png/SCsub | 11 |
3 files changed, 18 insertions, 8 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 7714a5d17a..7740c9054b 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -4781,9 +4781,12 @@ void RasterizerGLES2::_add_geometry( const Geometry* p_geometry, const InstanceD if (has_blend_alpha || (has_base_alpha && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA)) return; //bye - if (m->shader_cache && !m->shader_cache->writes_vertex && !m->shader_cache->uses_discard && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA) { + if (!m->shader_cache || (!m->shader_cache->writes_vertex && !m->shader_cache->uses_discard && m->depth_draw_mode!=VS::MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA)) { //shader does not use discard and does not write a vertex position, use generic material - m = shadow_mat_ptr; + if (p_instance->cast_shadows == VS::SHADOW_CASTING_SETTING_DOUBLE_SIDED) + m = shadow_mat_double_sided_ptr; + else + m = shadow_mat_ptr; if (m->last_pass!=frame) { if (m->shader.is_valid()) { @@ -10961,6 +10964,12 @@ void RasterizerGLES2::init() { shadow_material = material_create(); //empty with nothing shadow_mat_ptr = material_owner.get(shadow_material); + + // Now create a second shadow material for double-sided shadow instances + shadow_material_double_sided = material_create(); + shadow_mat_double_sided_ptr = material_owner.get(shadow_material_double_sided); + shadow_mat_double_sided_ptr->flags[VS::MATERIAL_FLAG_DOUBLE_SIDED] = true; + overdraw_material = create_overdraw_debug_material(); copy_shader.set_conditional(CopyShaderGLES2::USE_8BIT_HDR,!use_fp16_fb); canvas_shader.set_conditional(CanvasShaderGLES2::USE_DEPTH_SHADOWS,read_depth_supported); diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h index 0f70ceaa97..2a2f587f11 100644 --- a/drivers/gles2/rasterizer_gles2.h +++ b/drivers/gles2/rasterizer_gles2.h @@ -829,7 +829,9 @@ class RasterizerGLES2 : public Rasterizer { bool fragment_lighting; RID shadow_material; + RID shadow_material_double_sided; Material *shadow_mat_ptr; + Material *shadow_mat_double_sided_ptr; int max_texture_units; GLuint base_framebuffer; diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 5532e28ade..df521de3eb 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -22,17 +22,16 @@ png_sources = [ "png/image_loader_png.cpp" ] -if ("neon_enabled" in env and env["neon_enabled"]): +# Currently .ASM filter_neon.S does not compile on NT. +import os +if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt": env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) env_neon = env.Clone(); if "S_compiler" in env: env_neon['CC'] = env['S_compiler'] #env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"]) - import os - # Currently .ASM filter_neon.S does not compile on NT. - if (os.name!="nt"): - png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c")) - png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S")) + png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c")) + png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S")) else: env.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"]) |