Add ShaderBinding

This commit is contained in:
Lynix
2020-03-26 21:19:46 +01:00
parent 874130efd4
commit 1dc0ed8e94
14 changed files with 265 additions and 150 deletions

View File

@@ -0,0 +1,57 @@
// Copyright (C) 2020 Jérôme Leclercq
// This file is part of the "Nazara Engine - Renderer module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_SHADERBINDING_HPP
#define NAZARA_SHADERBINDING_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp>
#include <variant>
namespace Nz
{
class AbstractBuffer;
class Texture;
class TextureSampler;
class NAZARA_RENDERER_API ShaderBinding
{
public:
struct Binding;
ShaderBinding() = default;
virtual ~ShaderBinding();
virtual void Update(std::initializer_list<Binding> bindings) = 0;
struct TextureBinding
{
Texture* texture;
TextureSampler* sampler;
};
struct UniformBufferBinding
{
AbstractBuffer* buffer;
UInt64 offset;
UInt64 range;
};
struct Binding
{
std::size_t bindingIndex;
std::variant<TextureBinding, UniformBufferBinding> content;
};
protected:
ShaderBinding(const ShaderBinding&) = delete;
ShaderBinding(ShaderBinding&&) = default;
};
}
#include <Nazara/Renderer/ShaderBinding.inl>
#endif // NAZARA_SHADERBINDING_HPP