Permalink
Browse files

GPU: Fix possible crash by properly initializing working capture buff…

…ers. (Regression from commit 28f5c3a.)
  • Loading branch information...
rogerman committed Jul 8, 2017
1 parent 652af9e commit 63b232c1b8a94bb3dec559707d29f81749f69fc5
Showing with 6 additions and 0 deletions.
  1. +6 −0 desmume/src/GPU.cpp
View
@@ -5108,13 +5108,17 @@ GPUEngineA::GPUEngineA()
_3DFramebufferRGBA6665 = (FragmentColor *)malloc_alignedCacheLine(GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(FragmentColor));
_3DFramebufferRGBA5551 = (u16 *)malloc_alignedCacheLine(GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(u16));
_captureWorkingA16 = (u16 *)malloc_alignedCacheLine(GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16));
_captureWorkingB16 = (u16 *)malloc_alignedCacheLine(GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16));
gfx3d_Update3DFramebuffers(_3DFramebufferRGBA6665, _3DFramebufferRGBA5551);
}
GPUEngineA::~GPUEngineA()
{
free_aligned(this->_3DFramebufferRGBA6665);
free_aligned(this->_3DFramebufferRGBA5551);
free_aligned(this->_captureWorkingA16);
free_aligned(this->_captureWorkingB16);
gfx3d_Update3DFramebuffers(NULL, NULL);
}
@@ -5164,6 +5168,8 @@ void GPUEngineA::Reset()
memset(this->_3DFramebufferRGBA6665, 0, dispInfo.customWidth * dispInfo.customHeight * sizeof(FragmentColor));
memset(this->_3DFramebufferRGBA5551, 0, dispInfo.customWidth * dispInfo.customHeight * sizeof(u16));
memset(this->_captureWorkingA16, 0, dispInfo.customWidth * _gpuLargestDstLineCount * sizeof(u16));
memset(this->_captureWorkingB16, 0, dispInfo.customWidth * _gpuLargestDstLineCount * sizeof(u16));
}
void GPUEngineA::ResetCaptureLineStates()

0 comments on commit 63b232c

Please sign in to comment.