MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / tryGetEmbeddedShaderSource

Function tryGetEmbeddedShaderSource

Source/Shader/ShaderCompiler.cpp:26–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24};
25
26static bool tryGetEmbeddedShaderSource(String path, std::string& data) {
27#if DORA_HAS_EMBEDDED_BGFX_SHADERS
28 std::string file = path.toString();
29 while (!file.empty() && file.front() == '/') {
30 file.erase(file.begin());
31 }
32 auto pos = file.find_last_of("/\\");
33 if (pos != std::string::npos) {
34 file.erase(0, pos + 1);
35 }
36 if (file == "bgfx_shader.sh") {
37 data = BgfxEmbeddedShaders::kBgfxShaderSh;
38 return true;
39 }
40 if (file == "bgfx_compute.sh") {
41 data = BgfxEmbeddedShaders::kBgfxComputeSh;
42 return true;
43 }
44#else
45 DORA_UNUSED_PARAM(path);
46 DORA_UNUSED_PARAM(data);
47#endif
48 return false;
49}
50
51static const std::string& loadShaderFileData(ShaderCompilerFileContext& context, String path) {
52 std::string key = path.toString();

Callers 1

ShaderCompiler.cppFile · 0.85

Calls 5

toStringMethod · 0.65
emptyMethod · 0.45
frontMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected