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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright 2018 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <cstring>
#include <string>
#include <type_traits>
#include "common/hash.h"
namespace GLShader {
enum Attributes {
ATTRIBUTE_POSITION,
ATTRIBUTE_COLOR,
ATTRIBUTE_TEXCOORD0,
ATTRIBUTE_TEXCOORD1,
ATTRIBUTE_TEXCOORD2,
ATTRIBUTE_TEXCOORD0_W,
ATTRIBUTE_NORMQUAT,
ATTRIBUTE_VIEW,
};
struct MaxwellShaderConfigCommon {
explicit MaxwellShaderConfigCommon(){};
};
struct MaxwellVSConfig : MaxwellShaderConfigCommon {
explicit MaxwellVSConfig() : MaxwellShaderConfigCommon() {}
bool operator==(const MaxwellVSConfig& o) const {
return std::memcmp(this, &o, sizeof(MaxwellVSConfig)) == 0;
};
};
struct MaxwellFSConfig : MaxwellShaderConfigCommon {
explicit MaxwellFSConfig() : MaxwellShaderConfigCommon() {}
bool operator==(const MaxwellFSConfig& o) const {
return std::memcmp(this, &o, sizeof(MaxwellFSConfig)) == 0;
};
};
std::string GenerateVertexShader(const MaxwellVSConfig& config);
std::string GenerateFragmentShader(const MaxwellFSConfig& config);
} // namespace GLShader
namespace std {
template <>
struct hash<GLShader::MaxwellVSConfig> {
size_t operator()(const GLShader::MaxwellVSConfig& k) const {
return Common::ComputeHash64(&k, sizeof(GLShader::MaxwellVSConfig));
}
};
template <>
struct hash<GLShader::MaxwellFSConfig> {
size_t operator()(const GLShader::MaxwellFSConfig& k) const {
return Common::ComputeHash64(&k, sizeof(GLShader::MaxwellFSConfig));
}
};
} // namespace std
|