fix bug related to unshaded materials not working on MSVC. Not cleanest solution, might think about how to improve later.
This commit is contained in:
parent
47b34bf79b
commit
da14225ad8
3 changed files with 15 additions and 10 deletions
|
@ -1906,7 +1906,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
|
|||
if (!p_shadow) {
|
||||
|
||||
if (p_directional_add) {
|
||||
if (e->sort_key & RenderList::SORT_KEY_UNSHADED_FLAG || !(e->instance->layer_mask & directional_light->light_ptr->cull_mask)) {
|
||||
if (e->sort_key & SORT_KEY_UNSHADED_FLAG || !(e->instance->layer_mask & directional_light->light_ptr->cull_mask)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1915,7 +1915,8 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
|
|||
|
||||
if (shading != prev_shading) {
|
||||
|
||||
if (e->sort_key & RenderList::SORT_KEY_UNSHADED_FLAG) {
|
||||
if (e->sort_key & SORT_KEY_UNSHADED_FLAG) {
|
||||
|
||||
|
||||
state.scene_shader.set_conditional(SceneShaderGLES3::SHADELESS, true);
|
||||
state.scene_shader.set_conditional(SceneShaderGLES3::USE_FORWARD_LIGHTING, false);
|
||||
|
@ -1944,7 +1945,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
|
|||
state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_5, shadow_filter_mode == SHADOW_FILTER_PCF5);
|
||||
state.scene_shader.set_conditional(SceneShaderGLES3::SHADOW_MODE_PCF_13, shadow_filter_mode == SHADOW_FILTER_PCF13);
|
||||
|
||||
if (p_directional_add || (directional_light && (e->sort_key & RenderList::SORT_KEY_NO_DIRECTIONAL_FLAG) == 0)) {
|
||||
if (p_directional_add || (directional_light && (e->sort_key & SORT_KEY_NO_DIRECTIONAL_FLAG) == 0)) {
|
||||
state.scene_shader.set_conditional(SceneShaderGLES3::USE_LIGHT_DIRECTIONAL, true);
|
||||
|
||||
if (p_directional_shadows && directional_light->light_ptr->shadow) {
|
||||
|
@ -2048,7 +2049,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_
|
|||
}
|
||||
}
|
||||
|
||||
if (!(e->sort_key & RenderList::SORT_KEY_UNSHADED_FLAG) && !p_directional_add && !p_shadow) {
|
||||
if (!(e->sort_key & SORT_KEY_UNSHADED_FLAG) && !p_directional_add && !p_shadow) {
|
||||
_setup_light(e, p_view_transform);
|
||||
}
|
||||
|
||||
|
@ -2177,7 +2178,7 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
|
|||
}
|
||||
|
||||
if (!p_shadow && directional_light && (directional_light->light_ptr->cull_mask & e->instance->layer_mask) == 0) {
|
||||
e->sort_key |= RenderList::SORT_KEY_NO_DIRECTIONAL_FLAG;
|
||||
e->sort_key |= SORT_KEY_NO_DIRECTIONAL_FLAG;
|
||||
}
|
||||
|
||||
e->sort_key |= uint64_t(e->geometry->index) << RenderList::SORT_KEY_GEOMETRY_INDEX_SHIFT;
|
||||
|
@ -2205,7 +2206,7 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
|
|||
}
|
||||
|
||||
if (e->instance->gi_probe_instances.size()) {
|
||||
e->sort_key |= RenderList::SORT_KEY_GI_PROBES_FLAG;
|
||||
e->sort_key |= SORT_KEY_GI_PROBES_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2222,7 +2223,8 @@ void RasterizerSceneGLES3::_add_geometry(RasterizerStorageGLES3::Geometry *p_geo
|
|||
|
||||
if (shadow || m->shader->spatial.unshaded || state.debug_draw == VS::VIEWPORT_DEBUG_DRAW_UNSHADED) {
|
||||
|
||||
e->sort_key |= RenderList::SORT_KEY_UNSHADED_FLAG;
|
||||
e->sort_key |= SORT_KEY_UNSHADED_FLAG;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -638,9 +638,10 @@ public:
|
|||
MAX_REFLECTIONS = 1024,
|
||||
|
||||
SORT_KEY_DEPTH_LAYER_SHIFT = 60,
|
||||
SORT_KEY_UNSHADED_FLAG = uint64_t(1) << 59,
|
||||
SORT_KEY_NO_DIRECTIONAL_FLAG = uint64_t(1) << 58,
|
||||
SORT_KEY_GI_PROBES_FLAG = uint64_t(1) << 57,
|
||||
//64 bits unsupported in MSVC
|
||||
#define SORT_KEY_UNSHADED_FLAG (uint64_t(1) << 59)
|
||||
#define SORT_KEY_NO_DIRECTIONAL_FLAG (uint64_t(1) << 58)
|
||||
#define SORT_KEY_GI_PROBES_FLAG (uint64_t(1) << 57)
|
||||
SORT_KEY_SHADING_SHIFT = 57,
|
||||
SORT_KEY_SHADING_MASK = 7,
|
||||
SORT_KEY_MATERIAL_INDEX_SHIFT = 40,
|
||||
|
|
|
@ -1370,6 +1370,8 @@ void SpatialMaterial::_bind_methods() {
|
|||
BIND_CONSTANT(BILLBOARD_ENABLED);
|
||||
BIND_CONSTANT(BILLBOARD_FIXED_Y);
|
||||
BIND_CONSTANT(BILLBOARD_PARTICLES);
|
||||
|
||||
|
||||
}
|
||||
|
||||
SpatialMaterial::SpatialMaterial()
|
||||
|
|
Loading…
Reference in a new issue