mirror of
https://github.com/libretro/RetroArch
synced 2025-04-11 00:44:20 +00:00
(D3D8) More buildfixes
This commit is contained in:
parent
77fd75dd06
commit
c2ae445a85
@ -1588,6 +1588,10 @@ static void d3d8_set_menu_texture_frame(void *data,
|
|||||||
{
|
{
|
||||||
D3DLOCKED_RECT d3dlr;
|
D3DLOCKED_RECT d3dlr;
|
||||||
d3d8_video_t *d3d = (d3d8_video_t*)data;
|
d3d8_video_t *d3d = (d3d8_video_t*)data;
|
||||||
|
|
||||||
|
if (!d3d || !d3d->menu)
|
||||||
|
return;
|
||||||
|
|
||||||
if ( !d3d->menu->tex ||
|
if ( !d3d->menu->tex ||
|
||||||
d3d->menu->tex_w != width ||
|
d3d->menu->tex_w != width ||
|
||||||
d3d->menu->tex_h != height)
|
d3d->menu->tex_h != height)
|
||||||
@ -1614,51 +1618,49 @@ static void d3d8_set_menu_texture_frame(void *data,
|
|||||||
|
|
||||||
d3d->menu->alpha_mod = alpha;
|
d3d->menu->alpha_mod = alpha;
|
||||||
|
|
||||||
if (IDirect3DTexture8_LockRect(d3d->menu->tex,
|
|
||||||
0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK) == D3D_OK)
|
|
||||||
{
|
{
|
||||||
unsigned h, w;
|
LPDIRECT3DTEXTURE8 tex = d3d->menu->tex;
|
||||||
|
if (IDirect3DTexture8_LockRect(tex,
|
||||||
if (rgb32)
|
0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK) == D3D_OK)
|
||||||
{
|
{
|
||||||
uint8_t *dst = (uint8_t*)d3dlr.pBits;
|
unsigned h, w;
|
||||||
const uint32_t *src = (const uint32_t*)frame;
|
|
||||||
|
|
||||||
for (h = 0; h < height; h++, dst += d3dlr.Pitch, src += width)
|
if (rgb32)
|
||||||
{
|
{
|
||||||
memcpy(dst, src, width * sizeof(uint32_t));
|
uint8_t *dst = (uint8_t*)d3dlr.pBits;
|
||||||
memset(dst + width * sizeof(uint32_t), 0,
|
const uint32_t *src = (const uint32_t*)frame;
|
||||||
d3dlr.Pitch - width * sizeof(uint32_t));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uint32_t *dst = (uint32_t*)d3dlr.pBits;
|
|
||||||
const uint16_t *src = (const uint16_t*)frame;
|
|
||||||
|
|
||||||
for (h = 0; h < height; h++, dst += d3dlr.Pitch >> 2, src += width)
|
for (h = 0; h < height; h++, dst += d3dlr.Pitch, src += width)
|
||||||
{
|
|
||||||
for (w = 0; w < width; w++)
|
|
||||||
{
|
{
|
||||||
uint16_t c = src[w];
|
memcpy(dst, src, width * sizeof(uint32_t));
|
||||||
uint32_t r = (c >> 12) & 0xf;
|
memset(dst + width * sizeof(uint32_t), 0,
|
||||||
uint32_t g = (c >> 8) & 0xf;
|
d3dlr.Pitch - width * sizeof(uint32_t));
|
||||||
uint32_t b = (c >> 4) & 0xf;
|
|
||||||
uint32_t a = (c >> 0) & 0xf;
|
|
||||||
r = ((r << 4) | r) << 16;
|
|
||||||
g = ((g << 4) | g) << 8;
|
|
||||||
b = ((b << 4) | b) << 0;
|
|
||||||
a = ((a << 4) | a) << 24;
|
|
||||||
dst[w] = r | g | b | a;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
uint32_t *dst = (uint32_t*)d3dlr.pBits;
|
||||||
|
const uint16_t *src = (const uint16_t*)frame;
|
||||||
|
|
||||||
if (d3d->menu)
|
for (h = 0; h < height; h++, dst += d3dlr.Pitch >> 2, src += width)
|
||||||
{
|
{
|
||||||
LPDIRECT3DTEXTURE8 tex = d3d->menu->tex;
|
for (w = 0; w < width; w++)
|
||||||
if (tex)
|
{
|
||||||
IDirect3DTexture8_UnlockRect(tex, 0);
|
uint16_t c = src[w];
|
||||||
|
uint32_t r = (c >> 12) & 0xf;
|
||||||
|
uint32_t g = (c >> 8) & 0xf;
|
||||||
|
uint32_t b = (c >> 4) & 0xf;
|
||||||
|
uint32_t a = (c >> 0) & 0xf;
|
||||||
|
r = ((r << 4) | r) << 16;
|
||||||
|
g = ((g << 4) | g) << 8;
|
||||||
|
b = ((b << 4) | b) << 0;
|
||||||
|
a = ((a << 4) | a) << 24;
|
||||||
|
dst[w] = r | g | b | a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirect3DTexture8_UnlockRect(tex, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,7 @@ static void gfx_display_d3d8_draw(gfx_display_ctx_draw_t *draw,
|
|||||||
};
|
};
|
||||||
unsigned i;
|
unsigned i;
|
||||||
math_matrix_4x4 mop, m1, m2;
|
math_matrix_4x4 mop, m1, m2;
|
||||||
|
LPDIRECT3DVERTEXBUFFER8 vbo;
|
||||||
LPDIRECT3DDEVICE8 dev;
|
LPDIRECT3DDEVICE8 dev;
|
||||||
D3DPRIMITIVETYPE type;
|
D3DPRIMITIVETYPE type;
|
||||||
unsigned start = 0;
|
unsigned start = 0;
|
||||||
@ -129,9 +130,9 @@ static void gfx_display_d3d8_draw(gfx_display_ctx_draw_t *draw,
|
|||||||
if ((d3d->menu_display.offset + draw->coords->vertices )
|
if ((d3d->menu_display.offset + draw->coords->vertices )
|
||||||
> (unsigned)d3d->menu_display.size)
|
> (unsigned)d3d->menu_display.size)
|
||||||
return;
|
return;
|
||||||
|
vbo = (LPDIRECT3DVERTEXBUFFER8)d3d->menu_display.buffer;
|
||||||
dev = d3d->dev;
|
dev = d3d->dev;
|
||||||
pv = (Vertex*)
|
pv = (Vertex*)d3d8_vertex_buffer_lock(vbo);
|
||||||
d3d8_vertex_buffer_lock(d3d->menu_display.buffer);
|
|
||||||
|
|
||||||
if (!pv)
|
if (!pv)
|
||||||
return;
|
return;
|
||||||
@ -161,16 +162,17 @@ static void gfx_display_d3d8_draw(gfx_display_ctx_draw_t *draw,
|
|||||||
pv[i].u = *tex_coord++;
|
pv[i].u = *tex_coord++;
|
||||||
pv[i].v = *tex_coord++;
|
pv[i].v = *tex_coord++;
|
||||||
|
|
||||||
if ((void*)draw->texture)
|
if ((void*)draw->texture)
|
||||||
{
|
{
|
||||||
D3DSURFACE_DESC desc;
|
D3DSURFACE_DESC desc;
|
||||||
if (SUCCEEDED(IDirect3DTexture8_GetLevelDesc(
|
LPDIRECT3DTEXTURE8 tex = (LPDIRECT3DTEXTURE8)draw->texture;
|
||||||
(void*)draw->texture, 0, (D3DSURFACE_DESC*)&desc)))
|
if (SUCCEEDED(IDirect3DTexture8_GetLevelDesc(tex,
|
||||||
{
|
0, (D3DSURFACE_DESC*)&desc)))
|
||||||
pv[i].u *= desc.Width;
|
{
|
||||||
pv[i].v *= desc.Height;
|
pv[i].u *= desc.Width;
|
||||||
}
|
pv[i].v *= desc.Height;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pv[i].color =
|
pv[i].color =
|
||||||
D3DCOLOR_ARGB(
|
D3DCOLOR_ARGB(
|
||||||
@ -180,7 +182,7 @@ static void gfx_display_d3d8_draw(gfx_display_ctx_draw_t *draw,
|
|||||||
colors[2] /* B */
|
colors[2] /* B */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
IDirect3DVertexBuffer8_Unlock(d3d->menu_display.buffer);
|
IDirect3DVertexBuffer8_Unlock(vbo);
|
||||||
|
|
||||||
if (!draw->matrix_data)
|
if (!draw->matrix_data)
|
||||||
draw->matrix_data = &default_mvp;
|
draw->matrix_data = &default_mvp;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user