From d7b1ebe4a8a11cb1ac23b084e8014fae9cc6b7dd Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 19 Mar 2018 20:55:14 -0400 Subject: renderer_gl: Port over gl_shader_gen module from Citra. --- src/video_core/renderer_opengl/gl_shader_gen.cpp | 20 +++++++ src/video_core/renderer_opengl/gl_shader_gen.h | 66 ++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 src/video_core/renderer_opengl/gl_shader_gen.cpp create mode 100644 src/video_core/renderer_opengl/gl_shader_gen.h (limited to 'src/video_core/renderer_opengl') 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 @@ +// 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 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 @@ +// Copyright 2018 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include +#include +#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 { + size_t operator()(const GLShader::MaxwellVSConfig& k) const { + return Common::ComputeHash64(&k, sizeof(GLShader::MaxwellVSConfig)); + } +}; + +template <> +struct hash { + size_t operator()(const GLShader::MaxwellFSConfig& k) const { + return Common::ComputeHash64(&k, sizeof(GLShader::MaxwellFSConfig)); + } +}; + +} // namespace std -- cgit v1.2.3