mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 10:42:47 +01:00
renderer_gl: Port over gl_shader_gen module from Citra.
This commit is contained in:
parent
4bdb46e4c2
commit
d7b1ebe4a8
3 changed files with 88 additions and 0 deletions
|
@ -18,6 +18,8 @@ add_library(video_core STATIC
|
|||
renderer_opengl/gl_resource_manager.h
|
||||
renderer_opengl/gl_shader_decompiler.cpp
|
||||
renderer_opengl/gl_shader_decompiler.h
|
||||
renderer_opengl/gl_shader_gen.cpp
|
||||
renderer_opengl/gl_shader_gen.h
|
||||
renderer_opengl/gl_shader_util.cpp
|
||||
renderer_opengl/gl_shader_util.h
|
||||
renderer_opengl/gl_state.cpp
|
||||
|
|
20
src/video_core/renderer_opengl/gl_shader_gen.cpp
Normal file
20
src/video_core/renderer_opengl/gl_shader_gen.cpp
Normal file
|
@ -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
|
66
src/video_core/renderer_opengl/gl_shader_gen.h
Normal file
66
src/video_core/renderer_opengl/gl_shader_gen.h
Normal file
|
@ -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
|
Loading…
Reference in a new issue