2025-05-06 00:41:07 +08:00
|
|
|
|
#pragma once
|
2023-05-15 21:52:57 +08:00
|
|
|
|
|
|
|
|
|
#include<hgl/graph/mtl/StdMaterial.h>
|
|
|
|
|
#include<hgl/type/String.h>
|
|
|
|
|
#include<hgl/graph/RenderTargetOutputConfig.h>
|
|
|
|
|
#include<hgl/graph/VK.h>
|
2023-09-28 15:03:34 +08:00
|
|
|
|
#include<hgl/graph/mtl/SamplerName.h>
|
2023-05-15 21:52:57 +08:00
|
|
|
|
|
|
|
|
|
STD_MTL_NAMESPACE_BEGIN
|
2023-05-16 02:23:45 +08:00
|
|
|
|
class MaterialCreateInfo;
|
|
|
|
|
|
2023-05-15 21:52:57 +08:00
|
|
|
|
/**
|
|
|
|
|
* 材质配置结构
|
|
|
|
|
*/
|
2025-01-15 02:42:04 +08:00
|
|
|
|
struct MaterialCreateConfig:public Comparator<MaterialCreateConfig>
|
2023-05-15 21:52:57 +08:00
|
|
|
|
{
|
2025-05-06 00:41:07 +08:00
|
|
|
|
const GPUDeviceAttribute * dev_attr; ///<GPU设备属性(目前仅用于获取UBO/SSBO数值,未来可以考虑干掉)
|
2023-06-02 20:45:19 +08:00
|
|
|
|
|
2025-05-06 00:41:07 +08:00
|
|
|
|
AnsiString mtl_name; ///<材质名称
|
2023-05-15 21:52:57 +08:00
|
|
|
|
|
2025-05-06 00:41:07 +08:00
|
|
|
|
bool material_instance; ///<是否包含材质实例
|
2024-05-25 17:58:39 +08:00
|
|
|
|
|
2025-05-06 00:41:07 +08:00
|
|
|
|
RenderTargetOutputConfig rt_output; ///<渲染目标输出配置
|
2023-05-15 21:52:57 +08:00
|
|
|
|
|
2025-05-06 00:41:07 +08:00
|
|
|
|
uint32 shader_stage_flag_bit; ///<需要的shader
|
2023-05-15 21:52:57 +08:00
|
|
|
|
|
2025-05-06 00:41:07 +08:00
|
|
|
|
PrimitiveType prim; ///<图元类型
|
2023-09-27 20:31:46 +08:00
|
|
|
|
|
2023-05-15 21:52:57 +08:00
|
|
|
|
public:
|
|
|
|
|
|
2025-05-04 23:36:28 +08:00
|
|
|
|
MaterialCreateConfig(const GPUDeviceAttribute *da,const AnsiString &name,const PrimitiveType &p)
|
2023-05-15 21:52:57 +08:00
|
|
|
|
{
|
2023-06-02 20:45:19 +08:00
|
|
|
|
dev_attr=da;
|
|
|
|
|
|
2023-05-15 21:52:57 +08:00
|
|
|
|
mtl_name=name;
|
|
|
|
|
|
2024-05-25 22:47:26 +08:00
|
|
|
|
material_instance=false;
|
2024-05-25 17:58:39 +08:00
|
|
|
|
|
2023-06-12 15:45:34 +08:00
|
|
|
|
shader_stage_flag_bit=VK_SHADER_STAGE_VERTEX_BIT|VK_SHADER_STAGE_FRAGMENT_BIT;
|
2023-09-27 20:31:46 +08:00
|
|
|
|
|
|
|
|
|
prim=p;
|
2023-05-15 21:52:57 +08:00
|
|
|
|
}
|
2023-10-12 14:59:39 +08:00
|
|
|
|
|
2025-01-15 02:42:04 +08:00
|
|
|
|
const int compare(const MaterialCreateConfig &cfg)const override
|
2023-10-12 14:59:39 +08:00
|
|
|
|
{
|
|
|
|
|
int off;
|
2024-05-25 22:47:26 +08:00
|
|
|
|
|
|
|
|
|
off=material_instance-cfg.material_instance;
|
|
|
|
|
if(off)return(off);
|
2023-10-12 14:59:39 +08:00
|
|
|
|
|
|
|
|
|
off=hgl_cmp(rt_output,cfg.rt_output);
|
|
|
|
|
if(off)return(off);
|
|
|
|
|
|
|
|
|
|
off=(int)prim-(int)cfg.prim;
|
|
|
|
|
if(off)return(off);
|
|
|
|
|
|
2024-05-25 22:47:26 +08:00
|
|
|
|
off=shader_stage_flag_bit-cfg.shader_stage_flag_bit;
|
|
|
|
|
|
|
|
|
|
return off;
|
2023-10-12 14:59:39 +08:00
|
|
|
|
}
|
2023-06-02 20:45:19 +08:00
|
|
|
|
};//struct MaterialCreateConfig
|
2023-05-15 21:52:57 +08:00
|
|
|
|
STD_MTL_NAMESPACE_END
|