shadows were not working in-editor for nvidia, fixed now

This commit is contained in:
Juan Linietsky 2017-02-06 20:18:35 -03:00
parent 5cc63dee0f
commit 6bfaa0f12c
7 changed files with 24 additions and 11 deletions

View file

@ -91,7 +91,6 @@ RES ResourceFormatImporter::load(const String &p_path,const String& p_original_p
void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extensions) const{
print_line("getting exts from: "+itos(importers.size()));
Set<String> found;
for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
@ -99,7 +98,6 @@ void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extension
E->get()->get_recognized_extensions(&local_exts);
for (List<String>::Element *F=local_exts.front();F;F=F->next()) {
if (!found.has(F->get())) {
print_line("adding ext "+String(F->get()));
p_extensions->push_back(F->get());
found.insert(F->get());
}

View file

@ -167,6 +167,7 @@ void RasterizerGLES3::initialize() {
void RasterizerGLES3::begin_frame(){
uint64_t tick = OS::get_singleton()->get_ticks_usec();
double time_total = double(tick)/1000000.0;

View file

@ -148,6 +148,9 @@ void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas,int p_size){
glClearDepth(0.0f);
glClear(GL_DEPTH_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER,0);
}
}
@ -557,6 +560,8 @@ void RasterizerSceneGLES3::reflection_atlas_set_size(RID p_ref_atlas,int p_size)
}
void RasterizerSceneGLES3::reflection_atlas_set_subdivision(RID p_ref_atlas,int p_subdiv) {
ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(p_ref_atlas);
@ -4422,18 +4427,18 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa
render_list.sort_by_depth(false); //shadow is front to back for performance
glDepthMask(true);
glColorMask(1,1,1,1);
glDisable(GL_BLEND);
glDisable(GL_DITHER);
glEnable(GL_DEPTH_TEST);
glBindFramebuffer(GL_FRAMEBUFFER,fbo);
glDepthMask(true);
glColorMask(0,0,0,0);
if (custom_vp_size) {
glViewport(0,0,custom_vp_size,custom_vp_size);
glScissor(0,0,custom_vp_size,custom_vp_size);
} else {
glViewport(x,y,width,height);
glScissor(x,y,width,height);
@ -5028,5 +5033,4 @@ void RasterizerSceneGLES3::finalize(){
RasterizerSceneGLES3::RasterizerSceneGLES3()
{
}

View file

@ -210,7 +210,6 @@ public:
bool _shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int *p_in_quadrants, int p_quadrant_count, int p_current_subdiv, uint64_t p_tick, int &r_quadrant, int &r_shadow);
bool shadow_atlas_update_light(RID p_atlas,RID p_light_intance,float p_coverage,uint64_t p_light_version);
struct DirectionalShadow {
GLuint fbo;
GLuint depth;

View file

@ -2495,6 +2495,7 @@ RID RasterizerStorageGLES3::mesh_create(){
void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes,const Vector<Rect3>& p_bone_aabbs){
PoolVector<uint8_t> array = p_array;
Mesh *mesh = mesh_owner.getornull(p_mesh);
@ -2693,8 +2694,6 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P
int array_size = stride * p_vertex_count;
int index_array_size=0;
print_line("desired size: "+itos(array_size)+" vcount "+itos(p_vertex_count)+" should be: "+itos(array.size()+p_vertex_count*2)+" but is "+itos(array.size()));
if (array.size()!=array_size && array.size()+p_vertex_count*2 == array_size) {
//old format, convert
array = PoolVector<uint8_t>();
@ -5447,12 +5446,14 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce
void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
if (rt->fbo) {
glDeleteFramebuffers(1,&rt->fbo);
glDeleteTextures(1,&rt->color);
rt->fbo=0;
}
if (rt->buffers.fbo) {
glDeleteFramebuffers(1,&rt->buffers.fbo);
glDeleteRenderbuffers(1,&rt->buffers.depth);
@ -5466,11 +5467,13 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
rt->buffers.fbo=0;
}
if (rt->depth) {
glDeleteTextures(1,&rt->depth);
rt->depth=0;
}
if (rt->effects.ssao.blur_fbo[0]) {
glDeleteFramebuffers(1,&rt->effects.ssao.blur_fbo[0]);
glDeleteTextures(1,&rt->effects.ssao.blur_red[0]);
@ -5483,11 +5486,16 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
rt->effects.ssao.depth_mipmap_fbos.clear();
glDeleteTextures(1,&rt->effects.ssao.linear_depth);
rt->effects.ssao.blur_fbo[0]=0;
rt->effects.ssao.blur_fbo[1]=0;
}
if (rt->exposure.fbo) {
glDeleteFramebuffers(1,&rt->exposure.fbo);
glDeleteTextures(1,&rt->exposure.color);
rt->exposure.fbo=0;
}
Texture *tex = texture_owner.get(rt->texture);
tex->alloc_height=0;
@ -5495,6 +5503,7 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
tex->width=0;
tex->height=0;
for(int i=0;i<2;i++) {
for(int j=0;j<rt->effects.mip_maps[i].sizes.size();j++) {
glDeleteFramebuffers(1,&rt->effects.mip_maps[i].sizes[j].fbo);
@ -5504,6 +5513,8 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) {
rt->effects.mip_maps[i].sizes.clear();
rt->effects.mip_maps[i].levels=0;
}
/*
if (rt->effects.screen_space_depth) {
glDeleteTextures(1,&rt->effects.screen_space_depth);
@ -5518,7 +5529,6 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){
if (rt->width<=0 || rt->height<=0)
return;
GLuint color_internal_format;
GLuint color_format;
GLuint color_type;

View file

@ -1178,9 +1178,11 @@ public:
height=0;
depth=0;
fbo=0;
exposure.fbo=0;
buffers.fbo=0;
used_in_frame=false;
flags[RENDER_TARGET_VFLIP]=false;
flags[RENDER_TARGET_TRANSPARENT]=false;
flags[RENDER_TARGET_NO_3D]=false;

View file

@ -2239,7 +2239,6 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform,const Came
bool redraw = VSG::scene_render->shadow_atlas_update_light(p_shadow_atlas,light->instance,coverage,light->last_version);
if (redraw) {
print_line("redraw shadow");
//must redraw!
_light_instance_update_shadow(ins,p_cam_transform,p_cam_projection,p_cam_orthogonal,p_shadow_atlas,scenario);
}