finished auto bound GlobalDescriptor

This commit is contained in:
2023-03-22 15:58:59 +08:00
parent e1c3b95de7
commit ac42dcdb26
14 changed files with 136 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
#ifndef HGL_GRAPH_VULKAN_MATERIAL_PARAMETERS_INCLUDE
#ifndef HGL_GRAPH_VULKAN_MATERIAL_PARAMETERS_INCLUDE
#define HGL_GRAPH_VULKAN_MATERIAL_PARAMETERS_INCLUDE
#include<hgl/graph/VK.h>
@@ -27,10 +27,10 @@ public:
DescriptorSet * GetDescriptorSet (){return descriptor_set;}
const VkDescriptorSet GetVkDescriptorSet ()const{return descriptor_set->GetDescriptorSet();}
const uint32_t GetDescriptorCount ()const{return desc_manager->GetBindCount(set_type);} ///<<EFBFBD><EFBFBD>ȡ<EFBFBD>ܹ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>󶨵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
const uint32_t GetDescriptorCount ()const{return desc_manager->GetBindCount(set_type);} ///<获取总共需要绑定的描述符数量
const uint32_t GetBoundCount ()const{return descriptor_set->GetCount();} ///<<EFBFBD><EFBFBD>ȡ<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
const bool IsReady ()const{return descriptor_set->IsReady();} ///<<EFBFBD>Ƿ<EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
const uint32_t GetBoundCount ()const{return descriptor_set->GetCount();} ///<获取已经绑好的数量
const bool IsReady ()const{return descriptor_set->IsReady();} ///<是否全部绑好了
public:
@@ -55,4 +55,4 @@ public:
void Update();
};//class MaterialParameters
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_MATERIAL_PARAMETERS_INCLUDE
#endif//HGL_GRAPH_VULKAN_MATERIAL_PARAMETERS_INCLUDE

View File

@@ -12,8 +12,50 @@ enum class CoordinateSystem2D
Ortho //左上角为0,0右下角为(width-1),(height-1)
};
namespace GlobalShaderUBO
namespace GlobalDescriptor
{
constexpr const char ViewportInfo[]="ViewportInfo";
constexpr const char CameraInfo[]="CameraInfo";
struct ShaderStruct
{
const char *struct_name;
const char *name;
const char *codes;
};
constexpr const ShaderStruct ViewportInfo=
{
"ViewportInfo",
"viewport",
R"(
mat4 ortho_matrix;
vec2 canvas_resolution;
vec2 viewport_resolution;
vec2 inv_viewport_resolution;
)"
};
constexpr const ShaderStruct CameraInfo=
{
"CameraInfo",
"camera",
R"(
mat4 projection;
mat4 inverse_projection;
mat4 view;
mat4 inverse_view;
mat4 vp;
mat4 inverse_vp;
mat4 sky;
vec3 pos; //eye
vec3 view_line; //pos-target
vec3 world_up;
float znear,zfar;)"
};
}