summaryrefslogtreecommitdiff
path: root/drivers/gles2/rasterizer_scene_gles2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles2/rasterizer_scene_gles2.cpp')
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp38
1 files changed, 31 insertions, 7 deletions
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index de31288838..e790d5b031 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -1208,7 +1208,8 @@ void RasterizerSceneGLES2::_fill_render_list(InstanceBase **p_cull_result, int p
} break;
- default: {}
+ default: {
+ }
}
}
}
@@ -1369,7 +1370,8 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
} break;
- default: {}
+ default: {
+ }
}
}
}
@@ -1530,7 +1532,8 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
glVertexAttrib4f(VS::ARRAY_COLOR, 1, 1, 1, 1);
} break;
- default: {}
+ default: {
+ }
}
}
}
@@ -1550,7 +1553,8 @@ void RasterizerSceneGLES2::_setup_geometry(RenderList::Element *p_element, Raste
case VS::INSTANCE_IMMEDIATE: {
} break;
- default: {}
+ default: {
+ }
}
}
@@ -1566,8 +1570,10 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
if (s->index_array_len > 0) {
glDrawElements(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0);
+ storage->info.render.vertices_count += s->index_array_len;
} else {
glDrawArrays(gl_primitive[s->primitive], 0, s->array_len);
+ storage->info.render.vertices_count += s->array_len;
}
/*
if (p_element->instance->skeleton.is_valid() && s->attribs[VS::ARRAY_BONES].enabled && s->attribs[VS::ARRAY_WEIGHTS].enabled) {
@@ -1637,8 +1643,10 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
if (s->index_array_len > 0) {
glDrawElements(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0);
+ storage->info.render.vertices_count += s->index_array_len;
} else {
glDrawArrays(gl_primitive[s->primitive], 0, s->array_len);
+ storage->info.render.vertices_count += s->array_len;
}
}
@@ -1754,7 +1762,8 @@ void RasterizerSceneGLES2::_render_geometry(RenderList::Element *p_element) {
}
} break;
- default: {}
+ default: {
+ }
}
}
@@ -2070,7 +2079,8 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
}
} break;
- default: {}
+ default: {
+ }
}
}
@@ -2182,6 +2192,8 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
float lightmap_energy = 1.0;
bool prev_use_lightmap_capture = false;
+ storage->info.render.draw_call_count += p_element_count;
+
for (int i = 0; i < p_element_count; i++) {
RenderList::Element *e = p_elements[i];
@@ -2389,11 +2401,17 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
if (e->owner != prev_owner || e->geometry != prev_geometry || skeleton != prev_skeleton) {
_setup_geometry(e, skeleton);
+ storage->info.render.surface_switch_count++;
}
bool shader_rebind = false;
if (rebind || material != prev_material) {
+
+ storage->info.render.material_switch_count++;
shader_rebind = _setup_material(material, p_reverse_cull, p_alpha_pass, Size2i(skeleton ? skeleton->size * 3 : 0, 0));
+ if (shader_rebind) {
+ storage->info.render.shader_rebind_count++;
+ }
}
if (i == 0 || shader_rebind) { //first time must rebind
@@ -2637,6 +2655,8 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
Transform cam_transform = p_cam_transform;
+ storage->info.render.object_count += p_cull_count;
+
GLuint current_fb = 0;
Environment *env = NULL;
@@ -2667,7 +2687,11 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
} else {
state.render_no_shadows = false;
- current_fb = storage->frame.current_rt->fbo;
+ if (storage->frame.current_rt->external.fbo != 0) {
+ current_fb = storage->frame.current_rt->external.fbo;
+ } else {
+ current_fb = storage->frame.current_rt->fbo;
+ }
env = environment_owner.getornull(p_environment);
viewport_width = storage->frame.current_rt->width;