83 lines
1.9 KiB
C++
83 lines
1.9 KiB
C++
#ifndef HGL_SHADER_CREATE_INFO_INCLUDE
|
|
#define HGL_SHADER_CREATE_INFO_INCLUDE
|
|
|
|
#include<hgl/graph/VertexAttrib.h>
|
|
#include<hgl/graph/VK.h>
|
|
#include<hgl/graph/VKInterpolation.h>
|
|
#include<hgl/type/StringList.h>
|
|
|
|
namespace hgl{namespace graph
|
|
{
|
|
struct SPVData;
|
|
|
|
class MaterialDescriptorInfo;
|
|
class ShaderDescriptorInfo;
|
|
|
|
struct UBODescriptor;
|
|
|
|
class ShaderCreateInfo
|
|
{
|
|
protected:
|
|
|
|
VkShaderStageFlagBits shader_stage; ///<着色器阶段
|
|
|
|
MaterialDescriptorInfo *mdi;
|
|
|
|
protected:
|
|
|
|
AnsiString output_struct;
|
|
|
|
AnsiStringList function_list;
|
|
AnsiString main_function;
|
|
|
|
AnsiString final_shader;
|
|
|
|
SPVData *spv_data;
|
|
|
|
protected:
|
|
|
|
virtual bool ProcHeader(){return(true);}
|
|
virtual bool ProcSubpassInput();
|
|
virtual bool ProcInput(ShaderCreateInfo *);
|
|
virtual bool ProcOutput();
|
|
|
|
virtual bool ProcStruct();
|
|
|
|
virtual bool ProcUBO();
|
|
virtual bool ProcSSBO();
|
|
virtual bool ProcConst();
|
|
virtual bool ProcSampler();
|
|
|
|
bool CompileToSPV();
|
|
|
|
public:
|
|
|
|
ShaderDescriptorInfo *sdm;
|
|
|
|
VkShaderStageFlagBits GetShaderStage()const{return shader_stage;}
|
|
|
|
public:
|
|
|
|
ShaderCreateInfo(VkShaderStageFlagBits ss,MaterialDescriptorInfo *m);
|
|
virtual ~ShaderCreateInfo();
|
|
|
|
int AddOutput(const graph::VAT &type,const AnsiString &name,Interpolation inter=Interpolation::Smooth);
|
|
int AddOutput(const AnsiString &type,const AnsiString &name,Interpolation inter=Interpolation::Smooth);
|
|
|
|
void AddFunction(const AnsiString &str){function_list.Add(str);}
|
|
|
|
void SetMaterialInstance(UBODescriptor *);
|
|
|
|
void SetMain(const AnsiString &str){main_function=str;}
|
|
|
|
const AnsiString &GetOutputStruct()const{return output_struct;}
|
|
const AnsiString &GetShaderSource()const{return final_shader;}
|
|
|
|
bool CreateShader(ShaderCreateInfo *);
|
|
|
|
const uint32 *GetSPVData()const;
|
|
const size_t GetSPVSize()const;
|
|
};//class ShaderCreateInfo
|
|
}}//namespace hgl::graph
|
|
#endif//HGL_SHADER_CREATE_INFO_INCLUDE
|