mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-02 20:11:15 +00:00
Cleanup
This commit is contained in:
parent
11316f5699
commit
426958bf7b
@ -912,11 +912,7 @@ MxResult IsleApp::SetupWindow()
|
||||
#endif
|
||||
|
||||
window = SDL_CreateWindowWithProperties(props);
|
||||
|
||||
SDL_SetPointerProperty(SDL_GetWindowProperties(window), ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM, &m_videoParam);
|
||||
MxVideoParam* p = (MxVideoParam*)
|
||||
SDL_GetPointerProperty(SDL_GetWindowProperties(window), ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM, nullptr);
|
||||
SDL_Log("MSAA WINDOW: %p %d", p, (p)->GetMSAASamples());
|
||||
|
||||
if (m_exclusiveFullScreen && m_fullScreen) {
|
||||
SDL_DisplayMode closestMode;
|
||||
|
||||
@ -148,8 +148,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
p_videoParam.GetRect().GetHeight(),
|
||||
bits,
|
||||
paletteEntries,
|
||||
sizeof(paletteEntries) / sizeof(paletteEntries[0]),
|
||||
p_videoParam.GetMSAASamples()
|
||||
sizeof(paletteEntries) / sizeof(paletteEntries[0])
|
||||
)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxDirect3D::Create failed");
|
||||
goto done;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#include "mxdirect3d.h"
|
||||
|
||||
#include "mxvideoparam.h"
|
||||
|
||||
#include <SDL3/SDL.h> // for SDL_Log
|
||||
#include <assert.h>
|
||||
#include <miniwin/miniwind3d.h>
|
||||
@ -41,8 +43,7 @@ BOOL MxDirect3D::Create(
|
||||
int height,
|
||||
int bpp,
|
||||
const PALETTEENTRY* pPaletteEntries,
|
||||
int paletteEntryCount,
|
||||
DWORD msaaSamples
|
||||
int paletteEntryCount
|
||||
)
|
||||
{
|
||||
BOOL success = FALSE;
|
||||
@ -58,8 +59,7 @@ BOOL MxDirect3D::Create(
|
||||
height,
|
||||
bpp,
|
||||
pPaletteEntries,
|
||||
paletteEntryCount,
|
||||
msaaSamples
|
||||
paletteEntryCount
|
||||
)) {
|
||||
goto done;
|
||||
}
|
||||
@ -68,8 +68,14 @@ BOOL MxDirect3D::Create(
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (msaaSamples && m_pDirect3d->QueryInterface(IID_IDirect3DMiniwin, (void**) &miniwind3d) == S_OK) {
|
||||
miniwind3d->RequestMSAA(msaaSamples);
|
||||
if (m_pDirect3d->QueryInterface(IID_IDirect3DMiniwin, (void**) &miniwind3d) == DD_OK) {
|
||||
MxVideoParam* videoParam = (MxVideoParam*) SDL_GetPointerProperty(
|
||||
SDL_GetWindowProperties(reinterpret_cast<SDL_Window*>(hWnd)),
|
||||
ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM,
|
||||
nullptr
|
||||
);
|
||||
assert(videoParam);
|
||||
miniwind3d->RequestMSAA(videoParam->GetMSAASamples());
|
||||
}
|
||||
|
||||
if (!D3DSetMode()) {
|
||||
|
||||
@ -31,8 +31,7 @@ class MxDirect3D : public MxDirectDraw {
|
||||
int height,
|
||||
int bpp,
|
||||
const PALETTEENTRY* pPaletteEntries,
|
||||
int paletteEntryCount,
|
||||
DWORD msaaSamples
|
||||
int paletteEntryCount
|
||||
) override; // vtable+0x04
|
||||
void Destroy() override; // vtable+0x08
|
||||
void DestroyButNotDirectDraw() override; // vtable+0x0c
|
||||
|
||||
@ -91,8 +91,7 @@ BOOL MxDirectDraw::Create(
|
||||
int height,
|
||||
int bpp,
|
||||
const PALETTEENTRY* pPaletteEntries,
|
||||
int paletteEntryCount,
|
||||
DWORD msaaSamples
|
||||
int paletteEntryCount
|
||||
)
|
||||
{
|
||||
assert(m_currentDevInfo);
|
||||
|
||||
@ -33,8 +33,7 @@ class MxDirectDraw {
|
||||
int height,
|
||||
int bpp,
|
||||
const PALETTEENTRY* pPaletteEntries,
|
||||
int paletteEntryCount,
|
||||
DWORD msaaSamples
|
||||
int paletteEntryCount
|
||||
); // vtable+0x04
|
||||
virtual void Destroy(); // vtable+0x08
|
||||
virtual void DestroyButNotDirectDraw(); // vtable+0x0c
|
||||
|
||||
@ -258,7 +258,7 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc
|
||||
goto done;
|
||||
}
|
||||
|
||||
result = lpDirect3d2->EnumDevices(DevicesEnumerateCallback, miniwind3d);
|
||||
result = lpDirect3d2->EnumDevices(DevicesEnumerateCallback, this);
|
||||
|
||||
if (result != DD_OK) {
|
||||
BuildErrorString("D3D enum devices failed: %s\n", EnumerateErrorToString(result));
|
||||
|
||||
@ -301,7 +301,6 @@ OpenGLES2Renderer::OpenGLES2Renderer(
|
||||
m_virtualWidth = width;
|
||||
m_virtualHeight = height;
|
||||
m_requestedMsaaSamples = msaaSamples;
|
||||
SDL_Log("Requested MSAA %d", m_requestedMsaaSamples);
|
||||
ViewportTransform viewportTransform = {1.0f, 0.0f, 0.0f};
|
||||
Resize(width, height, viewportTransform);
|
||||
|
||||
@ -640,8 +639,9 @@ void OpenGLES2Renderer::Resize(int width, int height, const ViewportTransform& v
|
||||
}
|
||||
m_colorTarget = m_depthTarget = m_msaaColorRbo = m_msaaDepthRbo = 0;
|
||||
|
||||
GLint samples;
|
||||
GLint samples, maxSamples;
|
||||
glGetIntegerv(GL_SAMPLES, &samples);
|
||||
glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
|
||||
m_useMsaa = samples > 1;
|
||||
|
||||
if (m_useMsaa) {
|
||||
@ -663,14 +663,13 @@ void OpenGLES2Renderer::Resize(int width, int height, const ViewportTransform& v
|
||||
}
|
||||
}
|
||||
|
||||
if (m_useMsaa) {
|
||||
GLint max_samples;
|
||||
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
|
||||
SDL_Log("MSAA: ON! samples %d max samples %d", samples, max_samples);
|
||||
}
|
||||
else {
|
||||
SDL_Log("MSAA: OFF! %d %d", samples, m_requestedMsaaSamples);
|
||||
}
|
||||
SDL_Log(
|
||||
"MSAA is %s. Requested samples: %d, active samples: %d, max samples: %d",
|
||||
m_useMsaa ? "on" : "off",
|
||||
m_requestedMsaaSamples,
|
||||
samples,
|
||||
maxSamples
|
||||
);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
|
||||
|
||||
|
||||
@ -57,13 +57,13 @@ Direct3DRMRenderer* CreateDirect3DRMRenderer(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Direct3DRMRenderer_EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
|
||||
void Direct3DRMRenderer_EnumDevices(const IDirect3DMiniwin* d3d, LPD3DENUMDEVICESCALLBACK cb, void* ctx)
|
||||
{
|
||||
#ifdef USE_SDL_GPU
|
||||
Direct3DRMSDL3GPU_EnumDevice(cb, ctx);
|
||||
#endif
|
||||
#ifdef USE_OPENGLES2
|
||||
OpenGLES2Renderer_EnumDevice(cb, ctx);
|
||||
OpenGLES2Renderer_EnumDevice(d3d, cb, ctx);
|
||||
#endif
|
||||
#ifdef USE_OPENGL1
|
||||
OpenGL1Renderer_EnumDevice(cb, ctx);
|
||||
|
||||
@ -225,7 +225,7 @@ void EnumDevice(
|
||||
|
||||
HRESULT DirectDrawImpl::EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
|
||||
{
|
||||
Direct3DRMRenderer_EnumDevices(cb, ctx);
|
||||
Direct3DRMRenderer_EnumDevices(this, cb, ctx);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -67,4 +67,4 @@ Direct3DRMRenderer* CreateDirect3DRMRenderer(
|
||||
const DDSURFACEDESC& DDSDesc,
|
||||
const GUID* guid
|
||||
);
|
||||
void Direct3DRMRenderer_EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx);
|
||||
void Direct3DRMRenderer_EnumDevices(const IDirect3DMiniwin* d3d, LPD3DENUMDEVICESCALLBACK cb, void* ctx);
|
||||
|
||||
@ -97,12 +97,9 @@ class OpenGLES2Renderer : public Direct3DRMRenderer {
|
||||
ViewportTransform m_viewportTransform;
|
||||
};
|
||||
|
||||
inline static void OpenGLES2Renderer_EnumDevice(LPD3DENUMDEVICESCALLBACK cb, void* ctx)
|
||||
inline static void OpenGLES2Renderer_EnumDevice(const IDirect3DMiniwin* d3d, LPD3DENUMDEVICESCALLBACK cb, void* ctx)
|
||||
{
|
||||
IDirect3DMiniwin* miniwind3d = reinterpret_cast<IDirect3DMiniwin*>(ctx);
|
||||
SDL_assert(miniwind3d);
|
||||
|
||||
Direct3DRMRenderer* device = OpenGLES2Renderer::Create(640, 480, miniwind3d->GetMSAASamples());
|
||||
Direct3DRMRenderer* device = OpenGLES2Renderer::Create(640, 480, d3d->GetMSAASamples());
|
||||
if (!device) {
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user