small update

This commit is contained in:
hyzboy 2019-06-27 21:26:57 +08:00
parent e25e75a9c7
commit 36156b0172

View File

@ -30,13 +30,14 @@ private:
struct SubpassParam struct SubpassParam
{ {
vulkan::Material * mtl; vulkan::Material * material;
vulkan::DescriptorSets *desc_sets; vulkan::DescriptorSets *desc_sets;
vulkan::Pipeline * pipeline; vulkan::Pipeline * pipeline;
};// };//
SubpassParam * mrt; SubpassParam sp_gbuffer_opaque;
SubpassParam * composition; SubpassParam sp_gbuffer_alpha_test;
SubpassParam sp_ds_composition;
vulkan::Renderable *ro_sphere; vulkan::Renderable *ro_sphere;
@ -45,24 +46,20 @@ private:
private: private:
bool InitMaterial() bool InitSubpass(SubpassParam *sp,const OSString &vs,const OSString &fs)
{ {
material_mrt=shader_manage->CreateMaterial( OS_TEXT("Atomsphere.vert.spv"), sp->material=shader_manage->CreateMaterial(vs,fs);
OS_TEXT("Atomsphere.frag.spv"));
if(!material_mrt) if(!sp->material)
return(false); return(false);
descriptor_sets=material_mrt->CreateDescriptorSets(); sp->desc_sets=sp->material->CreateDescriptorSets();
db->Add(material); db->Add(sp->material);
db->Add(descriptor_sets); db->Add(sp->desc_sets);
return(true); return(true);
} }
bool InitMaterial()
{
}
void CreateRenderObject() void CreateRenderObject()
{ {
ro_sphere=CreateRenderableSphere(db,material,128); ro_sphere=CreateRenderableSphere(db,material,128);
@ -112,6 +109,13 @@ private:
return(true); return(true);
} }
bool InitMaterial()
{
InitSubpass(&sp_gbuffer_opaque, OS_TEXT("gbuffer_opaque.vert.spv"), OS_TEXT("gbuffer_opaque.frag.spv") );
//InitSubpass(&sp_gbuffer_alpha_test, OS_TEXT("sp_gbuffer_alpha_test.vert.spv"), OS_TEXT("sp_gbuffer_alpha_test.frag.spv") );
InitSubpass(&sp_ds_composition, OS_TEXT("ds_composition.vert.spv"), OS_TEXT("ds_composition.frag.spv") );
}
bool InitScene() bool InitScene()
{ {
render_root.Add(db->CreateRenderableInstance(pipeline_solid,descriptor_sets,ro_sphere),scale(1000)); render_root.Add(db->CreateRenderableInstance(pipeline_solid,descriptor_sets,ro_sphere),scale(1000));