The goal is to reduce the startup time cost of all of these parsing and string replacement. All comments are now stripped at compile time. This comment check added noticeable slowdown at startup in debug builds and during preprocessing. Put all metadatas between start and end token. Use very simple parsing using `StringRef` and hash all identifiers. Move all the complexity to the preprocessor that massagess the metadata into a well expected input to the runtime parser. All identifiers are compile time hashed so that no string comparison is made at runtime. Speed up the source loading: - from 10ms to 1.6ms (6.25x speedup) in release - from 194ms to 6ms (32.3x speedup) in debug Follow up #129009 Pull Request: https://projects.blender.org/blender/blender/pulls/128927
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#include "draw_defines.hh"
|
|
#include "gpu_shader_create_info.hh"
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
/** \name Debug draw shapes
|
|
*
|
|
* Allows to draw lines and points just like the DRW_debug module functions.
|
|
* \{ */
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_debug_draw)
|
|
DEFINE("DRW_DEBUG_DRAW")
|
|
TYPEDEF_SOURCE("draw_shader_shared.hh")
|
|
STORAGE_BUF(DRW_DEBUG_DRAW_SLOT, READ_WRITE, DRWDebugVert, drw_debug_verts_buf[])
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
GPU_SHADER_NAMED_INTERFACE_INFO(draw_debug_draw_display_iface, interp)
|
|
FLAT(VEC4, color)
|
|
GPU_SHADER_NAMED_INTERFACE_END(interp)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_debug_draw_display)
|
|
DO_STATIC_COMPILATION()
|
|
TYPEDEF_SOURCE("draw_shader_shared.hh")
|
|
STORAGE_BUF(DRW_DEBUG_DRAW_SLOT, READ, DRWDebugVert, drw_debug_verts_buf[])
|
|
VERTEX_OUT(draw_debug_draw_display_iface)
|
|
FRAGMENT_OUT(0, VEC4, out_color)
|
|
PUSH_CONSTANT(MAT4, persmat)
|
|
VERTEX_SOURCE("draw_debug_draw_display_vert.glsl")
|
|
FRAGMENT_SOURCE("draw_debug_draw_display_frag.glsl")
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
/** \} */
|