- don't map the frame buffer memory every frame when doing software rendering

This commit is contained in:
Magnus Norddahl 2019-11-23 12:09:05 +01:00
parent 8abbd63427
commit bff22bbd81
2 changed files with 11 additions and 2 deletions

View File

@ -69,6 +69,12 @@ void VkHardwareTexture::Reset()
{
ResetDescriptors();
if (mappedSWFB)
{
mImage.Image->Unmap();
mappedSWFB = nullptr;
}
auto &deleteList = fb->FrameDeleteList;
if (mImage.Image) deleteList.Images.push_back(std::move(mImage.Image));
if (mImage.View) deleteList.ImageViews.push_back(std::move(mImage.View));
@ -348,12 +354,13 @@ void VkHardwareTexture::AllocateBuffer(int w, int h, int texelsize)
uint8_t *VkHardwareTexture::MapBuffer()
{
return (uint8_t*)mImage.Image->Map(0, mImage.Image->width * mImage.Image->height * mTexelsize);
if (!mappedSWFB)
mappedSWFB = (uint8_t*)mImage.Image->Map(0, mImage.Image->width * mImage.Image->height * mTexelsize);
return mappedSWFB;
}
unsigned int VkHardwareTexture::CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const char *name)
{
mImage.Image->Unmap();
return 0;
}

View File

@ -77,4 +77,6 @@ private:
int mTexelsize = 4;
VkTextureImage mDepthStencil;
uint8_t* mappedSWFB = nullptr;
};