Skip to content

Commit

Permalink
MorphOS: add 3D detection on Monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
BeWorld2018 committed Oct 10, 2023
1 parent 9a15e0d commit 210b0f2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/video/morphos/SDL_mosmodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,29 @@ static const struct
{ PIXFMT_RGBA32, SDL_PIXELFORMAT_RGBA8888 },
};

SDL_bool
MOS_MonitorHas3D(APTR monitor, Uint32 fmt) {

SDL_bool has3D = SDL_FALSE;
ULONG state = 0;
DoMethod(monitor, MM_Query3DSupport, fmt, &state);

switch (state)
{

case MSQUERY3D_HWDRIVER:
has3D = SDL_TRUE;
D("[%s] MSQUERY3D_HWDRIVER\n", __FUNCTION__);
break;
default:
D("[%s] PAS DE 3D\n", __FUNCTION__);
has3D = SDL_FALSE;
break;

}
return has3D;
}

int
MOS_InitModes(_THIS)
{
Expand Down Expand Up @@ -176,7 +199,9 @@ MOS_InitModes(_THIS)

if (modedata) {
modedata->monitor = mon;

//3D support

modedata->has3D = MOS_MonitorHas3D(mon, getv(s, SA_PixelFormat));
mode.format = pixfmt;
mode.w = width;
mode.h = height;
Expand Down Expand Up @@ -224,6 +249,7 @@ MOS_InitModes(_THIS)
}

modedata->monitor = m;
modedata->has3D = MOS_MonitorHas3D(mon, getv(m, SA_PixelFormat));

display.desktop_mode = mode;
display.current_mode = mode;
Expand Down
1 change: 1 addition & 0 deletions src/video/morphos/SDL_mosmodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
typedef struct
{
APTR monitor;
SDL_bool has3D;
} SDL_DisplayModeData;

extern int MOS_InitModes(_THIS);
Expand Down

0 comments on commit 210b0f2

Please sign in to comment.