修复至可运行
This commit is contained in:
parent
f5cafb91b8
commit
338558205e
@ -16,7 +16,7 @@ using namespace hgl;
|
|||||||
using namespace hgl::graph;
|
using namespace hgl::graph;
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
Texture2D *LoadTGATexture(const OSString &filename,Device *device);
|
Texture2D *LoadTGATexture(const OSString &filename,Device *device,bool use_optimal=true);
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
|
||||||
constexpr uint32_t SCREEN_WIDTH=256;
|
constexpr uint32_t SCREEN_WIDTH=256;
|
||||||
|
@ -10,7 +10,7 @@ using namespace hgl;
|
|||||||
using namespace hgl::graph;
|
using namespace hgl::graph;
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
Texture2D *LoadTGATexture(const OSString &filename,Device *device);
|
Texture2D *LoadTGATexture(const OSString &filename,Device *device,bool use_optimal=true);
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
|
||||||
constexpr uint32_t SCREEN_WIDTH=512;
|
constexpr uint32_t SCREEN_WIDTH=512;
|
||||||
|
@ -255,7 +255,7 @@ Texture2D *LoadTGATexture(const OSString &filename,Device *device,bool use_optim
|
|||||||
|
|
||||||
if(use_optimar)
|
if(use_optimar)
|
||||||
{
|
{
|
||||||
device->CreateTexture2D(format,buf,header.width,header.height);
|
tex=device->CreateTexture2D(format,buf,header.width,header.height);
|
||||||
delete buf;
|
delete buf;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -25,7 +25,7 @@ class Device
|
|||||||
bool CreateSwapchainColorTexture();
|
bool CreateSwapchainColorTexture();
|
||||||
bool CreateSwapchainDepthTexture();
|
bool CreateSwapchainDepthTexture();
|
||||||
|
|
||||||
Swapchain *CreateSwapchain(const VkExtent2D &acquire_extent);
|
bool CreateSwapchain(const VkExtent2D &acquire_extent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -43,7 +43,9 @@ bool Device::Resize(const VkExtent2D &extent)
|
|||||||
SAFE_CLEAR(texture_cmd_buf);
|
SAFE_CLEAR(texture_cmd_buf);
|
||||||
|
|
||||||
attr->Refresh();
|
attr->Refresh();
|
||||||
swapchain=CreateSwapchain(extent);
|
|
||||||
|
if(!CreateSwapchain(extent))
|
||||||
|
return(false);
|
||||||
|
|
||||||
texture_cmd_buf=CreateCommandBuffer(extent,0);
|
texture_cmd_buf=CreateCommandBuffer(extent,0);
|
||||||
textureSQ=new SubmitQueue(this,attr->graphics_queue,1);
|
textureSQ=new SubmitQueue(this,attr->graphics_queue,1);
|
||||||
|
@ -118,24 +118,23 @@ bool Device::CreateSwapchainDepthTexture()
|
|||||||
return swapchain->sc_depth;
|
return swapchain->sc_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
Swapchain *Device::CreateSwapchain(const VkExtent2D &acquire_extent)
|
bool Device::CreateSwapchain(const VkExtent2D &acquire_extent)
|
||||||
{
|
{
|
||||||
AutoDelete<Swapchain> sc=new Swapchain;
|
swapchain=new Swapchain;
|
||||||
|
|
||||||
sc->device =attr->device;
|
swapchain->device =attr->device;
|
||||||
sc->extent =SwapchainExtentClamp(attr->surface_caps,acquire_extent);
|
swapchain->extent =SwapchainExtentClamp(attr->surface_caps,acquire_extent);
|
||||||
sc->graphics_queue =attr->graphics_queue;
|
swapchain->graphics_queue =attr->graphics_queue;
|
||||||
sc->swap_chain =CreateSwapChain(attr,sc->extent);
|
swapchain->swap_chain =CreateSwapChain(attr,swapchain->extent);
|
||||||
|
|
||||||
if(!sc->swap_chain)
|
if(swapchain->swap_chain)
|
||||||
return(nullptr);
|
if(CreateSwapchainColorTexture())
|
||||||
|
if(CreateSwapchainDepthTexture())
|
||||||
|
return(true);
|
||||||
|
|
||||||
if(!CreateSwapchainColorTexture())
|
delete swapchain;
|
||||||
return(nullptr);
|
swapchain=nullptr;
|
||||||
|
|
||||||
if(!CreateSwapchainDepthTexture())
|
return(false);
|
||||||
return(nullptr);
|
|
||||||
|
|
||||||
return sc.Finish();
|
|
||||||
}
|
}
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
@ -92,7 +92,7 @@ Texture2D *Device::CreateTexture2D(const VkFormat format,uint32_t width,uint32_t
|
|||||||
|
|
||||||
ImageView *iv=CreateImageView2D(attr->device,format,ext,aspectMask,img);
|
ImageView *iv=CreateImageView2D(attr->device,format,ext,aspectMask,img);
|
||||||
|
|
||||||
return CreateTexture2D(format,width,height,aspectMask,usage,image_layout,linear);
|
return CreateTexture2D(mem,img,iv,image_layout,linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture2D *Device::CreateTexture2D(const VkFormat format,Buffer *buf,uint32_t width,uint32_t height,const VkImageAspectFlags aspectMask,const uint usage,const VkImageLayout image_layout,const bool linear)
|
Texture2D *Device::CreateTexture2D(const VkFormat format,Buffer *buf,uint32_t width,uint32_t height,const VkImageAspectFlags aspectMask,const uint usage,const VkImageLayout image_layout,const bool linear)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user