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