diff options
| author | 2018-03-19 20:55:14 -0400 | |
|---|---|---|
| committer | 2018-03-20 00:07:30 -0400 | |
| commit | d7b1ebe4a8a11cb1ac23b084e8014fae9cc6b7dd (patch) | |
| tree | d11bb0678d38a6d24718f24befe23f04a30afb81 | |
| parent | renderer_gl: Port over gl_shader_decompiler module from Citra. (diff) | |
| download | yuzu-d7b1ebe4a8a11cb1ac23b084e8014fae9cc6b7dd.tar.gz yuzu-d7b1ebe4a8a11cb1ac23b084e8014fae9cc6b7dd.tar.xz yuzu-d7b1ebe4a8a11cb1ac23b084e8014fae9cc6b7dd.zip | |
renderer_gl: Port over gl_shader_gen module from Citra.
| -rw-r--r-- | src/video_core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 20 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.h | 66 |
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 | |||
| 8 | namespace GLShader { | ||
| 9 | |||
| 10 | std::string GenerateVertexShader(const MaxwellVSConfig& config) { | ||
| 11 | UNIMPLEMENTED(); | ||
| 12 | return {}; | ||
| 13 | } | ||
| 14 | |||
| 15 | std::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 | |||
| 12 | namespace GLShader { | ||
| 13 | |||
| 14 | enum 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 | |||
| 25 | struct MaxwellShaderConfigCommon { | ||
| 26 | explicit MaxwellShaderConfigCommon(){}; | ||
| 27 | }; | ||
| 28 | |||
| 29 | struct 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 | |||
| 37 | struct 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 | |||
| 45 | std::string GenerateVertexShader(const MaxwellVSConfig& config); | ||
| 46 | std::string GenerateFragmentShader(const MaxwellFSConfig& config); | ||
| 47 | |||
| 48 | } // namespace GLShader | ||
| 49 | |||
| 50 | namespace std { | ||
| 51 | |||
| 52 | template <> | ||
| 53 | struct hash<GLShader::MaxwellVSConfig> { | ||
| 54 | size_t operator()(const GLShader::MaxwellVSConfig& k) const { | ||
| 55 | return Common::ComputeHash64(&k, sizeof(GLShader::MaxwellVSConfig)); | ||
| 56 | } | ||
| 57 | }; | ||
| 58 | |||
| 59 | template <> | ||
| 60 | struct 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 | ||