mirror of
https://github.com/libretro/RetroArch
synced 2025-03-27 23:37:39 +00:00
(D3D12) add support for scaling/rotation im menu display driver.
This commit is contained in:
parent
45541a0d44
commit
8354ffd452
gfx
menu
@ -2484,6 +2484,11 @@ typedef struct
|
||||
float u, v, w, h;
|
||||
} coords;
|
||||
UINT32 colors[4];
|
||||
struct
|
||||
{
|
||||
float scaling;
|
||||
float rotation;
|
||||
}params;
|
||||
} d3d11_sprite_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -330,8 +330,10 @@ d3d11_gfx_init(const video_info_t* video, const input_driver_t** input, void** i
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "COLOR", 3, DXGI_FORMAT_R8G8B8A8_UNORM, 0, offsetof(d3d11_sprite_t, colors[3]),
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "PARAMS", 0, DXGI_FORMAT_R32G32_FLOAT, 0, offsetof(d3d11_sprite_t, params),
|
||||
D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
#if 1
|
||||
#if 0
|
||||
d3d_compile(sprite, sizeof(sprite), "VSMain", "vs_5_0", &vs_code);
|
||||
d3d_compile(sprite, sizeof(sprite), "PSMain", "ps_5_0", &ps_code);
|
||||
d3d_compile(sprite, sizeof(sprite), "PSMainA8", "ps_5_0", &ps_A8_code);
|
||||
@ -522,7 +524,6 @@ static bool d3d11_gfx_frame(
|
||||
D3D11SetPShaderSamplers(d3d11->ctx, 0, 1, &d3d11->sampler_linear);
|
||||
D3D11SetBlendState(d3d11->ctx, d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
|
||||
|
||||
d3d11->sprites.enabled = true;
|
||||
|
||||
if (d3d11->menu.enabled)
|
||||
|
@ -138,7 +138,7 @@ static void d3d11_font_render_line(
|
||||
if (!d3d11->sprites.enabled || msg_len > d3d11->sprites.capacity)
|
||||
return;
|
||||
|
||||
if(d3d11->sprites.offset + msg_len > d3d11->sprites.capacity)
|
||||
if (d3d11->sprites.offset + msg_len > d3d11->sprites.capacity)
|
||||
d3d11->sprites.offset = 0;
|
||||
|
||||
switch (text_align)
|
||||
@ -158,9 +158,9 @@ static void d3d11_font_render_line(
|
||||
for (i = 0; i < msg_len; i++)
|
||||
{
|
||||
const struct font_glyph* glyph;
|
||||
const char* msg_tmp = &msg[i];
|
||||
unsigned code = utf8_walk(&msg_tmp);
|
||||
unsigned skip = msg_tmp - &msg[i];
|
||||
const char* msg_tmp = &msg[i];
|
||||
unsigned code = utf8_walk(&msg_tmp);
|
||||
unsigned skip = msg_tmp - &msg[i];
|
||||
|
||||
if (skip > 1)
|
||||
i += skip - 1;
|
||||
@ -183,6 +183,9 @@ static void d3d11_font_render_line(
|
||||
v->coords.w = glyph->width / (float)font->texture.desc.Width;
|
||||
v->coords.h = glyph->height / (float)font->texture.desc.Height;
|
||||
|
||||
v->params.scaling = 1;
|
||||
v->params.rotation = 0;
|
||||
|
||||
v->colors[0] = color;
|
||||
v->colors[1] = color;
|
||||
v->colors[2] = color;
|
||||
|
@ -633,6 +633,8 @@ static void xmb_draw_icon(
|
||||
|
||||
draw.width = icon_size;
|
||||
draw.height = icon_size;
|
||||
draw.rotation = rotation;
|
||||
draw.scale_factor = scale_factor;
|
||||
#if defined(VITA) || defined(WIIU)
|
||||
draw.width *= scale_factor;
|
||||
draw.height *= scale_factor;
|
||||
|
@ -70,6 +70,12 @@ static void menu_display_d3d11_draw(void* data)
|
||||
v->coords.w = 1.0f;
|
||||
v->coords.h = 1.0f;
|
||||
|
||||
if(draw->scale_factor)
|
||||
v->params.scaling = draw->scale_factor;
|
||||
else
|
||||
v->params.scaling = 1.0f;
|
||||
v->params.rotation = draw->rotation;
|
||||
|
||||
v->colors[3] = DXGI_COLOR_RGBA(
|
||||
0xFF * draw->coords->color[0], 0xFF * draw->coords->color[1],
|
||||
0xFF * draw->coords->color[2], 0xFF * draw->coords->color[3]);
|
||||
|
@ -615,9 +615,11 @@ void menu_display_draw_bg(menu_display_ctx_draw_t *draw,
|
||||
coords.vertex = new_vertex;
|
||||
coords.tex_coord = new_tex_coord;
|
||||
coords.lut_tex_coord = new_tex_coord;
|
||||
coords.color = (const float*)draw->color;
|
||||
coords.color = (const float*)draw->color;
|
||||
|
||||
draw->coords = &coords;
|
||||
draw->coords = &coords;
|
||||
draw->scale_factor = 1.0f;
|
||||
draw->rotation = 0.0f;
|
||||
|
||||
if (draw->texture)
|
||||
add_opacity_to_wallpaper = true;
|
||||
@ -660,15 +662,17 @@ void menu_display_draw_quad(
|
||||
if (menu_disp && menu_disp->blend_begin)
|
||||
menu_disp->blend_begin();
|
||||
|
||||
draw.x = x;
|
||||
draw.y = (int)height - y - (int)h;
|
||||
draw.width = w;
|
||||
draw.height = h;
|
||||
draw.coords = &coords;
|
||||
draw.matrix_data = NULL;
|
||||
draw.texture = menu_display_white_texture;
|
||||
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||
draw.pipeline.id = 0;
|
||||
draw.x = x;
|
||||
draw.y = (int)height - y - (int)h;
|
||||
draw.width = w;
|
||||
draw.height = h;
|
||||
draw.coords = &coords;
|
||||
draw.matrix_data = NULL;
|
||||
draw.texture = menu_display_white_texture;
|
||||
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
||||
draw.pipeline.id = 0;
|
||||
draw.scale_factor = 1.0f;
|
||||
draw.rotation = 0.0f;
|
||||
|
||||
menu_display_draw(&draw);
|
||||
|
||||
|
@ -379,6 +379,8 @@ typedef struct menu_display_ctx_draw
|
||||
size_t backend_data_size;
|
||||
bool active;
|
||||
} pipeline;
|
||||
float rotation;
|
||||
float scale_factor;
|
||||
} menu_display_ctx_draw_t;
|
||||
|
||||
typedef struct menu_display_ctx_rotate_draw
|
||||
|
Loading…
x
Reference in New Issue
Block a user