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