- fix palette color problem

This commit is contained in:
Magnus Norddahl 2019-02-27 16:28:29 +01:00
parent 96547713d9
commit b4154f1772
2 changed files with 7 additions and 2 deletions

View file

@ -61,6 +61,7 @@ VulkanFrameBuffer::VulkanFrameBuffer(void *hMonitor, bool fullscreen, VulkanDevi
{ {
device = dev; device = dev;
SetViewportRects(nullptr); SetViewportRects(nullptr);
InitPalette();
} }
VulkanFrameBuffer::~VulkanFrameBuffer() VulkanFrameBuffer::~VulkanFrameBuffer()
@ -264,6 +265,8 @@ void VulkanFrameBuffer::SetVSync(bool vsync)
void VulkanFrameBuffer::CleanForRestart() void VulkanFrameBuffer::CleanForRestart()
{ {
// force recreation of the SW scene drawer to ensure it gets a new set of resources.
swdrawer.reset();
} }
IHardwareTexture *VulkanFrameBuffer::CreateHardwareTexture() IHardwareTexture *VulkanFrameBuffer::CreateHardwareTexture()

View file

@ -213,8 +213,10 @@ void VkHardwareTexture::AllocateBuffer(int w, int h, int texelsize)
{ {
auto fb = GetVulkanFrameBuffer(); auto fb = GetVulkanFrameBuffer();
VkFormat format = texelsize == 4 ? VK_FORMAT_B8G8R8A8_UNORM : VK_FORMAT_R8_UNORM;
ImageBuilder imgbuilder; ImageBuilder imgbuilder;
imgbuilder.setFormat(VK_FORMAT_B8G8R8A8_UNORM); imgbuilder.setFormat(format);
imgbuilder.setSize(w, h); imgbuilder.setSize(w, h);
imgbuilder.setUsage(VK_IMAGE_USAGE_SAMPLED_BIT, VMA_MEMORY_USAGE_CPU_TO_GPU); imgbuilder.setUsage(VK_IMAGE_USAGE_SAMPLED_BIT, VMA_MEMORY_USAGE_CPU_TO_GPU);
imgbuilder.setLinearTiling(); imgbuilder.setLinearTiling();
@ -223,7 +225,7 @@ void VkHardwareTexture::AllocateBuffer(int w, int h, int texelsize)
mTexelsize = texelsize; mTexelsize = texelsize;
ImageViewBuilder viewbuilder; ImageViewBuilder viewbuilder;
viewbuilder.setImage(mImage.get(), texelsize == 4 ? VK_FORMAT_B8G8R8A8_UNORM : VK_FORMAT_R8_UNORM); viewbuilder.setImage(mImage.get(), format);
mImageView = viewbuilder.create(fb->device); mImageView = viewbuilder.create(fb->device);
auto cmdbuffer = fb->GetUploadCommands(); auto cmdbuffer = fb->GetUploadCommands();