mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
Plug leaks until Information Center, detected by the LeakSanitizer (#764)
Some checks are pending
CI / clang-format (push) Waiting to run
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Waiting to run
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Waiting to run
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Waiting to run
CI / C++ (push) Waiting to run
CI / Release (push) Blocked by required conditions
Docker / Publish web port (push) Waiting to run
Some checks are pending
CI / clang-format (push) Waiting to run
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Waiting to run
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Waiting to run
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Waiting to run
CI / C++ (push) Waiting to run
CI / Release (push) Blocked by required conditions
Docker / Publish web port (push) Waiting to run
This commit is contained in:
parent
945d868644
commit
e4690a57b8
@ -483,6 +483,7 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
|||||||
if (device && !device->ConvertEventToRenderCoordinates(event)) {
|
if (device && !device->ConvertEventToRenderCoordinates(event)) {
|
||||||
SDL_Log("Failed to convert event coordinates: %s", SDL_GetError());
|
SDL_Log("Failed to convert event coordinates: %s", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
device->Release();
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
Emscripten_ConvertEventToRenderCoordinates(event);
|
Emscripten_ConvertEventToRenderCoordinates(event);
|
||||||
|
|||||||
@ -155,6 +155,11 @@ void LegoOmni::Destroy()
|
|||||||
m_transitionManager = NULL;
|
m_transitionManager = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_videoManager) {
|
||||||
|
delete m_videoManager;
|
||||||
|
m_videoManager = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
m_action.ClearAtom();
|
m_action.ClearAtom();
|
||||||
DestroyScripts();
|
DestroyScripts();
|
||||||
|
|
||||||
|
|||||||
@ -54,6 +54,8 @@ LegoVideoManager::LegoVideoManager()
|
|||||||
m_unk0xe5 = FALSE;
|
m_unk0xe5 = FALSE;
|
||||||
m_unk0x554 = FALSE;
|
m_unk0x554 = FALSE;
|
||||||
m_paused = FALSE;
|
m_paused = FALSE;
|
||||||
|
m_camera = NULL;
|
||||||
|
m_appdata = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1007ab40
|
// FUNCTION: LEGO1 0x1007ab40
|
||||||
@ -237,6 +239,11 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
|||||||
// FUNCTION: BETA10 0x100d6816
|
// FUNCTION: BETA10 0x100d6816
|
||||||
void LegoVideoManager::Destroy()
|
void LegoVideoManager::Destroy()
|
||||||
{
|
{
|
||||||
|
if (m_camera != NULL) {
|
||||||
|
m_camera->Release();
|
||||||
|
m_camera = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_cursorSurface != NULL) {
|
if (m_cursorSurface != NULL) {
|
||||||
m_cursorSurface->Release();
|
m_cursorSurface->Release();
|
||||||
m_cursorSurface = NULL;
|
m_cursorSurface = NULL;
|
||||||
@ -264,6 +271,12 @@ void LegoVideoManager::Destroy()
|
|||||||
|
|
||||||
delete m_3dManager;
|
delete m_3dManager;
|
||||||
MxVideoManager::Destroy();
|
MxVideoManager::Destroy();
|
||||||
|
|
||||||
|
if (m_direct3d != NULL) {
|
||||||
|
delete m_direct3d;
|
||||||
|
m_direct3d = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
delete m_phonemeRefList;
|
delete m_phonemeRefList;
|
||||||
delete m_stopWatch;
|
delete m_stopWatch;
|
||||||
}
|
}
|
||||||
@ -677,6 +690,7 @@ int LegoVideoManager::EnableRMDevice()
|
|||||||
d3drmDev2->SetDither(m_dither);
|
d3drmDev2->SetDither(m_dither);
|
||||||
d3drmDev2->SetBufferCount(m_bufferCount);
|
d3drmDev2->SetBufferCount(m_bufferCount);
|
||||||
m_camera->Release();
|
m_camera->Release();
|
||||||
|
m_camera = nullptr;
|
||||||
|
|
||||||
if (viewport->AddDestroyCallback(ViewportDestroyCallback, m_appdata) == D3DRM_OK) {
|
if (viewport->AddDestroyCallback(ViewportDestroyCallback, m_appdata) == D3DRM_OK) {
|
||||||
((TglImpl::ViewImpl*) m_3dManager->GetLego3DView()->GetView())->SetImplementationData(viewport);
|
((TglImpl::ViewImpl*) m_3dManager->GetLego3DView()->GetView())->SetImplementationData(viewport);
|
||||||
|
|||||||
@ -57,19 +57,21 @@ BOOL LegoView::Create(const TglSurface::CreateStruct& rCreateStruct, Tgl::Render
|
|||||||
viewAngle = 90;
|
viewAngle = 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(!m_pScene);
|
||||||
m_pScene = pRenderer->CreateGroup();
|
m_pScene = pRenderer->CreateGroup();
|
||||||
assert(m_pScene);
|
assert(m_pScene);
|
||||||
// TglSurface::Create() calls CreateView(), and we need the camera in
|
// TglSurface::Create() calls CreateView(), and we need the camera in
|
||||||
// CreateView(), so create camera before calling TglSurface::Create()
|
// CreateView(), so create camera before calling TglSurface::Create()
|
||||||
|
assert(!m_pCamera);
|
||||||
m_pCamera = pRenderer->CreateCamera();
|
m_pCamera = pRenderer->CreateCamera();
|
||||||
assert(m_pCamera);
|
assert(m_pCamera);
|
||||||
|
|
||||||
if (!TglSurface::Create(rCreateStruct, pRenderer, m_pScene)) {
|
if (!TglSurface::Create(rCreateStruct, pRenderer, m_pScene)) {
|
||||||
delete m_pScene;
|
delete m_pScene;
|
||||||
m_pScene = 0;
|
m_pScene = NULL;
|
||||||
|
|
||||||
delete m_pCamera;
|
delete m_pCamera;
|
||||||
m_pCamera = 0;
|
m_pCamera = NULL;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -96,10 +98,10 @@ Tgl::View* LegoView::CreateView(Tgl::Renderer* pRenderer, Tgl::Device* pDevice)
|
|||||||
void LegoView::Destroy()
|
void LegoView::Destroy()
|
||||||
{
|
{
|
||||||
delete m_pScene;
|
delete m_pScene;
|
||||||
m_pScene = 0;
|
m_pScene = NULL;
|
||||||
|
|
||||||
delete m_pCamera;
|
delete m_pCamera;
|
||||||
m_pCamera = 0;
|
m_pCamera = NULL;
|
||||||
|
|
||||||
TglSurface::Destroy();
|
TglSurface::Destroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,6 +86,9 @@ BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer,
|
|||||||
int textureColorCount = -1;
|
int textureColorCount = -1;
|
||||||
Result result;
|
Result result;
|
||||||
|
|
||||||
|
assert(!m_pRenderer);
|
||||||
|
assert(!m_pScene);
|
||||||
|
assert(!m_pDevice);
|
||||||
m_pRenderer = pRenderer;
|
m_pRenderer = pRenderer;
|
||||||
m_pScene = pScene;
|
m_pScene = pScene;
|
||||||
m_pDevice = m_pRenderer->CreateDevice(createData);
|
m_pDevice = m_pRenderer->CreateDevice(createData);
|
||||||
@ -145,6 +148,7 @@ BOOL TglSurface::Create(const CreateStruct& rCreateStruct, Renderer* pRenderer,
|
|||||||
m_width = m_pDevice->GetWidth();
|
m_width = m_pDevice->GetWidth();
|
||||||
m_height = m_pDevice->GetHeight();
|
m_height = m_pDevice->GetHeight();
|
||||||
|
|
||||||
|
assert(!m_pView);
|
||||||
m_pView = CreateView(m_pRenderer, m_pDevice);
|
m_pView = CreateView(m_pRenderer, m_pDevice);
|
||||||
if (!m_pView) {
|
if (!m_pView) {
|
||||||
delete m_pDevice;
|
delete m_pDevice;
|
||||||
|
|||||||
@ -139,6 +139,7 @@ BOOL MxDirect3D::D3DCreate()
|
|||||||
Error("Creation of IDirect3D failed", result);
|
Error("Creation of IDirect3D failed", result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
m_pDirect3d->Release();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,6 +182,7 @@ BOOL MxDirect3D::D3DSetMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
LPDIRECTDRAWSURFACE backBuf = BackBuffer();
|
LPDIRECTDRAWSURFACE backBuf = BackBuffer();
|
||||||
|
assert(!m_pDirect3dDevice);
|
||||||
HRESULT result = m_pDirect3d->CreateDevice(m_currentDeviceInfo->m_guid, backBuf, &m_pDirect3dDevice);
|
HRESULT result = m_pDirect3d->CreateDevice(m_currentDeviceInfo->m_guid, backBuf, &m_pDirect3dDevice);
|
||||||
|
|
||||||
if (result != DD_OK) {
|
if (result != DD_OK) {
|
||||||
|
|||||||
@ -275,6 +275,10 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
if (miniwind3d) {
|
||||||
|
miniwind3d->Release();
|
||||||
|
}
|
||||||
|
|
||||||
if (lpDirect3d2) {
|
if (lpDirect3d2) {
|
||||||
lpDirect3d2->Release();
|
lpDirect3d2->Release();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,10 +57,10 @@ class MxMediaPresenter : public MxPresenter {
|
|||||||
// MxMediaPresenter::`scalar deleting destructor'
|
// MxMediaPresenter::`scalar deleting destructor'
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MxDSSubscriber* m_subscriber; // 0x40
|
MxDSSubscriber* m_subscriber = NULL; // 0x40
|
||||||
MxStreamChunkList* m_loopingChunks; // 0x44
|
MxStreamChunkList* m_loopingChunks = NULL; // 0x44
|
||||||
MxStreamChunkListCursor* m_loopingChunkCursor; // 0x48
|
MxStreamChunkListCursor* m_loopingChunkCursor = NULL; // 0x48
|
||||||
MxStreamChunk* m_currentChunk; // 0x4c
|
MxStreamChunk* m_currentChunk = NULL; // 0x4c
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void Destroy(MxBool p_fromDestructor);
|
void Destroy(MxBool p_fromDestructor);
|
||||||
|
|||||||
@ -13,13 +13,13 @@ void MxSoundPresenter::Destroy(MxBool p_fromDestructor)
|
|||||||
MSoundManager()->UnregisterPresenter(*this);
|
MSoundManager()->UnregisterPresenter(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ENTER(m_criticalSection);
|
|
||||||
MxMediaPresenter::Init();
|
|
||||||
m_criticalSection.Leave();
|
|
||||||
|
|
||||||
if (!p_fromDestructor) {
|
if (!p_fromDestructor) {
|
||||||
MxMediaPresenter::Destroy(FALSE);
|
MxMediaPresenter::Destroy(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENTER(m_criticalSection);
|
||||||
|
MxMediaPresenter::Init();
|
||||||
|
m_criticalSection.Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100b1aa0
|
// FUNCTION: LEGO1 0x100b1aa0
|
||||||
|
|||||||
@ -16,6 +16,12 @@ DECOMP_SIZE_ASSERT(MxStreamChunkListCursor, 0x10);
|
|||||||
// FUNCTION: LEGO1 0x100b54e0
|
// FUNCTION: LEGO1 0x100b54e0
|
||||||
void MxMediaPresenter::Init()
|
void MxMediaPresenter::Init()
|
||||||
{
|
{
|
||||||
|
if (this->m_loopingChunks) {
|
||||||
|
delete m_loopingChunks;
|
||||||
|
}
|
||||||
|
if (this->m_loopingChunkCursor) {
|
||||||
|
delete this->m_loopingChunkCursor;
|
||||||
|
}
|
||||||
this->m_subscriber = NULL;
|
this->m_subscriber = NULL;
|
||||||
this->m_loopingChunks = NULL;
|
this->m_loopingChunks = NULL;
|
||||||
this->m_loopingChunkCursor = NULL;
|
this->m_loopingChunkCursor = NULL;
|
||||||
@ -38,6 +44,7 @@ void MxMediaPresenter::Destroy(MxBool p_fromDestructor)
|
|||||||
|
|
||||||
if (m_loopingChunkCursor) {
|
if (m_loopingChunkCursor) {
|
||||||
delete m_loopingChunkCursor;
|
delete m_loopingChunkCursor;
|
||||||
|
m_loopingChunkCursor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_loopingChunks) {
|
if (m_loopingChunks) {
|
||||||
@ -49,6 +56,7 @@ void MxMediaPresenter::Destroy(MxBool p_fromDestructor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete m_loopingChunks;
|
delete m_loopingChunks;
|
||||||
|
m_loopingChunks = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
@ -106,6 +114,12 @@ MxResult MxMediaPresenter::StartAction(MxStreamController* p_controller, MxDSAct
|
|||||||
|
|
||||||
if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) {
|
if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) {
|
||||||
if (m_action->GetFlags() & MxDSAction::c_looping) {
|
if (m_action->GetFlags() & MxDSAction::c_looping) {
|
||||||
|
if (m_loopingChunks) {
|
||||||
|
delete m_loopingChunks;
|
||||||
|
}
|
||||||
|
if (m_loopingChunkCursor) {
|
||||||
|
delete m_loopingChunkCursor;
|
||||||
|
}
|
||||||
m_loopingChunks = new MxStreamChunkList;
|
m_loopingChunks = new MxStreamChunkList;
|
||||||
m_loopingChunkCursor = new MxStreamChunkListCursor(m_loopingChunks);
|
m_loopingChunkCursor = new MxStreamChunkListCursor(m_loopingChunks);
|
||||||
|
|
||||||
|
|||||||
@ -54,10 +54,8 @@ ViewportAppData::~ViewportAppData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
refCount = pChildFrames->Release();
|
refCount = pChildFrames->Release();
|
||||||
assert(refCount == 0);
|
|
||||||
|
|
||||||
refCount = m_pLightFrame->Release();
|
refCount = m_pLightFrame->Release();
|
||||||
assert(refCount == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forward declare to satisfy order check
|
// Forward declare to satisfy order check
|
||||||
|
|||||||
@ -545,11 +545,11 @@ ViewROI* ViewManager::Pick(Tgl::View* p_view, int x, int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
visual->Release();
|
|
||||||
frameArray->Release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
visual->Release();
|
||||||
|
frameArray->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
picked->Release();
|
picked->Release();
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#include "miniwin.h"
|
#include "miniwin.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
@ -349,6 +350,7 @@ Direct3DRMSDL3GPURenderer::Direct3DRMSDL3GPURenderer(
|
|||||||
|
|
||||||
Direct3DRMSDL3GPURenderer::~Direct3DRMSDL3GPURenderer()
|
Direct3DRMSDL3GPURenderer::~Direct3DRMSDL3GPURenderer()
|
||||||
{
|
{
|
||||||
|
assert(m_refCount == 0);
|
||||||
SDL_ReleaseGPUBuffer(m_device, m_uiMeshCache.vertexBuffer);
|
SDL_ReleaseGPUBuffer(m_device, m_uiMeshCache.vertexBuffer);
|
||||||
SDL_ReleaseGPUBuffer(m_device, m_uiMeshCache.indexBuffer);
|
SDL_ReleaseGPUBuffer(m_device, m_uiMeshCache.indexBuffer);
|
||||||
SDL_ReleaseWindowFromGPUDevice(m_device, DDWindow);
|
SDL_ReleaseWindowFromGPUDevice(m_device, DDWindow);
|
||||||
@ -717,6 +719,9 @@ SDL_GPUTransferBuffer* Direct3DRMSDL3GPURenderer::GetUploadBuffer(size_t size)
|
|||||||
|
|
||||||
void Direct3DRMSDL3GPURenderer::StartRenderPass(float r, float g, float b, bool clear)
|
void Direct3DRMSDL3GPURenderer::StartRenderPass(float r, float g, float b, bool clear)
|
||||||
{
|
{
|
||||||
|
if (m_cmdbuf != nullptr) {
|
||||||
|
SDL_CancelGPUCommandBuffer(m_cmdbuf);
|
||||||
|
}
|
||||||
m_cmdbuf = SDL_AcquireGPUCommandBuffer(m_device);
|
m_cmdbuf = SDL_AcquireGPUCommandBuffer(m_device);
|
||||||
if (!m_cmdbuf) {
|
if (!m_cmdbuf) {
|
||||||
SDL_LogError(
|
SDL_LogError(
|
||||||
|
|||||||
@ -9,10 +9,12 @@
|
|||||||
#include "miniwin/miniwindevice.h"
|
#include "miniwin/miniwindevice.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
Direct3DRMDevice2Impl::Direct3DRMDevice2Impl(DWORD width, DWORD height, Direct3DRMRenderer* renderer)
|
Direct3DRMDevice2Impl::Direct3DRMDevice2Impl(DWORD width, DWORD height, Direct3DRMRenderer* renderer)
|
||||||
: m_virtualWidth(width), m_virtualHeight(height), m_renderer(renderer), m_viewports(new Direct3DRMViewportArrayImpl)
|
: m_virtualWidth(width), m_virtualHeight(height), m_renderer(renderer), m_viewports(new Direct3DRMViewportArrayImpl)
|
||||||
{
|
{
|
||||||
|
m_renderer->AddRef();
|
||||||
Resize();
|
Resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +27,7 @@ Direct3DRMDevice2Impl::~Direct3DRMDevice2Impl()
|
|||||||
viewport->Release();
|
viewport->Release();
|
||||||
}
|
}
|
||||||
m_viewports->Release();
|
m_viewports->Release();
|
||||||
delete m_renderer;
|
m_renderer->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT Direct3DRMDevice2Impl::QueryInterface(const GUID& riid, void** ppvObject)
|
HRESULT Direct3DRMDevice2Impl::QueryInterface(const GUID& riid, void** ppvObject)
|
||||||
@ -161,7 +163,9 @@ void Direct3DRMDevice2Impl::Resize()
|
|||||||
for (int i = 0; i < m_viewports->GetSize(); i++) {
|
for (int i = 0; i < m_viewports->GetSize(); i++) {
|
||||||
IDirect3DRMViewport* viewport;
|
IDirect3DRMViewport* viewport;
|
||||||
m_viewports->GetElement(i, &viewport);
|
m_viewports->GetElement(i, &viewport);
|
||||||
|
assert(viewport);
|
||||||
static_cast<Direct3DRMViewportImpl*>(viewport)->UpdateProjectionMatrix();
|
static_cast<Direct3DRMViewportImpl*>(viewport)->UpdateProjectionMatrix();
|
||||||
|
viewport->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,11 +10,8 @@
|
|||||||
Direct3DRMFrameImpl::Direct3DRMFrameImpl(Direct3DRMFrameImpl* parent)
|
Direct3DRMFrameImpl::Direct3DRMFrameImpl(Direct3DRMFrameImpl* parent)
|
||||||
{
|
{
|
||||||
m_children = new Direct3DRMFrameArrayImpl;
|
m_children = new Direct3DRMFrameArrayImpl;
|
||||||
m_children->AddRef();
|
|
||||||
m_lights = new Direct3DRMLightArrayImpl;
|
m_lights = new Direct3DRMLightArrayImpl;
|
||||||
m_lights->AddRef();
|
|
||||||
m_visuals = new Direct3DRMVisualArrayImpl;
|
m_visuals = new Direct3DRMVisualArrayImpl;
|
||||||
m_visuals->AddRef();
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent->AddChild(this);
|
parent->AddChild(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,6 +176,9 @@ HRESULT Direct3DRMMeshImpl::SetGroupTexture(D3DRMGROUPINDEX groupIndex, IDirect3
|
|||||||
}
|
}
|
||||||
|
|
||||||
texture->AddRef();
|
texture->AddRef();
|
||||||
|
if (group.texture) {
|
||||||
|
group.texture->Release();
|
||||||
|
}
|
||||||
group.texture = texture;
|
group.texture = texture;
|
||||||
group.version++;
|
group.version++;
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
|
|||||||
@ -19,6 +19,14 @@ Direct3DRMViewportImpl::Direct3DRMViewportImpl(DWORD width, DWORD height, Direct
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Direct3DRMViewportImpl::~Direct3DRMViewportImpl()
|
||||||
|
{
|
||||||
|
if (m_camera) {
|
||||||
|
m_camera->Release();
|
||||||
|
m_camera = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void D3DRMMatrixMultiply(D3DRMMATRIX4D out, const D3DRMMATRIX4D a, const D3DRMMATRIX4D b)
|
static void D3DRMMatrixMultiply(D3DRMMATRIX4D out, const D3DRMMATRIX4D a, const D3DRMMATRIX4D b)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
@ -374,12 +382,12 @@ HRESULT Direct3DRMViewportImpl::Clear()
|
|||||||
|
|
||||||
HRESULT Direct3DRMViewportImpl::SetCamera(IDirect3DRMFrame* camera)
|
HRESULT Direct3DRMViewportImpl::SetCamera(IDirect3DRMFrame* camera)
|
||||||
{
|
{
|
||||||
if (m_camera) {
|
|
||||||
m_camera->Release();
|
|
||||||
}
|
|
||||||
if (camera) {
|
if (camera) {
|
||||||
camera->AddRef();
|
camera->AddRef();
|
||||||
}
|
}
|
||||||
|
if (m_camera) {
|
||||||
|
m_camera->Release();
|
||||||
|
}
|
||||||
m_camera = camera;
|
m_camera = camera;
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -131,7 +131,7 @@ inline static void Direct3DRMSDL3GPU_EnumDevice(LPD3DENUMDEVICESCALLBACK cb, voi
|
|||||||
if (!device) {
|
if (!device) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delete device;
|
device->Release();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
D3DDEVICEDESC halDesc = {};
|
D3DDEVICEDESC halDesc = {};
|
||||||
|
|||||||
@ -21,6 +21,7 @@ class Direct3DRMFrameImpl;
|
|||||||
|
|
||||||
struct Direct3DRMViewportImpl : public Direct3DRMObjectBaseImpl<IDirect3DRMViewport> {
|
struct Direct3DRMViewportImpl : public Direct3DRMObjectBaseImpl<IDirect3DRMViewport> {
|
||||||
Direct3DRMViewportImpl(DWORD width, DWORD height, Direct3DRMRenderer* renderer);
|
Direct3DRMViewportImpl(DWORD width, DWORD height, Direct3DRMRenderer* renderer);
|
||||||
|
~Direct3DRMViewportImpl() override;
|
||||||
HRESULT Render(IDirect3DRMFrame* group) override;
|
HRESULT Render(IDirect3DRMFrame* group) override;
|
||||||
/**
|
/**
|
||||||
* @brief Blit the render back to our backbuffer
|
* @brief Blit the render back to our backbuffer
|
||||||
|
|||||||
@ -2,16 +2,19 @@
|
|||||||
#include "miniwin/ddraw.h"
|
#include "miniwin/ddraw.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
#include <cassert>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
ULONG IUnknown::AddRef()
|
ULONG IUnknown::AddRef()
|
||||||
{
|
{
|
||||||
|
assert(m_refCount > 0);
|
||||||
m_refCount += 1;
|
m_refCount += 1;
|
||||||
return m_refCount;
|
return m_refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG IUnknown::Release()
|
ULONG IUnknown::Release()
|
||||||
{
|
{
|
||||||
|
assert(m_refCount > 0);
|
||||||
m_refCount -= 1;
|
m_refCount -= 1;
|
||||||
if (m_refCount == 0) {
|
if (m_refCount == 0) {
|
||||||
delete this;
|
delete this;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user