writed GeometryShaderStateParse, need to test in furture.
This commit is contained in:
parent
5ede824522
commit
237c1a469b
@ -1 +1 @@
|
|||||||
Subproject commit b5305731744fea32e6494bb4dc4ff281c06188b1
|
Subproject commit b5b5b0b2e7b00ec3d399659573ba40db8ec8e175
|
@ -269,6 +269,75 @@ namespace
|
|||||||
}
|
}
|
||||||
};//struct ShaderStateParse
|
};//struct ShaderStateParse
|
||||||
|
|
||||||
|
struct GeometryShaderStateParse:public ShaderStateParse
|
||||||
|
{
|
||||||
|
Prim input_prim;
|
||||||
|
Prim output_prim;
|
||||||
|
uint max_vertices;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
bool OnLine(const char *text,const int len) override
|
||||||
|
{
|
||||||
|
if(!text||!*text||len<=0)
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
if(hgl::stricmp(text,"in ",3)==0)
|
||||||
|
{
|
||||||
|
text+=3;
|
||||||
|
|
||||||
|
while(*text==' '||*text=='\t')++text;
|
||||||
|
|
||||||
|
const char *sp=text;
|
||||||
|
|
||||||
|
while(hgl::isalpha(*text)||*text=='_')++text;
|
||||||
|
|
||||||
|
const Prim ip=ParsePrimName(sp,text-sp);
|
||||||
|
|
||||||
|
if(!CheckGeometryShaderIn(ip))
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
input_prim=ip;
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(hgl::stricmp(text,"out ",4)==0)
|
||||||
|
{
|
||||||
|
text+=4;
|
||||||
|
|
||||||
|
while(*text==' '||*text=='\t')++text;
|
||||||
|
|
||||||
|
const char *sp=text;
|
||||||
|
|
||||||
|
while(hgl::isalpha(*text)||*text=='_')++text;
|
||||||
|
|
||||||
|
const Prim op=ParsePrimName(sp,text-sp);
|
||||||
|
|
||||||
|
if(!CheckGeometryShaderOut(op))
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
output_prim=op;
|
||||||
|
|
||||||
|
while(*text!=',')++text;
|
||||||
|
|
||||||
|
while(*text==' '||*text=='\t'||*text==',')++text;
|
||||||
|
|
||||||
|
hgl::stou(text,max_vertices);
|
||||||
|
|
||||||
|
if(max_vertices<=0)
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ShaderStateParse::OnLine(text,len))
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
};//struct GeometryShaderStateParse
|
||||||
|
|
||||||
struct MaterialTextParse:public MaterialFileParse
|
struct MaterialTextParse:public MaterialFileParse
|
||||||
{
|
{
|
||||||
MaterialFileState state;
|
MaterialFileState state;
|
||||||
@ -306,8 +375,7 @@ namespace
|
|||||||
case MaterialFileState::VertexInput: parse=new VertexInputStateParse;break;
|
case MaterialFileState::VertexInput: parse=new VertexInputStateParse;break;
|
||||||
case MaterialFileState::Vertex:
|
case MaterialFileState::Vertex:
|
||||||
case MaterialFileState::Fragment: parse=new ShaderStateParse;break;
|
case MaterialFileState::Fragment: parse=new ShaderStateParse;break;
|
||||||
|
case MaterialFileState::Geometry: parse=new GeometryShaderStateParse;break;
|
||||||
// case MaterialFileState::Geometry: parse=new GeometryStateParse;break;
|
|
||||||
|
|
||||||
default: state=MaterialFileState::None;return(false);
|
default: state=MaterialFileState::None;return(false);
|
||||||
}
|
}
|
||||||
|
@ -6,21 +6,15 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
bool ShaderCreateInfoGeometry::SetGeom(const Prim &ip,const Prim &op,const uint32_t mv)
|
bool ShaderCreateInfoGeometry::SetGeom(const Prim &ip,const Prim &op,const uint32_t mv)
|
||||||
{
|
{
|
||||||
if(ip==Prim::Points )input_prim="points";else
|
if(!CheckGeometryShaderIn(ip))return(false);
|
||||||
if(ip==Prim::Lines )input_prim="lines";else
|
if(!CheckGeometryShaderOut(op))return(false);
|
||||||
if(ip==Prim::LinesAdj )input_prim="lines_adjacency";else
|
|
||||||
if(ip==Prim::Triangles )input_prim="triangles";else
|
|
||||||
if(ip==Prim::TrianglesAdj )input_prim="triangles_adjacency";else
|
|
||||||
return(false);
|
|
||||||
|
|
||||||
if(op==Prim::Points )output_prim="points";else
|
|
||||||
if(op==Prim::LineStrip )output_prim="line_strip";else
|
|
||||||
if(op==Prim::TriangleStrip )output_prim="triangle_strip";else
|
|
||||||
return(false);
|
|
||||||
|
|
||||||
if(mv==0)
|
if(mv==0)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
input_prim=GetPrimName(ip);
|
||||||
|
output_prim=GetPrimName(op);
|
||||||
|
|
||||||
max_vertices=mv;
|
max_vertices=mv;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user