mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
(gfx display) set_viewport - no longer dependent on video_frame_info
This commit is contained in:
parent
874510152e
commit
809e22ec1a
@ -34,7 +34,7 @@ static void *gfx_display_ctr_get_default_mvp(void *data) { return NULL; }
|
||||
static void gfx_display_ctr_blend_begin(video_frame_info_t *video_info) { }
|
||||
static void gfx_display_ctr_blend_end(video_frame_info_t *video_info) { }
|
||||
static void gfx_display_ctr_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info) { }
|
||||
void *data) { }
|
||||
|
||||
static void gfx_display_ctr_draw(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
|
@ -57,10 +57,7 @@ static void gfx_display_d3d10_blend_end(video_frame_info_t *video_info)
|
||||
d3d10->blend_disable, NULL, D3D10_DEFAULT_SAMPLE_MASK);
|
||||
}
|
||||
|
||||
static void gfx_display_d3d10_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
}
|
||||
static void gfx_display_d3d10_viewport(gfx_display_ctx_draw_t *draw, void *data) { }
|
||||
|
||||
static void gfx_display_d3d10_draw(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
|
@ -56,10 +56,7 @@ static void gfx_display_d3d11_blend_end(video_frame_info_t *video_info)
|
||||
d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
}
|
||||
|
||||
static void gfx_display_d3d11_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
}
|
||||
static void gfx_display_d3d11_viewport(gfx_display_ctx_draw_t *draw, void *data) { }
|
||||
|
||||
static void gfx_display_d3d11_draw(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
|
@ -58,10 +58,7 @@ static void gfx_display_d3d12_blend_end(video_frame_info_t *video_info)
|
||||
D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe);
|
||||
}
|
||||
|
||||
static void gfx_display_d3d12_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
}
|
||||
static void gfx_display_d3d12_viewport(gfx_display_ctx_draw_t *draw, void *data) { }
|
||||
|
||||
static void gfx_display_d3d12_draw(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
@ -176,7 +173,7 @@ static void gfx_display_d3d12_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (texture->dirty)
|
||||
{
|
||||
d3d12_upload_texture(d3d12->queue.cmd,
|
||||
texture, video_info->userdata);
|
||||
texture, d3d12);
|
||||
|
||||
if (vertex_count > 1)
|
||||
D3D12SetPipelineState(d3d12->queue.cmd,
|
||||
|
@ -98,10 +98,7 @@ static void gfx_display_d3d8_blend_end(video_frame_info_t *video_info)
|
||||
d3d8_disable_blend_func(d3d->dev);
|
||||
}
|
||||
|
||||
static void gfx_display_d3d8_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
}
|
||||
static void gfx_display_d3d8_viewport(gfx_display_ctx_draw_t *draw, void *data) { }
|
||||
|
||||
static void gfx_display_d3d8_bind_texture(gfx_display_ctx_draw_t *draw,
|
||||
d3d8_video_t *d3d)
|
||||
@ -188,7 +185,7 @@ static void gfx_display_d3d8_draw(gfx_display_ctx_draw_t *draw,
|
||||
d3d8_vertex_buffer_unlock(d3d->menu_display.buffer);
|
||||
|
||||
if (!draw->matrix_data)
|
||||
draw->matrix_data = gfx_display_d3d8_get_default_mvp(video_info->userdata);
|
||||
draw->matrix_data = gfx_display_d3d8_get_default_mvp(d3d);
|
||||
|
||||
/* ugh */
|
||||
matrix_4x4_scale(m1, 2.0, 2.0, 0);
|
||||
|
@ -98,10 +98,7 @@ static void gfx_display_d3d9_blend_end(video_frame_info_t *video_info)
|
||||
d3d9_disable_blend_func(d3d->dev);
|
||||
}
|
||||
|
||||
static void gfx_display_d3d9_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
}
|
||||
static void gfx_display_d3d9_viewport(gfx_display_ctx_draw_t *draw, void *data) { }
|
||||
|
||||
static void gfx_display_d3d9_bind_texture(gfx_display_ctx_draw_t *draw,
|
||||
d3d9_video_t *d3d)
|
||||
@ -183,7 +180,7 @@ static void gfx_display_d3d9_draw(gfx_display_ctx_draw_t *draw,
|
||||
d3d->menu_display.buffer);
|
||||
|
||||
if (!draw->matrix_data)
|
||||
draw->matrix_data = gfx_display_d3d9_get_default_mvp(video_info->userdata);
|
||||
draw->matrix_data = gfx_display_d3d9_get_default_mvp(d3d);
|
||||
|
||||
/* ugh */
|
||||
matrix_4x4_scale(m1, 2.0, 2.0, 0);
|
||||
|
@ -112,10 +112,7 @@ static void gfx_display_gdi_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
{
|
||||
}
|
||||
|
||||
static void gfx_display_gdi_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
}
|
||||
static void gfx_display_gdi_viewport(gfx_display_ctx_draw_t *draw, void *data) { }
|
||||
|
||||
static void gfx_display_gdi_restore_clear_color(void)
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ static void gfx_display_gl_blend_end(video_frame_info_t *video_info)
|
||||
}
|
||||
|
||||
static void gfx_display_gl_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
void *data)
|
||||
{
|
||||
if (draw)
|
||||
glViewport(draw->x, draw->y, draw->width, draw->height);
|
||||
@ -244,13 +244,13 @@ static void gfx_display_gl_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (!draw->coords->lut_tex_coord)
|
||||
draw->coords->lut_tex_coord = gfx_display_gl_get_default_tex_coords();
|
||||
|
||||
gfx_display_gl_viewport(draw, video_info);
|
||||
gfx_display_gl_viewport(draw, gl);
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)draw->texture);
|
||||
|
||||
gl->shader->set_coords(gl->shader_data, draw->coords);
|
||||
gl->shader->set_mvp(gl->shader_data,
|
||||
draw->matrix_data ? (math_matrix_4x4*)draw->matrix_data
|
||||
: (math_matrix_4x4*)gfx_display_gl_get_default_mvp(video_info->userdata));
|
||||
: (math_matrix_4x4*)gfx_display_gl_get_default_mvp(gl));
|
||||
|
||||
|
||||
glDrawArrays(gfx_display_prim_to_gl_enum(
|
||||
|
@ -93,7 +93,7 @@ static void gfx_display_gl1_blend_end(video_frame_info_t *video_info)
|
||||
}
|
||||
|
||||
static void gfx_display_gl1_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
void *data)
|
||||
{
|
||||
if (draw)
|
||||
glViewport(draw->x, draw->y, draw->width, draw->height);
|
||||
@ -115,7 +115,7 @@ static void gfx_display_gl1_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (!draw->coords->lut_tex_coord)
|
||||
draw->coords->lut_tex_coord = gfx_display_gl1_get_default_tex_coords();
|
||||
|
||||
gfx_display_gl1_viewport(draw, video_info);
|
||||
gfx_display_gl1_viewport(draw, gl1);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
@ -123,7 +123,7 @@ static void gfx_display_gl1_draw(gfx_display_ctx_draw_t *draw,
|
||||
|
||||
mvp.data = gl1;
|
||||
mvp.matrix = draw->matrix_data ? (math_matrix_4x4*)draw->matrix_data
|
||||
: (math_matrix_4x4*)gfx_display_gl1_get_default_mvp(video_info->userdata);
|
||||
: (math_matrix_4x4*)gfx_display_gl1_get_default_mvp(gl1);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
|
@ -71,8 +71,7 @@ static const float *gfx_display_gl_core_get_default_tex_coords(void)
|
||||
return &gl_core_tex_coords[0];
|
||||
}
|
||||
|
||||
static void gfx_display_gl_core_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
static void gfx_display_gl_core_viewport(gfx_display_ctx_draw_t *draw, void *data)
|
||||
{
|
||||
if (draw)
|
||||
glViewport(draw->x, draw->y, draw->width, draw->height);
|
||||
@ -88,11 +87,11 @@ static void gfx_display_gl_core_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
static float t = 0.0f;
|
||||
float yflip = 0.0f;
|
||||
video_coord_array_t *ca = NULL;
|
||||
gl_core_t *gl_core = (gl_core_t*)video_info->userdata;
|
||||
gl_core_t *gl = (gl_core_t*)video_info->userdata;
|
||||
unsigned video_width = video_info->width;
|
||||
unsigned video_height = video_info->height;
|
||||
|
||||
if (!gl_core || !draw)
|
||||
if (!gl || !draw)
|
||||
return;
|
||||
|
||||
draw->x = 0;
|
||||
@ -129,7 +128,7 @@ static void gfx_display_gl_core_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
|
||||
/* Match UBO layout in shader. */
|
||||
memcpy(ubo_scratch_data,
|
||||
gfx_display_gl_core_get_default_mvp(video_info->userdata),
|
||||
gfx_display_gl_core_get_default_mvp(gl),
|
||||
sizeof(math_matrix_4x4));
|
||||
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4),
|
||||
output_size,
|
||||
@ -178,7 +177,7 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (!color)
|
||||
color = gfx_display_gl_core_get_default_color();
|
||||
|
||||
gfx_display_gl_core_viewport(draw, video_info);
|
||||
gfx_display_gl_core_viewport(draw, gl);
|
||||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
@ -242,7 +241,7 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (!loc)
|
||||
{
|
||||
const math_matrix_4x4 *mat = draw->matrix_data
|
||||
? (const math_matrix_4x4*)draw->matrix_data : (const math_matrix_4x4*)gfx_display_gl_core_get_default_mvp(video_info->userdata);
|
||||
? (const math_matrix_4x4*)draw->matrix_data : (const math_matrix_4x4*)gfx_display_gl_core_get_default_mvp(gl);
|
||||
if (gl->pipelines.alpha_blend_loc.flat_ubo_vertex >= 0)
|
||||
glUniform4fv(gl->pipelines.alpha_blend_loc.flat_ubo_vertex,
|
||||
4, mat->data);
|
||||
|
@ -82,9 +82,7 @@ static void gfx_display_metal_draw_pipeline(gfx_display_ctx_draw_t *draw, video_
|
||||
}
|
||||
|
||||
static void gfx_display_metal_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
}
|
||||
void *data) } { }
|
||||
|
||||
static void gfx_display_metal_scissor_begin(video_frame_info_t *video_info, int x, int y, unsigned width, unsigned height)
|
||||
{
|
||||
|
@ -46,9 +46,7 @@ static void gfx_display_switch_draw_pipeline(
|
||||
}
|
||||
|
||||
static void gfx_display_switch_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
}
|
||||
void *data) { }
|
||||
|
||||
static void gfx_display_switch_restore_clear_color(void)
|
||||
{
|
||||
|
@ -85,11 +85,10 @@ static void gfx_display_vita2d_blend_end(video_frame_info_t *video_info)
|
||||
}
|
||||
|
||||
static void gfx_display_vita2d_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
void *data)
|
||||
{
|
||||
if (draw){
|
||||
if (draw)
|
||||
vita2d_set_viewport(draw->x, draw->y, draw->width, draw->height);
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_display_vita2d_draw(gfx_display_ctx_draw_t *draw,
|
||||
@ -121,7 +120,7 @@ static void gfx_display_vita2d_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (!color)
|
||||
color = gfx_display_vita2d_get_default_color();
|
||||
|
||||
gfx_display_vita2d_viewport(draw, video_info);
|
||||
gfx_display_vita2d_viewport(draw, vita2d);
|
||||
|
||||
vita2d_texture_tint_vertex *vertices = (vita2d_texture_tint_vertex *)vita2d_pool_memalign(
|
||||
draw->coords->vertices * sizeof(vita2d_texture_tint_vertex),
|
||||
@ -140,13 +139,13 @@ static void gfx_display_vita2d_draw(gfx_display_ctx_draw_t *draw,
|
||||
}
|
||||
|
||||
const math_matrix_4x4 *mat = draw->matrix_data
|
||||
? (const math_matrix_4x4*)draw->matrix_data : (const math_matrix_4x4*)gfx_display_vita2d_get_default_mvp(video_info->userdata);
|
||||
? (const math_matrix_4x4*)draw->matrix_data : (const math_matrix_4x4*)gfx_display_vita2d_get_default_mvp(vita2d);
|
||||
|
||||
switch (draw->pipeline.id)
|
||||
{
|
||||
default:
|
||||
{
|
||||
vita2d_draw_array_textured_mat(texture, vertices, draw->coords->vertices, gfx_display_vita2d_get_default_mvp(video_info->userdata));
|
||||
vita2d_draw_array_textured_mat(texture, vertices, draw->coords->vertices, gfx_display_vita2d_get_default_mvp(vita2d));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -100,9 +100,9 @@ static unsigned to_menu_pipeline(
|
||||
#endif
|
||||
|
||||
static void gfx_display_vk_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
void *data)
|
||||
{
|
||||
vk_t *vk = (vk_t*)video_info->userdata;
|
||||
vk_t *vk = (vk_t*)data;
|
||||
|
||||
if (!vk || !draw)
|
||||
return;
|
||||
@ -164,7 +164,7 @@ static void gfx_display_vk_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
|
||||
/* Match UBO layout in shader. */
|
||||
memcpy(ubo_scratch_data,
|
||||
gfx_display_vk_get_default_mvp(video_info->userdata),
|
||||
gfx_display_vk_get_default_mvp(vk),
|
||||
sizeof(math_matrix_4x4));
|
||||
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4),
|
||||
output_size,
|
||||
@ -221,7 +221,7 @@ static void gfx_display_vk_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (!color)
|
||||
color = gfx_display_vk_get_default_color();
|
||||
|
||||
gfx_display_vk_viewport(draw, video_info);
|
||||
gfx_display_vk_viewport(draw, vk);
|
||||
|
||||
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
|
||||
|
||||
@ -284,7 +284,7 @@ static void gfx_display_vk_draw(gfx_display_ctx_draw_t *draw,
|
||||
(texture->default_smooth ? vk->samplers.linear
|
||||
: vk->samplers.nearest);
|
||||
call.uniform = draw->matrix_data
|
||||
? draw->matrix_data : gfx_display_vk_get_default_mvp(video_info->userdata);
|
||||
? draw->matrix_data : gfx_display_vk_get_default_mvp(vk);
|
||||
call.uniform_size = sizeof(math_matrix_4x4);
|
||||
call.vbo = ⦥
|
||||
call.vertices = draw->coords->vertices;
|
||||
|
@ -53,11 +53,7 @@ static void gfx_display_wiiu_blend_end(video_frame_info_t *video_info)
|
||||
|
||||
}
|
||||
|
||||
static void gfx_display_wiiu_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
{
|
||||
|
||||
}
|
||||
static void gfx_display_wiiu_viewport(gfx_display_ctx_draw_t *draw, void *data) { }
|
||||
|
||||
static void gfx_display_wiiu_draw(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info)
|
||||
|
@ -83,8 +83,7 @@ static void gfx_display_null_draw(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info) { }
|
||||
static void gfx_display_null_draw_pipeline(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info) { }
|
||||
static void gfx_display_null_viewport(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info) { }
|
||||
static void gfx_display_null_viewport(gfx_display_ctx_draw_t *draw, void *data) { }
|
||||
static void gfx_display_null_restore_clear_color(void) { }
|
||||
static void gfx_display_null_clear_color(gfx_display_ctx_clearcolor_t *clearcolor, video_frame_info_t *video_info) { }
|
||||
|
||||
|
@ -109,8 +109,7 @@ typedef struct gfx_display_ctx_driver
|
||||
/* Draw one of the menu pipeline shaders. */
|
||||
void (*draw_pipeline)(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info);
|
||||
void (*viewport)(gfx_display_ctx_draw_t *draw,
|
||||
video_frame_info_t *video_info);
|
||||
void (*viewport)(gfx_display_ctx_draw_t *draw, void *data);
|
||||
/* Start blending operation. */
|
||||
void (*blend_begin)(video_frame_info_t *video_info);
|
||||
/* Finish blending operation. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user