From a61c529d20f5b0c929ab3311427509f69ad95589 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 11 Nov 2015 04:07:48 +0100 Subject: [PATCH] (D3D) Simplify struct overlay_vertex --- gfx/d3d/d3d.cpp | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index aab2624878..a913436a64 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -1290,9 +1290,7 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay) unsigned i; struct overlay_vertex { - float x, y, z; - float u, v; - float r, g, b, a; + float v[9]; } vert[4]; float overlay_width, overlay_height; #ifndef _XBOX1 @@ -1325,9 +1323,11 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay) for (i = 0; i < 4; i++) { - vert[i].z = 0.5f; - vert[i].r = vert[i].g = vert[i].b = 1.0f; - vert[i].a = overlay->alpha_mod; + vert[i].v[2] = 0.5f; + vert[i].v[5] = 1.0f; + vert[i].v[6] = 1.0f; + vert[i].v[7] = 1.0f; + vert[i].v[8] = overlay->alpha_mod; } d3d_viewport_info(d3d, &vp); @@ -1335,33 +1335,33 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay) overlay_width = vp.width; overlay_height = vp.height; - vert[0].x = overlay->vert_coords[0] * overlay_width; - vert[1].x = (overlay->vert_coords[0] + overlay->vert_coords[2]) + vert[0].v[0] = overlay->vert_coords[0] * overlay_width; + vert[1].v[0] = (overlay->vert_coords[0] + overlay->vert_coords[2]) * overlay_width; - vert[2].x = overlay->vert_coords[0] * overlay_width; - vert[3].x = (overlay->vert_coords[0] + overlay->vert_coords[2]) + vert[2].v[0] = overlay->vert_coords[0] * overlay_width; + vert[3].v[0] = (overlay->vert_coords[0] + overlay->vert_coords[2]) * overlay_width; - vert[0].y = overlay->vert_coords[1] * overlay_height; - vert[1].y = overlay->vert_coords[1] * overlay_height; - vert[2].y = (overlay->vert_coords[1] + overlay->vert_coords[3]) + vert[0].v[1] = overlay->vert_coords[1] * overlay_height; + vert[1].v[1] = overlay->vert_coords[1] * overlay_height; + vert[2].v[1] = (overlay->vert_coords[1] + overlay->vert_coords[3]) * overlay_height; - vert[3].y = (overlay->vert_coords[1] + overlay->vert_coords[3]) + vert[3].v[1] = (overlay->vert_coords[1] + overlay->vert_coords[3]) * overlay_height; - vert[0].u = overlay->tex_coords[0]; - vert[1].u = overlay->tex_coords[0] + overlay->tex_coords[2]; - vert[2].u = overlay->tex_coords[0]; - vert[3].u = overlay->tex_coords[0] + overlay->tex_coords[2]; - vert[0].v = overlay->tex_coords[1]; - vert[1].v = overlay->tex_coords[1]; - vert[2].v = overlay->tex_coords[1] + overlay->tex_coords[3]; - vert[3].v = overlay->tex_coords[1] + overlay->tex_coords[3]; + vert[0].v[3] = overlay->tex_coords[0]; + vert[1].v[3] = overlay->tex_coords[0] + overlay->tex_coords[2]; + vert[2].v[3] = overlay->tex_coords[0]; + vert[3].v[3] = overlay->tex_coords[0] + overlay->tex_coords[2]; + vert[0].v[4] = overlay->tex_coords[1]; + vert[1].v[4] = overlay->tex_coords[1]; + vert[2].v[4] = overlay->tex_coords[1] + overlay->tex_coords[3]; + vert[3].v[4] = overlay->tex_coords[1] + overlay->tex_coords[3]; /* Align texels and vertices. */ for (i = 0; i < 4; i++) { - vert[i].x -= 0.5f; - vert[i].y += 0.5f; + vert[i].v[0] -= 0.5f; + vert[i].v[1] += 0.5f; } overlay->vert_buf->Lock(0, sizeof(vert), &verts, 0);