summaryrefslogtreecommitdiff
path: root/src/gpu/effects/shader_composer.h
blob: 49bf00c9c540b2bbe4ea4f8b42d3fda652f1e9bb (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
// This file is part of the 64k demo project.
// It defines the ShaderComposer class for managing WGSL snippets.

#pragma once

#include <map>
#include <string>
#include <vector>

class ShaderComposer {
 public:
  static ShaderComposer& Get();

  // Register a snippet (e.g. "common_math", "sdf_primitives")
  void RegisterSnippet(const std::string& name, const std::string& code);

  // Assemble a final shader string by prepending required snippets
  std::string Compose(const std::vector<std::string>& dependencies,
                      const std::string& main_code);

 private:
  ShaderComposer() = default;
  std::map<std::string, std::string> snippets_;
};