renamed values/struct.
This commit is contained in:
parent
6b9ac3220b
commit
3927b3c788
@ -1 +1 @@
|
||||
Subproject commit 66518a8af330139c482755c5b249a6044f9104ff
|
||||
Subproject commit 31a4223bd8646dfb603502f4c5bb51e5bd12f5e5
|
@ -78,7 +78,7 @@ class Semaphore;
|
||||
struct PipelineLayoutData;
|
||||
class DescriptorSet;
|
||||
|
||||
struct ShaderAttribute;
|
||||
struct VertexInputAttribute;
|
||||
|
||||
class ShaderResource;
|
||||
class ShaderModule;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include<hgl/graph/VertexAttrib.h>
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/graph/VKInterpolation.h>
|
||||
#include<hgl/graph/mtl/ShaderVariableType.h>
|
||||
#include<hgl/type/StringList.h>
|
||||
|
||||
namespace hgl{namespace graph
|
||||
@ -65,9 +66,9 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
ShaderDescriptorInfo *sdm;
|
||||
ShaderDescriptorInfo *sdi;
|
||||
|
||||
VkShaderStageFlagBits GetShaderStage()const{return shader_stage;}
|
||||
const VkShaderStageFlagBits GetShaderStage()const{return shader_stage;}
|
||||
|
||||
public:
|
||||
|
||||
@ -78,6 +79,7 @@ public:
|
||||
|
||||
int AddOutput(const graph::VAType &type,const AnsiString &name,Interpolation inter=Interpolation::Smooth);
|
||||
int AddOutput(const AnsiString &type,const AnsiString &name,Interpolation inter=Interpolation::Smooth);
|
||||
//int AddOutput(const ShaderVariableType &type,const AnsiString &name,Interpolation inter=Interpolation::Smooth);
|
||||
|
||||
void AddFunction(const char *str){function_list.Add(str);}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include<hgl/type/Map.h>
|
||||
#include<hgl/type/StringList.h>
|
||||
@ -56,8 +56,8 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
bool AddInput(ShaderAttribute *);
|
||||
bool AddOutput(ShaderAttribute *);
|
||||
bool AddInput(VertexInputAttribute *);
|
||||
bool AddOutput(VertexInputAttribute *);
|
||||
|
||||
bool hasInput(const char *)const; ///<是否有指定输入
|
||||
|
||||
|
@ -98,11 +98,6 @@ SET(VK_RR_SOURCE ${SG_INCLUDE_PATH}/VKRenderResource.h
|
||||
|
||||
SOURCE_GROUP("Vulkan\\RenderResource" FILES ${VK_RR_SOURCE})
|
||||
|
||||
SET(VK_RR_SHADER_FILES ${SG_INCLUDE_PATH}/VKShaderResource.h
|
||||
Vulkan/VKShaderResource.cpp)
|
||||
|
||||
SOURCE_GROUP("Vulkan\\RenderResource\\Shader" FILES ${VK_RR_SHADER_FILES})
|
||||
|
||||
SET(VK_RR_MATERIAL_FILES ${SG_INCLUDE_PATH}/VKMaterialDescriptorManager.h
|
||||
Vulkan/VKMaterialDescriptorManager.cpp)
|
||||
|
||||
@ -282,7 +277,6 @@ ENDIF(UNIX)
|
||||
SOURCE_GROUP("Vulkan\\Surface" FILES ${VULKAN_SURFACE_SOURCE})
|
||||
|
||||
SET(VULKAN_RENDER_SOURCE ${VK_RR_SOURCE}
|
||||
${VK_RR_SHADER_FILES}
|
||||
${VK_RR_MATERIAL_FILES}
|
||||
${VK_INST_SOURCE}
|
||||
${VK_DEBUG_SOURCE}
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include<hgl/graph/VKMaterial.h>
|
||||
#include<hgl/graph/VKDevice.h>
|
||||
#include<hgl/graph/VKShaderModuleMap.h>
|
||||
#include<hgl/graph/VKShaderResource.h>
|
||||
#include<hgl/graph/VKMaterialDescriptorManager.h>
|
||||
#include<hgl/graph/VKVertexInput.h>
|
||||
#include<hgl/filesystem/FileSystem.h>
|
||||
@ -124,7 +123,7 @@ Material *RenderResource::CreateMaterial(const mtl::MaterialCreateInfo *mci)
|
||||
ShaderCreateInfoVertex *vert=mci->GetVS();
|
||||
|
||||
if(vert)
|
||||
mtl->vertex_input=GetVertexInput(vert->sdm->GetShaderStageIO().input);
|
||||
mtl->vertex_input=GetVertexInput(vert->sdi->GetShaderStageIO().input);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ bool MaterialCreateInfo::AddUBO(const VkShaderStageFlagBits flag_bit,const Descr
|
||||
|
||||
ubo->stage_flag|=flag_bit;
|
||||
|
||||
return sc->sdm->AddUBO(set_type,ubo);
|
||||
return sc->sdi->AddUBO(set_type,ubo);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -67,7 +67,7 @@ bool MaterialCreateInfo::AddUBO(const VkShaderStageFlagBits flag_bit,const Descr
|
||||
ubo->type=struct_name;
|
||||
hgl::strcpy(ubo->name,DESCRIPTOR_NAME_MAX_LENGTH,name);
|
||||
|
||||
return sc->sdm->AddUBO(set_type,mdi.AddUBO(flag_bit,set_type,ubo));
|
||||
return sc->sdi->AddUBO(set_type,mdi.AddUBO(flag_bit,set_type,ubo));
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ bool MaterialCreateInfo::AddSampler(const VkShaderStageFlagBits flag_bit,const D
|
||||
|
||||
sampler->stage_flag|=flag_bit;
|
||||
|
||||
return sc->sdm->AddSampler(set_type,sampler);
|
||||
return sc->sdi->AddSampler(set_type,sampler);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -125,7 +125,7 @@ bool MaterialCreateInfo::AddSampler(const VkShaderStageFlagBits flag_bit,const D
|
||||
sampler->type=st_name;
|
||||
hgl::strcpy(sampler->name,DESCRIPTOR_NAME_MAX_LENGTH,name);
|
||||
|
||||
return sc->sdm->AddSampler(set_type,mdi.AddSampler(flag_bit,set_type,sampler));
|
||||
return sc->sdi->AddSampler(set_type,mdi.AddSampler(flag_bit,set_type,sampler));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ ShaderCreateInfo::ShaderCreateInfo(VkShaderStageFlagBits ss,MaterialDescriptorIn
|
||||
{
|
||||
shader_stage=ss;
|
||||
mdi=m;
|
||||
sdm=new ShaderDescriptorInfo(ss);
|
||||
sdi=new ShaderDescriptorInfo(ss);
|
||||
|
||||
spv_data=nullptr;
|
||||
|
||||
@ -26,7 +26,7 @@ ShaderCreateInfo::~ShaderCreateInfo()
|
||||
if(spv_data)
|
||||
FreeSPVData(spv_data);
|
||||
|
||||
delete sdm;
|
||||
delete sdi;
|
||||
}
|
||||
|
||||
bool ShaderCreateInfo::AddDefine(const AnsiString &m,const AnsiString &v)
|
||||
@ -102,7 +102,7 @@ bool ShaderCreateInfo::ProcDefine()
|
||||
|
||||
int ShaderCreateInfo::AddOutput(const VAType &type,const AnsiString &name,Interpolation inter)
|
||||
{
|
||||
ShaderAttribute *ss=new ShaderAttribute;
|
||||
VertexInputAttribute *ss=new VertexInputAttribute;
|
||||
|
||||
hgl::strcpy(ss->name,sizeof(ss->name),name.c_str());
|
||||
|
||||
@ -110,7 +110,7 @@ int ShaderCreateInfo::AddOutput(const VAType &type,const AnsiString &name,Interp
|
||||
ss->vec_size = type.vec_size;
|
||||
ss->interpolation = inter;
|
||||
|
||||
return sdm->AddOutput(ss);
|
||||
return sdi->AddOutput(ss);
|
||||
}
|
||||
|
||||
int ShaderCreateInfo::AddOutput(const AnsiString &type,const AnsiString &name,Interpolation inter)
|
||||
@ -126,9 +126,23 @@ int ShaderCreateInfo::AddOutput(const AnsiString &type,const AnsiString &name,In
|
||||
return AddOutput(vat,name,inter);
|
||||
}
|
||||
|
||||
//int ShaderCreateInfo::AddOutput(const ShaderVariableType &type,const AnsiString &name,Interpolation inter=Interpolation::Smooth)
|
||||
//{
|
||||
// VertexInputAttribute *ss=new VertexInputAttribute;
|
||||
//
|
||||
// hgl::strcpy(ss->name,sizeof(ss->name),name.c_str());
|
||||
//
|
||||
// ss->basetype =(uint8)type.base_type;
|
||||
// ss->vec_size = type.vec_size;
|
||||
// ss->interpolation = inter;
|
||||
//
|
||||
// return sdi->AddOutput(ss);
|
||||
//
|
||||
//}
|
||||
|
||||
bool ShaderCreateInfo::ProcSubpassInput()
|
||||
{
|
||||
auto sil=sdm->GetSubpassInputList();
|
||||
auto sil=sdi->GetSubpassInputList();
|
||||
|
||||
if(sil.IsEmpty())
|
||||
return(true);
|
||||
@ -167,8 +181,8 @@ namespace
|
||||
|
||||
void ShaderCreateInfo::SetMaterialInstance(UBODescriptor *ubo,const AnsiString &mi)
|
||||
{
|
||||
sdm->AddUBO(DescriptorSetType::PerMaterial,ubo);
|
||||
sdm->AddStruct(mtl::MaterialInstanceStruct);
|
||||
sdi->AddUBO(DescriptorSetType::PerMaterial,ubo);
|
||||
sdi->AddStruct(mtl::MaterialInstanceStruct);
|
||||
|
||||
AddFunction(shader_stage==VK_SHADER_STAGE_VERTEX_BIT?MF_GetMI_VS:MF_GetMI_Other);
|
||||
|
||||
@ -212,14 +226,14 @@ bool ShaderCreateInfo::ProcOutput()
|
||||
{
|
||||
output_struct.Clear();
|
||||
|
||||
const ShaderAttributeArray &ssd=sdm->GetShaderStageIO().output;
|
||||
const VertexInputAttributeArray &ssd=sdi->GetShaderStageIO().output;
|
||||
|
||||
if(ssd.count<=0)return(true);
|
||||
|
||||
output_struct=GetShaderStageName(shader_stage);
|
||||
output_struct+="_Output\n{\n";
|
||||
|
||||
const ShaderAttribute *ss=ssd.items;
|
||||
const VertexInputAttribute *ss=ssd.items;
|
||||
|
||||
for(uint i=0;i<ssd.count;i++)
|
||||
{
|
||||
@ -251,7 +265,7 @@ bool ShaderCreateInfo::ProcOutput()
|
||||
|
||||
bool ShaderCreateInfo::ProcStruct()
|
||||
{
|
||||
const AnsiStringList &struct_list=sdm->GetStructList();
|
||||
const AnsiStringList &struct_list=sdi->GetStructList();
|
||||
|
||||
AnsiString codes;
|
||||
|
||||
@ -283,7 +297,7 @@ bool ShaderCreateInfo::ProcMI()
|
||||
|
||||
bool ShaderCreateInfo::ProcUBO()
|
||||
{
|
||||
auto ubo_list=sdm->GetUBOList();
|
||||
auto ubo_list=sdi->GetUBOList();
|
||||
|
||||
const int count=ubo_list.GetCount();
|
||||
|
||||
@ -327,7 +341,7 @@ bool ShaderCreateInfo::ProcSSBO()
|
||||
|
||||
bool ShaderCreateInfo::ProcConstantID()
|
||||
{
|
||||
auto const_list=sdm->GetConstList();
|
||||
auto const_list=sdi->GetConstList();
|
||||
|
||||
const int count=const_list.GetCount();
|
||||
|
||||
@ -357,7 +371,7 @@ bool ShaderCreateInfo::ProcConstantID()
|
||||
|
||||
bool ShaderCreateInfo::ProcSampler()
|
||||
{
|
||||
auto sampler_list=sdm->GetSamplerList();
|
||||
auto sampler_list=sdi->GetSamplerList();
|
||||
|
||||
const int count=sampler_list.GetCount();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include<hgl/shadergen/ShaderCreateInfoFragment.h>
|
||||
#include<hgl/shadergen/ShaderCreateInfoFragment.h>
|
||||
#include<hgl/shadergen/ShaderDescriptorInfo.h>
|
||||
|
||||
namespace hgl{namespace graph{
|
||||
@ -7,9 +7,9 @@ using namespace hgl::graph;
|
||||
|
||||
bool ShaderCreateInfoFragment::ProcOutput()
|
||||
{
|
||||
const auto &output_list=sdm->GetShaderStageIO().output;
|
||||
const auto &output_list=sdi->GetShaderStageIO().output;
|
||||
|
||||
const ShaderAttribute *o=output_list.items;
|
||||
const VertexInputAttribute *o=output_list.items;
|
||||
|
||||
final_shader+="\n";
|
||||
|
||||
|
@ -14,7 +14,7 @@ ShaderCreateInfoVertex::ShaderCreateInfoVertex(MaterialDescriptorInfo *m):Shader
|
||||
|
||||
int ShaderCreateInfoVertex::AddInput(const VAType &type,const AnsiString &name,const VkVertexInputRate input_rate,const VertexInputGroup &group)
|
||||
{
|
||||
ShaderAttribute *ss=new ShaderAttribute;
|
||||
VertexInputAttribute *ss=new VertexInputAttribute;
|
||||
|
||||
hgl::strcpy(ss->name,sizeof(ss->name),name.c_str());
|
||||
|
||||
@ -24,7 +24,7 @@ int ShaderCreateInfoVertex::AddInput(const VAType &type,const AnsiString &name,c
|
||||
ss->input_rate =input_rate;
|
||||
ss->group =group;
|
||||
|
||||
return sdm->AddInput(ss);
|
||||
return sdi->AddInput(ss);
|
||||
}
|
||||
|
||||
int ShaderCreateInfoVertex::AddInput(const AnsiString &type,const AnsiString &name,const VkVertexInputRate input_rate,const VertexInputGroup &group)
|
||||
@ -39,7 +39,7 @@ int ShaderCreateInfoVertex::AddInput(const AnsiString &type,const AnsiString &na
|
||||
|
||||
int ShaderCreateInfoVertex::hasInput(const char *name)
|
||||
{
|
||||
return sdm->hasInput(name);
|
||||
return sdi->hasInput(name);
|
||||
}
|
||||
|
||||
void ShaderCreateInfoVertex::AddJoint()
|
||||
@ -60,7 +60,7 @@ void ShaderCreateInfoVertex::AddAssign()
|
||||
|
||||
bool ShaderCreateInfoVertex::ProcInput(ShaderCreateInfo *)
|
||||
{
|
||||
const auto &input=sdm->GetShaderStageIO().input;
|
||||
const auto &input=sdi->GetShaderStageIO().input;
|
||||
|
||||
if(input.count<=0)
|
||||
{
|
||||
@ -71,7 +71,7 @@ bool ShaderCreateInfoVertex::ProcInput(ShaderCreateInfo *)
|
||||
|
||||
final_shader+="\n";
|
||||
|
||||
const ShaderAttribute *ss=input.items;
|
||||
const VertexInputAttribute *ss=input.items;
|
||||
|
||||
for(uint i=0;i<input.count;i++)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include<hgl/shadergen/ShaderDescriptorInfo.h>
|
||||
#include<hgl/shadergen/ShaderDescriptorInfo.h>
|
||||
|
||||
namespace hgl{namespace graph{
|
||||
ShaderDescriptorInfo::ShaderDescriptorInfo(VkShaderStageFlagBits flag_bit)
|
||||
@ -12,7 +12,7 @@ ShaderDescriptorInfo::ShaderDescriptorInfo(VkShaderStageFlagBits flag_bit)
|
||||
|
||||
namespace
|
||||
{
|
||||
bool Find(const ShaderAttributeArray &sad,const char *name)
|
||||
bool Find(const VertexInputAttributeArray &sad,const char *name)
|
||||
{
|
||||
if(sad.count<=0)
|
||||
return(false);
|
||||
@ -25,7 +25,7 @@ namespace
|
||||
}
|
||||
}//namespace
|
||||
|
||||
bool ShaderDescriptorInfo::AddInput(ShaderAttribute *ss)
|
||||
bool ShaderDescriptorInfo::AddInput(VertexInputAttribute *ss)
|
||||
{
|
||||
if(!ss)return(false);
|
||||
|
||||
@ -46,7 +46,7 @@ bool ShaderDescriptorInfo::hasInput(const char *name)const
|
||||
|
||||
}
|
||||
|
||||
bool ShaderDescriptorInfo::AddOutput(ShaderAttribute *ss)
|
||||
bool ShaderDescriptorInfo::AddOutput(VertexInputAttribute *ss)
|
||||
{
|
||||
if(!ss)return(false);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user