Welcome to mirror list, hosted at ThFree Co, Russian Federation.

static_shader_manager.cc « intern « realtime_compositor « compositor « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c9c8a056f8753f463bab3cf4593e2c5bdfaf1e27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include "GPU_shader.h"

#include "COM_static_shader_manager.hh"

namespace blender::realtime_compositor {

StaticShaderManager::~StaticShaderManager()
{
  for (GPUShader *shader : shaders_.values()) {
    GPU_shader_free(shader);
  }
}

GPUShader *StaticShaderManager::get(const char *info_name)
{
  /* If a shader with the same info name already exists in the manager, return it, otherwise,
   * create a new shader from the info name and return it. */
  return shaders_.lookup_or_add_cb(
      info_name, [info_name]() { return GPU_shader_create_from_info_name(info_name); });
}

}  // namespace blender::realtime_compositor