diff --git a/menu/drivers_display/menu_display_d3d10.c b/menu/drivers_display/menu_display_d3d10.c index f04452b069..914a40b879 100644 --- a/menu/drivers_display/menu_display_d3d10.c +++ b/menu/drivers_display/menu_display_d3d10.c @@ -46,14 +46,14 @@ static void* menu_display_d3d10_get_default_mvp(video_frame_info_t *video_info) static void menu_display_d3d10_blend_begin(video_frame_info_t *video_info) { - d3d10_video_t* d3d10 = video_info ? (d3d10_video_t*)video_info->userdata : NULL; + d3d10_video_t* d3d10 = (d3d10_video_t*)video_info->userdata; D3D10SetBlendState(d3d10->device, d3d10->blend_enable, NULL, D3D10_DEFAULT_SAMPLE_MASK); } static void menu_display_d3d10_blend_end(video_frame_info_t *video_info) { - d3d10_video_t* d3d10 = video_info ? (d3d10_video_t*)video_info->userdata : NULL; + d3d10_video_t* d3d10 = (d3d10_video_t*)video_info->userdata; D3D10SetBlendState(d3d10->device, d3d10->blend_disable, NULL, D3D10_DEFAULT_SAMPLE_MASK); } @@ -66,9 +66,8 @@ static void menu_display_d3d10_viewport(menu_display_ctx_draw_t *draw, static void menu_display_d3d10_draw(menu_display_ctx_draw_t *draw, video_frame_info_t *video_info) { - int vertex_count; - d3d10_video_t* d3d10 = video_info ? - (d3d10_video_t*)video_info->userdata : NULL; + int vertex_count; + d3d10_video_t* d3d10 = (d3d10_video_t*)video_info->userdata; if (!d3d10 || !draw || !draw->texture) return; @@ -114,7 +113,8 @@ static void menu_display_d3d10_draw(menu_display_ctx_draw_t *draw, { sprite->pos.x = draw->x / (float)d3d10->viewport.Width; sprite->pos.y = - (d3d10->viewport.Height - draw->y - draw->height) / (float)d3d10->viewport.Height; + (d3d10->viewport.Height - draw->y - draw->height) + / (float)d3d10->viewport.Height; sprite->pos.w = draw->width / (float)d3d10->viewport.Width; sprite->pos.h = draw->height / (float)d3d10->viewport.Height; @@ -188,8 +188,7 @@ static void menu_display_d3d10_draw(menu_display_ctx_draw_t *draw, static void menu_display_d3d10_draw_pipeline(menu_display_ctx_draw_t* draw, video_frame_info_t *video_info) { - d3d10_video_t* d3d10 = video_info ? - (d3d10_video_t*)video_info->userdata : NULL; + d3d10_video_t* d3d10 = (d3d10_video_t*)video_info->userdata; if (!d3d10 || !draw) return; @@ -248,8 +247,7 @@ static void menu_display_d3d10_clear_color( menu_display_ctx_clearcolor_t* clearcolor, video_frame_info_t *video_info) { - d3d10_video_t *d3d10 = video_info ? - (d3d10_video_t*)video_info->userdata : NULL; + d3d10_video_t* d3d10 = (d3d10_video_t*)video_info->userdata; if (!d3d10 || !clearcolor) return; @@ -277,34 +275,32 @@ static bool menu_display_d3d10_font_init_first( void menu_display_d3d10_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) { - D3D10_RECT rect = {0}; - d3d10_video_t *d3d10 = video_info ? - (d3d10_video_t*)video_info->userdata : NULL; - - rect.left = x; - rect.top = y; - rect.right = width + x; - rect.bottom = height + y; + D3D10_RECT rect; + d3d10_video_t *d3d10 = (d3d10_video_t*)video_info->userdata; if (!d3d10 || !width || !height) return; + rect.left = x; + rect.top = y; + rect.right = width + x; + rect.bottom = height + y; + D3D10SetScissorRects(d3d10->device, 1, &rect); } void menu_display_d3d10_scissor_end(video_frame_info_t *video_info) { - D3D10_RECT rect = {0}; - d3d10_video_t *d3d10 = video_info ? - (d3d10_video_t*)video_info->userdata : NULL; + D3D10_RECT rect; + d3d10_video_t *d3d10 = (d3d10_video_t*)video_info->userdata; if (!d3d10) return; - rect.left = d3d10->vp.x; - rect.top = d3d10->vp.y; - rect.right = d3d10->vp.width; - rect.bottom = d3d10->vp.height; + rect.left = d3d10->vp.x; + rect.top = d3d10->vp.y; + rect.right = d3d10->vp.width; + rect.bottom = d3d10->vp.height; D3D10SetScissorRects(d3d10->device, 1, &rect); } diff --git a/menu/drivers_display/menu_display_d3d11.c b/menu/drivers_display/menu_display_d3d11.c index 55ac4fc9fe..043a392392 100644 --- a/menu/drivers_display/menu_display_d3d11.c +++ b/menu/drivers_display/menu_display_d3d11.c @@ -65,8 +65,8 @@ static void menu_display_d3d11_viewport(menu_display_ctx_draw_t *draw, static void menu_display_d3d11_draw(menu_display_ctx_draw_t *draw, video_frame_info_t *video_info) { - int vertex_count; - d3d11_video_t* d3d11 = video_info ? (d3d11_video_t*)video_info->userdata : NULL; + int vertex_count; + d3d11_video_t *d3d11 = (d3d11_video_t*)video_info->userdata; if (!d3d11 || !draw || !draw->texture) return; @@ -187,8 +187,7 @@ static void menu_display_d3d11_draw(menu_display_ctx_draw_t *draw, static void menu_display_d3d11_draw_pipeline(menu_display_ctx_draw_t *draw, video_frame_info_t *video_info) { - d3d11_video_t* d3d11 = video_info ? - (d3d11_video_t*)video_info->userdata : NULL; + d3d11_video_t *d3d11 = (d3d11_video_t*)video_info->userdata; if (!d3d11 || !draw) return; @@ -247,8 +246,7 @@ static void menu_display_d3d11_clear_color( menu_display_ctx_clearcolor_t* clearcolor, video_frame_info_t *video_info) { - d3d11_video_t *d3d11 = video_info ? - (d3d11_video_t*)video_info->userdata : NULL; + d3d11_video_t *d3d11 = (d3d11_video_t*)video_info->userdata; if (!d3d11 || !clearcolor) return; @@ -276,34 +274,32 @@ static bool menu_display_d3d11_font_init_first( void menu_display_d3d11_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) { - D3D11_RECT rect = {0}; - d3d11_video_t *d3d11 = video_info ? - (d3d11_video_t*)video_info->userdata : NULL; - - rect.left = x; - rect.top = y; - rect.right = width + x; - rect.bottom = height + y; + D3D11_RECT rect; + d3d11_video_t *d3d11 = (d3d11_video_t*)video_info->userdata; if (!d3d11 || !width || !height) return; + rect.left = x; + rect.top = y; + rect.right = width + x; + rect.bottom = height + y; + D3D11SetScissorRects(d3d11->context, 1, &rect); } void menu_display_d3d11_scissor_end(video_frame_info_t *video_info) { - D3D11_RECT rect = {0}; - d3d11_video_t *d3d11 = video_info ? - (d3d11_video_t*)video_info->userdata : NULL; + D3D11_RECT rect; + d3d11_video_t *d3d11 = (d3d11_video_t*)video_info->userdata; if (!d3d11) return; - rect.left = d3d11->vp.x; - rect.top = d3d11->vp.y; - rect.right = d3d11->vp.width; - rect.bottom = d3d11->vp.height; + rect.left = d3d11->vp.x; + rect.top = d3d11->vp.y; + rect.right = d3d11->vp.width; + rect.bottom = d3d11->vp.height; D3D11SetScissorRects(d3d11->context, 1, &rect); } diff --git a/menu/drivers_display/menu_display_d3d12.c b/menu/drivers_display/menu_display_d3d12.c index e845770724..3a96c215d6 100644 --- a/menu/drivers_display/menu_display_d3d12.c +++ b/menu/drivers_display/menu_display_d3d12.c @@ -67,9 +67,8 @@ static void menu_display_d3d12_viewport(menu_display_ctx_draw_t *draw, static void menu_display_d3d12_draw(menu_display_ctx_draw_t *draw, video_frame_info_t *video_info) { - int vertex_count; - d3d12_video_t* d3d12 = video_info ? - (d3d12_video_t*)video_info->userdata : NULL; + int vertex_count; + d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata; if (!d3d12 || !draw || !draw->texture) return; @@ -205,8 +204,7 @@ static void menu_display_d3d12_draw(menu_display_ctx_draw_t *draw, static void menu_display_d3d12_draw_pipeline(menu_display_ctx_draw_t *draw, video_frame_info_t *video_info) { - d3d12_video_t *d3d12 = video_info ? - (d3d12_video_t*)video_info->userdata : NULL; + d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata; if (!d3d12 || !draw) return; @@ -269,7 +267,7 @@ static void menu_display_d3d12_restore_clear_color(void) {} static void menu_display_d3d12_clear_color( menu_display_ctx_clearcolor_t* clearcolor, video_frame_info_t *video_info) { - d3d12_video_t* d3d12 = video_info ? (d3d12_video_t*)video_info->userdata : NULL; + d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata; if (!d3d12 || !clearcolor) return; @@ -297,34 +295,32 @@ static bool menu_display_d3d12_font_init_first( void menu_display_d3d12_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) { - D3D12_RECT rect = {0}; - d3d12_video_t *d3d12 = video_info ? - (d3d12_video_t*)video_info->userdata : NULL; - - rect.left = x; - rect.top = y; - rect.right = width + x; - rect.bottom = height + y; + D3D12_RECT rect; + d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata; if (!d3d12 || !width || !height) return; + rect.left = x; + rect.top = y; + rect.right = width + x; + rect.bottom = height + y; + D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &rect); } void menu_display_d3d12_scissor_end(video_frame_info_t *video_info) { - D3D12_RECT rect = {0}; - d3d12_video_t *d3d12 = video_info ? - (d3d12_video_t*)video_info->userdata : NULL; + D3D12_RECT rect; + d3d12_video_t *d3d12 = (d3d12_video_t*)video_info->userdata; if (!d3d12) return; - rect.left = d3d12->vp.x; - rect.top = d3d12->vp.y; - rect.right = d3d12->vp.width; - rect.bottom = d3d12->vp.height; + rect.left = d3d12->vp.x; + rect.top = d3d12->vp.y; + rect.right = d3d12->vp.width; + rect.bottom = d3d12->vp.height; D3D12RSSetScissorRects(d3d12->queue.cmd, 1, &rect); } diff --git a/menu/drivers_display/menu_display_d3d8.c b/menu/drivers_display/menu_display_d3d8.c index f5189bed91..4e10a5c8a6 100644 --- a/menu/drivers_display/menu_display_d3d8.c +++ b/menu/drivers_display/menu_display_d3d8.c @@ -80,8 +80,7 @@ static INT32 menu_display_prim_to_d3d8_enum( static void menu_display_d3d8_blend_begin(video_frame_info_t *video_info) { - d3d8_video_t *d3d = video_info ? - (d3d8_video_t*)video_info->userdata : NULL; + d3d8_video_t *d3d = (d3d8_video_t*)video_info->userdata; if (!d3d) return; @@ -91,8 +90,7 @@ static void menu_display_d3d8_blend_begin(video_frame_info_t *video_info) static void menu_display_d3d8_blend_end(video_frame_info_t *video_info) { - d3d8_video_t *d3d = video_info ? - (d3d8_video_t*)video_info->userdata : NULL; + d3d8_video_t *d3d = (d3d8_video_t*)video_info->userdata; if (!d3d) return; @@ -123,8 +121,7 @@ static void menu_display_d3d8_draw(menu_display_ctx_draw_t *draw, unsigned i; math_matrix_4x4 mop, m1, m2; unsigned width, height; - d3d8_video_t *d3d = video_info ? - (d3d8_video_t*)video_info->userdata : NULL; + d3d8_video_t *d3d = (d3d8_video_t*)video_info->userdata; Vertex * pv = NULL; const float *vertex = NULL; const float *tex_coord = NULL; @@ -239,9 +236,8 @@ static void menu_display_d3d8_restore_clear_color(void) static void menu_display_d3d8_clear_color( menu_display_ctx_clearcolor_t *clearcolor, video_frame_info_t *video_info) { - DWORD clear_color = 0; - d3d8_video_t *d3d = video_info ? - (d3d8_video_t*)video_info->userdata : NULL; + DWORD clear_color = 0; + d3d8_video_t *d3d = (d3d8_video_t*)video_info->userdata; if (!d3d || !clearcolor) return; diff --git a/menu/drivers_display/menu_display_d3d9.c b/menu/drivers_display/menu_display_d3d9.c index 003afb7062..fc5af5479e 100644 --- a/menu/drivers_display/menu_display_d3d9.c +++ b/menu/drivers_display/menu_display_d3d9.c @@ -80,8 +80,7 @@ static INT32 menu_display_prim_to_d3d9_enum( static void menu_display_d3d9_blend_begin(video_frame_info_t *video_info) { - d3d9_video_t *d3d = video_info ? - (d3d9_video_t*)video_info->userdata : NULL; + d3d9_video_t *d3d = (d3d9_video_t*)video_info->userdata; if (!d3d) return; @@ -91,8 +90,7 @@ static void menu_display_d3d9_blend_begin(video_frame_info_t *video_info) static void menu_display_d3d9_blend_end(video_frame_info_t *video_info) { - d3d9_video_t *d3d = video_info ? - (d3d9_video_t*)video_info->userdata : NULL; + d3d9_video_t *d3d = (d3d9_video_t*)video_info->userdata; if (!d3d) return; @@ -125,8 +123,7 @@ static void menu_display_d3d9_draw(menu_display_ctx_draw_t *draw, math_matrix_4x4 mop, m1, m2; unsigned width, height; LPDIRECT3DDEVICE9 dev; - d3d9_video_t *d3d = video_info ? - (d3d9_video_t*)video_info->userdata : NULL; + d3d9_video_t *d3d = (d3d9_video_t*)video_info->userdata; Vertex * pv = NULL; const float *vertex = NULL; const float *tex_coord = NULL; @@ -142,7 +139,8 @@ static void menu_display_d3d9_draw(menu_display_ctx_draw_t *draw, return; pv = (Vertex*) - d3d9_vertex_buffer_lock((LPDIRECT3DVERTEXBUFFER9)d3d->menu_display.buffer); + d3d9_vertex_buffer_lock((LPDIRECT3DVERTEXBUFFER9) + d3d->menu_display.buffer); if (!pv) return; @@ -180,7 +178,8 @@ static void menu_display_d3d9_draw(menu_display_ctx_draw_t *draw, colors[2] /* B */ ); } - d3d9_vertex_buffer_unlock((LPDIRECT3DVERTEXBUFFER9)d3d->menu_display.buffer); + d3d9_vertex_buffer_unlock((LPDIRECT3DVERTEXBUFFER9) + d3d->menu_display.buffer); if(!draw->matrix_data) draw->matrix_data = menu_display_d3d9_get_default_mvp(video_info); @@ -270,12 +269,12 @@ static void menu_display_d3d9_restore_clear_color(void) } static void menu_display_d3d9_clear_color( - menu_display_ctx_clearcolor_t *clearcolor, video_frame_info_t *video_info) + menu_display_ctx_clearcolor_t *clearcolor, + video_frame_info_t *video_info) { LPDIRECT3DDEVICE9 dev; - DWORD clear_color = 0; - d3d9_video_t *d3d = video_info ? - (d3d9_video_t*)video_info->userdata : NULL; + DWORD clear_color = 0; + d3d9_video_t *d3d = (d3d9_video_t*)video_info->userdata; if (!d3d || !clearcolor) return; @@ -306,36 +305,36 @@ static bool menu_display_d3d9_font_init_first( return true; } -void menu_display_d3d9_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) +void menu_display_d3d9_scissor_begin( + video_frame_info_t *video_info, + int x, int y, unsigned width, unsigned height) { - RECT rect = {0}; - d3d9_video_t *d3d9 = video_info ? - (d3d9_video_t*)video_info->userdata : NULL; - - rect.left = x; - rect.top = y; - rect.right = width + x; - rect.bottom = height + y; + RECT rect; + d3d9_video_t *d3d9 = (d3d9_video_t*)video_info->userdata; if (!d3d9 || !width || !height) return; + rect.left = x; + rect.top = y; + rect.right = width + x; + rect.bottom = height + y; + d3d9_set_scissor_rect(d3d9->dev, &rect); } void menu_display_d3d9_scissor_end(video_frame_info_t *video_info) { - RECT rect = {0}; - d3d9_video_t *d3d9 = video_info ? - (d3d9_video_t*)video_info->userdata : NULL; + RECT rect; + d3d9_video_t *d3d9 = (d3d9_video_t*)video_info->userdata; if (!d3d9) return; - rect.left = d3d9->vp.x; - rect.top = d3d9->vp.y; - rect.right = d3d9->vp.width; - rect.bottom = d3d9->vp.height; + rect.left = d3d9->vp.x; + rect.top = d3d9->vp.y; + rect.right = d3d9->vp.width; + rect.bottom = d3d9->vp.height; d3d9_set_scissor_rect(d3d9->dev, &rect); } diff --git a/menu/drivers_display/menu_display_gl.c b/menu/drivers_display/menu_display_gl.c index 2baa181da4..7e02fe4a09 100644 --- a/menu/drivers_display/menu_display_gl.c +++ b/menu/drivers_display/menu_display_gl.c @@ -52,7 +52,7 @@ static const float *menu_display_gl_get_default_tex_coords(void) static void *menu_display_gl_get_default_mvp(video_frame_info_t *video_info) { - gl_t *gl = video_info ? (gl_t*)video_info->userdata : NULL; + gl_t *gl = (gl_t*)video_info->userdata; if (!gl) return NULL; diff --git a/menu/drivers_display/menu_display_gl1.c b/menu/drivers_display/menu_display_gl1.c index b0099d76f4..7e308015bd 100644 --- a/menu/drivers_display/menu_display_gl1.c +++ b/menu/drivers_display/menu_display_gl1.c @@ -53,7 +53,7 @@ static const float *menu_display_gl1_get_default_tex_coords(void) static void *menu_display_gl1_get_default_mvp(video_frame_info_t *video_info) { - gl1_t *gl1 = video_info ? (gl1_t*)video_info->userdata : NULL; + gl1_t *gl1 = (gl1_t*)video_info->userdata; if (!gl1) return NULL; diff --git a/menu/drivers_display/menu_display_gl_core.c b/menu/drivers_display/menu_display_gl_core.c index c2f9df52d1..8930f76aeb 100644 --- a/menu/drivers_display/menu_display_gl_core.c +++ b/menu/drivers_display/menu_display_gl_core.c @@ -51,7 +51,7 @@ static const float gl_core_colors[] = { static void *menu_display_gl_core_get_default_mvp(video_frame_info_t *video_info) { - gl_core_t *gl_core = video_info ? (gl_core_t*)video_info->userdata : NULL; + gl_core_t *gl_core = (gl_core_t*)video_info->userdata; if (!gl_core) return NULL; return &gl_core->mvp_no_rot; @@ -83,23 +83,23 @@ static void menu_display_gl_core_draw_pipeline(menu_display_ctx_draw_t *draw, video_frame_info_t *video_info) { #ifdef HAVE_SHADERPIPELINE + float output_size[2]; + static struct video_coords blank_coords; static uint8_t ubo_scratch_data[768]; static float t = 0.0f; float yflip = 0.0f; - static struct video_coords blank_coords; - float output_size[2]; - video_coord_array_t *ca = NULL; - gl_core_t *gl = video_info ? (gl_core_t*)video_info->userdata : NULL; + video_coord_array_t *ca = NULL; + gl_core_t *gl_core = (gl_core_t*)video_info->userdata; - if (!gl || !draw) + if (!gl_core || !draw) return; - draw->x = 0; - draw->y = 0; - draw->matrix_data = NULL; + draw->x = 0; + 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_info->width; + output_size[1] = (float)video_info->height; switch (draw->pipeline.id) { @@ -123,7 +123,8 @@ static void menu_display_gl_core_draw_pipeline(menu_display_ctx_draw_t *draw, case VIDEO_SHADER_MENU_4: case VIDEO_SHADER_MENU_5: draw->pipeline.backend_data = ubo_scratch_data; - draw->pipeline.backend_data_size = sizeof(math_matrix_4x4) + 4 * sizeof(float); + draw->pipeline.backend_data_size = sizeof(math_matrix_4x4) + + 4 * sizeof(float); /* Match UBO layout in shader. */ memcpy(ubo_scratch_data, @@ -138,8 +139,10 @@ static void menu_display_gl_core_draw_pipeline(menu_display_ctx_draw_t *draw, else yflip = 0.0f; - memcpy(ubo_scratch_data + sizeof(math_matrix_4x4) + 2 * sizeof(float), &t, sizeof(t)); - memcpy(ubo_scratch_data + sizeof(math_matrix_4x4) + 3 * sizeof(float), &yflip, sizeof(yflip)); + memcpy(ubo_scratch_data + sizeof(math_matrix_4x4) + + 2 * sizeof(float), &t, sizeof(t)); + memcpy(ubo_scratch_data + sizeof(math_matrix_4x4) + + 3 * sizeof(float), &yflip, sizeof(yflip)); draw->coords = &blank_coords; blank_coords.vertices = 4; draw->prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; @@ -158,7 +161,7 @@ static void menu_display_gl_core_draw(menu_display_ctx_draw_t *draw, const float *color = NULL; struct gl_core_vertex *pv = NULL; GLuint texture = 0; - gl_core_t *gl = video_info ? (gl_core_t*)video_info->userdata : NULL; + gl_core_t *gl = (gl_core_t*)video_info->userdata; const struct gl_core_buffer_locations *loc = NULL; if (!gl || !draw) @@ -228,18 +231,14 @@ static void menu_display_gl_core_draw(menu_display_ctx_draw_t *draw, } if (loc && loc->flat_ubo_vertex >= 0) - { glUniform4fv(loc->flat_ubo_vertex, (GLsizei)((draw->pipeline.backend_data_size + 15) / 16), (const GLfloat*)draw->pipeline.backend_data); - } if (loc && loc->flat_ubo_fragment >= 0) - { glUniform4fv(loc->flat_ubo_fragment, (GLsizei)((draw->pipeline.backend_data_size + 15) / 16), (const GLfloat*)draw->pipeline.backend_data); - } if (!loc) { @@ -298,7 +297,7 @@ static void menu_display_gl_core_clear_color( static void menu_display_gl_core_blend_begin(video_frame_info_t *video_info) { - gl_core_t *gl = video_info ? (gl_core_t*)video_info->userdata : NULL; + gl_core_t *gl = (gl_core_t*)video_info->userdata; glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/menu/drivers_display/menu_display_vulkan.c b/menu/drivers_display/menu_display_vulkan.c index b4b6af2f30..081e3291e4 100644 --- a/menu/drivers_display/menu_display_vulkan.c +++ b/menu/drivers_display/menu_display_vulkan.c @@ -121,13 +121,12 @@ static void menu_display_vk_draw_pipeline(menu_display_ctx_draw_t *draw, { #ifdef HAVE_SHADERPIPELINE static uint8_t ubo_scratch_data[768]; - static float t = 0.0f; - float yflip = 0.0f; + static float t = 0.0f; + float yflip = 0.0f; static struct video_coords blank_coords; float output_size[2]; - video_coord_array_t *ca = NULL; - vk_t *vk = video_info ? - (vk_t*)video_info->userdata : NULL; + video_coord_array_t *ca = NULL; + vk_t *vk = (vk_t*)video_info->userdata; if (!vk || !draw) return; @@ -161,7 +160,8 @@ static void menu_display_vk_draw_pipeline(menu_display_ctx_draw_t *draw, case VIDEO_SHADER_MENU_4: case VIDEO_SHADER_MENU_5: draw->pipeline.backend_data = ubo_scratch_data; - draw->pipeline.backend_data_size = sizeof(math_matrix_4x4) + 4 * sizeof(float); + draw->pipeline.backend_data_size = sizeof(math_matrix_4x4) + + 4 * sizeof(float); /* Match UBO layout in shader. */ memcpy(ubo_scratch_data, @@ -177,11 +177,13 @@ static void menu_display_vk_draw_pipeline(menu_display_ctx_draw_t *draw, else yflip = 1.0f; - memcpy(ubo_scratch_data + sizeof(math_matrix_4x4) + 2 * sizeof(float), &t, sizeof(t)); - memcpy(ubo_scratch_data + sizeof(math_matrix_4x4) + 3 * sizeof(float), &yflip, sizeof(yflip)); - draw->coords = &blank_coords; + memcpy(ubo_scratch_data + sizeof(math_matrix_4x4) + + 2 * sizeof(float), &t, sizeof(t)); + memcpy(ubo_scratch_data + sizeof(math_matrix_4x4) + + 3 * sizeof(float), &yflip, sizeof(yflip)); + draw->coords = &blank_coords; blank_coords.vertices = 4; - draw->prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; + draw->prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP; break; } @@ -199,8 +201,7 @@ static void menu_display_vk_draw(menu_display_ctx_draw_t *draw, const float *tex_coord = NULL; const float *color = NULL; struct vk_vertex *pv = NULL; - vk_t *vk = video_info ? - (vk_t*)video_info->userdata : NULL; + vk_t *vk = (vk_t*)video_info->userdata; if (!vk || !draw) return; @@ -305,7 +306,7 @@ static void menu_display_vk_clear_color( { VkClearRect rect; VkClearAttachment attachment; - vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; + vk_t *vk = (vk_t*)video_info->userdata; if (!vk || !clearcolor) return; @@ -327,7 +328,7 @@ static void menu_display_vk_clear_color( static void menu_display_vk_blend_begin(video_frame_info_t *video_info) { - vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; + vk_t *vk = (vk_t*)video_info->userdata; if (vk) vk->display.blend = true; @@ -335,7 +336,7 @@ static void menu_display_vk_blend_begin(video_frame_info_t *video_info) static void menu_display_vk_blend_end(video_frame_info_t *video_info) { - vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; + vk_t *vk = (vk_t*)video_info->userdata; if (vk) vk->display.blend = false; @@ -360,7 +361,7 @@ static bool menu_display_vk_font_init_first( static void menu_display_vk_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height) { - vk_t *vk = (vk_t*)video_info->userdata; + vk_t *vk = (vk_t*)video_info->userdata; vk->tracker.use_scissor = true; vk->tracker.scissor.offset.x = x; @@ -372,7 +373,8 @@ static void menu_display_vk_scissor_begin(video_frame_info_t *video_info, static void menu_display_vk_scissor_end(video_frame_info_t *video_info) { - vk_t *vk = (vk_t*)video_info->userdata; + vk_t *vk = (vk_t*)video_info->userdata; + vk->tracker.use_scissor = false; vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT; }