if (gb->gfxboard_surface) {
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[gb->monitor_id];
if (w != gb->width_redraw || h != gb->height_redraw) {
- for (int y = 0; y < vidinfo->height; y++) {
+ for (int y = 0; y < vidinfo->maxheight; y++) {
uae_u8 *d = gb->gfxboard_surface + y * vidinfo->rowbytes;
if (y < h) {
- if (vidinfo->width > w) {
- memset(d + w * vidinfo->pixbytes, 0, (vidinfo->width - w) * vidinfo->pixbytes);
+ if (vidinfo->maxwidth > w) {
+ memset(d + w * vidinfo->pixbytes, 0, (vidinfo->maxwidth - w) * vidinfo->pixbytes);
}
} else {
- memset(d, 0, vidinfo->width * vidinfo->pixbytes);
+ memset(d, 0, vidinfo->maxwidth * vidinfo->pixbytes);
}
}
gb->width_redraw = w;
y1 = 0;
y2 = h;
}
- for (int yy = y1; yy < y2 && yy < vidinfo->height; yy++) {
+ for (int yy = y1; yy < y2 && yy < vidinfo->maxheight; yy++) {
uae_u8 *d = gb->gfxboard_surface + yy * vidinfo->rowbytes;
uae_u8 *s = getpcembuffer32(x, y, yy);
- int ww = w > vidinfo->width ? vidinfo->width : w;
+ int ww = w > vidinfo->maxwidth ? vidinfo->maxwidth : w;
memcpy(d, s, ww * vidinfo->pixbytes);
}
}
d3d->fulllocked = 0;
}
-static uae_u8 *xD3D_locktexture (int monid, int *pitch, int *height, int fullupdate)
+static uae_u8 *xD3D_locktexture (int monid, int *pitch, int *width, int *height, int fullupdate)
{
struct d3dstruct *d3d = &d3ddata[monid];
D3DLOCKED_RECT lock;
*pitch = lock.Pitch;
if (height)
*height = d3d->tin_h;
+ if (width)
+ *width = d3d->tin_w;
return (uae_u8*)lock.pBits;
}
extern bool(*D3D_renderframe)(int, int,bool);
extern void(*D3D_showframe)(int);
extern void(*D3D_showframe_special)(int, int);
-extern uae_u8* (*D3D_locktexture)(int, int*, int*, int);
+extern uae_u8 *(*D3D_locktexture)(int, int*, int*, int*, int);
extern void(*D3D_unlocktexture)(int, int, int);
extern void(*D3D_flushtexture)(int, int miny, int maxy);
extern void(*D3D_guimode)(int, int);
extern int(*D3D_canshaders)(void);
extern int(*D3D_goodenough)(void);
extern bool(*D3D_setcursor)(int, int x, int y, int width, int height, float mx, float my, bool visible, bool noscale);
-extern uae_u8* (*D3D_setcursorsurface)(int, int *pitch);
+extern uae_u8 *(*D3D_setcursorsurface)(int, int *pitch);
extern float(*D3D_getrefreshrate)(int);
extern void(*D3D_restore)(int, bool);
extern void(*D3D_resize)(int, int);
bool(*D3D_renderframe)(int, int,bool);
void(*D3D_showframe)(int);
void(*D3D_showframe_special)(int, int);
-uae_u8* (*D3D_locktexture)(int, int*, int*, int);
+uae_u8 *(*D3D_locktexture)(int, int*, int*, int*, int);
void (*D3D_unlocktexture)(int, int, int);
void (*D3D_flushtexture)(int, int miny, int maxy);
void (*D3D_guimode)(int, int);
int (*D3D_canshaders)(void);
int (*D3D_goodenough)(void);
bool (*D3D_setcursor)(int, int x, int y, int width, int height, float mx, float my, bool visible, bool noscale);
-uae_u8* (*D3D_setcursorsurface)(int, int *pitch);
+uae_u8 *(*D3D_setcursorsurface)(int, int *pitch);
float (*D3D_getrefreshrate)(int);
void(*D3D_restore)(int, bool);
void(*D3D_resize)(int, int);
return true;
}
-static uae_u8 *xD3D11_locktexture(int monid, int *pitch, int *height, int fullupdate)
+static uae_u8 *xD3D11_locktexture(int monid, int *pitch, int *width, int *height, int fullupdate)
{
struct d3d11struct *d3d = &d3d11data[monid];
*pitch = map.RowPitch;
if (height)
*height = d3d->m_bitmapHeight;
+ if (width)
+ *width = d3d->m_bitmapWidth;
d3d->texturelocked++;
return (uae_u8*)map.pData;
}
{
}
-static uae_u8 *gdi_locktexture(int monid, int *pitch, int *height, int fullupdate)
+static uae_u8 *gdi_locktexture(int monid, int *pitch, int *width, int *height, int fullupdate)
{
struct gdistruct *gdi = &gdidata[monid];
if (gdi->bm.bits) {
*pitch = gdi->bm.pitch;
if (height)
*height = gdi->bm.height;
+ if (width)
+ *width = gdi->bm.width;
return (uae_u8*)gdi->bm.bits;
}
return NULL;
dst = dstp;
// safety check
- if (pwidth > vidinfo->rowbytes / vidinfo->pixbytes) {
- pwidth = vidinfo->rowbytes / vidinfo->pixbytes;
+ if (pwidth > vidinfo->maxwidth) {
+ pwidth = vidinfo->maxwidth;
}
- if (pheight > vidinfo->height) {
- pheight = vidinfo->height;
+ if (pheight > vidinfo->maxheight) {
+ pheight = vidinfo->maxheight;
}
if (!split && vidinfo->rtg_clear_flag) {
struct picasso_vidbuf_description {
int width, height, depth;
int rowbytes, pixbytes, offset;
+ int maxwidth, maxheight; // allocated surface/texture size
int extra_mem; /* nonzero if there's a second buffer that must be updated */
uae_u32 rgbformat;
uae_u32 selected_rgbformat;
int aw, ah, aws, ahs;
uae_u8 *dptr, *enddptr, *sptr, *endsptr;
int ok = 0;
- int pitch, surf_height;
+ int pitch, surf_height, surf_width;
uae_u8 *surfstart;
aw = amiga_width;
if (D3D_restore)
D3D_restore(monid, true);
- surfstart = D3D_locktexture(monid, &pitch, &surf_height, y_start < -1 ? -1 : (y_start < 0 ? 1 : 0));
+ surfstart = D3D_locktexture(monid, &pitch, &surf_width, &surf_height, y_start < -1 ? -1 : (y_start < 0 ? 1 : 0));
if (surfstart == NULL) {
return;
}
struct AmigaMonitor *mon = &AMonitors[vb->monitor_id];
if (mon->currentmode.flags & DM_D3D) {
if (!(mon->currentmode.flags & DM_SWSCALE)) {
- vb->bufmem = D3D_locktexture(vb->monitor_id, &vb->rowbytes, NULL, false);
+ vb->bufmem = D3D_locktexture(vb->monitor_id, &vb->rowbytes, NULL, NULL, false);
if (vb->bufmem)
return true;
}
ret = 1;
} else {
ret = 0;
- vb->bufmem = D3D_locktexture(vb->monitor_id, &vb->rowbytes, NULL, skip ? -1 : (fullupdate ? 1 : 0));
+ vb->bufmem = D3D_locktexture(vb->monitor_id, &vb->rowbytes, NULL, NULL, skip ? -1 : (fullupdate ? 1 : 0));
if (vb->bufmem) {
if (first)
init_row_map();
static uae_u8 *gfx_lock_picasso2(int monid, bool fullupdate)
{
struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
- int pitch;
- uae_u8 *p = D3D_locktexture(monid, &pitch, NULL, fullupdate);
- vidinfo->rowbytes = pitch;
+ uae_u8 *p = D3D_locktexture(monid, &vidinfo->rowbytes, &vidinfo->maxwidth, &vidinfo->maxheight, fullupdate);
return p;
}
uae_u8 *gfx_lock_picasso(int monid, bool fullupdate)