diff --git a/ref/vk/vk_brush.c b/ref/vk/vk_brush.c index fd225ba6d..c2fa4ae07 100644 --- a/ref/vk/vk_brush.c +++ b/ref/vk/vk_brush.c @@ -16,6 +16,7 @@ #include "r_speeds.h" #include "vk_staging.h" #include "vk_logs.h" +#include "profiler.h" #include "ref_params.h" #include "eiface.h" @@ -416,7 +417,16 @@ static qboolean isSurfaceAnimated( const msurface_t *s, const struct texture_s * if( base->name[0] == '-' ) return false; - return true; + // It is not an animation if all textures are the same + const texture_t *prev = base; + base = base->anim_next; + while (base && base != prev) { + if (prev->gl_texturenum != base->gl_texturenum) + return true; + base = base->anim_next; + } + + return false; } typedef enum { @@ -522,6 +532,7 @@ static qboolean brushCreateWaterModel(const model_t *mod, vk_brush_model_t *bmod } static void brushDrawWater(vk_brush_model_t *bmodel, const cl_entity_t *ent, int render_type, const vec4_t color, const matrix4x4 transform) { + APROF_SCOPE_DECLARE_BEGIN(brush_draw_water, __FUNCTION__); ASSERT(bmodel->water.surfaces_count > 0); fillWaterSurfaces(NULL, bmodel, bmodel->water.render_model.geometries); @@ -535,6 +546,8 @@ static void brushDrawWater(vk_brush_model_t *bmodel, const cl_entity_t *ent, int .transform = (const matrix4x4*)transform, .prev_transform = &bmodel->prev_transform, }); + + APROF_SCOPE_END(brush_draw_water); } // FIXME use this @@ -694,6 +707,7 @@ void VK_BrushModelDraw( const cl_entity_t *ent, int render_mode, float blend, co geom->texture = tglob.whiteTexture; } } else { + APROF_SCOPE_DECLARE_BEGIN(brush_update_textures, "brush: update animated textures"); // Update animated textures int updated_textures_count = 0; for (int i = 0; i < bmodel->animated_indexes_count; ++i) { @@ -729,6 +743,7 @@ void VK_BrushModelDraw( const cl_entity_t *ent, int render_mode, float blend, co if (updated_textures_count > 0) { R_RenderModelUpdateMaterials(&bmodel->render_model, g_brush.updated_textures, updated_textures_count); } + APROF_SCOPE_END(brush_update_textures); } R_RenderModelDraw(&bmodel->render_model, (r_model_draw_t){ diff --git a/ref/vk/vk_light.c b/ref/vk/vk_light.c index f944bda88..cd45d05c3 100644 --- a/ref/vk/vk_light.c +++ b/ref/vk/vk_light.c @@ -1081,6 +1081,7 @@ int RT_LightAddPolygon(const rt_light_add_polygon_t *addpoly) { ASSERT(g_lights_.num_polygon_vertices + addpoly->num_vertices <= COUNTOF(g_lights_.polygon_vertices)); { + APROF_SCOPE_DECLARE_BEGIN(add_polygon, __FUNCTION__); rt_light_polygon_t *const poly = g_lights_.polygons + g_lights_.num_polygons; vec3_t *vertices = g_lights_.polygon_vertices + g_lights_.num_polygon_vertices; vec3_t normal; @@ -1143,6 +1144,7 @@ int RT_LightAddPolygon(const rt_light_add_polygon_t *addpoly) { } g_lights_.num_polygon_vertices += addpoly->num_vertices; + APROF_SCOPE_END(add_polygon); return g_lights_.num_polygons++; } } diff --git a/ref/vk/vk_ray_model.c b/ref/vk/vk_ray_model.c index b53ed2314..0de8855af 100644 --- a/ref/vk/vk_ray_model.c +++ b/ref/vk/vk_ray_model.c @@ -10,6 +10,7 @@ #include "vk_math.h" #include "vk_combuf.h" #include "vk_logs.h" +#include "profiler.h" #include "eiface.h" #include "xash3d_mathlib.h" @@ -262,6 +263,8 @@ qboolean RT_ModelUpdateMaterials(struct rt_model_s *model, const struct vk_rende if (!geom_indices_count) return true; + APROF_SCOPE_DECLARE_BEGIN(update_materials, __FUNCTION__); + int begin = 0; for (int i = 1; i < geom_indices_count; ++i) { const int geom_index = geom_indices[i]; @@ -272,8 +275,10 @@ qboolean RT_ModelUpdateMaterials(struct rt_model_s *model, const struct vk_rende const int offset = geom_indices[begin]; const int count = i - begin; ASSERT(offset + count <= geometries_count); - if (!RT_KusochkiUpload(model->kusochki.offset + offset, geometries + offset, count, -1, NULL)) + if (!RT_KusochkiUpload(model->kusochki.offset + offset, geometries + offset, count, -1, NULL)) { + APROF_SCOPE_END(update_materials); return false; + } begin = i; } @@ -283,10 +288,14 @@ qboolean RT_ModelUpdateMaterials(struct rt_model_s *model, const struct vk_rende const int offset = geom_indices[begin]; const int count = geom_indices_count - begin; ASSERT(offset + count <= geometries_count); - if (!RT_KusochkiUpload(model->kusochki.offset + offset, geometries + offset, count, -1, NULL)) + if (!RT_KusochkiUpload(model->kusochki.offset + offset, geometries + offset, count, -1, NULL)) { + + APROF_SCOPE_END(update_materials); return false; + } } + APROF_SCOPE_END(update_materials); return true; }