summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-03-19 20:55:14 -0400
committerGravatar bunnei2018-03-20 00:07:30 -0400
commitd7b1ebe4a8a11cb1ac23b084e8014fae9cc6b7dd (patch)
treed11bb0678d38a6d24718f24befe23f04a30afb81 /src
parentrenderer_gl: Port over gl_shader_decompiler module from Citra. (diff)
downloadyuzu-d7b1ebe4a8a11cb1ac23b084e8014fae9cc6b7dd.tar.gz
yuzu-d7b1ebe4a8a11cb1ac23b084e8014fae9cc6b7dd.tar.xz
yuzu-d7b1ebe4a8a11cb1ac23b084e8014fae9cc6b7dd.zip
renderer_gl: Port over gl_shader_gen module from Citra.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/CMakeLists.txt2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.cpp20
-rw-r--r--src/video_core/renderer_opengl/gl_shader_gen.h66
3 files changed, 88 insertions, 0 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index cce29231f..df4368f52 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -18,6 +18,8 @@ add_library(video_core STATIC
18 renderer_opengl/gl_resource_manager.h 18 renderer_opengl/gl_resource_manager.h
19 renderer_opengl/gl_shader_decompiler.cpp 19 renderer_opengl/gl_shader_decompiler.cpp
20 renderer_opengl/gl_shader_decompiler.h 20 renderer_opengl/gl_shader_decompiler.h
21 renderer_opengl/gl_shader_gen.cpp
22 renderer_opengl/gl_shader_gen.h
21 renderer_opengl/gl_shader_util.cpp 23 renderer_opengl/gl_shader_util.cpp
22 renderer_opengl/gl_shader_util.h 24 renderer_opengl/gl_shader_util.h
23 renderer_opengl/gl_state.cpp 25 renderer_opengl/gl_state.cpp
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp
new file mode 100644
index 000000000..f242bce1d
--- /dev/null
+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp
@@ -0,0 +1,20 @@
1// Copyright 2018 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "common/assert.h"
6#include "video_core/renderer_opengl/gl_shader_gen.h"
7
8namespace GLShader {
9
10std::string GenerateVertexShader(const MaxwellVSConfig& config) {
11 UNIMPLEMENTED();
12 return {};
13}
14
15std::string GenerateFragmentShader(const MaxwellFSConfig& config) {
16 UNIMPLEMENTED();
17 return {};
18}
19
20} // namespace GLShader
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.h b/src/video_core/renderer_opengl/gl_shader_gen.h
new file mode 100644
index 000000000..5101e7d30
--- /dev/null
+++ b/src/video_core/renderer_opengl/gl_shader_gen.h
@@ -0,0 +1,66 @@
1// Copyright 2018 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <cstring>
8#include <string>
9#include <type_traits>
10#include "common/hash.h"
11
12namespace GLShader {
13
14enum Attributes {
15 ATTRIBUTE_POSITION,
16 ATTRIBUTE_COLOR,
17 ATTRIBUTE_TEXCOORD0,
18 ATTRIBUTE_TEXCOORD1,
19 ATTRIBUTE_TEXCOORD2,
20 ATTRIBUTE_TEXCOORD0_W,
21 ATTRIBUTE_NORMQUAT,
22 ATTRIBUTE_VIEW,
23};
24
25struct MaxwellShaderConfigCommon {
26 explicit MaxwellShaderConfigCommon(){};
27};
28
29struct MaxwellVSConfig : MaxwellShaderConfigCommon {
30 explicit MaxwellVSConfig() : MaxwellShaderConfigCommon() {}
31
32 bool operator==(const MaxwellVSConfig& o) const {
33 return std::memcmp(this, &o, sizeof(MaxwellVSConfig)) == 0;
34 };
35};
36
37struct MaxwellFSConfig : MaxwellShaderConfigCommon {
38 explicit MaxwellFSConfig() : MaxwellShaderConfigCommon() {}
39
40 bool operator==(const MaxwellFSConfig& o) const {
41 return std::memcmp(this, &o, sizeof(MaxwellFSConfig)) == 0;
42 };
43};
44
45std::string GenerateVertexShader(const MaxwellVSConfig& config);
46std::string GenerateFragmentShader(const MaxwellFSConfig& config);
47
48} // namespace GLShader
49
50namespace std {
51
52template <>
53struct hash<GLShader::MaxwellVSConfig> {
54 size_t operator()(const GLShader::MaxwellVSConfig& k) const {
55 return Common::ComputeHash64(&k, sizeof(GLShader::MaxwellVSConfig));
56 }
57};
58
59template <>
60struct hash<GLShader::MaxwellFSConfig> {
61 size_t operator()(const GLShader::MaxwellFSConfig& k) const {
62 return Common::ComputeHash64(&k, sizeof(GLShader::MaxwellFSConfig));
63 }
64};
65
66} // namespace std