mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 17:31:11 -10:00
video_driver: rename {get,set}_size -> {get,set}_output_size
video_driver_get_size and video_driver_set_size publish the size of
the area where the active video driver presents pixels to the user.
The old name says "size" without saying "size of what," and the
ambiguity has cost: the caca driver bug fixed in ad986a6 was hidden
behind exactly this confusion -- caca was passing the libretro
core's frame size to set_size when the API contract was the canvas
(surface) size, and the call site looked plausible until the field
was renamed to expose what it actually held.
Rename the public API to make the contract explicit at the call
site, and add the documentation comment that should have been on
these declarations from the start:
video_driver_get_size -> video_driver_get_output_size
video_driver_set_size -> video_driver_set_output_size
"output_size" was chosen over the alternatives:
- window_size is wrong on terminal drivers (caca, sixel) and
DRM-fullscreen-no-window
- surface_size collides with SDL_Surface and D3D surface concepts
- display_size implies the physical monitor, not the output area
- present_size is jargon and reads oddly as a noun
- viewport_size collides with the existing vp.{width,height}
aspect-corrected sub-rect
"output_size" describes purpose (size of the visible output area)
without implying mechanism, doesn't collide with existing terms,
and maps cleanly onto every driver: desktop window output, DRM
scanout output, libcaca canvas output, sixel terminal output.
The doc comment in gfx/video_driver.h spells out the per-driver
mapping (window client area for desktop GL/D3D/Vulkan/Metal,
framebuffer scanout for DRM/KMS, canvas grid for libcaca,
terminal output region for sixel), the consumer list (menu
drivers, CRT switcher, shader subsystem, input drivers, other
video drivers), threading (protected by video_st->display_lock),
and explicitly contrasts with the libretro core's frame size that
lives on each driver's local state (frame_width / frame_height
after the gl1 / fpga / gdi / network / sixel / caca renames; gl2
/ gl3 still keep their canonical video_width / video_height which
mean the backbuffer size).
74 call sites across 33 files updated by word-boundary sed; no
collisions (no other identifiers contain video_driver_get_size or
_set_size as a substring).
Validation: the file with the function definitions
(gfx/video_driver.o) and a representative sample of caller files
(menu/drivers/{xmb,ozone,materialui}.o, gfx/drivers/gl{1,2,3}.o,
gfx/video_crt_switch.o, gfx/video_shader_parse.o) all build clean
in this sandbox. The remaining 24 files hit unrelated
dependency errors (windows.h not on Linux, libcaca / libvg
headers not installed) before reaching anything rename-related;
none produced a rename-related diagnostic. Maintainer review on
a full build environment recommended before merge.
No behavior change. Pure rename + documentation.
This commit is contained in:
1 parent
ad986a63ee
commit
cecd19ff0a
33 files changed
+103
-74
No files matched your search
@@ -343,7 +343,7 @@ void d3d9_make_d3dpp(d3d9_video_t *d3d,
|
||||
unsigned width = 0;
|
||||
unsigned height = 0;
|
||||
d3d9_get_video_size(d3d, &width, &height);
|
||||
video_driver_set_size(width, height);
|
||||
video_driver_set_output_size(width, height);
|
||||
d3d->vp.full_width = width;
|
||||
d3d->vp.full_height = height;
|
||||
d3dpp->BackBufferWidth = width;
|
||||
|
||||
@@ -111,7 +111,7 @@ typedef struct gdi
|
||||
unsigned frame_height;
|
||||
unsigned screen_width;
|
||||
unsigned screen_height;
|
||||
/* Surface (window) size last published via video_driver_set_size,
|
||||
/* Surface (window) size last published via video_driver_set_output_size,
|
||||
* tracked here so gdi_alive can read it without locking. */
|
||||
unsigned full_width;
|
||||
unsigned full_height;
|
||||
|
||||
@@ -212,11 +212,11 @@ static void caca_create(caca_t *caca)
|
||||
0xF800, 0x7E0, 0x1F, 0x0);
|
||||
|
||||
/* Publish the canvas (terminal grid) size as the surface size,
|
||||
* not the core's frame size. video_driver_set_size feeds the
|
||||
* not the core's frame size. video_driver_set_output_size feeds the
|
||||
* value used by menu drivers, the CRT switcher and the input
|
||||
* subsystem to size their output; passing the core's frame
|
||||
* dimensions instead would lie to all of them. */
|
||||
video_driver_set_size(
|
||||
video_driver_set_output_size(
|
||||
caca_get_canvas_width(caca->cv),
|
||||
caca_get_canvas_height(caca->cv));
|
||||
}
|
||||
@@ -345,7 +345,7 @@ static bool caca_alive(void *data)
|
||||
{
|
||||
caca_t *caca = (caca_t*)data;
|
||||
/* Canvas size, not core frame size -- see comment in caca_create. */
|
||||
video_driver_set_size(
|
||||
video_driver_set_output_size(
|
||||
caca_get_canvas_width(caca->cv),
|
||||
caca_get_canvas_height(caca->cv));
|
||||
return true;
|
||||
|
||||
@@ -1731,7 +1731,7 @@ static void* ctr_init(const video_info_t* video,
|
||||
ctr->vp.height = CTR_TOP_FRAMEBUFFER_HEIGHT;
|
||||
ctr->vp.full_width = CTR_TOP_FRAMEBUFFER_WIDTH;
|
||||
ctr->vp.full_height = CTR_TOP_FRAMEBUFFER_HEIGHT;
|
||||
video_driver_set_size(ctr->vp.width, ctr->vp.height);
|
||||
video_driver_set_output_size(ctr->vp.width, ctr->vp.height);
|
||||
|
||||
ctr->drawbuffers.top.left = vramAlloc(CTR_TOP_FRAMEBUFFER_WIDTH * CTR_TOP_FRAMEBUFFER_HEIGHT * 2 * sizeof(uint32_t));
|
||||
ctr->drawbuffers.top.right = (void*)((uint32_t*)ctr->drawbuffers.top.left + CTR_TOP_FRAMEBUFFER_WIDTH * CTR_TOP_FRAMEBUFFER_HEIGHT);
|
||||
|
||||
+3
-3
@@ -2361,7 +2361,7 @@ static void *d3d10_gfx_init(const video_info_t* video,
|
||||
d3d10->device->lpVtbl->OMSetRenderTargets(d3d10->device, 1,
|
||||
&d3d10->renderTargetView, NULL);
|
||||
|
||||
video_driver_set_size(d3d10->vp.full_width, d3d10->vp.full_height);
|
||||
video_driver_set_output_size(d3d10->vp.full_width, d3d10->vp.full_height);
|
||||
d3d10->viewport.Width = d3d10->vp.full_width;
|
||||
d3d10->viewport.Height = d3d10->vp.full_height;
|
||||
d3d10->flags |= D3D10_ST_FLAG_RESIZE_VIEWPORT;
|
||||
@@ -2925,7 +2925,7 @@ static bool d3d10_gfx_frame(
|
||||
d3d10->flags &= ~D3D10_ST_FLAG_RESIZE_CHAIN;
|
||||
d3d10->flags |= D3D10_ST_FLAG_RESIZE_VIEWPORT;
|
||||
|
||||
video_driver_set_size(video_width, video_height);
|
||||
video_driver_set_output_size(video_width, video_height);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -3513,7 +3513,7 @@ static bool d3d10_gfx_alive(void* data)
|
||||
if ( (d3d10->flags & D3D10_ST_FLAG_RESIZE_CHAIN)
|
||||
&& (d3d10->vp.full_width != 0)
|
||||
&& (d3d10->vp.full_height != 0))
|
||||
video_driver_set_size(d3d10->vp.full_width, d3d10->vp.full_height);
|
||||
video_driver_set_output_size(d3d10->vp.full_width, d3d10->vp.full_height);
|
||||
|
||||
return !quit;
|
||||
}
|
||||
|
||||
+3
-3
@@ -3267,7 +3267,7 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
|
||||
matrix_4x4_identity(d3d11->identity);
|
||||
|
||||
video_driver_set_size(d3d11->vp.full_width, d3d11->vp.full_height);
|
||||
video_driver_set_output_size(d3d11->vp.full_width, d3d11->vp.full_height);
|
||||
d3d11->viewport.Width = d3d11->vp.full_width;
|
||||
d3d11->viewport.Height = d3d11->vp.full_height;
|
||||
d3d11->scissor.right = d3d11->vp.full_width;
|
||||
@@ -4031,7 +4031,7 @@ static bool d3d11_gfx_frame(
|
||||
d3d11->flags &= ~D3D11_ST_FLAG_RESIZE_CHAIN;
|
||||
d3d11->flags |= D3D11_ST_FLAG_RESIZE_VIEWPORT;
|
||||
|
||||
video_driver_set_size(video_width, video_height);
|
||||
video_driver_set_output_size(video_width, video_height);
|
||||
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
#ifdef __WINRT__
|
||||
@@ -5014,7 +5014,7 @@ static bool d3d11_gfx_alive(void* data)
|
||||
if ( (d3d11->flags & D3D11_ST_FLAG_RESIZE_CHAIN)
|
||||
&& (d3d11->vp.full_width != 0)
|
||||
&& (d3d11->vp.full_height != 0))
|
||||
video_driver_set_size(d3d11->vp.full_width, d3d11->vp.full_height);
|
||||
video_driver_set_output_size(d3d11->vp.full_width, d3d11->vp.full_height);
|
||||
|
||||
return !quit;
|
||||
}
|
||||
|
||||
+3
-3
@@ -4421,7 +4421,7 @@ static void *d3d12_gfx_init(const video_info_t* video,
|
||||
matrix_4x4_identity(d3d12->identity);
|
||||
|
||||
d3d12_gfx_set_rotation(d3d12, 0);
|
||||
video_driver_set_size(d3d12->vp.full_width, d3d12->vp.full_height);
|
||||
video_driver_set_output_size(d3d12->vp.full_width, d3d12->vp.full_height);
|
||||
d3d12->chain.viewport.Width = d3d12->vp.full_width;
|
||||
d3d12->chain.viewport.Height = d3d12->vp.full_height;
|
||||
|
||||
@@ -4836,7 +4836,7 @@ static bool d3d12_gfx_frame(
|
||||
d3d12->flags &= ~D3D12_ST_FLAG_RESIZE_CHAIN;
|
||||
d3d12->flags |= D3D12_ST_FLAG_RESIZE_VIEWPORT;
|
||||
|
||||
video_driver_set_size(video_width, video_height);
|
||||
video_driver_set_output_size(video_width, video_height);
|
||||
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
#ifdef __WINRT__
|
||||
@@ -6076,7 +6076,7 @@ static bool d3d12_gfx_alive(void* data)
|
||||
if ( (d3d12->flags & D3D12_ST_FLAG_RESIZE_CHAIN)
|
||||
&& (d3d12->vp.full_width != 0)
|
||||
&& (d3d12->vp.full_height != 0))
|
||||
video_driver_set_size(d3d12->vp.full_width, d3d12->vp.full_height);
|
||||
video_driver_set_output_size(d3d12->vp.full_width, d3d12->vp.full_height);
|
||||
|
||||
return !quit;
|
||||
}
|
||||
|
||||
+5
-5
@@ -2080,7 +2080,7 @@ static void d3d8_make_d3dpp(void *data,
|
||||
unsigned height = 0;
|
||||
|
||||
d3d8_get_video_size(d3d, &width, &height);
|
||||
video_driver_set_size(width, height);
|
||||
video_driver_set_output_size(width, height);
|
||||
d3d->vp.full_width = width;
|
||||
d3d->vp.full_height = height;
|
||||
d3dpp->BackBufferWidth = width;
|
||||
@@ -2384,7 +2384,7 @@ static void d3d8_set_resize(d3d8_video_t *d3d,
|
||||
|
||||
d3d->video_info.width = new_width;
|
||||
d3d->video_info.height = new_height;
|
||||
video_driver_set_size(new_width, new_height);
|
||||
video_driver_set_output_size(new_width, new_height);
|
||||
d3d->vp.full_width = new_width;
|
||||
d3d->vp.full_height = new_height;
|
||||
}
|
||||
@@ -2423,7 +2423,7 @@ static bool d3d8_alive(void *data)
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
{
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
d3d->vp.full_width = temp_width;
|
||||
d3d->vp.full_height = temp_height;
|
||||
}
|
||||
@@ -2526,13 +2526,13 @@ static bool d3d8_init_internal(d3d8_video_t *d3d,
|
||||
{
|
||||
unsigned new_width = info->fullscreen ? full_x : info->width;
|
||||
unsigned new_height = info->fullscreen ? full_y : info->height;
|
||||
video_driver_set_size(new_width, new_height);
|
||||
video_driver_set_output_size(new_width, new_height);
|
||||
d3d->vp.full_width = new_width;
|
||||
d3d->vp.full_height = new_height;
|
||||
|
||||
#ifdef HAVE_WINDOW
|
||||
/* Use new_width / new_height directly rather than reading
|
||||
* them back via video_driver_get_size: nothing in the
|
||||
* them back via video_driver_get_output_size: nothing in the
|
||||
* codebase writes video_st->width / height between the
|
||||
* set_size above and this call except us. */
|
||||
if (!win32_set_video_mode(d3d, new_width, new_height,
|
||||
|
||||
@@ -3963,13 +3963,13 @@ static bool d3d9_cg_init_internal(d3d9_video_t *d3d,
|
||||
{
|
||||
unsigned new_width = info->fullscreen ? full_x : info->width;
|
||||
unsigned new_height = info->fullscreen ? full_y : info->height;
|
||||
video_driver_set_size(new_width, new_height);
|
||||
video_driver_set_output_size(new_width, new_height);
|
||||
d3d->vp.full_width = new_width;
|
||||
d3d->vp.full_height = new_height;
|
||||
|
||||
#ifdef HAVE_WINDOW
|
||||
/* Use new_width / new_height directly rather than reading
|
||||
* them back via video_driver_get_size: nothing in the
|
||||
* them back via video_driver_get_output_size: nothing in the
|
||||
* codebase writes video_st->width / height between the
|
||||
* set_size above and this call except us. */
|
||||
if (!win32_set_video_mode(d3d, new_width, new_height,
|
||||
@@ -4823,7 +4823,7 @@ static void d3d9_cg_set_resize(d3d9_video_t *d3d,
|
||||
|
||||
d3d->video_info.width = new_width;
|
||||
d3d->video_info.height = new_height;
|
||||
video_driver_set_size(new_width, new_height);
|
||||
video_driver_set_output_size(new_width, new_height);
|
||||
d3d->vp.full_width = new_width;
|
||||
d3d->vp.full_height = new_height;
|
||||
}
|
||||
@@ -4860,7 +4860,7 @@ static bool d3d9_cg_alive(void *data)
|
||||
if ( temp_width != 0 &&
|
||||
temp_height != 0)
|
||||
{
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
d3d->vp.full_width = temp_width;
|
||||
d3d->vp.full_height = temp_height;
|
||||
}
|
||||
|
||||
@@ -7191,13 +7191,13 @@ static bool d3d9_hlsl_init_internal(d3d9_video_t *d3d,
|
||||
{
|
||||
unsigned new_width = info->fullscreen ? full_x : info->width;
|
||||
unsigned new_height = info->fullscreen ? full_y : info->height;
|
||||
video_driver_set_size(new_width, new_height);
|
||||
video_driver_set_output_size(new_width, new_height);
|
||||
d3d->vp.full_width = new_width;
|
||||
d3d->vp.full_height = new_height;
|
||||
|
||||
#ifdef HAVE_WINDOW
|
||||
/* Use new_width / new_height directly rather than reading
|
||||
* them back via video_driver_get_size: nothing in the
|
||||
* them back via video_driver_get_output_size: nothing in the
|
||||
* codebase writes video_st->width / height between the
|
||||
* set_size above and this call except us. */
|
||||
if (!win32_set_video_mode(d3d, new_width, new_height,
|
||||
@@ -8163,7 +8163,7 @@ static void d3d9_hlsl_set_resize(d3d9_video_t *d3d,
|
||||
|
||||
d3d->video_info.width = new_width;
|
||||
d3d->video_info.height = new_height;
|
||||
video_driver_set_size(new_width, new_height);
|
||||
video_driver_set_output_size(new_width, new_height);
|
||||
d3d->vp.full_width = new_width;
|
||||
d3d->vp.full_height = new_height;
|
||||
}
|
||||
@@ -8200,7 +8200,7 @@ static bool d3d9_hlsl_alive(void *data)
|
||||
if ( temp_width != 0 &&
|
||||
temp_height != 0)
|
||||
{
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
d3d->vp.full_width = temp_width;
|
||||
d3d->vp.full_height = temp_height;
|
||||
}
|
||||
|
||||
@@ -2535,9 +2535,9 @@ static void *gdi_init(const video_info_t *video,
|
||||
/* Get real known video size, which might have been altered by context. */
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
else
|
||||
video_driver_get_size(&temp_width, &temp_height);
|
||||
video_driver_get_output_size(&temp_width, &temp_height);
|
||||
gdi->full_width = temp_width;
|
||||
gdi->full_height = temp_height;
|
||||
|
||||
@@ -3192,7 +3192,7 @@ static bool gdi_alive(void *data)
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
{
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
gdi->full_width = temp_width;
|
||||
gdi->full_height = temp_height;
|
||||
}
|
||||
|
||||
+4
-4
@@ -1263,9 +1263,9 @@ static void *gl1_init(const video_info_t *video,
|
||||
/* Get real known video size, which might have been altered by context. */
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
else
|
||||
video_driver_get_size(&temp_width, &temp_height);
|
||||
video_driver_get_output_size(&temp_width, &temp_height);
|
||||
gl1->vp.full_width = temp_width;
|
||||
gl1->vp.full_height = temp_height;
|
||||
|
||||
@@ -2006,7 +2006,7 @@ static bool gl1_alive(void *data)
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
{
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
gl1->vp.full_width = temp_width;
|
||||
gl1->vp.full_height = temp_height;
|
||||
}
|
||||
@@ -2092,7 +2092,7 @@ static void gl1_viewport_info(void *data, struct video_viewport *vp)
|
||||
|
||||
/* gl1->vp carries full_width/full_height (written at every
|
||||
* set_size call site), so the struct copy populates them
|
||||
* directly without a video_driver_get_size round-trip. */
|
||||
* directly without a video_driver_get_output_size round-trip. */
|
||||
*vp = gl1->vp;
|
||||
|
||||
/* Adjust as GL viewport is bottom-up. */
|
||||
|
||||
+3
-3
@@ -4639,9 +4639,9 @@ static void *gl2_init(const video_info_t *video,
|
||||
/* Get real known video size, which might have been altered by context. */
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
else
|
||||
video_driver_get_size(&temp_width, &temp_height);
|
||||
video_driver_get_output_size(&temp_width, &temp_height);
|
||||
gl->video_width = temp_width;
|
||||
gl->video_height = temp_height;
|
||||
|
||||
@@ -4854,7 +4854,7 @@ static bool gl2_alive(void *data)
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
{
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
gl->video_width = temp_width;
|
||||
gl->video_height = temp_height;
|
||||
}
|
||||
|
||||
+3
-3
@@ -2997,9 +2997,9 @@ static void *gl3_init(const video_info_t *video,
|
||||
/* Get real known video size, which might have been altered by context. */
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
else
|
||||
video_driver_get_size(&temp_width, &temp_height);
|
||||
video_driver_get_output_size(&temp_width, &temp_height);
|
||||
gl->video_width = temp_width;
|
||||
gl->video_height = temp_height;
|
||||
|
||||
@@ -3300,7 +3300,7 @@ static bool gl3_alive(void *data)
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
{
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
gl->video_width = temp_width;
|
||||
gl->video_height = temp_height;
|
||||
}
|
||||
|
||||
@@ -1368,7 +1368,7 @@ static void *gx2_init(const video_info_t *video,
|
||||
wiiu->vp.full_height = wiiu->render_mode.height;
|
||||
}
|
||||
|
||||
video_driver_set_size(wiiu->vp.width, wiiu->vp.height);
|
||||
video_driver_set_output_size(wiiu->vp.width, wiiu->vp.height);
|
||||
|
||||
driver_ctl(RARCH_DRIVER_CTL_SET_REFRESH_RATE, &refresh_rate);
|
||||
|
||||
|
||||
+1
-1
@@ -3961,7 +3961,7 @@ font_renderer_t metal_raster_font = {
|
||||
{
|
||||
_viewport->full_width = width;
|
||||
_viewport->full_height = height;
|
||||
video_driver_set_size(_viewport->full_width, _viewport->full_height);
|
||||
video_driver_set_output_size(_viewport->full_width, _viewport->full_height);
|
||||
_layer.drawableSize = CGSizeMake(width, height);
|
||||
video_driver_update_viewport(_viewport, forceFull, _keepAspect, YES);
|
||||
_context.viewport = _viewport; /* Update matrix */
|
||||
|
||||
@@ -343,7 +343,7 @@ static void network_gfx_set_nonblock_state(void *a, bool b, bool c, unsigned d)
|
||||
|
||||
static bool network_gfx_alive(void *data)
|
||||
{
|
||||
/* The video_driver_get_size + conditional set_size dance that
|
||||
/* The video_driver_get_output_size + conditional set_size dance that
|
||||
* used to live here was a copy-paste from d3d8_alive, where the
|
||||
* intermediate win32_check_window call mutates the fetched
|
||||
* size on window resize. The network driver has no equivalent
|
||||
|
||||
@@ -1566,7 +1566,7 @@ static void* rsx_init(const video_info_t* video,
|
||||
rsx->vp.full_width = rsx->width;
|
||||
rsx->vp.full_height = rsx->height;
|
||||
rsx->rgb32 = video->rgb32;
|
||||
video_driver_set_size(rsx->vp.width, rsx->vp.height);
|
||||
video_driver_set_output_size(rsx->vp.width, rsx->vp.height);
|
||||
rsx_set_viewport(rsx, rsx->vp.width, rsx->vp.height, false, true);
|
||||
|
||||
if (input && input_data)
|
||||
|
||||
@@ -257,7 +257,7 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
|
||||
* relative to that tiny coordinate space, and end up drawing into
|
||||
* the top-left corner of the actual SDL framebuffer. Most other
|
||||
* drivers (vga, gx2, d3d8, d3d9 common) make this call too. */
|
||||
video_driver_set_size(win_w, win_h);
|
||||
video_driver_set_output_size(win_w, win_h);
|
||||
|
||||
vid->flags &= ~SDL2_FLAG_SHOULD_RESIZE;
|
||||
|
||||
|
||||
@@ -502,7 +502,7 @@ static bool sixel_gfx_frame(void *data, const void *frame,
|
||||
|
||||
static bool sixel_gfx_alive(void *data)
|
||||
{
|
||||
/* The video_driver_get_size + conditional set_size dance that
|
||||
/* The video_driver_get_output_size + conditional set_size dance that
|
||||
* used to live here was a copy-paste from d3d8_alive, where the
|
||||
* intermediate win32_check_window call mutates the fetched
|
||||
* size on window resize. sixel has no equivalent windowing
|
||||
|
||||
+5
-5
@@ -145,7 +145,7 @@ static void *vg_init(const video_info_t *video,
|
||||
RARCH_LOG("[VG] Detecting screen resolution: %ux%u.\n", temp_width, temp_height);
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
|
||||
interval = video->vsync ? 1 : 0;
|
||||
|
||||
@@ -164,7 +164,7 @@ static void *vg_init(const video_info_t *video,
|
||||
|
||||
if (video->fullscreen && (win_width == 0) && (win_height == 0))
|
||||
{
|
||||
video_driver_get_size(&temp_width, &temp_height);
|
||||
video_driver_get_output_size(&temp_width, &temp_height);
|
||||
|
||||
win_width = temp_width;
|
||||
win_height = temp_height;
|
||||
@@ -193,10 +193,10 @@ static void *vg_init(const video_info_t *video,
|
||||
{
|
||||
RARCH_LOG("[VG] Verified window resolution %ux%u.\n",
|
||||
temp_width, temp_height);
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
}
|
||||
else
|
||||
video_driver_get_size(&temp_width, &temp_height);
|
||||
video_driver_get_output_size(&temp_width, &temp_height);
|
||||
|
||||
vg->mScreenAspect = (float)temp_width / temp_height;
|
||||
|
||||
@@ -440,7 +440,7 @@ static bool vg_alive(void *data)
|
||||
&quit, &resize, &temp_width, &temp_height);
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
|
||||
return !quit;
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ static bool vga_gfx_alive(void *data)
|
||||
{
|
||||
vga_t *vga = (vga_t*)data;
|
||||
/* TODO/FIXME - check if this is valid */
|
||||
video_driver_set_size(vga->vga_video_width, vga->vga_video_height);
|
||||
video_driver_set_output_size(vga->vga_video_width, vga->vga_video_height);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -661,7 +661,7 @@ static void *vita2d_gfx_init(const video_info_t *video,
|
||||
vita->video_width = temp_width;
|
||||
vita->video_height = temp_height;
|
||||
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
vita2d_set_viewport_wrapper(vita, temp_width, temp_height, false, true);
|
||||
|
||||
if (input && input_data)
|
||||
|
||||
@@ -4954,9 +4954,9 @@ static void *vulkan_init(const video_info_t *video,
|
||||
temp_height = mode_height;
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
else
|
||||
video_driver_get_size(&temp_width, &temp_height);
|
||||
video_driver_get_output_size(&temp_width, &temp_height);
|
||||
vk->video_width = temp_width;
|
||||
vk->video_height = temp_height;
|
||||
vk->translate_x = 0.0;
|
||||
@@ -5304,7 +5304,7 @@ static bool vulkan_alive(void *data)
|
||||
|
||||
if (temp_width != 0 && temp_height != 0)
|
||||
{
|
||||
video_driver_set_size(temp_width, temp_height);
|
||||
video_driver_set_output_size(temp_width, temp_height);
|
||||
vk->video_width = temp_width;
|
||||
vk->video_height = temp_height;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ static void crt_aspect_ratio_switch(
|
||||
RARCH_LOG("[CRT] Setting aspect ratio: %f.\n", fly_aspect);
|
||||
RARCH_LOG("[CRT] Setting screen size: %dx%d.\n",
|
||||
width, height);
|
||||
video_driver_set_size(width, height);
|
||||
video_driver_set_output_size(width, height);
|
||||
if (video_st->current_video && video_st->current_video->set_viewport)
|
||||
video_st->current_video->set_viewport(
|
||||
video_st->data, width, height, true, true);
|
||||
@@ -131,7 +131,7 @@ static void crt_switch_set_aspect(
|
||||
/* used to fix aspect should SR not find a resolution */
|
||||
if (srm_width == 0)
|
||||
{
|
||||
video_driver_get_size(&patched_width, &patched_height);
|
||||
video_driver_get_output_size(&patched_width, &patched_height);
|
||||
srm_xscale = 1;
|
||||
srm_yscale = 1;
|
||||
}
|
||||
@@ -418,7 +418,7 @@ static void switch_res_crt(
|
||||
1.0f,
|
||||
1.0f,
|
||||
false);
|
||||
video_driver_set_size(width , height);
|
||||
video_driver_set_output_size(width , height);
|
||||
video_driver_apply_state_changes();
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,7 @@ void crt_switch_res_core(
|
||||
crt_mode, corrected_width, monitor_index-1, super_width);
|
||||
crt_switch_set_aspect(p_switch, native_width, height, native_width,
|
||||
height ,(float)1,(float)1, false);
|
||||
video_driver_set_size(native_width , height);
|
||||
video_driver_set_output_size(native_width , height);
|
||||
}
|
||||
else
|
||||
switch_res_crt(p_switch, p_switch->ra_core_width,
|
||||
|
||||
+2
-2
@@ -2033,7 +2033,7 @@ void video_driver_set_filtering(unsigned index,
|
||||
index, smooth, ctx_scaling);
|
||||
}
|
||||
|
||||
void video_driver_get_size(unsigned *width, unsigned *height)
|
||||
void video_driver_get_output_size(unsigned *width, unsigned *height)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
#ifdef HAVE_THREADS
|
||||
@@ -2055,7 +2055,7 @@ void video_driver_get_size(unsigned *width, unsigned *height)
|
||||
*height = video_st->height;
|
||||
}
|
||||
|
||||
void video_driver_set_size(unsigned width, unsigned height)
|
||||
void video_driver_set_output_size(unsigned width, unsigned height)
|
||||
{
|
||||
video_driver_state_t *video_st = &video_driver_st;
|
||||
#ifdef HAVE_THREADS
|
||||
|
||||
+31
-2
@@ -1023,9 +1023,38 @@ void video_driver_set_filtering(unsigned index, bool smooth, bool ctx_scaling);
|
||||
|
||||
const char *video_driver_get_ident(void);
|
||||
|
||||
void video_driver_get_size(unsigned *width, unsigned *height);
|
||||
/**
|
||||
* video_driver_get_output_size / video_driver_set_output_size:
|
||||
*
|
||||
* Get or set the output dimensions -- the size of the area where
|
||||
* the active video driver presents pixels to the user.
|
||||
*
|
||||
* Per-driver mapping of "output area":
|
||||
* desktop GL/D3D/Vulkan/Metal -- the window's client area
|
||||
* (matches the backbuffer)
|
||||
* DRM/KMS -- the framebuffer scanout
|
||||
* resolution
|
||||
* libcaca -- the canvas grid (terminal cells)
|
||||
* sixel -- the terminal output region
|
||||
*
|
||||
* NOT the libretro core's frame size. That lives on each driver's
|
||||
* local state (typically the frame_width / frame_height fields after
|
||||
* the gl1 / fpga / gdi / network / sixel / caca renames; gl2 / gl3
|
||||
* still keep their canonical video_width / video_height which mean
|
||||
* the backbuffer size).
|
||||
*
|
||||
* Read by: menu drivers (RGUI, XMB, Ozone, MaterialUI) to size
|
||||
* their canvas; the CRT switcher; the shader subsystem; input
|
||||
* drivers (Android, rwebinput) to scale absolute mouse coordinates
|
||||
* against the visible output area; and other video drivers for
|
||||
* cross-driver coordination.
|
||||
*
|
||||
* Threaded video: the read and write are protected by
|
||||
* video_st->display_lock; safe to call from any thread.
|
||||
*/
|
||||
void video_driver_get_output_size(unsigned *width, unsigned *height);
|
||||
|
||||
void video_driver_set_size(unsigned width, unsigned height);
|
||||
void video_driver_set_output_size(unsigned width, unsigned height);
|
||||
|
||||
float video_driver_get_aspect_ratio(void);
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ static void video_shader_replace_wildcards_impl(
|
||||
{
|
||||
unsigned viewport_width = 0;
|
||||
unsigned viewport_height = 0;
|
||||
video_driver_get_size(&viewport_width, &viewport_height);
|
||||
video_driver_get_output_size(&viewport_width, &viewport_height);
|
||||
_len = strlcpy(replace_text,
|
||||
(viewport_height > 0 && (float)viewport_width / viewport_height < 1)
|
||||
? "VIEW-ASPECT-ORIENT-VERT"
|
||||
|
||||
@@ -757,7 +757,7 @@ static INLINE void android_mouse_calculate_deltas(android_input_t *android,
|
||||
AInputEvent *event,size_t motion_ptr,int source)
|
||||
{
|
||||
unsigned video_width, video_height;
|
||||
video_driver_get_size(&video_width, &video_height);
|
||||
video_driver_get_output_size(&video_width, &video_height);
|
||||
|
||||
float x = 0;
|
||||
float x_delta = 0;
|
||||
|
||||
@@ -314,7 +314,7 @@ static EM_BOOL rwebinput_mouse_cb(int event_type,
|
||||
if (rwebinput->pointerlock_active)
|
||||
{
|
||||
unsigned video_width, video_height;
|
||||
video_driver_get_size(&video_width, &video_height);
|
||||
video_driver_get_output_size(&video_width, &video_height);
|
||||
|
||||
rwebinput->mouse.x += mouse_event->movementX;
|
||||
rwebinput->mouse.y += mouse_event->movementY;
|
||||
|
||||
@@ -3366,7 +3366,7 @@ static float materialui_get_scroll(materialui_handle_t *mui,
|
||||
return 0;
|
||||
|
||||
/* Read cached size from mui rather than locking video_st via
|
||||
* video_driver_get_size: mui->last_{width,height} is updated
|
||||
* video_driver_get_output_size: mui->last_{width,height} is updated
|
||||
* every frame in materialui_render. */
|
||||
height = mui->last_height;
|
||||
|
||||
@@ -9129,7 +9129,7 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
|
||||
|
||||
/* Get DPI/screen-size-aware base unit size for
|
||||
* UI elements */
|
||||
video_driver_get_size(&width, &height);
|
||||
video_driver_get_output_size(&width, &height);
|
||||
|
||||
mui->last_width = width;
|
||||
mui->last_height = height;
|
||||
@@ -11020,7 +11020,7 @@ static int materialui_pointer_up(void *userdata,
|
||||
return -1;
|
||||
|
||||
/* Read cached size from mui rather than locking video_st via
|
||||
* video_driver_get_size: mui->last_{width,height} is updated
|
||||
* video_driver_get_output_size: mui->last_{width,height} is updated
|
||||
* every frame in materialui_render. */
|
||||
|
||||
/* All input is ignored if user was previously
|
||||
|
||||
@@ -9303,7 +9303,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
|
||||
for (i = 0; i < 15; i++)
|
||||
ozone->pure_white[i] = 1.00f;
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
video_driver_get_output_size(&width, &height);
|
||||
|
||||
/* Also used as a tag for cursor animation */
|
||||
ozone->default_theme = &ozone_theme_dark;
|
||||
|
||||
+2
-2
@@ -524,7 +524,7 @@ typedef struct xmb_handle
|
||||
* from video_info->{width,height} so non-render code paths
|
||||
* (selection_pointer_changed, list_open_new, list_switch_new,
|
||||
* list_cache, pointer_up, layout) can read the size without
|
||||
* locking video_st via video_driver_get_size. */
|
||||
* locking video_st via video_driver_get_output_size. */
|
||||
unsigned last_width;
|
||||
unsigned last_height;
|
||||
} xmb_handle_t;
|
||||
@@ -9482,7 +9482,7 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
|
||||
if (!menu)
|
||||
return NULL;
|
||||
|
||||
video_driver_get_size(&width, &height);
|
||||
video_driver_get_output_size(&width, &height);
|
||||
|
||||
if (!(xmb = (xmb_handle_t*)calloc(1, sizeof(xmb_handle_t))))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user