增加UBO使用测试,已可正确绘出图像,但ORTHO2D矩阵计算有误,待研究
This commit is contained in:
parent
5df7ee9b2b
commit
e1e6cf2575
@ -3,11 +3,16 @@
|
|||||||
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
|
||||||
|
{
|
||||||
|
mat4 MVP;
|
||||||
|
} ubo;
|
||||||
|
|
||||||
layout(location = 0) out vec4 FragmentColor;
|
layout(location = 0) out vec4 FragmentColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
FragmentColor=vec4(Color,1.0);
|
FragmentColor=vec4(Color,1.0);
|
||||||
|
|
||||||
gl_Position=vec4(Vertex,0.0,1.0);
|
gl_Position=vec4(Vertex,0.0,1.0)*ubo.MVP;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,9 @@ public:
|
|||||||
|
|
||||||
virtual ~Buffer();
|
virtual ~Buffer();
|
||||||
|
|
||||||
VkBuffer GetBuffer(){return buf.buffer;}
|
operator VkBuffer (){return buf.buffer;}
|
||||||
|
operator VkDeviceMemory (){return buf.memory;}
|
||||||
|
operator VkDescriptorBufferInfo * (){return &buf.info;}
|
||||||
|
|
||||||
virtual uint8_t *Map(uint32_t start=0,uint32_t size=0);
|
virtual uint8_t *Map(uint32_t start=0,uint32_t size=0);
|
||||||
void Unmap();
|
void Unmap();
|
||||||
|
@ -2,55 +2,66 @@
|
|||||||
#include"VKDevice.h"
|
#include"VKDevice.h"
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
DescriptorSets::~DescriptorSets()
|
namespace
|
||||||
{
|
{
|
||||||
// 这里注释掉是因为从来不见那里的范便有FREE过,但又有vkFreeDescriptorSets这个函数。如发现此注释,请使用工具查是否有资源泄露
|
void DestroyDescriptorSetLayout(VkDevice device,List<VkDescriptorSetLayout> &dsl_list)
|
||||||
{
|
{
|
||||||
|
const int count=dsl_list.GetCount();
|
||||||
|
|
||||||
|
if(count>0)
|
||||||
|
{
|
||||||
|
VkDescriptorSetLayout *dsl=dsl_list.GetData();
|
||||||
|
|
||||||
|
for(int i=0;i<count;i++)
|
||||||
|
{
|
||||||
|
vkDestroyDescriptorSetLayout(device,*dsl,nullptr);
|
||||||
|
++dsl;
|
||||||
|
}
|
||||||
|
|
||||||
|
dsl_list.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//namespace
|
||||||
|
|
||||||
|
DescriptorSetLayout::~DescriptorSetLayout()
|
||||||
|
{
|
||||||
|
// 这里注释掉是因为从来不见那里的范例有FREE过,但又有vkFreeDescriptorSets这个函数。如发现此注释,请使用工具查是否有资源泄露
|
||||||
|
//{
|
||||||
//const int count=desc_sets.GetCount();
|
//const int count=desc_sets.GetCount();
|
||||||
|
|
||||||
//if(count>0)
|
//if(count>0)
|
||||||
// vkFreeDescriptorSets(device->GetDevice(),device->GetDescriptorPool(),count,desc_sets.GetData());
|
// vkFreeDescriptorSets(device->GetDevice(),device->GetDescriptorPool(),count,desc_sets.GetData());
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
DestroyDescriptorSetLayout(*device,desc_set_layout_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorSetLayout::~DescriptorSetLayout()
|
bool DescriptorSetLayout::UpdateBuffer(const uint32_t binding,const VkDescriptorBufferInfo *buf_info)
|
||||||
{
|
{
|
||||||
const int count=desc_set_layout_list.GetCount();
|
int index;
|
||||||
|
|
||||||
if(count>0)
|
if(!binding_index.Get(binding,index))
|
||||||
{
|
return(false);
|
||||||
VkDescriptorSetLayout *dsl=desc_set_layout_list.GetData();
|
|
||||||
|
|
||||||
for(int i=0;i<count;i++)
|
VkDescriptorSet set;
|
||||||
{
|
if(!desc_sets.Get(index,set))
|
||||||
vkDestroyDescriptorSetLayout(device->GetDevice(),*dsl,nullptr);
|
return(false);
|
||||||
++dsl;
|
// 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
|
||||||
}
|
|
||||||
|
|
||||||
DescriptorSets *DescriptorSetLayout::CreateSets()const
|
VkWriteDescriptorSet writeDescriptorSet = {};
|
||||||
{
|
|
||||||
const int count=desc_set_layout_list.GetCount();
|
|
||||||
|
|
||||||
if(count<=0)
|
// Binding 0 : Uniform buffer
|
||||||
return(nullptr);
|
writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||||
|
writeDescriptorSet.dstSet = set;
|
||||||
|
writeDescriptorSet.descriptorCount = 1;
|
||||||
|
writeDescriptorSet.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||||
|
writeDescriptorSet.pBufferInfo = buf_info;
|
||||||
|
writeDescriptorSet.dstBinding = binding;
|
||||||
|
|
||||||
VkDescriptorSetAllocateInfo alloc_info[1];
|
vkUpdateDescriptorSets(device->GetDevice(), 1, &writeDescriptorSet, 0, nullptr);
|
||||||
alloc_info[0].sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
return(true);
|
||||||
alloc_info[0].pNext = nullptr;
|
|
||||||
alloc_info[0].descriptorPool = device->GetDescriptorPool();
|
|
||||||
alloc_info[0].descriptorSetCount = count;
|
|
||||||
alloc_info[0].pSetLayouts = desc_set_layout_list.GetData();
|
|
||||||
|
|
||||||
List<VkDescriptorSet> desc_set;
|
|
||||||
|
|
||||||
desc_set.SetCount(count);
|
|
||||||
|
|
||||||
if(vkAllocateDescriptorSets(device->GetDevice(), alloc_info, desc_set.GetData())!=VK_SUCCESS)
|
|
||||||
return(nullptr);
|
|
||||||
|
|
||||||
return(new DescriptorSets(device,desc_set));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DescriptorSetLayoutCreater::Bind(const uint32_t binding,VkDescriptorType desc_type,VkShaderStageFlagBits stageFlags)
|
void DescriptorSetLayoutCreater::Bind(const uint32_t binding,VkDescriptorType desc_type,VkShaderStageFlagBits stageFlags)
|
||||||
@ -62,7 +73,9 @@ void DescriptorSetLayoutCreater::Bind(const uint32_t binding,VkDescriptorType de
|
|||||||
layout_binding.stageFlags = stageFlags;
|
layout_binding.stageFlags = stageFlags;
|
||||||
layout_binding.pImmutableSamplers = nullptr;
|
layout_binding.pImmutableSamplers = nullptr;
|
||||||
|
|
||||||
layout_binding_list.Add(layout_binding);
|
const int index=layout_binding_list.Add(layout_binding);
|
||||||
|
|
||||||
|
binding_index.Add(binding,index);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorSetLayout *DescriptorSetLayoutCreater::Create()
|
DescriptorSetLayout *DescriptorSetLayoutCreater::Create()
|
||||||
@ -84,6 +97,23 @@ DescriptorSetLayout *DescriptorSetLayoutCreater::Create()
|
|||||||
if(vkCreateDescriptorSetLayout(device->GetDevice(),&descriptor_layout, nullptr, dsl_list.GetData())!=VK_SUCCESS)
|
if(vkCreateDescriptorSetLayout(device->GetDevice(),&descriptor_layout, nullptr, dsl_list.GetData())!=VK_SUCCESS)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
return(new DescriptorSetLayout(device,dsl_list));
|
VkDescriptorSetAllocateInfo alloc_info;
|
||||||
|
alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
||||||
|
alloc_info.pNext = nullptr;
|
||||||
|
alloc_info.descriptorPool = device->GetDescriptorPool();
|
||||||
|
alloc_info.descriptorSetCount = count;
|
||||||
|
alloc_info.pSetLayouts = dsl_list.GetData();
|
||||||
|
|
||||||
|
List<VkDescriptorSet> desc_set;
|
||||||
|
|
||||||
|
desc_set.SetCount(count);
|
||||||
|
|
||||||
|
if(vkAllocateDescriptorSets(device->GetDevice(), &alloc_info, desc_set.GetData())!=VK_SUCCESS)
|
||||||
|
{
|
||||||
|
DestroyDescriptorSetLayout(*device,dsl_list);
|
||||||
|
return(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(new DescriptorSetLayout(device,dsl_list,desc_set,binding_index));
|
||||||
}
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -2,41 +2,37 @@
|
|||||||
#define HGL_GRAPH_VULKAN_DESCRIPTOR_SETS_LAYOUT_INCLUDE
|
#define HGL_GRAPH_VULKAN_DESCRIPTOR_SETS_LAYOUT_INCLUDE
|
||||||
|
|
||||||
#include"VK.h"
|
#include"VK.h"
|
||||||
|
#include<hgl/type/Map.h>
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
class Device;
|
class Device;
|
||||||
class DescriptorSets
|
|
||||||
{
|
|
||||||
Device *device;
|
|
||||||
List<VkDescriptorSet> desc_sets;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DescriptorSets(Device *dev,List<VkDescriptorSet> &ds):device(dev),desc_sets(ds){}
|
|
||||||
~DescriptorSets();
|
|
||||||
|
|
||||||
const uint32_t GetCount()const{return desc_sets.GetCount();}
|
|
||||||
const VkDescriptorSet * GetData()const{return desc_sets.GetData();}
|
|
||||||
};//class DescriptorSets
|
|
||||||
|
|
||||||
class DescriptorSetLayout
|
class DescriptorSetLayout
|
||||||
{
|
{
|
||||||
Device *device;
|
Device *device;
|
||||||
List<VkDescriptorSetLayout> desc_set_layout_list;
|
List<VkDescriptorSetLayout> desc_set_layout_list;
|
||||||
|
List<VkDescriptorSet> desc_sets;
|
||||||
|
|
||||||
|
Map<uint32_t,int> binding_index;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DescriptorSetLayout(Device *dev,const List<VkDescriptorSetLayout> &dsl_list)
|
DescriptorSetLayout(Device *dev,const List<VkDescriptorSetLayout> &dsl_list,List<VkDescriptorSet> &ds_list,
|
||||||
|
Map<uint32_t,int> &bi)
|
||||||
{
|
{
|
||||||
device=dev;
|
device=dev;
|
||||||
desc_set_layout_list=dsl_list;
|
desc_set_layout_list=dsl_list;
|
||||||
|
desc_sets=ds_list;
|
||||||
|
binding_index=bi;
|
||||||
}
|
}
|
||||||
|
|
||||||
~DescriptorSetLayout();
|
~DescriptorSetLayout();
|
||||||
|
|
||||||
const uint32_t GetCount()const{return desc_set_layout_list.GetCount();}
|
const uint32_t GetCount ()const{return desc_set_layout_list.GetCount();}
|
||||||
const VkDescriptorSetLayout * GetData ()const{return desc_set_layout_list.GetData();}
|
const VkDescriptorSetLayout * GetLayouts ()const{return desc_set_layout_list.GetData();}
|
||||||
|
|
||||||
DescriptorSets *CreateSets()const;
|
const List<VkDescriptorSet> & GetSets ()const{return desc_sets;}
|
||||||
|
|
||||||
|
bool UpdateBuffer(const uint32_t binding,const VkDescriptorBufferInfo *buf_info);
|
||||||
};//class DescriptorSetLayout
|
};//class DescriptorSetLayout
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,6 +45,8 @@ class DescriptorSetLayoutCreater
|
|||||||
|
|
||||||
List<VkDescriptorSetLayoutBinding> layout_binding_list;
|
List<VkDescriptorSetLayoutBinding> layout_binding_list;
|
||||||
|
|
||||||
|
Map<uint32_t,int> binding_index;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DescriptorSetLayoutCreater(Device *dev):device(dev){}
|
DescriptorSetLayoutCreater(Device *dev):device(dev){}
|
||||||
|
@ -133,7 +133,7 @@ Instance *CreateInstance(const UTF8String &app_name)
|
|||||||
"VK_LAYER_LUNARG_standard_validation",
|
"VK_LAYER_LUNARG_standard_validation",
|
||||||
"VK_LAYER_LUNARG_parameter_validation",
|
"VK_LAYER_LUNARG_parameter_validation",
|
||||||
// "VK_LAYER_LUNARG_vktrace",
|
// "VK_LAYER_LUNARG_vktrace",
|
||||||
// "VK_LAYER_RENDERDOC_Capture",
|
"VK_LAYER_RENDERDOC_Capture",
|
||||||
|
|
||||||
// "VK_LAYER_KHRONOS_validation",
|
// "VK_LAYER_KHRONOS_validation",
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ PipelineLayout::~PipelineLayout()
|
|||||||
PipelineLayout *CreatePipelineLayout(VkDevice dev,const DescriptorSetLayout *dsl)
|
PipelineLayout *CreatePipelineLayout(VkDevice dev,const DescriptorSetLayout *dsl)
|
||||||
{
|
{
|
||||||
const uint32_t layout_count=(dsl?dsl->GetCount():0);
|
const uint32_t layout_count=(dsl?dsl->GetCount():0);
|
||||||
const VkDescriptorSetLayout *layouts=(layout_count>0?dsl->GetData():nullptr);
|
const VkDescriptorSetLayout *layouts=(layout_count>0?dsl->GetLayouts():nullptr);
|
||||||
|
|
||||||
VkPipelineLayoutCreateInfo pPipelineLayoutCreateInfo = {};
|
VkPipelineLayoutCreateInfo pPipelineLayoutCreateInfo = {};
|
||||||
pPipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
pPipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||||
@ -26,8 +26,6 @@ PipelineLayout *CreatePipelineLayout(VkDevice dev,const DescriptorSetLayout *dsl
|
|||||||
if(vkCreatePipelineLayout(dev, &pPipelineLayoutCreateInfo, nullptr, &pipeline_layout)!=VK_SUCCESS)
|
if(vkCreatePipelineLayout(dev, &pPipelineLayoutCreateInfo, nullptr, &pipeline_layout)!=VK_SUCCESS)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
DescriptorSets *desc_sets=(layout_count>0?dsl->CreateSets():nullptr);
|
return(new PipelineLayout(dev,pipeline_layout,dsl->GetSets()));
|
||||||
|
|
||||||
return(new PipelineLayout(dev,pipeline_layout,desc_sets));
|
|
||||||
}
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -9,13 +9,13 @@ class PipelineLayout
|
|||||||
VkDevice device;
|
VkDevice device;
|
||||||
VkPipelineLayout layout;
|
VkPipelineLayout layout;
|
||||||
|
|
||||||
const DescriptorSets *desc_sets;
|
List<VkDescriptorSet> desc_sets;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
friend PipelineLayout *CreatePipelineLayout(VkDevice dev,const DescriptorSetLayout *dsl);
|
friend PipelineLayout *CreatePipelineLayout(VkDevice dev,const DescriptorSetLayout *dsl);
|
||||||
|
|
||||||
PipelineLayout(VkDevice dev,VkPipelineLayout pl,const DescriptorSets *ds){device=dev;layout=pl;desc_sets=ds;}
|
PipelineLayout(VkDevice dev,VkPipelineLayout pl,const List<VkDescriptorSet> &ds){device=dev;layout=pl;desc_sets=ds;}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ public:
|
|||||||
|
|
||||||
operator VkPipelineLayout (){return layout;}
|
operator VkPipelineLayout (){return layout;}
|
||||||
|
|
||||||
const uint32_t GetDescriptorSetCount ()const{return desc_sets?desc_sets->GetCount():0;}
|
const uint32_t GetDescriptorSetCount ()const{return desc_sets.GetCount();}
|
||||||
const VkDescriptorSet * GetDescriptorSets ()const{return desc_sets?desc_sets->GetData():nullptr;}
|
const VkDescriptorSet * GetDescriptorSets ()const{return desc_sets.GetData();}
|
||||||
};//class PipelineLayout
|
};//class PipelineLayout
|
||||||
|
|
||||||
PipelineLayout *CreatePipelineLayout(VkDevice dev,const DescriptorSetLayout *dsl);
|
PipelineLayout *CreatePipelineLayout(VkDevice dev,const DescriptorSetLayout *dsl);
|
||||||
|
@ -22,7 +22,7 @@ bool VertexInput::Add(uint32_t location,VertexBuffer *buf,bool instance,VkDevice
|
|||||||
attrib.offset=offset;
|
attrib.offset=offset;
|
||||||
|
|
||||||
vib_list.Add(new VertexInputBuffer(binding,attrib,buf));
|
vib_list.Add(new VertexInputBuffer(binding,attrib,buf));
|
||||||
buf_list.Add(buf->GetBuffer());
|
buf_list.Add(*buf);
|
||||||
buf_offset.Add(offset);
|
buf_offset.Add(offset);
|
||||||
|
|
||||||
binding_list.Add(binding);
|
binding_list.Add(binding);
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include"VKSemaphore.h"
|
#include"VKSemaphore.h"
|
||||||
#include"VKFormat.h"
|
#include"VKFormat.h"
|
||||||
#include"VKFramebuffer.h"
|
#include"VKFramebuffer.h"
|
||||||
|
#include<hgl/math/Math.h>
|
||||||
|
|
||||||
#include<fstream>
|
#include<fstream>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -24,9 +25,17 @@
|
|||||||
using namespace hgl;
|
using namespace hgl;
|
||||||
using namespace hgl::graph;
|
using namespace hgl::graph;
|
||||||
|
|
||||||
|
constexpr uint32_t SCREEN_WIDTH=1280;
|
||||||
|
constexpr uint32_t SCREEN_HEIGHT=720;
|
||||||
|
|
||||||
VkShaderModule vs=nullptr;
|
VkShaderModule vs=nullptr;
|
||||||
VkShaderModule fs=nullptr;
|
VkShaderModule fs=nullptr;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
Matrix4f mvp;
|
||||||
|
}ubo_vs;
|
||||||
|
|
||||||
char *LoadFile(const char *filename,uint32_t &file_length)
|
char *LoadFile(const char *filename,uint32_t &file_length)
|
||||||
{
|
{
|
||||||
std::ifstream fs;
|
std::ifstream fs;
|
||||||
@ -74,7 +83,33 @@ vulkan::Shader *LoadShader(VkDevice device)
|
|||||||
return(nullptr);
|
return(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr float vertex_data[]={0.0f,0.5f, -0.5f,-0.5f, 0.5f,-0.5f };
|
vulkan::Buffer *CreateUBO(vulkan::Device *dev,vulkan::Shader *shader)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
const VkExtent2D extent=dev->GetExtent();
|
||||||
|
|
||||||
|
ubo_vs.mvp=ortho2d(extent.width,extent.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
vulkan::Buffer *ubo=dev->CreateUBO(sizeof(ubo_vs));
|
||||||
|
|
||||||
|
uint8_t *p=ubo->Map();
|
||||||
|
|
||||||
|
if(p)
|
||||||
|
{
|
||||||
|
memcpy(p,&ubo_vs,sizeof(ubo_vs));
|
||||||
|
ubo->Unmap();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ubo;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr float vertex_data[]=
|
||||||
|
{
|
||||||
|
SCREEN_WIDTH/2,SCREEN_HEIGHT/4,
|
||||||
|
SCREEN_WIDTH*3/4,SCREEN_HEIGHT*3/4,
|
||||||
|
SCREEN_WIDTH/4,SCREEN_HEIGHT*3/4
|
||||||
|
};
|
||||||
constexpr float color_data[]={1,0,0, 0,1,0, 0,0,1 };
|
constexpr float color_data[]={1,0,0, 0,1,0, 0,0,1 };
|
||||||
|
|
||||||
vulkan::VertexBuffer *vertex_buffer=nullptr;
|
vulkan::VertexBuffer *vertex_buffer=nullptr;
|
||||||
@ -131,7 +166,7 @@ int main(int,char **)
|
|||||||
|
|
||||||
Window *win=CreateRenderWindow(OS_TEXT("VulkanTest"));
|
Window *win=CreateRenderWindow(OS_TEXT("VulkanTest"));
|
||||||
|
|
||||||
win->Create(1280,720);
|
win->Create(SCREEN_WIDTH,SCREEN_HEIGHT);
|
||||||
|
|
||||||
vulkan::Instance *inst=vulkan::CreateInstance(U8_TEXT("VulkanTest"));
|
vulkan::Instance *inst=vulkan::CreateInstance(U8_TEXT("VulkanTest"));
|
||||||
|
|
||||||
@ -156,21 +191,13 @@ int main(int,char **)
|
|||||||
std::cout<<"auto select physical device: "<<render_device->GetDeviceName()<<std::endl;
|
std::cout<<"auto select physical device: "<<render_device->GetDeviceName()<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//vulkan::Buffer *ubo=device->CreateUBO(1024);
|
|
||||||
|
|
||||||
//uint8_t *p=ubo->Map();
|
|
||||||
|
|
||||||
//if(p)
|
|
||||||
//{
|
|
||||||
// memset(p,0,1024);
|
|
||||||
// ubo->Unmap();
|
|
||||||
//}
|
|
||||||
|
|
||||||
vulkan::Shader *shader=LoadShader(device->GetDevice());
|
vulkan::Shader *shader=LoadShader(device->GetDevice());
|
||||||
|
|
||||||
if(!shader)
|
if(!shader)
|
||||||
return -3;
|
return -3;
|
||||||
|
|
||||||
|
vulkan::Buffer *ubo=CreateUBO(device,shader);
|
||||||
|
|
||||||
vulkan::Semaphore *sem=device->CreateSem();
|
vulkan::Semaphore *sem=device->CreateSem();
|
||||||
|
|
||||||
vulkan::VertexInput *vi=CreateVertexBuffer(device);
|
vulkan::VertexInput *vi=CreateVertexBuffer(device);
|
||||||
@ -178,7 +205,13 @@ int main(int,char **)
|
|||||||
vulkan::PipelineCreater pc(device);
|
vulkan::PipelineCreater pc(device);
|
||||||
|
|
||||||
vulkan::DescriptorSetLayoutCreater dslc(device);
|
vulkan::DescriptorSetLayoutCreater dslc(device);
|
||||||
|
|
||||||
|
dslc.BindUBO(0,VK_SHADER_STAGE_VERTEX_BIT);
|
||||||
|
|
||||||
vulkan::DescriptorSetLayout *dsl=dslc.Create();
|
vulkan::DescriptorSetLayout *dsl=dslc.Create();
|
||||||
|
|
||||||
|
dsl->UpdateBuffer(0,*ubo);
|
||||||
|
|
||||||
vulkan::PipelineLayout *pl=CreatePipelineLayout(*device,dsl);
|
vulkan::PipelineLayout *pl=CreatePipelineLayout(*device,dsl);
|
||||||
|
|
||||||
pc.Set(shader);
|
pc.Set(shader);
|
||||||
@ -219,7 +252,7 @@ int main(int,char **)
|
|||||||
delete sem;
|
delete sem;
|
||||||
|
|
||||||
delete vi;
|
delete vi;
|
||||||
// delete ubo;
|
delete ubo;
|
||||||
|
|
||||||
delete shader;
|
delete shader;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user