diff options
Diffstat (limited to 'drivers/gles2')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 176 | ||||
-rw-r--r-- | drivers/gles2/shader_compiler_gles2.cpp | 19 | ||||
-rw-r--r-- | drivers/gles2/shader_gles2.cpp | 2 | ||||
-rw-r--r-- | drivers/gles2/shaders/canvas.glsl | 2 | ||||
-rw-r--r-- | drivers/gles2/shaders/material.glsl | 10 |
5 files changed, 107 insertions, 102 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 40866e0c90..760af5100c 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -915,7 +915,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I if (scale_textures) { texture->alloc_width = po2_width; texture->alloc_height = po2_height; - // print_line("scale because npo2: "+itos(npo2_textures_available)+" mm: "+itos(p_format&VS::TEXTURE_FLAG_MIPMAPS)+" "+itos(p_mipmap_count) ); + //print_line("scale because npo2: "+itos(npo2_textures_available)+" mm: "+itos(p_format&VS::TEXTURE_FLAG_MIPMAPS)+" "+itos(p_mipmap_count) ); } else { texture->alloc_width = texture->width; @@ -1910,7 +1910,7 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive, use_VBO=false; } -// surface->packed=pack_arrays && use_VBO; + //surface->packed=pack_arrays && use_VBO; int total_elem_size=0; @@ -3917,7 +3917,7 @@ void RasterizerGLES2::light_instance_set_shadow_transform(RID p_light_instance, ERR_FAIL_COND(!lighti); ERR_FAIL_COND(lighti->base->type!=VS::LIGHT_DIRECTIONAL); -// ERR_FAIL_INDEX(p_index,1); + //ERR_FAIL_INDEX(p_index,1); lighti->custom_projection[p_index]=p_camera; lighti->custom_transform[p_index]=p_transform; @@ -4043,8 +4043,10 @@ RID RasterizerGLES2::viewport_data_create() { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, - // GL_RGBA, GL_UNSIGNED_BYTE, NULL); + /* + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + */ glTexImage2D(GL_TEXTURE_2D, 0, format_luminance, 1, 1, 0, format_luminance_components, format_luminance_type, NULL); @@ -4295,11 +4297,11 @@ void RasterizerGLES2::begin_frame() { draw_next_frame=false; -// material_shader.set_uniform_default(MaterialShaderGLES2::SCREENZ_SCALE, Math::fmod(time, 3600.0)); + //material_shader.set_uniform_default(MaterialShaderGLES2::SCREENZ_SCALE, Math::fmod(time, 3600.0)); /* nehe ?*/ -// glClearColor(0,0,1,1); -// glClear(GL_COLOR_BUFFER_BIT); //should not clear if anything else cleared.. + //glClearColor(0,0,1,1); + //glClear(GL_COLOR_BUFFER_BIT); //should not clear if anything else cleared.. } void RasterizerGLES2::capture_viewport(Image* r_capture) { @@ -4329,7 +4331,7 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) { PoolVector<uint8_t>::Write w = pixels.write(); glPixelStorei(GL_PACK_ALIGNMENT, 4); -// uint64_t time = OS::get_singleton()->get_ticks_usec(); + //uint64_t time = OS::get_singleton()->get_ticks_usec(); if (current_rt) { #ifdef GLEW_ENABLED @@ -4456,7 +4458,7 @@ void RasterizerGLES2::begin_shadow_map( RID p_light_instance, int p_shadow_pass opaque_render_list.clear(); alpha_render_list.clear(); -// pre_zpass_render_list.clear(); + //pre_zpass_render_list.clear(); light_instance_count=0; glCullFace(GL_FRONT); @@ -4614,7 +4616,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const { //print_line("compiled fragment: "+fragment_code); - // ("compiled fragment globals: "+fragment_globals); + //("compiled fragment globals: "+fragment_globals); //print_line("UCF: "+itos(p_shader->uniforms.size())); @@ -5128,9 +5130,11 @@ _FORCE_INLINE_ void RasterizerGLES2::_update_material_shader_params(Material *p_ ud.value=E->value().default_value; old_inuse=false; //if reverted to default, obviously did not work - //print_line("NEW: "+String(E->key())+" because: hasold-"+itos(old_mparams.has(E->key()))); - //if (old_mparams.has(E->key())) - // print_line(" told "+Variant::get_type_name(old_mparams[E->key()].value.get_type())+" tnew "+Variant::get_type_name(E->value().default_value.get_type())); + /* + print_line("NEW: "+String(E->key())+" because: hasold-"+itos(old_mparams.has(E->key()))); + if (old_mparams.has(E->key())) + print_line(" told "+Variant::get_type_name(old_mparams[E->key()].value.get_type())+" tnew "+Variant::get_type_name(E->value().default_value.get_type())); + */ } @@ -5216,12 +5220,14 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material if (p_material->shader_cache && p_material->shader_cache->valid) { - // // reduce amount of conditional compilations - // for(int i=0;i<_tex_version_count;i++) - // material_shader.set_conditional((MaterialShaderGLES2::Conditionals)_tex_version[i],false); + /* + // reduce amount of conditional compilations + for(int i=0;i<_tex_version_count;i++) + material_shader.set_conditional((MaterialShaderGLES2::Conditionals)_tex_version[i],false); + */ - // material_shader.set_custom_shader(p_material->shader_cache->custom_code_id); + //material_shader.set_custom_shader(p_material->shader_cache->custom_code_id); if (p_material->shader_version!=p_material->shader_cache->version) { //shader changed somehow, must update uniforms @@ -5241,7 +5247,7 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material if (E->get().index<0) continue; -// print_line(String(E->key())+": "+E->get().value); + //print_line(String(E->key())+": "+E->get().value); if (E->get().istexture) { //clearly a texture.. RID rid = E->get().value; @@ -5418,13 +5424,7 @@ void RasterizerGLES2::_setup_light(uint16_t p_light) { if (li->near_shadow_buffer) { glActiveTexture(GL_TEXTURE0+max_texture_units-1); - //if (read_depth_supported) { - - glBindTexture(GL_TEXTURE_2D,li->near_shadow_buffer->depth); - //} else { - - - //} + glBindTexture(GL_TEXTURE_2D,li->near_shadow_buffer->depth); material_shader.set_uniform(MaterialShaderGLES2::SHADOW_MATRIX,li->shadow_projection[0]); material_shader.set_uniform(MaterialShaderGLES2::SHADOW_TEXEL_SIZE,Vector2(1.0,1.0)/li->near_shadow_buffer->size); @@ -5944,8 +5944,10 @@ Error RasterizerGLES2::_setup_geometry(const Geometry *p_geometry, const Materia const Surface::ArrayData& ad=surf->array[i]; -// if (!gl_texcoord_shader[i]) -// continue; + /* + if (!gl_texcoord_shader[i]) + continue; + */ if (ad.size==0 || ! ad.bind) { glDisableVertexAttribArray(i); @@ -5957,7 +5959,7 @@ Error RasterizerGLES2::_setup_geometry(const Geometry *p_geometry, const Materia } glEnableVertexAttribArray(i); -// print_line("set: "+itos(i)+" - count: "+itos(ad.count)+" datatype: "+itos(ad.datatype)+" ofs: "+itos(ad.ofs)+" stride: "+itos(stride)+" total len: "+itos(surf->array_len)); + //print_line("set: "+itos(i)+" - count: "+itos(ad.count)+" datatype: "+itos(ad.datatype)+" ofs: "+itos(ad.ofs)+" stride: "+itos(stride)+" total len: "+itos(surf->array_len)); glVertexAttribPointer(i, ad.count, ad.datatype, ad.normalize, stride, &base[ad.ofs]); } @@ -6015,7 +6017,7 @@ void RasterizerGLES2::_render(const Geometry *p_geometry,const Material *p_mater glDrawElements(gl_primitive[s->primitive], s->index_array_len, (s->array_len>(1<<16))?GL_UNSIGNED_INT:GL_UNSIGNED_SHORT, s->index_array_local); } else { - // print_line("indices: "+itos(s->index_array_local) ); + //print_line("indices: "+itos(s->index_array_local) ); //print_line("VBO F: "+itos(s->format)+" C: "+itos(s->index_array_len)+" VC: "+itos(s->array_len)); @@ -6405,7 +6407,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans material_shader.set_conditional(MaterialShaderGLES2::SHADELESS,false); material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_OCTREE,false); material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_LIGHTMAP,false); -// material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_TEXTURE,false); + //material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_TEXTURE,false); } @@ -6956,7 +6958,7 @@ void RasterizerGLES2::_process_glow_bloom() { glUniform1i(copy_shader.get_uniform_location(CopyShaderGLES2::HDR_SOURCE),2); copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_EXPOSURE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_EXPOSURE])); copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_WHITE])); -// copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,1.0); + //copy_shader.set_uniform(CopyShaderGLES2::TONEMAP_WHITE,1.0); copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_TRESHOLD,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_TRESHOLD])); copy_shader.set_uniform(CopyShaderGLES2::HDR_GLOW_SCALE,float(current_env->fx_param[VS::ENV_FX_PARAM_HDR_GLOW_SCALE])); @@ -7040,7 +7042,7 @@ void RasterizerGLES2::_process_hdr() { _copy_screen_quad(); copy_shader.set_conditional(CopyShaderGLES2::USE_HDR_COPY,false); -// int passes = current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_PASSES]; + //int passes = current_env->fx_param[VS::ENV_FX_PARAM_GLOW_BLUR_PASSES]; copy_shader.set_conditional(CopyShaderGLES2::USE_HDR_REDUCE,true); copy_shader.bind(); @@ -7345,7 +7347,7 @@ void RasterizerGLES2::end_scene() { print_line(String("setting camera to ")+camera_transform_inverse); */ -// material_shader.set_uniform_default(MaterialShaderGLES2::CAMERA_INVERSE, camera_transform_inverse); + //material_shader.set_uniform_default(MaterialShaderGLES2::CAMERA_INVERSE, camera_transform_inverse); current_depth_test=true; @@ -7391,7 +7393,7 @@ void RasterizerGLES2::end_scene() { _render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true); glColorMask(1,1,1,1); -// material_shader.set_conditional( MaterialShaderGLES2::USE_FOG,false); + //material_shader.set_conditional( MaterialShaderGLES2::USE_FOG,false); DEBUG_TEST_ERROR("Drawing Scene"); @@ -7534,8 +7536,8 @@ void RasterizerGLES2::end_scene() { if (GLOBAL_DEF("rasterizer/debug_shadow_maps",false)) { _debug_shadows(); } -// _debug_luminances(); -// _debug_samplers(); + //_debug_luminances(); + //_debug_samplers(); if (using_canvas_bg) { using_canvas_bg=false; @@ -7884,7 +7886,7 @@ void RasterizerGLES2::_debug_draw_shadows_type(Vector<ShadowBuffer>& p_shadows,P Size2 debug_size(128,128); -// Size2 debug_size(512,512); + //Size2 debug_size(512,512); int useblur=shadow_filter==SHADOW_FILTER_ESM?1:0; @@ -7989,7 +7991,7 @@ void RasterizerGLES2::_debug_shadows() { _debug_draw_shadows_type(near_shadow_buffers,ofs); -// _debug_draw_shadows_type(far_shadow_buffers,ofs); + //_debug_draw_shadows_type(far_shadow_buffers,ofs); } @@ -8841,11 +8843,11 @@ RID RasterizerGLES2::canvas_light_shadow_buffer_create(int p_width) { } else { // We'll use a RGBA texture into which we pack the depth info glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cls->size, cls->height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + GL_RGBA, GL_UNSIGNED_BYTE, NULL); // Attach the RGBA texture to FBO color attachment point glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, cls->depth, 0); + GL_TEXTURE_2D, cls->depth, 0); cls->rgba=cls->depth; // Allocate 16-bit depth buffer @@ -8853,7 +8855,7 @@ RID RasterizerGLES2::canvas_light_shadow_buffer_create(int p_width) { // Attach the render buffer as depth buffer - will be ignored glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, cls->rbo); + GL_RENDERBUFFER, cls->rbo); } @@ -8922,7 +8924,7 @@ void RasterizerGLES2::canvas_light_shadow_buffer_update(RID p_buffer, const Tran //light.basis.scale(Vector3(to_light.elements[0].length(),to_light.elements[1].length(),1)); - /// p_near=1; + / //p_near=1; CameraMatrix projection; { real_t fov = 90; @@ -9121,10 +9123,10 @@ void RasterizerGLES2::canvas_debug_viewport_shadows(CanvasLight* p_lights_with_s //print_line(" debug lights "); while(light) { - // print_line("debug light"); + //print_line("debug light"); if (light->shadow_buffer.is_valid()) { - // print_line("sb is valid"); + //print_line("sb is valid"); CanvasLightShadow * sb = canvas_light_shadow_owner.get(light->shadow_buffer); if (sb) { glActiveTexture(GL_TEXTURE0); @@ -9172,7 +9174,7 @@ void RasterizerGLES2::_canvas_item_render_commands(CanvasItem *p_item,CanvasItem case CanvasItem::Command::TYPE_RECT: { CanvasItem::CommandRect* rect = static_cast<CanvasItem::CommandRect*>(c); -// canvas_draw_rect(rect->rect,rect->region,rect->source,rect->flags&CanvasItem::CommandRect::FLAG_TILE,rect->flags&CanvasItem::CommandRect::FLAG_FLIP_H,rect->flags&CanvasItem::CommandRect::FLAG_FLIP_V,rect->texture,rect->modulate); + //canvas_draw_rect(rect->rect,rect->region,rect->source,rect->flags&CanvasItem::CommandRect::FLAG_TILE,rect->flags&CanvasItem::CommandRect::FLAG_FLIP_H,rect->flags&CanvasItem::CommandRect::FLAG_FLIP_V,rect->texture,rect->modulate); #if 0 int flags=0; @@ -9344,9 +9346,6 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater } else { glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height); } -// if (current_clip) { -// // print_line(" a clip "); -// } canvas_texscreen_used=true; } @@ -9925,8 +9924,8 @@ RID RasterizerGLES2::sampled_light_dp_create(int p_width,int p_height) { glGenTextures(1,&slight->texture); glBindTexture(GL_TEXTURE_2D, slight->texture); // for debug, but glitchy -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -10046,7 +10045,7 @@ void RasterizerGLES2::free(const RID& p_rid) { // delete the texture Texture *texture = texture_owner.get(p_rid); -// glDeleteTextures( 1,&texture->tex_id ); + //glDeleteTextures( 1,&texture->tex_id ); _rinfo.texture_mem-=texture->total_data_size; texture_owner.free(p_rid); memdelete(texture); @@ -10232,9 +10231,11 @@ void RasterizerGLES2::free(const RID& p_rid) { glDeleteFramebuffers(1,&cls->fbo); glDeleteRenderbuffers(1,&cls->rbo); glDeleteTextures(1,&cls->depth); - //if (!read_depth_supported) { - // glDeleteTextures(1,&cls->rgba); - //} + /* + if (!read_depth_supported) { + glDeleteTextures(1,&cls->rgba); + } + */ canvas_light_shadow_owner.free(p_rid); memdelete(cls); @@ -10286,18 +10287,18 @@ bool RasterizerGLES2::ShadowBuffer::init(int p_size,bool p_use_depth) { } else { // We'll use a RGBA texture into which we pack the depth info glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + GL_RGBA, GL_UNSIGNED_BYTE, NULL); // Attach the RGBA texture to FBO color attachment point glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, depth, 0); + GL_TEXTURE_2D, depth, 0); // Allocate 16-bit depth buffer glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size,size); // Attach the render buffer as depth buffer - will be ignored glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, rbo); + GL_RENDERBUFFER, rbo); } @@ -10332,8 +10333,8 @@ bool RasterizerGLES2::ShadowBuffer::init(int p_size,bool p_use_depth) { } else { -// glGenRenderbuffers(1, &rbo); -// glBindRenderbuffer(GL_RENDERBUFFER, rbo); + //glGenRenderbuffers(1, &rbo); + //glBindRenderbuffer(GL_RENDERBUFFER, rbo); glGenTextures(1, &depth); glBindTexture(GL_TEXTURE_2D, depth); @@ -10383,20 +10384,21 @@ bool RasterizerGLES2::ShadowBuffer::init(int p_size,bool p_use_depth) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); -// glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, size, size, 0, -// GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, NULL); + //glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, size, size, 0, + //GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, NULL); - // Attach the RGBA texture to FBO color attachment point - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, blur, 0); + // Attach the RGBA texture to FBO color attachment point + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, blur, 0); - // Allocate 16-bit depth buffer - /* glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size, size); + // Allocate 16-bit depth buffer + /* + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size, size); - // Attach the render buffer as depth buffer - will be ignored - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_RENDERBUFFER, rbo_blur); -*/ + // Attach the render buffer as depth buffer - will be ignored + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, rbo_blur); + */ status = glCheckFramebufferStatus(GL_FRAMEBUFFER); OS::get_singleton()->print("Status: %x\n",status); glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -10502,7 +10504,7 @@ void RasterizerGLES2::_update_framebuffer() { #endif //color -// GLuint format_rgba = use_fp16_fb?_GL_RGBA16F_EXT:GL_RGBA; + //GLuint format_rgba = use_fp16_fb?_GL_RGBA16F_EXT:GL_RGBA; GLuint format_rgba = GL_RGBA; GLuint format_type = use_fp16_fb?_GL_HALF_FLOAT_OES:GL_UNSIGNED_BYTE; GLuint format_internal=GL_RGBA; @@ -10528,8 +10530,8 @@ void RasterizerGLES2::_update_framebuffer() { glTexImage2D(GL_TEXTURE_2D, 0, format_rgba, framebuffer.width, framebuffer.height, 0, format_internal, format_type, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebuffer.color, 0); @@ -10562,8 +10564,8 @@ void RasterizerGLES2::_update_framebuffer() { glTexImage2D(GL_TEXTURE_2D, 0, format_rgba, framebuffer.width, framebuffer.height, 0, format_internal, format_type, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, framebuffer.sample_color, 0); @@ -10730,9 +10732,9 @@ void RasterizerGLES2::_update_blur_buffer() { glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + GL_RGBA, GL_UNSIGNED_BYTE, NULL); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, framebuffer.blur[i].color, 0); + GL_TEXTURE_2D, framebuffer.blur[i].color, 0); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); @@ -10915,9 +10917,9 @@ void RasterizerGLES2::init() { framebuffer.fbo=0; framebuffer.width=0; framebuffer.height=0; -// framebuffer.buff16=false; -// framebuffer.blur[0].fbo=false; -// framebuffer.blur[1].fbo=false; + //framebuffer.buff16=false; + //framebuffer.blur[0].fbo=false; + //framebuffer.blur[1].fbo=false; framebuffer.active=false; @@ -10945,8 +10947,8 @@ void RasterizerGLES2::init() { use_depth24 =true; s3tc_supported = true; atitc_supported = false; -// use_texture_instancing=false; -// use_attribute_instancing=true; + //use_texture_instancing=false; + //use_attribute_instancing=true; use_texture_instancing=false; use_attribute_instancing=true; full_float_fb_supported=true; @@ -11017,8 +11019,10 @@ void RasterizerGLES2::init() { use_hw_skeleton_xform=vtf>0 && float_supported; float_linear_supported = extensions.has("GL_OES_texture_float_linear"); - //if (extensions.has("GL_QCOM_tiled_rendering")) - // use_hw_skeleton_xform=false; + /* + if (extensions.has("GL_QCOM_tiled_rendering")) + use_hw_skeleton_xform=false; + */ GLint mva; glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&mva); if (vtf==0 && mva>8) { @@ -11195,7 +11199,7 @@ void RasterizerGLES2::set_extensions(const char *p_strings) { for(int i=0;i<strings.size();i++) { extensions.insert(strings[i]); -// print_line(strings[i]); + //print_line(strings[i]); } } diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index adb9fe0e83..247a35141e 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -435,7 +435,7 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a //create the call to sample the screen, and clamp it uses_texpos=true; code="get_texpos("+dump_node_code(onode->arguments[1],p_level)+""; -// code="get_texpos(gl_ProjectionMatrixInverse * texture2D( depth_texture, clamp(("+dump_node_code(onode->arguments[1],p_level)+").xy,vec2(0.0),vec2(1.0))*gl_LightSource[5].specular.zw+gl_LightSource[5].specular.xy)"; + //code="get_texpos(gl_ProjectionMatrixInverse * texture2D( depth_texture, clamp(("+dump_node_code(onode->arguments[1],p_level)+").xy,vec2(0.0),vec2(1.0))*gl_LightSource[5].specular.zw+gl_LightSource[5].specular.xy)"; //code="(texture2D( screen_texture, ("+dump_node_code(onode->arguments[1],p_level)+").xy).rgb"; break; } else if (custom_h && callfunc=="cosh_custom") { @@ -571,12 +571,13 @@ Error ShaderCompilerGLES2::compile_node(SL::ProgramNode *p_program) { global_code+=uline; if (uniforms) { - //if (uniforms->has(E->key())) { - // //repeated uniform, error - // ERR_EXPLAIN("Uniform already exists from other shader: "+String(E->key())); - // ERR_FAIL_COND_V(uniforms->has(E->key()),ERR_ALREADY_EXISTS); -// -// } + /* + if (uniforms->has(E->key())) { + //repeated uniform, error + ERR_EXPLAIN("Uniform already exists from other shader: "+String(E->key())); + ERR_FAIL_COND_V(uniforms->has(E->key()),ERR_ALREADY_EXISTS); + } + */ SL::Uniform u = E->get(); u.order+=ubase; uniforms->insert(E->key(),u); @@ -812,8 +813,8 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() { mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["VAR1"]="var1_interp"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["VAR2"]="var2_interp"; -// mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SCREEN_POS"]="SCREEN_POS"; -// mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SCREEN_SIZE"]="SCREEN_SIZE"; + //mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SCREEN_POS"]="SCREEN_POS"; + //mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["SCREEN_SIZE"]="SCREEN_SIZE"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["INSTANCE_ID"]="instance_id"; mode_replace_table[ShaderLanguage::SHADER_MATERIAL_VERTEX]["TIME"]="time"; diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp index 2ee89e9895..97c31dfc1c 100644 --- a/drivers/gles2/shader_gles2.cpp +++ b/drivers/gles2/shader_gles2.cpp @@ -561,7 +561,7 @@ ShaderGLES2::Version* ShaderGLES2::get_current_version() { v.uniform_location[j]=glGetUniformLocation(v.id,uniform_names[j]); - // print_line("uniform "+String(uniform_names[j])+" location "+itos(v.uniform_location[j])); + //print_line("uniform "+String(uniform_names[j])+" location "+itos(v.uniform_location[j])); } // set texture uniforms diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index eeab42ee64..4bcebbd69d 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -392,7 +392,7 @@ LIGHT_SHADER_CODE //use lighting #endif -// color.rgb*=color.a; + //color.rgb*=color.a; gl_FragColor = color; diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl index e5be25757d..704a22c5d1 100644 --- a/drivers/gles2/shaders/material.glsl +++ b/drivers/gles2/shaders/material.glsl @@ -820,7 +820,7 @@ void main() { vec3 binormal = normalize(binormal_interp)*side; vec3 tangent = normalize(tangent_interp)*side; #endif -// vec3 normal = abs(normalize(normal_interp))*side; + //vec3 normal = abs(normalize(normal_interp))*side; vec3 normal = normalize(normal_interp)*side; #if defined(ENABLE_SCREEN_UV) vec2 screen_uv = gl_FragCoord.xy*screen_uv_mult; @@ -989,7 +989,7 @@ FRAGMENT_SHADER_CODE #ifdef LIGHT_USE_PSSM -// if (vertex_interp.z > light_pssm_split) { + //if (vertex_interp.z > light_pssm_split) { #if 0 highp vec3 splane = vec3(0.0,0.0,0.0); @@ -1261,12 +1261,12 @@ LIGHT_SHADER_CODE vec3 ambient = const_light_mult*ambient_light*diffuse.rgb; # if defined(LIGHT_TYPE_OMNI) || defined (LIGHT_TYPE_SPOT) -// ambient*=diffuse_interp.a; //attenuation affects ambient too + //ambient*=diffuse_interp.a; //attenuation affects ambient too # endif -// diffuse.rgb=(diffuse.rgb * diffuse_interp.rgb + specular * specular_interp)*shadow_attenuation + ambient; -// diffuse.rgb+=emission * const_light_mult; + //diffuse.rgb=(diffuse.rgb * diffuse_interp.rgb + specular * specular_interp)*shadow_attenuation + ambient; + //diffuse.rgb+=emission * const_light_mult; diffuse.rgb=(diffuse.rgb * diffuse_interp.rgb + specular * specular_interp)*shadow_attenuation + ambient; diffuse.rgb+=emission * const_light_mult; |