OpenGL: Handle Spir-V

This commit is contained in:
Lynix
2020-04-19 15:31:48 +02:00
parent f63d045676
commit bd6924d66d
11 changed files with 3454 additions and 53 deletions

View File

@@ -13,11 +13,37 @@ namespace Nz::GL
Destroy();
}
inline bool Shader::Compile(std::string* error)
inline void Shader::Compile()
{
assert(m_shader);
m_device->GetReferenceContext().glCompileShader(m_shader);
}
inline bool Shader::Create(OpenGLDevice& device, GLenum type)
{
Destroy();
m_device = &device;
m_shader = device.GetReferenceContext().glCreateShader(type);
if (!m_shader)
return false; //< TODO: Handle error messages
return true;
}
inline void Shader::Destroy()
{
if (m_shader)
{
m_device->GetReferenceContext().glDeleteShader(m_shader);
m_shader = 0;
}
}
inline bool Shader::GetCompilationStatus(std::string* error)
{
assert(m_shader);
const GL::Context& context = m_device->GetReferenceContext();
context.glCompileShader(m_shader);
GLint success;
context.glGetShaderiv(m_shader, GL_COMPILE_STATUS, &success);
@@ -43,27 +69,6 @@ namespace Nz::GL
return true;
}
inline bool Shader::Create(OpenGLDevice& device, GLenum type)
{
Destroy();
m_device = &device;
m_shader = device.GetReferenceContext().glCreateShader(type);
if (!m_shader)
return false; //< TODO: Handle error messages
return true;
}
inline void Shader::Destroy()
{
if (m_shader)
{
m_device->GetReferenceContext().glDeleteShader(m_shader);
m_shader = 0;
}
}
inline void Shader::SetBinarySource(GLenum binaryFormat, const void* binary, GLsizei length)
{
assert(m_shader);
@@ -77,6 +82,15 @@ namespace Nz::GL
m_device->GetReferenceContext().glShaderSource(m_shader, 1U, &source, &length);
}
inline void Shader::SpecializeShader(const GLchar* pEntryPoint, GLuint numSpecializationConstants, const GLuint* pConstantIndex, const GLuint* pConstantValue)
{
assert(m_shader);
const GL::Context& context = m_device->GetReferenceContext();
assert(context.glSpecializeShaderARB);
context.glSpecializeShaderARB(m_shader, pEntryPoint, numSpecializationConstants, pConstantIndex, pConstantValue);
}
}
#include <Nazara/OpenGLRenderer/DebugOff.hpp>