mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Reverting commit 6a225516 due to possible BSOD on AMD drivers
This commit is contained in:
parent
587af2c855
commit
7fe68a6e1e
@ -7,5 +7,4 @@ namespace Config
|
||||
const int delayedFlipModeTimeout = 200;
|
||||
const int maxPaletteUpdatesPerMs = 5;
|
||||
const int minExpectedFlipsPerSec = 5;
|
||||
const DWORD primarySurfaceExtraRows = 2;
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ namespace DDraw
|
||||
g_primarySurface = nullptr;
|
||||
g_origCaps = 0;
|
||||
s_palette = nullptr;
|
||||
s_surfaceBuffers.clear();
|
||||
ZeroMemory(&s_paletteEntries, sizeof(s_paletteEntries));
|
||||
ZeroMemory(&g_primarySurfaceDesc, sizeof(g_primarySurfaceDesc));
|
||||
|
||||
@ -197,40 +196,10 @@ namespace DDraw
|
||||
g_primarySurfaceDesc.dwSize = sizeof(g_primarySurfaceDesc);
|
||||
g_primarySurface->GetSurfaceDesc(g_primarySurface, &g_primarySurfaceDesc);
|
||||
|
||||
if (g_primarySurfaceDesc.ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
|
||||
{
|
||||
resizeBuffers();
|
||||
}
|
||||
|
||||
g_gdiResourceHandle = getResourceHandle(*g_primarySurface);
|
||||
D3dDdi::Device::setGdiResourceHandle(*reinterpret_cast<HANDLE*>(g_gdiResourceHandle));
|
||||
}
|
||||
|
||||
void PrimarySurface::resizeBuffers()
|
||||
{
|
||||
DDSCAPS2 flipCaps = {};
|
||||
flipCaps.dwCaps = DDSCAPS_FLIP;
|
||||
|
||||
DDSURFACEDESC2 desc = {};
|
||||
desc.dwSize = sizeof(desc);
|
||||
desc.dwFlags = DDSD_LPSURFACE;
|
||||
|
||||
const DWORD newBufferSize = g_primarySurfaceDesc.lPitch *
|
||||
(g_primarySurfaceDesc.dwHeight + Config::primarySurfaceExtraRows);
|
||||
|
||||
auto surfacePtr(CompatPtr<IDirectDrawSurface7>::from(g_primarySurface.get()));
|
||||
do
|
||||
{
|
||||
s_surfaceBuffers.push_back(std::vector<unsigned char>(newBufferSize));
|
||||
desc.lpSurface = s_surfaceBuffers.back().data();
|
||||
surfacePtr->SetSurfaceDesc(surfacePtr, &desc, 0);
|
||||
|
||||
CompatPtr<IDirectDrawSurface7> nextSurface;
|
||||
surfacePtr->GetAttachedSurface(surfacePtr, &flipCaps, &nextSurface.getRef());
|
||||
surfacePtr.swap(nextSurface);
|
||||
} while (surfacePtr && surfacePtr != g_primarySurface.get());
|
||||
}
|
||||
|
||||
void PrimarySurface::updatePalette()
|
||||
{
|
||||
if (s_palette)
|
||||
@ -242,5 +211,4 @@ namespace DDraw
|
||||
|
||||
CompatWeakPtr<IDirectDrawPalette> PrimarySurface::s_palette;
|
||||
PALETTEENTRY PrimarySurface::s_paletteEntries[256] = {};
|
||||
std::vector<std::vector<unsigned char>> PrimarySurface::s_surfaceBuffers;
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <ddraw.h>
|
||||
|
||||
#include "Common/CompatPtr.h"
|
||||
@ -39,10 +37,6 @@ namespace DDraw
|
||||
|
||||
virtual void createImpl() override;
|
||||
|
||||
static void resizeBuffers();
|
||||
|
||||
std::unique_ptr<Surface> m_surface;
|
||||
|
||||
static std::vector<std::vector<unsigned char>> s_surfaceBuffers;
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user