use VKStruct.h/VKImageCreateInfo.h
This commit is contained in:
parent
e76234a01a
commit
cc7f462f85
@ -1 +1 @@
|
||||
Subproject commit cf0b4cfb35fe5385fd8a887a0aabbdf115abfe74
|
||||
Subproject commit ef941fde85bc16964cbbcd7c4505189986834e0a
|
@ -5,7 +5,7 @@
|
||||
#include<hgl/filesystem/FileSystem.h>
|
||||
#include<hgl/graph/InlineGeometry.h>
|
||||
#include<hgl/graph/vulkan/VKDatabase.h>
|
||||
#include<hgl/graph/RenderableInstance.h>
|
||||
#include<hgl/graph/vulkan/VKRenderableInstance.h>
|
||||
#include<hgl/graph/RenderList.h>
|
||||
|
||||
using namespace hgl;
|
||||
|
@ -31,8 +31,8 @@ CreateProject(04.texture_rect texture_rect.cpp)
|
||||
CreateProject(05.HQFilterTexture HQFilterTexture.cpp)
|
||||
CreateProject(06.Geometry2D Geometry2D.cpp)
|
||||
CreateProject(07.Geometry3D Geometry3D.cpp)
|
||||
CreateProject(08.SceneTree SceneTree.cpp)
|
||||
CreateProject(09.LoadStaticMesh LoadStaticMesh.cpp LoadScene.cpp)
|
||||
#CreateProject(08.SceneTree SceneTree.cpp)
|
||||
#CreateProject(09.LoadStaticMesh LoadStaticMesh.cpp LoadScene.cpp)
|
||||
CreateProject(10.InlineGeometryScene InlineGeometryScene.cpp)
|
||||
CreateProject(11.Atomsphere Atomsphere.cpp)
|
||||
|
||||
|
@ -35,7 +35,6 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
|
||||
bool InitMDP(MDP *mdp,const Prim primitive,const OSString &mtl_name)
|
||||
{
|
||||
mdp->material=db->CreateMaterial(mtl_name);
|
||||
@ -44,7 +43,7 @@ private:
|
||||
mdp->material_instance=db->CreateMaterialInstance(mdp->material);
|
||||
if(!mdp->material_instance)return(false);
|
||||
|
||||
mdp->pipeline=CreatePipeline(mdp->material_instance,OS_TEXT("res/pipeline/solid2d"),primitive);
|
||||
mdp->pipeline=CreatePipeline(mdp->material_instance,OS_TEXT("res/pipeline/default"),primitive);
|
||||
|
||||
if(!mdp->material_instance->BindUBO("world",GetCameraMatrixBuffer()))
|
||||
return(false);
|
||||
|
@ -112,11 +112,8 @@ private:
|
||||
|
||||
vulkan::Sampler *InitSampler(VkFilter filter)
|
||||
{
|
||||
VkSamplerCreateInfo sampler_create_info;
|
||||
vulkan::SamplerCreateInfo sampler_create_info;
|
||||
|
||||
sampler_create_info.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
||||
sampler_create_info.pNext = nullptr;
|
||||
sampler_create_info.flags = 0;
|
||||
sampler_create_info.magFilter = filter;
|
||||
sampler_create_info.minFilter = filter;
|
||||
sampler_create_info.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include<hgl/filesystem/FileSystem.h>
|
||||
#include<hgl/graph/InlineGeometry.h>
|
||||
#include<hgl/graph/vulkan/VKDatabase.h>
|
||||
#include<hgl/graph/RenderableInstance.h>
|
||||
#include<hgl/graph/vulkan/VKRenderableInstance.h>
|
||||
#include<hgl/graph/RenderList.h>
|
||||
|
||||
using namespace hgl;
|
||||
@ -23,12 +23,12 @@ private:
|
||||
SceneNode render_root;
|
||||
RenderList render_list;
|
||||
|
||||
struct MDP
|
||||
{
|
||||
vulkan::Material * material =nullptr;
|
||||
vulkan::MaterialInstance * material_instance =nullptr;
|
||||
vulkan::Pipeline * pipeline =nullptr;
|
||||
}m3d,m2d;
|
||||
vulkan::Material * material =nullptr;
|
||||
vulkan::MaterialInstance * material_instance =nullptr;
|
||||
|
||||
vulkan::PipelineData * pipeline_data =nullptr;
|
||||
vulkan::Pipeline * pipeline_line =nullptr;
|
||||
vulkan::Pipeline * pipeline_solid =nullptr;
|
||||
|
||||
vulkan::Buffer * ubo_color =nullptr;
|
||||
|
||||
@ -40,25 +40,25 @@ private:
|
||||
*ro_cylinder,
|
||||
*ro_cone;
|
||||
|
||||
vulkan::Pipeline *pipeline_line =nullptr,
|
||||
*pipeline_solid =nullptr;
|
||||
|
||||
private:
|
||||
|
||||
bool InitMDP(MDP *mdp,const Prim primitive,const OSString &mtl_name)
|
||||
bool InitMaterial()
|
||||
{
|
||||
mdp->material=db->CreateMaterial(mtl_name);
|
||||
if(!mdp->material)return(false);
|
||||
material=db->CreateMaterial(OS_TEXT("res/material/VertexColor3D"));
|
||||
if(!material)return(false);
|
||||
|
||||
mdp->material_instance=db->CreateMaterialInstance(mdp->material);
|
||||
if(!mdp->material_instance)return(false);
|
||||
material_instance=db->CreateMaterialInstance(material);
|
||||
if(!material_instance)return(false);
|
||||
|
||||
mdp->pipeline=CreatePipeline(mdp->material_instance,OS_TEXT("res/pipeline/solid2d"),primitive);
|
||||
pipeline_data=vulkan::GetPipelineData(OS_TEXT("res/pipeline/default"));
|
||||
if(!pipeline_data)return(false);
|
||||
|
||||
if(!mdp->material_instance->BindUBO("world",GetCameraMatrixBuffer()))
|
||||
return(false);
|
||||
pipeline_line=CreatePipeline(material,pipeline_data,Prim::Lines);
|
||||
if(!pipeline_line)return(false);
|
||||
|
||||
pipeline_solid=CreatePipeline(material,pipeline_data,Prim::Triangles);
|
||||
if(!pipeline_solid)return(false);
|
||||
|
||||
mdp->material_instance->Update();
|
||||
return(true);
|
||||
}
|
||||
|
||||
@ -86,6 +86,8 @@ private:
|
||||
|
||||
{
|
||||
struct CubeCreateInfo cci;
|
||||
cci.has_color=true;
|
||||
cci.color.Set(1,1,1,1);
|
||||
ro_cube=CreateRenderableCube(db,material,&cci);
|
||||
}
|
||||
|
||||
@ -153,53 +155,29 @@ private:
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool InitPipeline()
|
||||
void Add(vulkan::Renderable *r,vulkan::Pipeline *pl)
|
||||
{
|
||||
AutoDelete<vulkan::PipelineCreater>
|
||||
pipeline_creater=new vulkan::PipelineCreater(device,material,sc_render_target);
|
||||
pipeline_creater->Set(Prim::Lines);
|
||||
|
||||
pipeline_line=pipeline_creater->Create();
|
||||
|
||||
if(!pipeline_line)
|
||||
return(false);
|
||||
|
||||
db->Add(pipeline_line);
|
||||
|
||||
pipeline_creater->Set(Prim::Triangles);
|
||||
pipeline_creater->SetPolygonMode(VK_POLYGON_MODE_FILL);
|
||||
pipeline_solid=pipeline_creater->Create();
|
||||
|
||||
if(!pipeline_solid)
|
||||
return(false);
|
||||
|
||||
db->Add(pipeline_solid);
|
||||
return(true);
|
||||
}
|
||||
|
||||
void Add(vulkan::Renderable *r,MDP &mdp)
|
||||
{
|
||||
auto ri=db->CreateRenderableInstance(r,mdp.material_instance,mdp.pipeline);
|
||||
auto ri=db->CreateRenderableInstance(r,material_instance,pl);
|
||||
|
||||
render_root.Add(ri);
|
||||
}
|
||||
|
||||
void Add(vulkan::Renderable *r,MDP &mdp,const Matrix4f &mat)
|
||||
void Add(vulkan::Renderable *r,vulkan::Pipeline *pl,const Matrix4f &mat)
|
||||
{
|
||||
auto ri=db->CreateRenderableInstance(r,mdp.material_instance,mdp.pipeline);
|
||||
auto ri=db->CreateRenderableInstance(r,material_instance,pl);
|
||||
|
||||
render_root.Add(ri,mat);
|
||||
}
|
||||
|
||||
bool InitScene()
|
||||
{
|
||||
render_root.Add(db->CreateRenderableInstance(pipeline_line,material_instance,ro_plane_grid));
|
||||
//render_root.Add(db->CreateRenderableInstance(pipeline_solid,material_instance,ro_dome));
|
||||
render_root.Add(db->CreateRenderableInstance(pipeline_solid,material_instance,ro_torus));
|
||||
render_root.Add(db->CreateRenderableInstance(pipeline_solid,material_instance,ro_cube ),translate(-10, 0, 5)*scale(10,10,10));
|
||||
render_root.Add(db->CreateRenderableInstance(pipeline_solid,material_instance,ro_sphere ),translate( 10, 0, 5)*scale(10,10,10));
|
||||
render_root.Add(db->CreateRenderableInstance(pipeline_solid,material_instance,ro_cylinder ),translate( 0, 16, 0));
|
||||
render_root.Add(db->CreateRenderableInstance(pipeline_solid,material_instance,ro_cone ),translate( 0,-16, 0));
|
||||
Add(ro_plane_grid,pipeline_line);
|
||||
// Add(ro_dome,pipeline_solid);
|
||||
Add(ro_torus ,pipeline_solid);
|
||||
Add(ro_cube ,pipeline_solid,translate(-10, 0, 5)*scale(10,10,10));
|
||||
Add(ro_sphere ,pipeline_solid,translate( 10, 0, 5)*scale(10,10,10));
|
||||
Add(ro_cylinder ,pipeline_solid,translate( 0, 16, 0));
|
||||
Add(ro_cone ,pipeline_solid,translate( 0,-16, 0));
|
||||
|
||||
render_root.RefreshMatrix();
|
||||
render_root.ExpendToList(&render_list);
|
||||
@ -214,19 +192,13 @@ public:
|
||||
if(!CameraAppFramework::Init(SCREEN_WIDTH,SCREEN_HEIGHT))
|
||||
return(false);
|
||||
|
||||
if(!InitMDP(&m3d,Prim::Lines,OS_TEXT("res/material/VertexColor3D")))
|
||||
if(!InitMaterial())
|
||||
return(false);
|
||||
|
||||
if(!InitMDP(&m2d,Prim::Fan, OS_TEXT("res/material/PureColor2D")))
|
||||
return(false);
|
||||
|
||||
CreateRenderObject();
|
||||
|
||||
if(!InitUBO())
|
||||
return(false);
|
||||
|
||||
if(!InitPipeline())
|
||||
return(false);
|
||||
CreateRenderObject();
|
||||
|
||||
if(!InitScene())
|
||||
return(false);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include<hgl/graph/vulkan/VKNamespace.h>
|
||||
#include<hgl/graph/vulkan/VKFormat.h>
|
||||
#include<hgl/graph/vulkan/VKPrimivate.h>
|
||||
#include<hgl/graph/vulkan/VKStruct.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -121,9 +121,9 @@ public: //Image
|
||||
VkImage CreateImage1DArray (const VkFormat format,const uint32_t width,const uint32_t layer, const uint usage,const ImageTiling tiling);
|
||||
VkImage CreateImage2D (const VkFormat format,const uint32_t width,const uint32_t height, const uint usage,const ImageTiling tiling);
|
||||
VkImage CreateImage2DArray (const VkFormat format,const uint32_t width,const uint32_t height,const uint32_t layer, const uint usage,const ImageTiling tiling);
|
||||
VkImage CreateImage3D (const VkFormat format,const uint32_t width,const uint32_t height,const uint32_t depth, const uint usage,const ImageTiling tiling);
|
||||
VkImage CreateImage3D (const VkFormat format,const VkExtent3D &extent, const uint usage,const ImageTiling tiling);
|
||||
VkImage CreateCubemap (const VkFormat format,const uint32_t width,const uint32_t height, const uint usage,const ImageTiling tiling);
|
||||
// VkImage CreateCubemapArray (const VkFormat format,const uint32_t width,const uint32_t height,const uint32_t count, const uint usage,const ImageTiling tiling);
|
||||
// VkImage CreateCubemapArray (const VkFormat format,const uint32_t width,const uint32_t height,const uint32_t layer, const uint usage,const ImageTiling tiling);
|
||||
|
||||
void DestoryImage (VkImage);
|
||||
|
||||
|
@ -17,7 +17,7 @@ protected:
|
||||
uint32_t current_fence;
|
||||
ObjectList<Fence> fence_list;
|
||||
|
||||
VkSubmitInfo submit_info;
|
||||
SubmitInfo submit_info;
|
||||
|
||||
public:
|
||||
|
||||
@ -63,7 +63,7 @@ class SwapchainRenderTarget:public RenderTarget
|
||||
{
|
||||
Swapchain *swapchain;
|
||||
VkSwapchainKHR vk_swapchain;
|
||||
VkPresentInfoKHR present_info;
|
||||
PresentInfo present_info;
|
||||
|
||||
RenderPass *main_rp=nullptr;
|
||||
|
||||
|
@ -55,11 +55,8 @@ void CommandBuffer::SetRenderArea(const VkExtent2D &ext2d)
|
||||
|
||||
bool CommandBuffer::Begin()
|
||||
{
|
||||
VkCommandBufferBeginInfo cmd_buf_info;
|
||||
CommandBufferBeginInfo cmd_buf_info;
|
||||
|
||||
cmd_buf_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||
cmd_buf_info.pNext = nullptr;
|
||||
cmd_buf_info.flags = 0;
|
||||
cmd_buf_info.pInheritanceInfo = nullptr;
|
||||
|
||||
if(vkBeginCommandBuffer(cmd_buf, &cmd_buf_info)!=VK_SUCCESS)
|
||||
@ -70,10 +67,8 @@ bool CommandBuffer::Begin()
|
||||
|
||||
bool CommandBuffer::BeginRenderPass(VkRenderPass rp,VkFramebuffer fb)
|
||||
{
|
||||
VkRenderPassBeginInfo rp_begin;
|
||||
RenderPassBeginInfo rp_begin;
|
||||
|
||||
rp_begin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
||||
rp_begin.pNext = nullptr;
|
||||
rp_begin.renderPass = rp;
|
||||
rp_begin.framebuffer = fb;
|
||||
rp_begin.renderArea = render_area;
|
||||
|
@ -79,11 +79,8 @@ bool DescriptorSetLayoutCreater::CreatePipelineLayout()
|
||||
if(count<=0)
|
||||
return(false);
|
||||
|
||||
VkDescriptorSetLayoutCreateInfo descriptor_layout;
|
||||
DescriptorSetLayoutCreateInfo descriptor_layout;
|
||||
|
||||
descriptor_layout.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
|
||||
descriptor_layout.pNext = nullptr;
|
||||
descriptor_layout.flags = 0;
|
||||
descriptor_layout.bindingCount = count;
|
||||
descriptor_layout.pBindings = layout_binding_list.GetData();
|
||||
|
||||
@ -99,10 +96,8 @@ bool DescriptorSetLayoutCreater::CreatePipelineLayout()
|
||||
push_constant_range.size = MAX_PUSH_CONSTANT_BYTES;
|
||||
push_constant_range.offset = 0;
|
||||
|
||||
VkPipelineLayoutCreateInfo pPipelineLayoutCreateInfo;
|
||||
pPipelineLayoutCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
|
||||
pPipelineLayoutCreateInfo.pNext = nullptr;
|
||||
pPipelineLayoutCreateInfo.flags = 0;
|
||||
PipelineLayoutCreateInfo pPipelineLayoutCreateInfo;
|
||||
|
||||
pPipelineLayoutCreateInfo.setLayoutCount = 1;
|
||||
pPipelineLayoutCreateInfo.pSetLayouts = &dsl;
|
||||
pPipelineLayoutCreateInfo.pushConstantRangeCount = 1;
|
||||
@ -124,9 +119,8 @@ DescriptorSets *DescriptorSetLayoutCreater::Create()
|
||||
if(count<=0)
|
||||
return(nullptr);
|
||||
|
||||
VkDescriptorSetAllocateInfo alloc_info;
|
||||
alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
||||
alloc_info.pNext = nullptr;
|
||||
DescriptorSetAllocateInfo alloc_info;
|
||||
|
||||
alloc_info.descriptorPool = pool;
|
||||
alloc_info.descriptorSetCount = 1;
|
||||
alloc_info.pSetLayouts = &dsl;
|
||||
|
@ -16,10 +16,8 @@ bool DescriptorSets::BindUBO(const int binding,const Buffer *buf)
|
||||
if(binding<0||!buf)
|
||||
return(false);
|
||||
|
||||
VkWriteDescriptorSet wds;
|
||||
WriteDescriptorSet wds;
|
||||
|
||||
wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
wds.pNext = nullptr;
|
||||
wds.dstSet = desc_set;
|
||||
wds.dstBinding = binding;
|
||||
wds.dstArrayElement = 0;
|
||||
@ -38,10 +36,8 @@ bool DescriptorSets::BindUBODynamic(const int binding,const Buffer *buf)
|
||||
if(binding<0||!buf)
|
||||
return(false);
|
||||
|
||||
VkWriteDescriptorSet wds;
|
||||
WriteDescriptorSet wds;
|
||||
|
||||
wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
wds.pNext = nullptr;
|
||||
wds.dstSet = desc_set;
|
||||
wds.dstBinding = binding;
|
||||
wds.dstArrayElement = 0;
|
||||
@ -68,10 +64,8 @@ bool DescriptorSets::BindSampler(const int binding,Texture *tex,Sampler *sampler
|
||||
|
||||
desc_image_info.Add(image_info);
|
||||
|
||||
VkWriteDescriptorSet wds;
|
||||
WriteDescriptorSet wds;
|
||||
|
||||
wds.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
wds.pNext = nullptr;
|
||||
wds.dstSet = desc_set;
|
||||
wds.dstBinding = binding;
|
||||
wds.dstArrayElement = 0;
|
||||
|
@ -60,9 +60,8 @@ CommandBuffer *Device::CreateCommandBuffer(const VkExtent2D &extent,const uint32
|
||||
if(!attr->cmd_pool)
|
||||
return(nullptr);
|
||||
|
||||
VkCommandBufferAllocateInfo cmd;
|
||||
cmd.sType =VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||
cmd.pNext =nullptr;
|
||||
CommandBufferAllocateInfo cmd;
|
||||
|
||||
cmd.commandPool =attr->cmd_pool;
|
||||
cmd.level =VK_COMMAND_BUFFER_LEVEL_PRIMARY;
|
||||
cmd.commandBufferCount =1;
|
||||
@ -83,10 +82,7 @@ CommandBuffer *Device::CreateCommandBuffer(const VkExtent2D &extent,const uint32
|
||||
*/
|
||||
Fence *Device::CreateFence(bool create_signaled)
|
||||
{
|
||||
VkFenceCreateInfo fenceInfo;
|
||||
fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||
fenceInfo.pNext = nullptr;
|
||||
fenceInfo.flags = create_signaled?VK_FENCE_CREATE_SIGNALED_BIT:0;
|
||||
FenceCreateInfo fenceInfo(create_signaled?VK_FENCE_CREATE_SIGNALED_BIT:0);
|
||||
|
||||
VkFence fence;
|
||||
|
||||
@ -98,12 +94,10 @@ Fence *Device::CreateFence(bool create_signaled)
|
||||
|
||||
vulkan::Semaphore *Device::CreateSem()
|
||||
{
|
||||
VkSemaphoreCreateInfo SemaphoreCreateInfo;
|
||||
SemaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||
SemaphoreCreateInfo.pNext = nullptr;
|
||||
SemaphoreCreateInfo.flags = 0;
|
||||
SemaphoreCreateInfo SemaphoreCreateInfo;
|
||||
|
||||
VkSemaphore sem;
|
||||
|
||||
if(vkCreateSemaphore(attr->device, &SemaphoreCreateInfo, nullptr, &sem)!=VK_SUCCESS)
|
||||
return(nullptr);
|
||||
|
||||
|
@ -4,15 +4,13 @@
|
||||
VK_NAMESPACE_BEGIN
|
||||
bool Device::CreateBuffer(BufferData *buf,VkBufferUsageFlags buf_usage,VkDeviceSize size,const void *data,SharingMode sharing_mode)
|
||||
{
|
||||
VkBufferCreateInfo buf_info={};
|
||||
buf_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
||||
buf_info.pNext = nullptr;
|
||||
BufferCreateInfo buf_info;
|
||||
|
||||
buf_info.usage = buf_usage;
|
||||
buf_info.size = size;
|
||||
buf_info.queueFamilyIndexCount = 0;
|
||||
buf_info.pQueueFamilyIndices = nullptr;
|
||||
buf_info.sharingMode = VkSharingMode(sharing_mode);
|
||||
buf_info.flags = 0;
|
||||
|
||||
if(vkCreateBuffer(attr->device,&buf_info,nullptr,&buf->buffer)!=VK_SUCCESS)
|
||||
return(false);
|
||||
|
@ -1,47 +1,13 @@
|
||||
#include<hgl/graph/vulkan/VKDevice.h>
|
||||
#include<hgl/graph/vulkan/VKImageCreateInfo.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
namespace
|
||||
{
|
||||
void InitImageCreateInfo(VkImageCreateInfo &imageCreateInfo)
|
||||
{
|
||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
imageCreateInfo.pNext = nullptr;
|
||||
imageCreateInfo.flags = 0;
|
||||
imageCreateInfo.mipLevels = 1;
|
||||
imageCreateInfo.arrayLayers = 1;
|
||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
imageCreateInfo.sharingMode = VkSharingMode(SharingMode::Exclusive);
|
||||
imageCreateInfo.queueFamilyIndexCount = 0;
|
||||
imageCreateInfo.pQueueFamilyIndices = nullptr;
|
||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
}
|
||||
}//namespace
|
||||
|
||||
VkImage Device::CreateImage1D(const VkFormat format,const uint32_t length,const uint usage,const ImageTiling tiling)
|
||||
{
|
||||
if(!CheckVulkanFormat(format))return(nullptr);
|
||||
if(length<1)return(nullptr);
|
||||
|
||||
VkImageCreateInfo imageCreateInfo;
|
||||
|
||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
imageCreateInfo.pNext = nullptr;
|
||||
imageCreateInfo.flags = 0;
|
||||
imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
|
||||
imageCreateInfo.format = format;
|
||||
imageCreateInfo.extent.width = length;
|
||||
imageCreateInfo.extent.height = 1;
|
||||
imageCreateInfo.extent.depth = 1;
|
||||
imageCreateInfo.mipLevels = 1;
|
||||
imageCreateInfo.arrayLayers = 1;
|
||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
imageCreateInfo.usage = usage;
|
||||
imageCreateInfo.sharingMode = VkSharingMode(SharingMode::Exclusive);
|
||||
imageCreateInfo.queueFamilyIndexCount = 0;
|
||||
imageCreateInfo.pQueueFamilyIndices = nullptr;
|
||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
imageCreateInfo.tiling = VkImageTiling(tiling);
|
||||
Image1DCreateInfo imageCreateInfo(usage,tiling,format,length);
|
||||
|
||||
VkImage image;
|
||||
|
||||
@ -56,25 +22,7 @@ VkImage Device::CreateImage1DArray(const VkFormat format,const uint32_t length,c
|
||||
if(!CheckVulkanFormat(format))return(nullptr);
|
||||
if(length<1||layer<1)return(nullptr);
|
||||
|
||||
VkImageCreateInfo imageCreateInfo;
|
||||
|
||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
imageCreateInfo.pNext = nullptr;
|
||||
imageCreateInfo.flags = 0;
|
||||
imageCreateInfo.imageType = VK_IMAGE_TYPE_1D;
|
||||
imageCreateInfo.format = format;
|
||||
imageCreateInfo.extent.width = length;
|
||||
imageCreateInfo.extent.height = 1;
|
||||
imageCreateInfo.extent.depth = 1;
|
||||
imageCreateInfo.mipLevels = 1;
|
||||
imageCreateInfo.arrayLayers = layer;
|
||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
imageCreateInfo.usage = usage;
|
||||
imageCreateInfo.sharingMode = VkSharingMode(SharingMode::Exclusive);
|
||||
imageCreateInfo.queueFamilyIndexCount = 0;
|
||||
imageCreateInfo.pQueueFamilyIndices = nullptr;
|
||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
imageCreateInfo.tiling = VkImageTiling(tiling);
|
||||
Image1DArrayCreateInfo imageCreateInfo(usage,tiling,format,length,layer);
|
||||
|
||||
VkImage image;
|
||||
|
||||
@ -89,25 +37,7 @@ VkImage Device::CreateImage2D(const VkFormat format,const uint32_t width,const u
|
||||
if(!CheckVulkanFormat(format))return(nullptr);
|
||||
if(width<1||height<1)return(nullptr);
|
||||
|
||||
VkImageCreateInfo imageCreateInfo;
|
||||
|
||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
imageCreateInfo.pNext = nullptr;
|
||||
imageCreateInfo.flags = 0;
|
||||
imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
|
||||
imageCreateInfo.format = format;
|
||||
imageCreateInfo.extent.width = width;
|
||||
imageCreateInfo.extent.height = height;
|
||||
imageCreateInfo.extent.depth = 1;
|
||||
imageCreateInfo.mipLevels = 1;
|
||||
imageCreateInfo.arrayLayers = 1;
|
||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
imageCreateInfo.usage = usage;
|
||||
imageCreateInfo.sharingMode = VkSharingMode(SharingMode::Exclusive);
|
||||
imageCreateInfo.queueFamilyIndexCount = 0;
|
||||
imageCreateInfo.pQueueFamilyIndices = nullptr;
|
||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
imageCreateInfo.tiling = VkImageTiling(tiling);
|
||||
Image2DCreateInfo imageCreateInfo(usage,tiling,format,width,height);
|
||||
|
||||
VkImage image;
|
||||
|
||||
@ -122,25 +52,7 @@ VkImage Device::CreateImage2DArray(const VkFormat format,const uint32_t width,co
|
||||
if(!CheckVulkanFormat(format))return(nullptr);
|
||||
if(width<1||height<1)return(nullptr);
|
||||
|
||||
VkImageCreateInfo imageCreateInfo;
|
||||
|
||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
imageCreateInfo.pNext = nullptr;
|
||||
imageCreateInfo.flags = 0;
|
||||
imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
|
||||
imageCreateInfo.format = format;
|
||||
imageCreateInfo.extent.width = width;
|
||||
imageCreateInfo.extent.height = height;
|
||||
imageCreateInfo.extent.depth = 1;
|
||||
imageCreateInfo.mipLevels = 1;
|
||||
imageCreateInfo.arrayLayers = layer;
|
||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
imageCreateInfo.usage = usage;
|
||||
imageCreateInfo.sharingMode = VkSharingMode(SharingMode::Exclusive);
|
||||
imageCreateInfo.queueFamilyIndexCount = 0;
|
||||
imageCreateInfo.pQueueFamilyIndices = nullptr;
|
||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
imageCreateInfo.tiling = VkImageTiling(tiling);
|
||||
Image2DArrayCreateInfo imageCreateInfo(usage,tiling,format,width,height,layer);
|
||||
|
||||
VkImage image;
|
||||
|
||||
@ -150,30 +62,12 @@ VkImage Device::CreateImage2DArray(const VkFormat format,const uint32_t width,co
|
||||
return image;
|
||||
}
|
||||
|
||||
VkImage Device::CreateImage3D(const VkFormat format,const uint32_t width,const uint32_t height,const uint32_t depth,const uint usage,const ImageTiling tiling)
|
||||
VkImage Device::CreateImage3D(const VkFormat format,const VkExtent3D &extent,const uint usage,const ImageTiling tiling)
|
||||
{
|
||||
if(!CheckVulkanFormat(format))return(nullptr);
|
||||
if(width<1||height<1)return(nullptr);
|
||||
if(extent.width<1||extent.height<1||extent.depth<1)return(nullptr);
|
||||
|
||||
VkImageCreateInfo imageCreateInfo;
|
||||
|
||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
imageCreateInfo.pNext = nullptr;
|
||||
imageCreateInfo.flags = 0;
|
||||
imageCreateInfo.imageType = VK_IMAGE_TYPE_3D;
|
||||
imageCreateInfo.format = format;
|
||||
imageCreateInfo.extent.width = width;
|
||||
imageCreateInfo.extent.height = height;
|
||||
imageCreateInfo.extent.depth = depth;
|
||||
imageCreateInfo.mipLevels = 1;
|
||||
imageCreateInfo.arrayLayers = 1;
|
||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
imageCreateInfo.usage = usage;
|
||||
imageCreateInfo.sharingMode = VkSharingMode(SharingMode::Exclusive);
|
||||
imageCreateInfo.queueFamilyIndexCount = 0;
|
||||
imageCreateInfo.pQueueFamilyIndices = nullptr;
|
||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
imageCreateInfo.tiling = VkImageTiling(tiling);
|
||||
Image3DCreateInfo imageCreateInfo(usage,tiling,format,extent);
|
||||
|
||||
VkImage image;
|
||||
|
||||
@ -188,25 +82,7 @@ VkImage Device::CreateCubemap(const VkFormat format,const uint32_t width,const u
|
||||
if(!CheckVulkanFormat(format))return(nullptr);
|
||||
if(width<1||height<1)return(nullptr);
|
||||
|
||||
VkImageCreateInfo imageCreateInfo;
|
||||
|
||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
imageCreateInfo.pNext = nullptr;
|
||||
imageCreateInfo.flags = VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
|
||||
imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;
|
||||
imageCreateInfo.format = format;
|
||||
imageCreateInfo.extent.width = width;
|
||||
imageCreateInfo.extent.height = height;
|
||||
imageCreateInfo.extent.depth = 1;
|
||||
imageCreateInfo.mipLevels = 1;
|
||||
imageCreateInfo.arrayLayers = 6;
|
||||
imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
imageCreateInfo.usage = usage;
|
||||
imageCreateInfo.sharingMode = VkSharingMode(SharingMode::Exclusive);
|
||||
imageCreateInfo.queueFamilyIndexCount = 0;
|
||||
imageCreateInfo.pQueueFamilyIndices = nullptr;
|
||||
imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
imageCreateInfo.tiling = VkImageTiling(tiling);
|
||||
ImageCubemapCreateInfo imageCreateInfo(usage,tiling,format,width,height);
|
||||
|
||||
VkImage image;
|
||||
|
||||
|
@ -49,10 +49,8 @@ Framebuffer *CreateFramebuffer(Device *dev,RenderPass *rp,ImageView **color_list
|
||||
|
||||
const VkExtent3D extent=depth->GetExtent();
|
||||
|
||||
VkFramebufferCreateInfo *fb_info=new VkFramebufferCreateInfo;
|
||||
fb_info->sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
|
||||
fb_info->pNext = nullptr;
|
||||
fb_info->flags = 0;
|
||||
FramebufferCreateInfo *fb_info=new FramebufferCreateInfo;
|
||||
|
||||
fb_info->renderPass = *rp;
|
||||
fb_info->attachmentCount = att_count;
|
||||
fb_info->pAttachments = attachments;
|
||||
|
@ -8,11 +8,8 @@ ImageView::~ImageView()
|
||||
|
||||
ImageView *CreateImageView(VkDevice device,VkImageViewType type,VkFormat format,const VkExtent3D &ext,VkImageAspectFlags aspectMask,VkImage img)
|
||||
{
|
||||
VkImageViewCreateInfo iv_createinfo={};
|
||||
ImageViewCreateInfo iv_createinfo;
|
||||
|
||||
iv_createinfo.sType =VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
iv_createinfo.pNext =nullptr;
|
||||
iv_createinfo.flags =0;
|
||||
iv_createinfo.image =img;
|
||||
iv_createinfo.format =format;
|
||||
iv_createinfo.viewType =type;
|
||||
|
@ -19,8 +19,6 @@ SubmitQueue::SubmitQueue(Device *dev,VkQueue q,const uint32_t fence_count)
|
||||
|
||||
current_fence=0;
|
||||
|
||||
submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
submit_info.pNext = nullptr;
|
||||
submit_info.pWaitDstStageMask = &pipe_stage_flags;
|
||||
}
|
||||
|
||||
@ -102,8 +100,6 @@ SwapchainRenderTarget::SwapchainRenderTarget(Device *dev,Swapchain *sc):RenderTa
|
||||
swapchain=sc;
|
||||
vk_swapchain=swapchain->GetSwapchain();
|
||||
|
||||
present_info.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
|
||||
present_info.pNext = nullptr;
|
||||
present_info.waitSemaphoreCount = 0;
|
||||
present_info.pWaitSemaphores = nullptr;
|
||||
present_info.swapchainCount = 1;
|
||||
|
@ -46,7 +46,7 @@ RenderableInstance *CreateRenderableInstance(Renderable *r,MaterialInstance *mi,
|
||||
const VkVertexInputBindingDescription *desc;
|
||||
const VkVertexInputAttributeDescription *attr;
|
||||
|
||||
for(uint i=0;i<input_count;i++)
|
||||
for(int i=0;i<input_count;i++)
|
||||
{
|
||||
desc=vsm->GetDesc(i);
|
||||
attr=vsm->GetAttr(i);
|
||||
|
@ -297,6 +297,13 @@ namespace hgl
|
||||
}
|
||||
}
|
||||
|
||||
if(cci->has_color)
|
||||
{
|
||||
AutoDelete<VB4f> color=rc.CreateVADA<VB4f>(VAN::Color);
|
||||
|
||||
if(color)color->Fill(cci->color,24);
|
||||
}
|
||||
|
||||
rc.CreateIBO16(6*2*3,indices);
|
||||
return rc.Finish();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user