mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-19 22:01:14 +00:00
miniwin: Compartmentalize EnumDevices (#222)
This compartmentalizes everything to a corresponding function for each renderer backend.
This commit is contained in:
parent
2affbdfcc7
commit
1ab11ed091
@ -223,14 +223,8 @@ void EnumDevice(LPD3DENUMDEVICESCALLBACK cb, void* ctx, Direct3DRMRenderer* devi
|
|||||||
|
|
||||||
HRESULT DirectDrawImpl::EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
|
HRESULT DirectDrawImpl::EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
|
||||||
{
|
{
|
||||||
Direct3DRMRenderer* device = Direct3DRMSDL3GPURenderer::Create(640, 480);
|
Direct3DRMSDL3GPU_EnumDevice(cb, ctx);
|
||||||
if (device) {
|
Direct3DRMSoftware_EnumDevice(cb, ctx);
|
||||||
EnumDevice(cb, ctx, device, SDL3_GPU_GUID);
|
|
||||||
delete device;
|
|
||||||
}
|
|
||||||
device = new Direct3DRMSoftwareRenderer(640, 480);
|
|
||||||
EnumDevice(cb, ctx, device, SOFTWARE_GUID);
|
|
||||||
delete device;
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "d3drmrenderer.h"
|
#include "d3drmrenderer.h"
|
||||||
|
#include "ddraw_impl.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
@ -60,3 +61,12 @@ class Direct3DRMSDL3GPURenderer : public Direct3DRMRenderer {
|
|||||||
SDL_GPUBuffer* m_vertexBuffer = nullptr;
|
SDL_GPUBuffer* m_vertexBuffer = nullptr;
|
||||||
SDL_Surface* m_renderedImage = nullptr;
|
SDL_Surface* m_renderedImage = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline static void Direct3DRMSDL3GPU_EnumDevice(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
|
||||||
|
{
|
||||||
|
Direct3DRMRenderer* device = Direct3DRMSDL3GPURenderer::Create(640, 480);
|
||||||
|
if (device) {
|
||||||
|
EnumDevice(cb, ctx, device, SDL3_GPU_GUID);
|
||||||
|
delete device;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "d3drmrenderer.h"
|
#include "d3drmrenderer.h"
|
||||||
#include "d3drmtexture_impl.h"
|
#include "d3drmtexture_impl.h"
|
||||||
|
#include "ddraw_impl.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@ -56,3 +57,11 @@ class Direct3DRMSoftwareRenderer : public Direct3DRMRenderer {
|
|||||||
float proj[4][4] = {0};
|
float proj[4][4] = {0};
|
||||||
std::vector<float> m_zBuffer;
|
std::vector<float> m_zBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline static void Direct3DRMSoftware_EnumDevice(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
|
||||||
|
{
|
||||||
|
Direct3DRMRenderer* device = nullptr;
|
||||||
|
device = new Direct3DRMSoftwareRenderer(640, 480);
|
||||||
|
EnumDevice(cb, ctx, device, SOFTWARE_GUID);
|
||||||
|
delete device;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "d3drmrenderer.h"
|
||||||
#include "miniwin/d3d.h"
|
#include "miniwin/d3d.h"
|
||||||
#include "miniwin/ddraw.h"
|
#include "miniwin/ddraw.h"
|
||||||
|
|
||||||
@ -43,3 +44,5 @@ struct DirectDrawImpl : public IDirectDraw2, public IDirect3D2 {
|
|||||||
HRESULT DirectDrawEnumerate(LPDDENUMCALLBACKA cb, void* context);
|
HRESULT DirectDrawEnumerate(LPDDENUMCALLBACKA cb, void* context);
|
||||||
|
|
||||||
HRESULT DirectDrawCreate(LPGUID lpGuid, LPDIRECTDRAW* lplpDD, IUnknown* pUnkOuter);
|
HRESULT DirectDrawCreate(LPGUID lpGuid, LPDIRECTDRAW* lplpDD, IUnknown* pUnkOuter);
|
||||||
|
|
||||||
|
void EnumDevice(LPD3DENUMDEVICESCALLBACK cb, void* ctx, Direct3DRMRenderer* device, GUID deviceGuid);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user