diff --git a/example/Vulkan/texture_rect.cpp b/example/Vulkan/texture_rect.cpp index a1458efb..a839fc98 100644 --- a/example/Vulkan/texture_rect.cpp +++ b/example/Vulkan/texture_rect.cpp @@ -50,7 +50,7 @@ private: Texture2D * texture =nullptr; Sampler * sampler =nullptr; MaterialInstance * material_instance =nullptr; - Renderable * renderable =nullptr; + Renderable * renderable =nullptr; Pipeline * pipeline =nullptr; private: diff --git a/src/ShaderGen/2d/VertexColor2D.cpp b/src/ShaderGen/2d/VertexColor2D.cpp index 36d82597..73f440cb 100644 --- a/src/ShaderGen/2d/VertexColor2D.cpp +++ b/src/ShaderGen/2d/VertexColor2D.cpp @@ -12,6 +12,10 @@ void main() gl_Position=GetPosition2D(); })"; + //一个shader中所有向下一个shader输出,会被定义在一个名为Output的结构中。 + //而同时,这个Output结构,会在下一个Shader中,以Input名称出现使用。 + //也就是说:在此材质中,VertexShader中的Output等于FragmentShader中的Input + constexpr const char fs_main[]=R"( void main() { @@ -30,16 +34,17 @@ void main() if(!Std2DMaterial::CreateVertexShader(vsc)) return(false); - vsc->AddOutput(VAT_VEC4,"Color"); vsc->AddInput(VAT_VEC4,VAN::Color); + vsc->AddOutput(VAT_VEC4,"Color"); + vsc->AddFunction(vs_main); return(true); } bool CreateFragmentShader(ShaderCreateInfoFragment *fsc) override { - fsc->AddOutput(VAT_VEC4,"Color"); + fsc->AddOutput(VAT_VEC4,"Color"); //Fragment shader的输出等于最终的RT了,所以这个名称其实随便起。 fsc->AddFunction(fs_main); return(true);