SBS增加DescriptorSetType数据,未来所有绑定地方使用此参数以避免对不上

This commit is contained in:
2025-06-09 22:52:10 +08:00
parent b5a5cb16c0
commit 784e7f0e0b
11 changed files with 51 additions and 22 deletions

View File

@@ -14,9 +14,12 @@ namespace blinnphong
constexpr const ShaderBufferSource SBS_SunLight=
{
"SunLight",
DescriptorSetType::Scene,
"sun",
"SunLight",
R"(
vec4 direction;
vec4 color;

View File

@@ -1,11 +1,19 @@
#pragma once
#include<hgl/graph/VKDescriptorSetType.h>
namespace hgl::graph
{
struct ShaderBufferSource
struct ShaderBufferDesc
{
const DescriptorSetType set_type;
const char *name;
};
struct ShaderBufferSource:public ShaderBufferDesc
{
const char *struct_name;
const char *name;
const char *codes;
};
}//namespace hgl::graph

View File

@@ -6,8 +6,10 @@
STD_MTL_NAMESPACE_BEGIN
constexpr const ShaderBufferSource SBS_ViewportInfo=
{
"ViewportInfo",
DescriptorSetType::RenderTarget,
"viewport",
"ViewportInfo",
R"(
mat4 ortho_matrix;
@@ -20,8 +22,10 @@ constexpr const ShaderBufferSource SBS_ViewportInfo=
constexpr const ShaderBufferSource SBS_CameraInfo=
{
"CameraInfo",
DescriptorSetType::Camera,
"camera",
"CameraInfo",
R"(
mat4 projection;
@@ -48,12 +52,13 @@ constexpr const ShaderBufferSource SBS_CameraInfo=
};
constexpr const char LocalToWorldStruct[]="LocalToWorld";
constexpr const DescriptorSetType DST_LocalToWorld=DescriptorSetType::PerFrame;
constexpr const ShaderBufferSource SBS_LocalToWorld=
{
"LocalToWorldData",
DescriptorSetType::PerFrame,
"l2w",
"LocalToWorldData",
R"(
mat4 mats[L2W_MAX_COUNT];
@@ -64,12 +69,13 @@ constexpr const ShaderBufferSource SBS_LocalToWorld=
// SSBO则不需要使用[]方式指定为动态大小数组
constexpr const char MaterialInstanceStruct[]="MaterialInstance";
constexpr const DescriptorSetType DST_MaterialInstance=DescriptorSetType::PerMaterial;
constexpr const ShaderBufferSource SBS_MaterialInstance=
{
"MaterialInstanceData",
DescriptorSetType::PerMaterial,
"mtl",
"MaterialInstanceData",
R"(
MaterialInstance mi[MI_MAX_COUNT];)"
@@ -77,11 +83,13 @@ constexpr const ShaderBufferSource SBS_MaterialInstance=
constexpr const ShaderBufferSource SBS_JointInfo=
{
"JointInfo",
"joint",
DescriptorSetType::PerFrame,
R"(
mat4 mats[];
)"
"joint",
"JointInfo",
R"(
mat4 mats[];
)"
};
STD_MTL_NAMESPACE_END