summaryrefslogtreecommitdiff
path: root/src/gpu/effects/shaders.cc
blob: 6b37869d7330cd185e5095062db6964f2ea51929 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// This file is part of the 64k demo project.
// It defines WGSL shader code for various effects.

#include "../demo_effects.h"
#include "generated/assets.h"
#include "gpu/effects/shader_composer.h"
#include "util/asset_manager.h"

void InitShaderComposer() {
  auto& sc = ShaderComposer::Get();

  sc.RegisterSnippet("common_uniforms",
                     (const char*)GetAsset(AssetId::ASSET_SHADER_COMMON_UNIFORMS));
  sc.RegisterSnippet("sdf_primitives",
                     (const char*)GetAsset(AssetId::ASSET_SHADER_SDF_PRIMITIVES));
  sc.RegisterSnippet("lighting",
                     (const char*)GetAsset(AssetId::ASSET_SHADER_LIGHTING));
  sc.RegisterSnippet("ray_box",
                     (const char*)GetAsset(AssetId::ASSET_SHADER_RAY_BOX));
}

const char* main_shader_wgsl = (const char*)GetAsset(AssetId::ASSET_SHADER_MAIN);
const char* particle_compute_wgsl =
    (const char*)GetAsset(AssetId::ASSET_SHADER_PARTICLE_COMPUTE);
const char* particle_render_wgsl =
    (const char*)GetAsset(AssetId::ASSET_SHADER_PARTICLE_RENDER);
const char* passthrough_shader_wgsl =
    (const char*)GetAsset(AssetId::ASSET_SHADER_PASSTHROUGH);
const char* ellipse_shader_wgsl =
    (const char*)GetAsset(AssetId::ASSET_SHADER_ELLIPSE);
const char* particle_spray_compute_wgsl =
    (const char*)GetAsset(AssetId::ASSET_SHADER_PARTICLE_SPRAY_COMPUTE);
const char* gaussian_blur_shader_wgsl =
    (const char*)GetAsset(AssetId::ASSET_SHADER_GAUSSIAN_BLUR);
const char* solarize_shader_wgsl =
    (const char*)GetAsset(AssetId::ASSET_SHADER_SOLARIZE);
const char* distort_shader_wgsl =
    (const char*)GetAsset(AssetId::ASSET_SHADER_DISTORT);
const char* chroma_aberration_shader_wgsl =
    (const char*)GetAsset(AssetId::ASSET_SHADER_CHROMA_ABERRATION);