Skip to content

Commit 2da65bb

Browse files
committed
Followup to previous commit
1 parent 54329f4 commit 2da65bb

4 files changed

Lines changed: 53 additions & 41 deletions

File tree

gfx/common/d3d9_common.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,22 @@ void d3d9_make_d3dpp(d3d9_video_t *d3d,
336336
if (!windowed_enable)
337337
{
338338
#ifdef _XBOX
339+
/* Xbox: query the actual display size and publish it to
340+
* video_st. Use the same values directly for the d3dpp
341+
* back-buffer rather than reading them back via
342+
* video_driver_get_size (which would just return what we
343+
* just wrote -- nothing else writes video_st->width /
344+
* height except the video drivers themselves). */
339345
unsigned width = 0;
340346
unsigned height = 0;
341347
d3d9_get_video_size(d3d, &width, &height);
342348
video_driver_set_size(width, height);
343-
#endif
349+
d3dpp->BackBufferWidth = width;
350+
d3dpp->BackBufferHeight = height;
351+
#else
344352
video_driver_get_size(&d3dpp->BackBufferWidth,
345353
&d3dpp->BackBufferHeight);
354+
#endif
346355
}
347356

348357
#ifdef _XBOX

gfx/drivers/d3d8.c

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,14 +2104,23 @@ static void d3d8_make_d3dpp(void *data,
21042104
if (!windowed_enable)
21052105
{
21062106
#ifdef _XBOX
2107+
/* Xbox: query the actual display size and publish it to
2108+
* video_st. Use the same values directly for the d3dpp
2109+
* back-buffer rather than reading them back via
2110+
* video_driver_get_size (which would just return what we
2111+
* just wrote -- nothing else writes video_st->width /
2112+
* height except the video drivers themselves). */
21072113
unsigned width = 0;
21082114
unsigned height = 0;
21092115

21102116
d3d8_get_video_size(d3d, &width, &height);
21112117
video_driver_set_size(width, height);
2112-
#endif
2118+
d3dpp->BackBufferWidth = width;
2119+
d3dpp->BackBufferHeight = height;
2120+
#else
21132121
video_driver_get_size(&d3dpp->BackBufferWidth,
21142122
&d3dpp->BackBufferHeight);
2123+
#endif
21152124
}
21162125

21172126
#ifdef _XBOX
@@ -2481,10 +2490,6 @@ static bool d3d8_init_internal(d3d8_video_t *d3d,
24812490
HMONITOR hm_to_use;
24822491
#endif
24832492
struct video_shader_pass *pass = NULL;
2484-
#ifdef HAVE_WINDOW
2485-
unsigned win_width = 0;
2486-
unsigned win_height = 0;
2487-
#endif
24882493
unsigned full_x = 0;
24892494
unsigned full_y = 0;
24902495
settings_t *settings = config_get_ptr();
@@ -2538,18 +2543,20 @@ static bool d3d8_init_internal(d3d8_video_t *d3d,
25382543
unsigned new_width = info->fullscreen ? full_x : info->width;
25392544
unsigned new_height = info->fullscreen ? full_y : info->height;
25402545
video_driver_set_size(new_width, new_height);
2541-
}
25422546

25432547
#ifdef HAVE_WINDOW
2544-
video_driver_get_size(&win_width, &win_height);
2545-
2546-
if (!win32_set_video_mode(d3d, win_width, win_height,
2547-
info->fullscreen))
2548-
{
2549-
RARCH_ERR("[D3D8] win32_set_video_mode failed.\n");
2550-
return false;
2551-
}
2548+
/* Use new_width / new_height directly rather than reading
2549+
* them back via video_driver_get_size: nothing in the
2550+
* codebase writes video_st->width / height between the
2551+
* set_size above and this call except us. */
2552+
if (!win32_set_video_mode(d3d, new_width, new_height,
2553+
info->fullscreen))
2554+
{
2555+
RARCH_ERR("[D3D8] win32_set_video_mode failed.\n");
2556+
return false;
2557+
}
25522558
#endif
2559+
}
25532560

25542561
memset(&d3d->shader, 0, sizeof(d3d->shader));
25552562
d3d->shader.passes = 1;

gfx/drivers/d3d9cg.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3918,10 +3918,6 @@ static bool d3d9_cg_init_internal(d3d9_video_t *d3d,
39183918
RECT mon_rect;
39193919
MONITORINFOEX current_mon;
39203920
HMONITOR hm_to_use;
3921-
#endif
3922-
#ifdef HAVE_WINDOW
3923-
unsigned win_width = 0;
3924-
unsigned win_height = 0;
39253921
#endif
39263922
unsigned full_x = 0;
39273923
unsigned full_y = 0;
@@ -3978,18 +3974,20 @@ static bool d3d9_cg_init_internal(d3d9_video_t *d3d,
39783974
unsigned new_width = info->fullscreen ? full_x : info->width;
39793975
unsigned new_height = info->fullscreen ? full_y : info->height;
39803976
video_driver_set_size(new_width, new_height);
3981-
}
39823977

39833978
#ifdef HAVE_WINDOW
3984-
video_driver_get_size(&win_width, &win_height);
3985-
3986-
if (!win32_set_video_mode(d3d, win_width, win_height,
3987-
info->fullscreen))
3988-
{
3989-
RARCH_ERR("[D3D9 Cg] win32_set_video_mode failed.\n");
3990-
return false;
3991-
}
3979+
/* Use new_width / new_height directly rather than reading
3980+
* them back via video_driver_get_size: nothing in the
3981+
* codebase writes video_st->width / height between the
3982+
* set_size above and this call except us. */
3983+
if (!win32_set_video_mode(d3d, new_width, new_height,
3984+
info->fullscreen))
3985+
{
3986+
RARCH_ERR("[D3D9 Cg] win32_set_video_mode failed.\n");
3987+
return false;
3988+
}
39923989
#endif
3990+
}
39933991

39943992
d3d->video_info = *info;
39953993

gfx/drivers/d3d9hlsl.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7144,10 +7144,6 @@ static bool d3d9_hlsl_init_internal(d3d9_video_t *d3d,
71447144
RECT mon_rect;
71457145
MONITORINFOEX current_mon;
71467146
HMONITOR hm_to_use;
7147-
#endif
7148-
#ifdef HAVE_WINDOW
7149-
unsigned win_width = 0;
7150-
unsigned win_height = 0;
71517147
#endif
71527148
unsigned full_x = 0;
71537149
unsigned full_y = 0;
@@ -7204,18 +7200,20 @@ static bool d3d9_hlsl_init_internal(d3d9_video_t *d3d,
72047200
unsigned new_width = info->fullscreen ? full_x : info->width;
72057201
unsigned new_height = info->fullscreen ? full_y : info->height;
72067202
video_driver_set_size(new_width, new_height);
7207-
}
72087203

72097204
#ifdef HAVE_WINDOW
7210-
video_driver_get_size(&win_width, &win_height);
7211-
7212-
if (!win32_set_video_mode(d3d, win_width, win_height,
7213-
info->fullscreen))
7214-
{
7215-
RARCH_ERR("[D3D9 HLSL] win32_set_video_mode failed.\n");
7216-
return false;
7217-
}
7205+
/* Use new_width / new_height directly rather than reading
7206+
* them back via video_driver_get_size: nothing in the
7207+
* codebase writes video_st->width / height between the
7208+
* set_size above and this call except us. */
7209+
if (!win32_set_video_mode(d3d, new_width, new_height,
7210+
info->fullscreen))
7211+
{
7212+
RARCH_ERR("[D3D9 HLSL] win32_set_video_mode failed.\n");
7213+
return false;
7214+
}
72187215
#endif
7216+
}
72197217

72207218
d3d->video_info = *info;
72217219

0 commit comments

Comments
 (0)