mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
This should make XMB/MaterialUI render correctly on D3D8
This commit is contained in:
parent
79b434719f
commit
4ef66e6e8c
@ -864,11 +864,13 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
|
||||
|
||||
#ifdef HAVE_D3D9
|
||||
{
|
||||
static const D3DVERTEXELEMENT VertexElements[] =
|
||||
{
|
||||
{ 0, 0 * sizeof(float), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
|
||||
{ 0, 2 * sizeof(float), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
|
||||
{ 0, 4 * sizeof(float), D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 },
|
||||
static const D3DVERTEXELEMENT VertexElements[4] = {
|
||||
{0, offsetof(Vertex, x), D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT,
|
||||
D3DDECLUSAGE_POSITION, 0},
|
||||
{0, offsetof(Vertex, u), D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT,
|
||||
D3DDECLUSAGE_TEXCOORD, 0},
|
||||
{0, offsetof(Vertex, color), D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT,
|
||||
D3DDECLUSAGE_COLOR, 0},
|
||||
D3DDECL_END()
|
||||
};
|
||||
if (!d3d_vertex_declaration_new(d3d->dev,
|
||||
@ -880,7 +882,7 @@ static bool d3d_initialize(d3d_video_t *d3d, const video_info_t *info)
|
||||
d3d->menu_display.offset = 0;
|
||||
d3d->menu_display.size = 1024;
|
||||
d3d->menu_display.buffer = d3d_vertex_buffer_new(
|
||||
d3d->dev, d3d->menu_display.size * 10 * sizeof(float),
|
||||
d3d->dev, d3d->menu_display.size * sizeof(Vertex),
|
||||
D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT,
|
||||
NULL);
|
||||
|
||||
@ -1543,7 +1545,7 @@ static bool d3d_frame(void *data, const void *frame,
|
||||
|
||||
d3d->menu_display.offset = 0;
|
||||
d3d_set_vertex_declaration(d3d->dev, d3d->menu_display.decl);
|
||||
d3d_set_stream_source(d3d->dev, 0, d3d->menu_display.buffer, 0, 8 * sizeof(float));
|
||||
d3d_set_stream_source(d3d->dev, 0, d3d->menu_display.buffer, 0, sizeof(Vertex));
|
||||
|
||||
d3d_set_viewports(d3d->dev, &screen_vp);
|
||||
menu_driver_frame(video_info);
|
||||
|
@ -147,7 +147,7 @@ static void menu_display_d3d_draw(void *data)
|
||||
unsigned width, height;
|
||||
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(false);
|
||||
menu_display_ctx_draw_t *draw = (menu_display_ctx_draw_t*)data;
|
||||
float* pv = NULL;
|
||||
Vertex * pv = NULL;
|
||||
const float *vertex = NULL;
|
||||
const float *tex_coord = NULL;
|
||||
const float *color = NULL;
|
||||
@ -161,8 +161,8 @@ static void menu_display_d3d_draw(void *data)
|
||||
if(d3d->menu_display.offset + draw->coords->vertices > d3d->menu_display.size)
|
||||
return;
|
||||
|
||||
pv = (float*)d3d_vertex_buffer_lock(d3d->menu_display.buffer);
|
||||
pv += d3d->menu_display.offset * 8;
|
||||
pv = (Vertex*)d3d_vertex_buffer_lock(d3d->menu_display.buffer);
|
||||
pv += d3d->menu_display.offset;
|
||||
vertex = draw->coords->vertex;
|
||||
tex_coord = draw->coords->tex_coord;
|
||||
color = draw->coords->color;
|
||||
@ -174,14 +174,26 @@ static void menu_display_d3d_draw(void *data)
|
||||
|
||||
for (i = 0; i < draw->coords->vertices; i++)
|
||||
{
|
||||
*pv++ = *vertex++;
|
||||
*pv++ = *vertex++;
|
||||
*pv++ = *tex_coord++;
|
||||
*pv++ = *tex_coord++;
|
||||
*pv++ = *color++;
|
||||
*pv++ = *color++;
|
||||
*pv++ = *color++;
|
||||
*pv++ = *color++;
|
||||
int colors[4];
|
||||
pv[i].x = *vertex++;
|
||||
pv[i].y = *vertex++;
|
||||
pv[i].z = 0.5f;
|
||||
|
||||
colors[0] = *color++ * 0xFF;
|
||||
colors[1] = *color++ * 0xFF;
|
||||
colors[2] = *color++ * 0xFF;
|
||||
colors[3] = *color++ * 0xFF;
|
||||
|
||||
pv[i].color =
|
||||
D3DCOLOR_ARGB(
|
||||
colors[3], /* A */
|
||||
colors[0], /* R */
|
||||
colors[1], /* G */
|
||||
colors[2] /* B */
|
||||
);
|
||||
|
||||
pv[i].u = *tex_coord++;
|
||||
pv[i].v = *tex_coord++;
|
||||
}
|
||||
d3d_vertex_buffer_unlock(d3d->menu_display.buffer);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user