(gfx/drivers_display) cleanups

This commit is contained in:
twinaphex 2020-03-08 01:28:15 +01:00
parent f0bf2df92f
commit cfa90a4a36
6 changed files with 38 additions and 19 deletions

View File

@ -290,15 +290,17 @@ void gfx_display_d3d11_scissor_begin(video_frame_info_t *video_info, int x, int
void gfx_display_d3d11_scissor_end(video_frame_info_t *video_info)
{
D3D11_RECT rect;
d3d11_video_t *d3d11 = (d3d11_video_t*)video_info->userdata;
d3d11_video_t *d3d11 = (d3d11_video_t*)video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
if (!d3d11)
return;
rect.left = 0;
rect.top = 0;
rect.right = video_info->width;
rect.bottom = video_info->height;
rect.right = video_width;
rect.bottom = video_height;
D3D11SetScissorRects(d3d11->context, 1, &rect);
}

View File

@ -311,15 +311,17 @@ void gfx_display_d3d12_scissor_begin(video_frame_info_t *video_info, int x, int
void gfx_display_d3d12_scissor_end(video_frame_info_t *video_info)
{
D3D12_RECT rect;
d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata;
d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
if (!d3d12)
return;
rect.left = 0;
rect.top = 0;
rect.right = video_info->width;
rect.bottom = video_info->height;
rect.right = video_width;
rect.bottom = video_height;
D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &rect);
}

View File

@ -220,14 +220,16 @@ gfx_display_gl_discard_draw_rectangle(gfx_display_ctx_draw_t *draw,
static void gfx_display_gl_draw(gfx_display_ctx_draw_t *draw,
video_frame_info_t *video_info)
{
gl_t *gl = (gl_t*)video_info->userdata;
gl_t *gl = (gl_t*)video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
if (!gl || !draw)
return;
#ifdef MALI_BUG
if (gfx_display_gl_discard_draw_rectangle(draw, video_info->width,
video_info->height))
if (gfx_display_gl_discard_draw_rectangle(draw, video_width,
video_height))
{
/*RARCH_WARN("[Menu]: discarded draw rect: %.4i %.4i %.4i %.4i\n",
(int)draw->x, (int)draw->y, (int)draw->width, (int)draw->height);*/
@ -368,7 +370,8 @@ static void gfx_display_gl_scissor_begin(
video_frame_info_t *video_info, int x, int y,
unsigned width, unsigned height)
{
glScissor(x, video_info->height - y - height, width, height);
unsigned video_height = video_info->height;
glScissor(x, video_height - y - height, width, height);
glEnable(GL_SCISSOR_TEST);
#ifdef MALI_BUG
/* TODO/FIXME: If video width/height changes between
@ -385,10 +388,12 @@ static void gfx_display_gl_scissor_begin(
static void gfx_display_gl_scissor_end(video_frame_info_t *video_info)
{
glScissor(0, 0, video_info->width, video_info->height);
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
glScissor(0, 0, video_width, video_height);
glDisable(GL_SCISSOR_TEST);
#ifdef MALI_BUG
scissor_set_rectangle(0, video_info->width - 1, 0, video_info->height - 1, 0);
scissor_set_rectangle(0, video_width - 1, 0, video_height - 1, 0);
#endif
}

View File

@ -204,13 +204,17 @@ static bool gfx_display_gl1_font_init_first(
static void gfx_display_gl1_scissor_begin(video_frame_info_t *video_info, int x, int y,
unsigned width, unsigned height)
{
glScissor(x, video_info->height - y - height, width, height);
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
glScissor(x, video_height - y - height, width, height);
glEnable(GL_SCISSOR_TEST);
}
static void gfx_display_gl1_scissor_end(video_frame_info_t *video_info)
{
glScissor(0, 0, video_info->width, video_info->height);
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
glScissor(0, 0, video_width, video_height);
glDisable(GL_SCISSOR_TEST);
}

View File

@ -89,6 +89,8 @@ static void gfx_display_gl_core_draw_pipeline(gfx_display_ctx_draw_t *draw,
float yflip = 0.0f;
video_coord_array_t *ca = NULL;
gl_core_t *gl_core = (gl_core_t*)video_info->userdata;
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
if (!gl_core || !draw)
return;
@ -97,8 +99,8 @@ static void gfx_display_gl_core_draw_pipeline(gfx_display_ctx_draw_t *draw,
draw->y = 0;
draw->matrix_data = NULL;
output_size[0] = (float)video_info->width;
output_size[1] = (float)video_info->height;
output_size[0] = (float)video_width;
output_size[1] = (float)video_height;
switch (draw->pipeline.id)
{
@ -158,7 +160,8 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw,
const float *color = NULL;
GLuint texture = 0;
gl_core_t *gl = (gl_core_t*)video_info->userdata;
const struct gl_core_buffer_locations *loc = NULL;
const struct
gl_core_buffer_locations *loc = NULL;
if (!gl || !draw)
return;
@ -332,7 +335,8 @@ static bool gfx_display_gl_core_font_init_first(
static void gfx_display_gl_core_scissor_begin(video_frame_info_t *video_info,
int x, int y, unsigned width, unsigned height)
{
glScissor(x, video_info->height - y - height, width, height);
unsigned video_height = video_info->height;
glScissor(x, video_height - y - height, width, height);
glEnable(GL_SCISSOR_TEST);
}

View File

@ -191,7 +191,9 @@ static bool gfx_display_vita2d_font_init_first(
static void gfx_display_vita2d_scissor_end(video_frame_info_t *video_info)
{
vita2d_set_region_clip(SCE_GXM_REGION_CLIP_NONE, 0, 0, video_info->width, video_info->height);
unsigned video_width = video_info->width;
unsigned video_height = video_info->height;
vita2d_set_region_clip(SCE_GXM_REGION_CLIP_NONE, 0, 0, video_width, video_height);
vita2d_disable_clipping();
}