mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-14 10:21:21 +00:00
parent
8c3b3f7ab4
commit
bbf7e6332c
@ -1732,8 +1732,6 @@ namespace gl
|
||||
|
||||
class shader
|
||||
{
|
||||
GLuint m_id = GL_NONE;
|
||||
|
||||
public:
|
||||
enum class type
|
||||
{
|
||||
@ -1742,6 +1740,13 @@ namespace gl
|
||||
geometry = GL_GEOMETRY_SHADER
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
GLuint m_id = GL_NONE;
|
||||
type shader_type = type::vertex;
|
||||
|
||||
public:
|
||||
|
||||
shader() = default;
|
||||
|
||||
shader(GLuint id)
|
||||
@ -1777,6 +1782,7 @@ namespace gl
|
||||
void create(type type_)
|
||||
{
|
||||
m_id = glCreateShader((GLenum)type_);
|
||||
shader_type = type_;
|
||||
}
|
||||
|
||||
void source(const std::string& src) const
|
||||
@ -1784,6 +1790,21 @@ namespace gl
|
||||
const char* str = src.c_str();
|
||||
const GLint length = (GLint)src.length();
|
||||
|
||||
{
|
||||
std::string base_name = "shaderlog/VertexProgram";
|
||||
switch (shader_type)
|
||||
{
|
||||
case type::fragment:
|
||||
base_name = "shaderlog/FragmentProgram";
|
||||
break;
|
||||
case type::geometry:
|
||||
base_name = "shaderlog/GeometryProgram";
|
||||
break;
|
||||
}
|
||||
|
||||
fs::file(fs::get_config_dir() + base_name + std::to_string(m_id) + ".glsl", fs::rewrite).write(str);
|
||||
}
|
||||
|
||||
glShaderSource(m_id, 1, &str, &length);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user