Last nzsl version update

This commit is contained in:
SirLynix
2022-06-07 20:18:16 +02:00
parent 510ef8c41e
commit c7b6d83bbc
16 changed files with 38 additions and 20 deletions

View File

@@ -12,7 +12,7 @@
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Renderer/RenderPipeline.hpp>
#include <Nazara/Utils/Signal.hpp>
#include <NZSL/ShaderModuleResolver.hpp>
#include <NZSL/ModuleResolver.hpp>
#include <NZSL/Ast/Module.hpp>
#include <unordered_map>
@@ -28,7 +28,7 @@ namespace Nz
using ConfigCallback = std::function<void(Config& config, const std::vector<RenderPipelineInfo::VertexBufferData>& vertexBuffers)>;
UberShader(nzsl::ShaderStageTypeFlags shaderStages, std::string moduleName);
UberShader(nzsl::ShaderStageTypeFlags shaderStages, nzsl::ShaderModuleResolver& moduleResolver, std::string moduleName);
UberShader(nzsl::ShaderStageTypeFlags shaderStages, nzsl::ModuleResolver& moduleResolver, std::string moduleName);
UberShader(nzsl::ShaderStageTypeFlags shaderStages, nzsl::Ast::ModulePtr shaderModule);
~UberShader() = default;
@@ -66,7 +66,7 @@ namespace Nz
private:
nzsl::Ast::ModulePtr Validate(const nzsl::Ast::Module& module, std::unordered_map<std::string, Option>* options);
NazaraSlot(nzsl::ShaderModuleResolver, OnModuleUpdated, m_onShaderModuleUpdated);
NazaraSlot(nzsl::ModuleResolver, OnModuleUpdated, m_onShaderModuleUpdated);
std::unordered_map<Config, std::shared_ptr<ShaderModule>, ConfigHasher, ConfigEqual> m_combinations;
std::unordered_map<std::string, Option> m_optionIndexByName;

View File

@@ -160,6 +160,7 @@ typedef void (GL_APIENTRYP PFNGLSPECIALIZESHADERPROC) (GLuint shader, const GLch
cb(glUniform3iv, PFNGLUNIFORM3IVPROC) \
cb(glUniform4fv, PFNGLUNIFORM4FVPROC) \
cb(glUniform4iv, PFNGLUNIFORM4IVPROC) \
cb(glUniformBlockBinding, PFNGLUNIFORMBLOCKBINDINGPROC) \
cb(glUniformMatrix4fv, PFNGLUNIFORMMATRIX4FVPROC) \
cb(glUnmapBuffer, PFNGLUNMAPBUFFERPROC) \
cb(glUseProgram, PFNGLUSEPROGRAMPROC) \

View File

@@ -44,6 +44,7 @@ namespace Nz::GL
inline void Link();
inline void Uniform(GLint uniformLocation, float value) const;
inline void UniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) const;
Program& operator=(const Program&) = delete;
Program& operator=(Program&&) noexcept = default;

View File

@@ -203,6 +203,14 @@ namespace Nz::GL
context.glUniform1f(uniformLocation, value);
}
inline void Program::UniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) const
{
assert(m_objectId);
const Context& context = EnsureDeviceContext();
context.glUniformBlockBinding(m_objectId, uniformBlockIndex, uniformBlockBinding);
}
inline GLuint Program::CreateHelper(OpenGLDevice& /*device*/, const Context& context)
{
return context.glCreateProgram();