|
@@ -915,7 +915,7 @@ void RasterizerGLES2::texture_allocate(RID p_texture,int p_width, int p_height,I
|
|
if (scale_textures) {
|
|
if (scale_textures) {
|
|
texture->alloc_width = po2_width;
|
|
texture->alloc_width = po2_width;
|
|
texture->alloc_height = po2_height;
|
|
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 {
|
|
} else {
|
|
|
|
|
|
texture->alloc_width = texture->width;
|
|
texture->alloc_width = texture->width;
|
|
@@ -1910,7 +1910,7 @@ void RasterizerGLES2::mesh_add_surface(RID p_mesh,VS::PrimitiveType p_primitive,
|
|
use_VBO=false;
|
|
use_VBO=false;
|
|
}
|
|
}
|
|
|
|
|
|
-// surface->packed=pack_arrays && use_VBO;
|
|
|
|
|
|
+ //surface->packed=pack_arrays && use_VBO;
|
|
|
|
|
|
int total_elem_size=0;
|
|
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);
|
|
|
|
|
|
ERR_FAIL_COND(lighti->base->type!=VS::LIGHT_DIRECTIONAL);
|
|
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_projection[p_index]=p_camera;
|
|
lighti->custom_transform[p_index]=p_transform;
|
|
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);
|
|
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_S, GL_CLAMP_TO_EDGE);
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 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,
|
|
glTexImage2D(GL_TEXTURE_2D, 0, format_luminance, 1, 1, 0,
|
|
format_luminance_components, format_luminance_type, NULL);
|
|
format_luminance_components, format_luminance_type, NULL);
|
|
|
|
|
|
@@ -4295,11 +4297,11 @@ void RasterizerGLES2::begin_frame() {
|
|
|
|
|
|
|
|
|
|
draw_next_frame=false;
|
|
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 ?*/
|
|
/* 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) {
|
|
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();
|
|
PoolVector<uint8_t>::Write w = pixels.write();
|
|
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
|
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) {
|
|
if (current_rt) {
|
|
#ifdef GLEW_ENABLED
|
|
#ifdef GLEW_ENABLED
|
|
@@ -4456,7 +4458,7 @@ void RasterizerGLES2::begin_shadow_map( RID p_light_instance, int p_shadow_pass
|
|
|
|
|
|
opaque_render_list.clear();
|
|
opaque_render_list.clear();
|
|
alpha_render_list.clear();
|
|
alpha_render_list.clear();
|
|
-// pre_zpass_render_list.clear();
|
|
|
|
|
|
+ //pre_zpass_render_list.clear();
|
|
light_instance_count=0;
|
|
light_instance_count=0;
|
|
|
|
|
|
glCullFace(GL_FRONT);
|
|
glCullFace(GL_FRONT);
|
|
@@ -4614,7 +4616,7 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const {
|
|
|
|
|
|
|
|
|
|
//print_line("compiled fragment: "+fragment_code);
|
|
//print_line("compiled fragment: "+fragment_code);
|
|
- // ("compiled fragment globals: "+fragment_globals);
|
|
|
|
|
|
+ //("compiled fragment globals: "+fragment_globals);
|
|
|
|
|
|
//print_line("UCF: "+itos(p_shader->uniforms.size()));
|
|
//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;
|
|
ud.value=E->value().default_value;
|
|
old_inuse=false; //if reverted to default, obviously did not work
|
|
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) {
|
|
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) {
|
|
if (p_material->shader_version!=p_material->shader_cache->version) {
|
|
//shader changed somehow, must update uniforms
|
|
//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)
|
|
if (E->get().index<0)
|
|
continue;
|
|
continue;
|
|
-// print_line(String(E->key())+": "+E->get().value);
|
|
|
|
|
|
+ //print_line(String(E->key())+": "+E->get().value);
|
|
if (E->get().istexture) {
|
|
if (E->get().istexture) {
|
|
//clearly a texture..
|
|
//clearly a texture..
|
|
RID rid = E->get().value;
|
|
RID rid = E->get().value;
|
|
@@ -5418,13 +5424,7 @@ void RasterizerGLES2::_setup_light(uint16_t p_light) {
|
|
if (li->near_shadow_buffer) {
|
|
if (li->near_shadow_buffer) {
|
|
|
|
|
|
glActiveTexture(GL_TEXTURE0+max_texture_units-1);
|
|
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_MATRIX,li->shadow_projection[0]);
|
|
material_shader.set_uniform(MaterialShaderGLES2::SHADOW_TEXEL_SIZE,Vector2(1.0,1.0)/li->near_shadow_buffer->size);
|
|
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];
|
|
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) {
|
|
if (ad.size==0 || ! ad.bind) {
|
|
glDisableVertexAttribArray(i);
|
|
glDisableVertexAttribArray(i);
|
|
@@ -5957,7 +5959,7 @@ Error RasterizerGLES2::_setup_geometry(const Geometry *p_geometry, const Materia
|
|
}
|
|
}
|
|
|
|
|
|
glEnableVertexAttribArray(i);
|
|
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]);
|
|
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);
|
|
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 {
|
|
} 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));
|
|
//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::SHADELESS,false);
|
|
material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_OCTREE,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_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);
|
|
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_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,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_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]));
|
|
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_screen_quad();
|
|
|
|
|
|
copy_shader.set_conditional(CopyShaderGLES2::USE_HDR_COPY,false);
|
|
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.set_conditional(CopyShaderGLES2::USE_HDR_REDUCE,true);
|
|
copy_shader.bind();
|
|
copy_shader.bind();
|
|
@@ -7345,7 +7347,7 @@ void RasterizerGLES2::end_scene() {
|
|
|
|
|
|
print_line(String("setting camera to ")+camera_transform_inverse);
|
|
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;
|
|
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);
|
|
_render_list_forward(&alpha_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting,true);
|
|
glColorMask(1,1,1,1);
|
|
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");
|
|
DEBUG_TEST_ERROR("Drawing Scene");
|
|
|
|
|
|
@@ -7534,8 +7536,8 @@ void RasterizerGLES2::end_scene() {
|
|
if (GLOBAL_DEF("rasterizer/debug_shadow_maps",false)) {
|
|
if (GLOBAL_DEF("rasterizer/debug_shadow_maps",false)) {
|
|
_debug_shadows();
|
|
_debug_shadows();
|
|
}
|
|
}
|
|
-// _debug_luminances();
|
|
|
|
-// _debug_samplers();
|
|
|
|
|
|
+ //_debug_luminances();
|
|
|
|
+ //_debug_samplers();
|
|
|
|
|
|
if (using_canvas_bg) {
|
|
if (using_canvas_bg) {
|
|
using_canvas_bg=false;
|
|
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(128,128);
|
|
-// Size2 debug_size(512,512);
|
|
|
|
|
|
+ //Size2 debug_size(512,512);
|
|
|
|
|
|
|
|
|
|
int useblur=shadow_filter==SHADOW_FILTER_ESM?1:0;
|
|
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(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 {
|
|
} else {
|
|
// We'll use a RGBA texture into which we pack the depth info
|
|
// 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,
|
|
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
|
|
// Attach the RGBA texture to FBO color attachment point
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
|
- GL_TEXTURE_2D, cls->depth, 0);
|
|
|
|
|
|
+ GL_TEXTURE_2D, cls->depth, 0);
|
|
cls->rgba=cls->depth;
|
|
cls->rgba=cls->depth;
|
|
|
|
|
|
// Allocate 16-bit depth buffer
|
|
// 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
|
|
// Attach the render buffer as depth buffer - will be ignored
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
|
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 Matr
|
|
|
|
|
|
//light.basis.scale(Vector3(to_light.elements[0].length(),to_light.elements[1].length(),1));
|
|
//light.basis.scale(Vector3(to_light.elements[0].length(),to_light.elements[1].length(),1));
|
|
|
|
|
|
- /// p_near=1;
|
|
|
|
|
|
+ / //p_near=1;
|
|
CameraMatrix projection;
|
|
CameraMatrix projection;
|
|
{
|
|
{
|
|
real_t fov = 90;
|
|
real_t fov = 90;
|
|
@@ -9121,10 +9123,10 @@ void RasterizerGLES2::canvas_debug_viewport_shadows(CanvasLight* p_lights_with_s
|
|
//print_line(" debug lights ");
|
|
//print_line(" debug lights ");
|
|
while(light) {
|
|
while(light) {
|
|
|
|
|
|
- // print_line("debug light");
|
|
|
|
|
|
+ //print_line("debug light");
|
|
if (light->shadow_buffer.is_valid()) {
|
|
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);
|
|
CanvasLightShadow * sb = canvas_light_shadow_owner.get(light->shadow_buffer);
|
|
if (sb) {
|
|
if (sb) {
|
|
glActiveTexture(GL_TEXTURE0);
|
|
glActiveTexture(GL_TEXTURE0);
|
|
@@ -9172,7 +9174,7 @@ void RasterizerGLES2::_canvas_item_render_commands(CanvasItem *p_item,CanvasItem
|
|
case CanvasItem::Command::TYPE_RECT: {
|
|
case CanvasItem::Command::TYPE_RECT: {
|
|
|
|
|
|
CanvasItem::CommandRect* rect = static_cast<CanvasItem::CommandRect*>(c);
|
|
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
|
|
#if 0
|
|
int flags=0;
|
|
int flags=0;
|
|
|
|
|
|
@@ -9344,9 +9346,6 @@ void RasterizerGLES2::_canvas_item_setup_shader_params(CanvasItemMaterial *mater
|
|
} else {
|
|
} else {
|
|
glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
|
|
glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,viewport.width,viewport.height);
|
|
}
|
|
}
|
|
-// if (current_clip) {
|
|
|
|
-// // print_line(" a clip ");
|
|
|
|
-// }
|
|
|
|
|
|
|
|
canvas_texscreen_used=true;
|
|
canvas_texscreen_used=true;
|
|
}
|
|
}
|
|
@@ -9925,8 +9924,8 @@ RID RasterizerGLES2::sampled_light_dp_create(int p_width,int p_height) {
|
|
glGenTextures(1,&slight->texture);
|
|
glGenTextures(1,&slight->texture);
|
|
glBindTexture(GL_TEXTURE_2D, slight->texture);
|
|
glBindTexture(GL_TEXTURE_2D, slight->texture);
|
|
// for debug, but glitchy
|
|
// 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_MIN_FILTER, GL_LINEAR);
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_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
|
|
// delete the texture
|
|
Texture *texture = texture_owner.get(p_rid);
|
|
Texture *texture = texture_owner.get(p_rid);
|
|
|
|
|
|
-// glDeleteTextures( 1,&texture->tex_id );
|
|
|
|
|
|
+ //glDeleteTextures( 1,&texture->tex_id );
|
|
_rinfo.texture_mem-=texture->total_data_size;
|
|
_rinfo.texture_mem-=texture->total_data_size;
|
|
texture_owner.free(p_rid);
|
|
texture_owner.free(p_rid);
|
|
memdelete(texture);
|
|
memdelete(texture);
|
|
@@ -10232,9 +10231,11 @@ void RasterizerGLES2::free(const RID& p_rid) {
|
|
glDeleteFramebuffers(1,&cls->fbo);
|
|
glDeleteFramebuffers(1,&cls->fbo);
|
|
glDeleteRenderbuffers(1,&cls->rbo);
|
|
glDeleteRenderbuffers(1,&cls->rbo);
|
|
glDeleteTextures(1,&cls->depth);
|
|
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);
|
|
canvas_light_shadow_owner.free(p_rid);
|
|
memdelete(cls);
|
|
memdelete(cls);
|
|
@@ -10286,18 +10287,18 @@ bool RasterizerGLES2::ShadowBuffer::init(int p_size,bool p_use_depth) {
|
|
} else {
|
|
} else {
|
|
// We'll use a RGBA texture into which we pack the depth info
|
|
// We'll use a RGBA texture into which we pack the depth info
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0,
|
|
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
|
|
// Attach the RGBA texture to FBO color attachment point
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
|
- GL_TEXTURE_2D, depth, 0);
|
|
|
|
|
|
+ GL_TEXTURE_2D, depth, 0);
|
|
|
|
|
|
// Allocate 16-bit depth buffer
|
|
// Allocate 16-bit depth buffer
|
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size,size);
|
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, size,size);
|
|
|
|
|
|
// Attach the render buffer as depth buffer - will be ignored
|
|
// Attach the render buffer as depth buffer - will be ignored
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
|
|
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 {
|
|
} else {
|
|
|
|
|
|
-// glGenRenderbuffers(1, &rbo);
|
|
|
|
-// glBindRenderbuffer(GL_RENDERBUFFER, rbo);
|
|
|
|
|
|
+ //glGenRenderbuffers(1, &rbo);
|
|
|
|
+ //glBindRenderbuffer(GL_RENDERBUFFER, rbo);
|
|
|
|
|
|
glGenTextures(1, &depth);
|
|
glGenTextures(1, &depth);
|
|
glBindTexture(GL_TEXTURE_2D, 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_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);
|
|
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
OS::get_singleton()->print("Status: %x\n",status);
|
|
OS::get_singleton()->print("Status: %x\n",status);
|
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
@@ -10502,7 +10504,7 @@ void RasterizerGLES2::_update_framebuffer() {
|
|
#endif
|
|
#endif
|
|
//color
|
|
//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_rgba = GL_RGBA;
|
|
GLuint format_type = use_fp16_fb?_GL_HALF_FLOAT_OES:GL_UNSIGNED_BYTE;
|
|
GLuint format_type = use_fp16_fb?_GL_HALF_FLOAT_OES:GL_UNSIGNED_BYTE;
|
|
GLuint format_internal=GL_RGBA;
|
|
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);
|
|
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_MAG_FILTER, GL_NEAREST);
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_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_S, GL_CLAMP_TO_EDGE);
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 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);
|
|
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);
|
|
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_MAG_FILTER, GL_NEAREST);
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_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_S, GL_CLAMP_TO_EDGE);
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 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);
|
|
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_S, GL_CLAMP_TO_EDGE);
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 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,
|
|
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,
|
|
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);
|
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
@@ -10915,9 +10917,9 @@ void RasterizerGLES2::init() {
|
|
framebuffer.fbo=0;
|
|
framebuffer.fbo=0;
|
|
framebuffer.width=0;
|
|
framebuffer.width=0;
|
|
framebuffer.height=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;
|
|
framebuffer.active=false;
|
|
|
|
|
|
|
|
|
|
@@ -10945,8 +10947,8 @@ void RasterizerGLES2::init() {
|
|
use_depth24 =true;
|
|
use_depth24 =true;
|
|
s3tc_supported = true;
|
|
s3tc_supported = true;
|
|
atitc_supported = false;
|
|
atitc_supported = false;
|
|
-// use_texture_instancing=false;
|
|
|
|
-// use_attribute_instancing=true;
|
|
|
|
|
|
+ //use_texture_instancing=false;
|
|
|
|
+ //use_attribute_instancing=true;
|
|
use_texture_instancing=false;
|
|
use_texture_instancing=false;
|
|
use_attribute_instancing=true;
|
|
use_attribute_instancing=true;
|
|
full_float_fb_supported=true;
|
|
full_float_fb_supported=true;
|
|
@@ -11017,8 +11019,10 @@ void RasterizerGLES2::init() {
|
|
use_hw_skeleton_xform=vtf>0 && float_supported;
|
|
use_hw_skeleton_xform=vtf>0 && float_supported;
|
|
float_linear_supported = extensions.has("GL_OES_texture_float_linear");
|
|
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;
|
|
GLint mva;
|
|
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&mva);
|
|
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS,&mva);
|
|
if (vtf==0 && mva>8) {
|
|
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++) {
|
|
for(int i=0;i<strings.size();i++) {
|
|
|
|
|
|
extensions.insert(strings[i]);
|
|
extensions.insert(strings[i]);
|
|
-// print_line(strings[i]);
|
|
|
|
|
|
+ //print_line(strings[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|