Add GPUVertexLayout to graphics backends

This commit is contained in:
Wojtek Figat
2024-12-13 09:20:01 +01:00
parent cedf4b1eb5
commit fc4e6f4972
31 changed files with 605 additions and 93 deletions

View File

@@ -7,6 +7,7 @@
#include "Config.h"
class GPUShader;
class GPUVertexLayout;
/// <summary>
/// The shader program metadata container. Contains description about resources used by the shader.
@@ -18,17 +19,17 @@ struct FLAXENGINE_API ShaderBindings
uint32 UsedSRsMask;
uint32 UsedUAsMask;
bool IsUsingCB(uint32 slotIndex) const
FORCE_INLINE bool IsUsingCB(uint32 slotIndex) const
{
return (UsedCBsMask & (1u << slotIndex)) != 0u;
}
bool IsUsingSR(uint32 slotIndex) const
FORCE_INLINE bool IsUsingSR(uint32 slotIndex) const
{
return (UsedSRsMask & (1u << slotIndex)) != 0u;
}
bool IsUsingUA(uint32 slotIndex) const
FORCE_INLINE bool IsUsingUA(uint32 slotIndex) const
{
return (UsedUAsMask & (1u << slotIndex)) != 0u;
}
@@ -57,15 +58,7 @@ protected:
GPUShader* _owner;
#endif
void Init(const GPUShaderProgramInitializer& initializer)
{
_name = initializer.Name;
_bindings = initializer.Bindings;
_flags = initializer.Flags;
#if !BUILD_RELEASE
_owner = initializer.Owner;
#endif
}
void Init(const GPUShaderProgramInitializer& initializer);
public:
/// <summary>
@@ -122,8 +115,18 @@ public:
/// </summary>
class GPUShaderProgramVS : public GPUShaderProgram
{
public:
~GPUShaderProgramVS();
// Vertex elements input layout defined explicitly in the shader.
// It's optional as it's been deprecated in favor or layouts defined by vertex buffers to allow data customizations.
// Can be overriden by the vertex buffers provided upon draw call.
// [Deprecated in v1.10]
GPUVertexLayout* Layout = nullptr;
public:
// Input element run-time data (see VertexShaderMeta::InputElement for compile-time data)
// [Deprecated in v1.10]
PACK_STRUCT(struct InputElement
{
byte Type; // VertexShaderMeta::InputType
@@ -135,14 +138,15 @@ public:
uint32 InstanceDataStepRate; // 0 if per-vertex
});
public:
/// <summary>
/// Gets input layout description handle (platform dependent).
/// [Deprecated in v1.10]
/// </summary>
virtual void* GetInputLayout() const = 0;
/// <summary>
/// Gets input layout description size (in bytes).
/// [Deprecated in v1.10]
/// </summary>
virtual byte GetInputLayoutSize() const = 0;
@@ -173,7 +177,7 @@ public:
class GPUShaderProgramHS : public GPUShaderProgram
{
protected:
int32 _controlPointsCount;
int32 _controlPointsCount = 0;
public:
/// <summary>