VERY experimental Nintendo Switch 2 emulator
C++
renderer_gl: Port over gl_shader_gen module from Citra.
bunnei756e14027aba
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txtindex cce29231f6..df4368f526 100644--- a/src/video_core/CMakeLists.txt+++ b/src/video_core/CMakeLists.txt@@ -18,6 +18,8 @@ add_library(video_core STATICrenderer_opengl/gl_resource_manager.hrenderer_opengl/gl_shader_decompiler.cpprenderer_opengl/gl_shader_decompiler.h+ renderer_opengl/gl_shader_gen.cpp+ renderer_opengl/gl_shader_gen.hrenderer_opengl/gl_shader_util.cpprenderer_opengl/gl_shader_util.hrenderer_opengl/gl_state.cppdiff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cppnew file mode 100644index 0000000000..f242bce1da--- /dev/null+++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp@@ -0,0 +1,20 @@+// Copyright 2018 yuzu Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "common/assert.h"+#include "video_core/renderer_opengl/gl_shader_gen.h"++namespace GLShader {++std::string GenerateVertexShader(const MaxwellVSConfig& config) {+ UNIMPLEMENTED();+ return {};+}++std::string GenerateFragmentShader(const MaxwellFSConfig& config) {+ UNIMPLEMENTED();+ return {};+}++} // namespace GLShaderdiff --git a/src/video_core/renderer_opengl/gl_shader_gen.h b/src/video_core/renderer_opengl/gl_shader_gen.hnew file mode 100644index 0000000000..5101e7d300--- /dev/null+++ b/src/video_core/renderer_opengl/gl_shader_gen.h@@ -0,0 +1,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