Graphics: Make use of shader binding sets

This commit is contained in:
Jérôme Leclercq
2021-06-16 14:47:54 +02:00
parent 5559fe1af7
commit 3cd9172f7a
49 changed files with 592 additions and 792 deletions

View File

@@ -28,7 +28,7 @@
namespace Nz
{
class CommandBufferBuilder;
class UploadPool;
class RenderFrame;
class NAZARA_GRAPHICS_API Material : public Resource
{
@@ -70,6 +70,7 @@ namespace Nz
inline float GetPointSize() const;
inline const std::shared_ptr<const MaterialSettings>& GetSettings() const;
inline const std::shared_ptr<UberShader>& GetShader(ShaderStageType shaderStage) const;
inline ShaderBinding& GetShaderBinding();
inline const std::shared_ptr<Texture>& GetTexture(std::size_t textureIndex) const;
inline const TextureSamplerInfo& GetTextureSampler(std::size_t textureIndex) const;
inline const std::shared_ptr<AbstractBuffer>& GetUniformBuffer(std::size_t bufferIndex) const;
@@ -103,8 +104,7 @@ namespace Nz
inline void SetTextureSampler(std::size_t textureIndex, TextureSamplerInfo samplerInfo);
inline void SetUniformBuffer(std::size_t bufferIndex, std::shared_ptr<AbstractBuffer> uniformBuffer);
void UpdateBuffers(UploadPool& uploadPool, CommandBufferBuilder& builder);
void UpdateShaderBinding(ShaderBinding& shaderBinding) const;
bool Update(RenderFrame& renderFrame, CommandBufferBuilder& builder);
// Signals:
NazaraSignal(OnMaterialRelease, const Material* /*material*/);
@@ -114,6 +114,7 @@ namespace Nz
inline void InvalidateShaderBinding();
inline void InvalidateTextureSampler(std::size_t textureIndex);
inline void UpdatePipeline() const;
void UpdateShaderBinding();
struct MaterialTexture
{
@@ -135,7 +136,9 @@ namespace Nz
mutable std::shared_ptr<MaterialPipeline> m_pipeline;
UInt64 m_enabledConditions;
mutable MaterialPipelineInfo m_pipelineInfo;
ShaderBindingPtr m_shaderBinding;
mutable bool m_pipelineUpdated;
bool m_shaderBindingUpdated;
bool m_shadowCastingEnabled;
};
}