mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-03 10:44:49 +12:00
resolve merge conflicts
This commit is contained in:
commit
804a0b083f
48 changed files with 7770 additions and 528 deletions
4405
third_party/libretro/include/libretro.h
vendored
Normal file
4405
third_party/libretro/include/libretro.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
130
third_party/opengl/opengl.hpp
vendored
130
third_party/opengl/opengl.hpp
vendored
|
@ -355,76 +355,98 @@ namespace OpenGL {
|
|||
}
|
||||
};
|
||||
|
||||
enum ShaderType {
|
||||
Fragment = GL_FRAGMENT_SHADER,
|
||||
Vertex = GL_VERTEX_SHADER,
|
||||
Geometry = GL_GEOMETRY_SHADER,
|
||||
Compute = GL_COMPUTE_SHADER,
|
||||
TessControl = GL_TESS_CONTROL_SHADER,
|
||||
TessEvaluation = GL_TESS_EVALUATION_SHADER
|
||||
};
|
||||
enum ShaderType {
|
||||
Fragment = GL_FRAGMENT_SHADER,
|
||||
Vertex = GL_VERTEX_SHADER,
|
||||
Geometry = GL_GEOMETRY_SHADER,
|
||||
Compute = GL_COMPUTE_SHADER,
|
||||
TessControl = GL_TESS_CONTROL_SHADER,
|
||||
TessEvaluation = GL_TESS_EVALUATION_SHADER
|
||||
};
|
||||
|
||||
struct Shader {
|
||||
GLuint m_handle = 0;
|
||||
struct Shader {
|
||||
GLuint m_handle = 0;
|
||||
|
||||
Shader() {}
|
||||
Shader(const std::string_view source, ShaderType type) { create(source, static_cast<GLenum>(type)); }
|
||||
Shader() {}
|
||||
Shader(const std::string_view source, ShaderType type) { create(source, static_cast<GLenum>(type)); }
|
||||
|
||||
// Returns whether compilation failed or not
|
||||
bool create(const std::string_view source, GLenum type) {
|
||||
m_handle = glCreateShader(type);
|
||||
const GLchar* const sources[1] = { source.data() };
|
||||
// Returns whether compilation failed or not
|
||||
bool create(const std::string_view source, GLenum type) {
|
||||
m_handle = glCreateShader(type);
|
||||
const GLchar* const sources[1] = {source.data()};
|
||||
|
||||
glShaderSource(m_handle, 1, sources, nullptr);
|
||||
glCompileShader(m_handle);
|
||||
glShaderSource(m_handle, 1, sources, nullptr);
|
||||
glCompileShader(m_handle);
|
||||
|
||||
GLint success;
|
||||
glGetShaderiv(m_handle, GL_COMPILE_STATUS, &success);
|
||||
if (success == GL_FALSE) {
|
||||
char buf[4096];
|
||||
glGetShaderInfoLog(m_handle, 4096, nullptr, buf);
|
||||
fprintf(stderr, "Failed to compile shader\nError: %s\n", buf);
|
||||
glDeleteShader(m_handle);
|
||||
GLint success;
|
||||
glGetShaderiv(m_handle, GL_COMPILE_STATUS, &success);
|
||||
if (success == GL_FALSE) {
|
||||
char buf[4096];
|
||||
glGetShaderInfoLog(m_handle, 4096, nullptr, buf);
|
||||
fprintf(stderr, "Failed to compile shader\nError: %s\n", buf);
|
||||
glDeleteShader(m_handle);
|
||||
|
||||
m_handle = 0;
|
||||
}
|
||||
m_handle = 0;
|
||||
}
|
||||
|
||||
return m_handle != 0;
|
||||
}
|
||||
return m_handle != 0;
|
||||
}
|
||||
|
||||
GLuint handle() const { return m_handle; }
|
||||
bool exists() const { return m_handle != 0; }
|
||||
};
|
||||
GLuint handle() const { return m_handle; }
|
||||
bool exists() const { return m_handle != 0; }
|
||||
|
||||
void free() {
|
||||
if (exists()) {
|
||||
glDeleteShader(m_handle);
|
||||
m_handle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef OPENGL_DESTRUCTORS
|
||||
~Shader() { free(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
struct Program {
|
||||
GLuint m_handle = 0;
|
||||
GLuint m_handle = 0;
|
||||
|
||||
bool create(std::initializer_list<std::reference_wrapper<Shader>> shaders) {
|
||||
m_handle = glCreateProgram();
|
||||
for (const auto& shader : shaders) {
|
||||
glAttachShader(m_handle, shader.get().handle());
|
||||
}
|
||||
bool create(std::initializer_list<std::reference_wrapper<Shader>> shaders) {
|
||||
m_handle = glCreateProgram();
|
||||
for (const auto& shader : shaders) {
|
||||
glAttachShader(m_handle, shader.get().handle());
|
||||
}
|
||||
|
||||
glLinkProgram(m_handle);
|
||||
GLint success;
|
||||
glGetProgramiv(m_handle, GL_LINK_STATUS, &success);
|
||||
glLinkProgram(m_handle);
|
||||
GLint success;
|
||||
glGetProgramiv(m_handle, GL_LINK_STATUS, &success);
|
||||
|
||||
if (!success) {
|
||||
char buf[4096];
|
||||
glGetProgramInfoLog(m_handle, 4096, nullptr, buf);
|
||||
fprintf(stderr, "Failed to link program\nError: %s\n", buf);
|
||||
glDeleteProgram(m_handle);
|
||||
if (!success) {
|
||||
char buf[4096];
|
||||
glGetProgramInfoLog(m_handle, 4096, nullptr, buf);
|
||||
fprintf(stderr, "Failed to link program\nError: %s\n", buf);
|
||||
glDeleteProgram(m_handle);
|
||||
|
||||
m_handle = 0;
|
||||
}
|
||||
m_handle = 0;
|
||||
}
|
||||
|
||||
return m_handle != 0;
|
||||
}
|
||||
return m_handle != 0;
|
||||
}
|
||||
|
||||
GLuint handle() const { return m_handle; }
|
||||
bool exists() const { return m_handle != 0; }
|
||||
void use() const { glUseProgram(m_handle); }
|
||||
};
|
||||
GLuint handle() const { return m_handle; }
|
||||
bool exists() const { return m_handle != 0; }
|
||||
void use() const { glUseProgram(m_handle); }
|
||||
|
||||
void free() {
|
||||
if (exists()) {
|
||||
glDeleteProgram(m_handle);
|
||||
m_handle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef OPENGL_DESTRUCTORS
|
||||
~Program() { free(); }
|
||||
#endif
|
||||
};
|
||||
|
||||
static void dispatchCompute(GLuint groupsX = 1, GLuint groupsY = 1, GLuint groupsZ = 1) {
|
||||
glDispatchCompute(groupsX, groupsY, groupsZ);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue