Skip to content

Commit

Permalink
Use MemBuffer instead of std::array on the stack as buffer.
Browse files Browse the repository at this point in the history
As Wouter analyzed: Commit 39f7692 changed this:
-               std::array<uint32_t, 512 * 256> pixels;
+               std::array<uint32_t, 512 * 256 * 2> pixels; // max size:  512*256*2  or  256*256*4
In other words: it increases the size of a stack-array from 512kB to 1MB.
Apparently on windows the stack is very limited(?), and this change pushes the total stack size over the limit?

So, herewith, we put the buffer on the heap using the MemBuffer class. Let's hope it helps...
  • Loading branch information
MBilderbeek committed May 13, 2024
1 parent 244eabd commit 257e7b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/imgui/ImGuiBitmapViewer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "VDP.hh"
#include "VDPVRAM.hh"

#include "MemBuffer.hh"
#include "ranges.hh"

#include <imgui.h>
Expand Down Expand Up @@ -159,7 +160,7 @@ void ImGuiBitmapViewer::paint(MSXMotherBoard* motherBoard)
[](uint16_t msx) { return ImGuiPalette::toRGBA(msx); });
if (color0 < 16) palette[0] = palette[color0];

std::array<uint32_t, 512 * 256 * 2> pixels; // max size: 512*256*2 or 256*256*4
MemBuffer<uint32_t> pixels(512 * 256 * 2); // max size: 512*256*2 or 256*256*4
renderBitmap(vram.getData(), palette, mode, height, page,
pixels.data());
if (!bitmapTex) {
Expand Down

0 comments on commit 257e7b1

Please sign in to comment.