定义一些说明未来要做的
This commit is contained in:
parent
2eaf43e42d
commit
f64ee43576
@ -3,7 +3,7 @@
|
|||||||
layout(location = 0) in vec2 Vertex;
|
layout(location = 0) in vec2 Vertex;
|
||||||
layout(location = 1) in vec3 Color;
|
layout(location = 1) in vec3 Color;
|
||||||
|
|
||||||
layout (binding = 0) uniform UBO
|
layout (binding = 0) uniform MVPMatrix
|
||||||
{
|
{
|
||||||
mat4 MVP;
|
mat4 MVP;
|
||||||
} ubo;
|
} ubo;
|
||||||
|
@ -36,7 +36,7 @@ DescriptorSetLayout::~DescriptorSetLayout()
|
|||||||
DestroyDescriptorSetLayout(*device,desc_set_layout_list);
|
DestroyDescriptorSetLayout(*device,desc_set_layout_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DescriptorSetLayout::UpdateBuffer(const uint32_t binding,const VkDescriptorBufferInfo *buf_info)
|
bool DescriptorSetLayout::UpdateUBO(const uint32_t binding,const VkDescriptorBufferInfo *buf_info)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
@ -46,13 +46,9 @@ bool DescriptorSetLayout::UpdateBuffer(const uint32_t binding,const VkDescriptor
|
|||||||
VkDescriptorSet set;
|
VkDescriptorSet set;
|
||||||
if(!desc_sets.Get(index,set))
|
if(!desc_sets.Get(index,set))
|
||||||
return(false);
|
return(false);
|
||||||
// Update the descriptor set determining the shader binding points
|
|
||||||
// For every binding point used in a shader there needs to be one
|
|
||||||
// descriptor set matching that binding point
|
|
||||||
|
|
||||||
VkWriteDescriptorSet writeDescriptorSet = {};
|
VkWriteDescriptorSet writeDescriptorSet = {};
|
||||||
|
|
||||||
// Binding 0 : Uniform buffer
|
|
||||||
writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||||
writeDescriptorSet.dstSet = set;
|
writeDescriptorSet.dstSet = set;
|
||||||
writeDescriptorSet.descriptorCount = 1;
|
writeDescriptorSet.descriptorCount = 1;
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
|
|
||||||
const List<VkDescriptorSet> & GetSets ()const{return desc_sets;}
|
const List<VkDescriptorSet> & GetSets ()const{return desc_sets;}
|
||||||
|
|
||||||
bool UpdateBuffer(const uint32_t binding,const VkDescriptorBufferInfo *buf_info);
|
bool UpdateUBO(const uint32_t binding,const VkDescriptorBufferInfo *buf_info);
|
||||||
};//class DescriptorSetLayout
|
};//class DescriptorSetLayout
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -202,11 +202,13 @@ int main(int,char **)
|
|||||||
|
|
||||||
vulkan::DescriptorSetLayoutCreater dslc(device);
|
vulkan::DescriptorSetLayoutCreater dslc(device);
|
||||||
|
|
||||||
dslc.BindUBO(0,VK_SHADER_STAGE_VERTEX_BIT);
|
const int mvp_binding=0; //shader->GetBinding("MVPMatrix"); 实现从材质shader文件中根据名称获取binding的功能
|
||||||
|
|
||||||
|
dslc.BindUBO(mvp_binding,VK_SHADER_STAGE_VERTEX_BIT);
|
||||||
|
|
||||||
vulkan::DescriptorSetLayout *dsl=dslc.Create();
|
vulkan::DescriptorSetLayout *dsl=dslc.Create();
|
||||||
|
|
||||||
dsl->UpdateBuffer(0,*ubo);
|
dsl->UpdateUBO(mvp_binding,*ubo);
|
||||||
|
|
||||||
vulkan::PipelineLayout *pl=CreatePipelineLayout(*device,dsl);
|
vulkan::PipelineLayout *pl=CreatePipelineLayout(*device,dsl);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user