Files
NazaraEngine/include/Nazara/OpenGLRenderer/Wrapper/Shader.hpp
Jérôme Leclercq 03e2801dbe Split engine to packages NazaraUtils and NZSL (#375)
* Move code to NazaraUtils and NZSL packages

* Reorder includes

* Tests: Remove glslang and spirv-tools deps

* Tests: Remove glslang init

* Remove NazaraUtils tests and fix Vector4Test

* Fix Linux compilation

* Update msys2-build.yml

* Fix assimp package

* Update xmake.lua

* Update xmake.lua

* Fix shader compilation on MinGW

* Final fixes

* The final fix 2: the fix strikes back!

* Disable cache on CI

* The return of the fix™️
2022-05-25 19:36:10 +02:00

51 lines
1.7 KiB
C++

// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - OpenGL renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_OPENGLRENDERER_WRAPPER_SHADER_HPP
#define NAZARA_OPENGLRENDERER_WRAPPER_SHADER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/DeviceObject.hpp>
#include <Nazara/Utils/MovableValue.hpp>
namespace Nz::GL
{
class Shader : public DeviceObject<Shader, GL_SHADER, GLenum>
{
friend DeviceObject;
public:
using DeviceObject::DeviceObject;
Shader(const Shader&) = delete;
Shader(Shader&&) noexcept = default;
~Shader() = default;
inline void Compile();
inline bool GetCompilationStatus(std::string* error = nullptr) const;
inline std::string GetSource() const;
inline void SetBinarySource(GLenum binaryFormat, const void* binary, GLsizei length);
inline void SetSource(const char* source, GLint length);
inline void SetSource(const std::string_view& source);
// GL_ARB_gl_spirv
inline void SpecializeShader(const GLchar* pEntryPoint, GLuint numSpecializationConstants, const GLuint* pConstantIndex, const GLuint* pConstantValue);
Shader& operator=(const Shader&) = delete;
Shader& operator=(Shader&&) noexcept = default;
private:
static inline GLuint CreateHelper(OpenGLDevice& device, const Context& context, GLenum shaderStage);
static inline void DestroyHelper(OpenGLDevice& device, const Context& context, GLuint objectId);
};
}
#include <Nazara/OpenGLRenderer/Wrapper/Shader.inl>
#endif // NAZARA_OPENGLRENDERER_WRAPPER_SHADER_HPP