2023-05-15 21:52:57 +08:00
|
|
|
|
#ifndef HGL_GRAPH_MTL_CONFIG_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_MTL_CONFIG_INCLUDE
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
/**
|
|
|
|
|
* 材质配置结构
|
|
|
|
|
*/
|
2023-06-02 20:45:19 +08:00
|
|
|
|
struct MaterialCreateConfig
|
2023-05-15 21:52:57 +08:00
|
|
|
|
{
|
2023-06-02 20:45:19 +08:00
|
|
|
|
const GPUDeviceAttribute *dev_attr;
|
|
|
|
|
|
2023-05-15 21:52:57 +08:00
|
|
|
|
AnsiString mtl_name; ///<材质名称
|
|
|
|
|
|
2024-05-25 17:58:39 +08:00
|
|
|
|
bool material_instance; ///<是否包含材质实例
|
|
|
|
|
|
2023-05-15 21:52:57 +08:00
|
|
|
|
RenderTargetOutputConfig rt_output; ///<渲染目标输出配置
|
|
|
|
|
|
2023-06-12 15:45:34 +08:00
|
|
|
|
uint32 shader_stage_flag_bit; ///<需要的shader
|
2023-05-15 21:52:57 +08:00
|
|
|
|
|
2023-09-27 20:31:46 +08:00
|
|
|
|
Prim prim; ///<图元类型
|
|
|
|
|
|
2023-05-15 21:52:57 +08:00
|
|
|
|
public:
|
|
|
|
|
|
2024-05-25 17:58:39 +08:00
|
|
|
|
MaterialCreateConfig(const GPUDeviceAttribute *da,const AnsiString &name,const bool mi,const Prim &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 17:58:39 +08:00
|
|
|
|
material_instance=mi;
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
int Comp(const MaterialCreateConfig &cfg)const
|
|
|
|
|
{
|
|
|
|
|
int off;
|
|
|
|
|
|
|
|
|
|
off=hgl_cmp(rt_output,cfg.rt_output);
|
|
|
|
|
|
|
|
|
|
if(off)return(off);
|
|
|
|
|
|
|
|
|
|
off=(int)prim-(int)cfg.prim;
|
|
|
|
|
|
|
|
|
|
if(off)return(off);
|
|
|
|
|
|
|
|
|
|
return shader_stage_flag_bit-cfg.shader_stage_flag_bit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CompOperator(const MaterialCreateConfig &,Comp)
|
2023-06-02 20:45:19 +08:00
|
|
|
|
};//struct MaterialCreateConfig
|
2023-05-15 21:52:57 +08:00
|
|
|
|
STD_MTL_NAMESPACE_END
|
|
|
|
|
#endif//HGL_GRAPH_MTL_CONFIG_INCLUDE
|