blob: 485a6796b384455f7902549f7fe595fdc8f897d9 (
plain) (
blame)
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
41
42
43
44
45
46
47
|
#include "includer.hpp"
#include <stdio.h>
#include <filesystem>
extern "C" {
#include "plat.h"
}
using IncludeResult = glslang::TShader::Includer::IncludeResult;
IncludeResult* Includer::includeSystem(
const char* headerName,
const char* includerName,
size_t inclusionDepth
) {
(void)headerName;
(void)includerName;
(void)inclusionDepth;
return 0;
}
extern bool rf(const char* n, char*& buf, size_t& size);
IncludeResult* Includer::includeLocal(
const char* header_name,
const char* includer_name,
size_t inclusionDepth
) {
char* src;
size_t src_size;
std::filesystem::path inc(includer_name);
(void)inclusionDepth;
inc.remove_filename();
inc /= header_name;
auto hn = std::filesystem::absolute(inc).string();
if (!rf(hn.c_str(), src, src_size)) {
print_err("Failed to include %s\n", header_name);
print_err("\tTried %s\n", hn.c_str());
return 0;
}
return new IncludeResult(hn, src, src_size, 0);
}
void Includer::releaseInclude(IncludeResult* i) {
delete i;
}
|