Skip to content
Permalink
Browse files

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

…endering
  • Loading branch information
dpjudas committed Nov 23, 2019
1 parent 8abbd63 commit bff22bbd812c815a5a2305420ffccc124ac1c18e
Showing with 11 additions and 2 deletions.
  1. +9 −2 src/rendering/vulkan/textures/vk_hwtexture.cpp
  2. +2 −0 src/rendering/vulkan/textures/vk_hwtexture.h
@@ -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;
}

@@ -77,4 +77,6 @@ class VkHardwareTexture : public IHardwareTexture
int mTexelsize = 4;

VkTextureImage mDepthStencil;

uint8_t* mappedSWFB = nullptr;
};

0 comments on commit bff22bb

Please sign in to comment.
You can’t perform that action at this time.