From: Toni Wilen Date: Mon, 24 Mar 2025 16:59:51 +0000 (+0200) Subject: Remove more color depth support code. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=80b21a687523462106538e2614776e522eefe63c;p=francis%2Fwinuae.git Remove more color depth support code. --- diff --git a/debug.cpp b/debug.cpp index bda4d8d6..391b5f16 100644 --- a/debug.cpp +++ b/debug.cpp @@ -1457,7 +1457,7 @@ void record_copper_reset (void) nr_cop_records[curr_cop_set] = 0; } -STATIC_INLINE uae_u32 ledcolor (uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *a) +static uae_u32 ledcolor (uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *a) { uae_u32 v = rc[(c >> 16) & 0xff] | gc[(c >> 8) & 0xff] | bc[(c >> 0) & 0xff]; if (a) @@ -1465,31 +1465,14 @@ STATIC_INLINE uae_u32 ledcolor (uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc return v; } -STATIC_INLINE void putpixel (uae_u8 *buf, int bpp, int x, xcolnr c8) +static void putpixel (uae_u8 *buf, int x, xcolnr c8) { - if (x <= 0) + if (x <= 0) { return; - - switch (bpp) { - case 1: - buf[x] = (uae_u8)c8; - break; - case 2: - { - uae_u16 *p = (uae_u16*)buf + x; - *p = (uae_u16)c8; - break; - } - case 3: - /* no 24 bit yet */ - break; - case 4: - { - uae_u32 *p = (uae_u32*)buf + x; - *p = c8; - break; - } } + + uae_u32 *p = (uae_u32*)buf + x; + *p = c8; } #define lc(x) ledcolor (x, xredcolors, xgreencolors, xbluecolors, NULL) @@ -1562,7 +1545,7 @@ static void set_debug_colors(void) static int cycles_toggle; -static void debug_draw_cycles(uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors) +static void debug_draw_cycles(uae_u8 *buf, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors) { int y, x, xx, dx, xplus, yplus; struct dma_rec *dr; @@ -1624,21 +1607,21 @@ static void debug_draw_cycles(uae_u8 *buf, int bpp, int line, int width, int hei } if (dr->intlev > intlev) intlev = dr->intlev; - putpixel(buf, bpp, xx + 4, c); + putpixel(buf, xx + 4, c); if (xplus > 1) - putpixel(buf, bpp, xx + 4 + 1, c); + putpixel(buf, xx + 4 + 1, c); if (xplus > 2) - putpixel(buf, bpp, xx + 4 + 2, c); + putpixel(buf, xx + 4 + 2, c); dr++; if (dr->hpos == 0) { break; } } - putpixel (buf, bpp, dx + 0, 0); - putpixel (buf, bpp, dx + 1, lc(intlevc[intlev])); - putpixel (buf, bpp, dx + 2, lc(intlevc[intlev])); - putpixel (buf, bpp, dx + 3, 0); + putpixel (buf, dx + 0, 0); + putpixel (buf, dx + 1, lc(intlevc[intlev])); + putpixel (buf, dx + 2, lc(intlevc[intlev])); + putpixel (buf, dx + 3, 0); } #define HEATMAP_WIDTH 256 @@ -1657,7 +1640,7 @@ struct memory_heatmap uae_u16 type, extra; }; -static void debug_draw_heatmap(uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors) +static void debug_draw_heatmap(uae_u8 *buf, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors) { struct memory_heatmap *mht = heatmap; int dx = 16; @@ -1672,14 +1655,14 @@ static void debug_draw_heatmap(uae_u8 *buf, int bpp, int line, int width, int he uae_u32 c = heatmap_debug_colors[mht->cnt * DMARECORD_MAX + mht->type]; //c = heatmap_debug_colors[(HEATMAP_COUNT - 1) * DMARECORD_MAX + DMARECORD_CPU_I]; int xx = x + dx; - putpixel(buf, bpp, xx, c); + putpixel(buf, xx, c); if (mht->cnt > 0) mht->cnt--; mht++; } } -void debug_draw(uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors) +void debug_draw(uae_u8 *buf, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors) { if (!heatmap_debug_colors) { heatmap_debug_colors = xcalloc(uae_u32, DMARECORD_MAX * HEATMAP_COUNT); @@ -1699,9 +1682,9 @@ void debug_draw(uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 * } if (heatmap) { - debug_draw_heatmap(buf, bpp, line, width, height, xredcolors, xgreencolors, xbluecolors); + debug_draw_heatmap(buf, line, width, height, xredcolors, xgreencolors, xbluecolors); } else if (dma_record_data) { - debug_draw_cycles(buf, bpp, line, width, height, xredcolors, xgreencolors, xbluecolors); + debug_draw_cycles(buf, line, width, height, xredcolors, xgreencolors, xbluecolors); } } diff --git a/drawing.cpp b/drawing.cpp index 886177ff..7f442186 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -1533,34 +1533,17 @@ static void init_drawing_frame(void) static int lightpen_y1[2], lightpen_y2[2]; -void putpixel(uae_u8 *buf, uae_u16 *genlockbuf, int bpp, int x, xcolnr c8) +void putpixel(uae_u8 *buf, uae_u16 *genlockbuf, int x, xcolnr c8) { if (x <= 0) return; - if (genlockbuf) + if (genlockbuf) { genlockbuf[x] = 1; - - switch (bpp) { - case 1: - buf[x] = (uae_u8)c8; - break; - case 2: - { - uae_u16 *p = (uae_u16*)buf + x; - *p = (uae_u16)c8; - break; - } - case 3: - /* no 24 bit yet */ - break; - case 4: - { - uae_u32 *p = (uae_u32*)buf + x; - *p = c8; - break; - } } + + uae_u32 *p = (uae_u32*)buf + x; + *p = c8; } static uae_u8 *status_line_ptr(int monid, int line) @@ -1569,9 +1552,7 @@ static uae_u8 *status_line_ptr(int monid, int line) int y; y = line - (vidinfo->inbuffer->outheight - TD_TOTAL_HEIGHT); - xlinebuffer = vidinfo->inbuffer->linemem; - if (xlinebuffer == 0) - xlinebuffer = row_map[line]; + xlinebuffer = row_map[line]; xlinebuffer_genlock = row_map_genlock[line]; return xlinebuffer; } @@ -1583,19 +1564,17 @@ static void draw_status_line(int monid, int line, int statusy) if (!buf) return; if (statusy < 0) - statusline_render(monid, buf, vidinfo->inbuffer->pixbytes, vidinfo->inbuffer->rowbytes, vidinfo->inbuffer->outwidth, TD_TOTAL_HEIGHT, xredcolors, xgreencolors, xbluecolors, NULL); + statusline_render(monid, buf, vidinfo->inbuffer->rowbytes, vidinfo->inbuffer->outwidth, TD_TOTAL_HEIGHT, xredcolors, xgreencolors, xbluecolors, NULL); else - draw_status_line_single(monid, buf, vidinfo->inbuffer->pixbytes, statusy, vidinfo->inbuffer->outwidth, xredcolors, xgreencolors, xbluecolors, NULL); + draw_status_line_single(monid, buf, statusy, vidinfo->inbuffer->outwidth, xredcolors, xgreencolors, xbluecolors, NULL); } static void draw_debug_status_line(int monid, int line) { struct vidbuf_description *vidinfo = &adisplays[monid].gfxvidinfo; - xlinebuffer = vidinfo->inbuffer->linemem; - if (xlinebuffer == 0) - xlinebuffer = row_map[line]; + xlinebuffer = row_map[line]; xlinebuffer_genlock = row_map_genlock[line]; - debug_draw(xlinebuffer, vidinfo->inbuffer->pixbytes, line, vidinfo->inbuffer->outwidth, vidinfo->inbuffer->outheight, xredcolors, xgreencolors, xbluecolors); + debug_draw(xlinebuffer, line, vidinfo->inbuffer->outwidth, vidinfo->inbuffer->outheight, xredcolors, xgreencolors, xbluecolors); } #define LIGHTPEN_HEIGHT 12 @@ -1623,16 +1602,14 @@ static void draw_lightpen_cursor(int monid, int x, int y, int line, int onscreen int color1 = onscreen ? (lpnum ? 0x0ff : 0xff0) : (lpnum ? 0x0f0 : 0xf00); int color2 = (color1 & 0xeee) >> 1; - xlinebuffer = vidinfo->inbuffer->linemem; - if (xlinebuffer == 0) - xlinebuffer = row_map[line]; + xlinebuffer = row_map[line]; xlinebuffer_genlock = row_map_genlock[line]; p = lightpen_cursor + y * LIGHTPEN_WIDTH; for (int i = 0; i < LIGHTPEN_WIDTH; i++) { int xx = x + i - LIGHTPEN_WIDTH / 2; if (*p != '-' && xx >= 0 && xx < vidinfo->inbuffer->outwidth) { - putpixel(xlinebuffer, xlinebuffer_genlock, vidinfo->inbuffer->pixbytes, xx, *p == 'x' ? xcolors[color1] : xcolors[color2]); + putpixel(xlinebuffer, xlinebuffer_genlock, xx, *p == 'x' ? xcolors[color1] : xcolors[color2]); } p++; } @@ -1760,10 +1737,10 @@ static void refresh_indicator_update(struct vidbuffer *vb) color2 = refresh_indicator_colors[pixel - 5]; } for (int x = 0; x < 8; x++) { - putpixel(xlinebuffer, NULL, vidinfo->inbuffer->pixbytes, x, xcolors[color1]); + putpixel(xlinebuffer, NULL, x, xcolors[color1]); } for (int x = 8; x < 16; x++) { - putpixel(xlinebuffer, NULL, vidinfo->inbuffer->pixbytes, x, xcolors[color2]); + putpixel(xlinebuffer, NULL, x, xcolors[color2]); } } } diff --git a/include/debug.h b/include/debug.h index 62f274de..c5f9f849 100644 --- a/include/debug.h +++ b/include/debug.h @@ -337,7 +337,7 @@ extern void record_rom_access(uaecptr, uae_u32 value, int size, bool rw); extern void record_dma_ipl(void); extern void record_dma_ipl_sample(void); extern void debug_mark_refreshed(uaecptr); -extern void debug_draw(uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors); +extern void debug_draw(uae_u8 *buf, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors); extern struct dma_rec *record_dma_next_cycle(int hpos, int vpos, int vvpos); #define TRACE_SKIP_INS 1 diff --git a/include/drawing.h b/include/drawing.h index 4a5b938c..148f4c94 100644 --- a/include/drawing.h +++ b/include/drawing.h @@ -127,7 +127,7 @@ extern void check_custom_limits (void); extern void get_custom_topedge (int *x, int *y, bool max); extern void get_custom_raw_limits (int *pw, int *ph, int *pdx, int *pdy); void get_custom_mouse_limits (int *pw, int *ph, int *pdx, int *pdy, int dbl); -extern void putpixel (uae_u8 *buf, uae_u16 *genlockbuf, int bpp, int x, xcolnr c8); +extern void putpixel (uae_u8 *buf, uae_u16 *genlockbuf, int x, xcolnr c8); extern void allocvidbuffer(int monid, struct vidbuffer *buf, int width, int height, int depth); extern void freevidbuffer(int monid, struct vidbuffer *buf); extern void check_prefs_picasso(void); diff --git a/include/statusline.h b/include/statusline.h index 21cf9eee..0587888e 100644 --- a/include/statusline.h +++ b/include/statusline.h @@ -32,8 +32,8 @@ extern int td_width; #define STATUSLINE_RTG 2 #define STATUSLINE_TARGET 0x80 -void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); -void statusline_single_erase(int monid, uae_u8 *buf, int bpp, int y, int totalwidth); +void draw_status_line_single(int monid, uae_u8 *buf, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); +void statusline_single_erase(int monid, uae_u8 *buf, int y, int totalwidth); void statusline_getpos(int monid, int *x, int *y, int width, int height); #define STATUSTYPE_FLOPPY 1 @@ -44,7 +44,7 @@ void statusline_getpos(int monid, int *x, int *y, int width, int height); bool createstatusline(HWND, int); void deletestatusline(int); -void statusline_render(int, uae_u8 *buf, int bpp, int pitch, int width, int height, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); +void statusline_render(int, uae_u8 *buf, int pitch, int width, int height, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha); void statusline_add_message(int statustype, const TCHAR *format, ...); void statusline_clear(void); void statusline_vsync(void); diff --git a/include/xwin.h b/include/xwin.h index e6550efd..cf103bab 100644 --- a/include/xwin.h +++ b/include/xwin.h @@ -79,27 +79,11 @@ extern void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs extern float getvsyncrate(int monid, float hz, int *mult); - /* The graphics code has a choice whether it wants to use a large buffer - * for the whole display, or only a small buffer for a single line. - * If you use a large buffer: - * - set bufmem to point at it - * - set linemem to 0 - * - if memcpy within bufmem would be very slow, i.e. because bufmem is - * in graphics card memory, also set emergmem to point to a buffer - * that is large enough to hold a single line. - * - implement flush_line to be a no-op. - * If you use a single line buffer: - * - set bufmem and emergmem to 0 - * - set linemem to point at your buffer - * - implement flush_line to copy a single line to the screen - */ struct vidbuffer { /* Function implemented by graphics driver */ int (*lockscr) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb); void (*unlockscr) (struct vidbuf_description *gfxinfo, struct vidbuffer *vb); - uae_u8 *linemem; - uae_u8 *emergmem; uae_u8 *bufmem, *bufmemend; uae_u8 *realbufmem; diff --git a/od-win32/avioutput.cpp b/od-win32/avioutput.cpp index 1474edd0..4150fd00 100644 --- a/od-win32/avioutput.cpp +++ b/od-win32/avioutput.cpp @@ -554,7 +554,7 @@ static int AVIOutput_AllocateVideo(void) if (avioutput_width == 0 || avioutput_height == 0 || avioutput_bits == 0) { avioutput_width = WIN32GFX_GetWidth(mon); avioutput_height = WIN32GFX_GetHeight(mon); - avioutput_bits = WIN32GFX_GetDepth(mon, 0); + avioutput_bits = 32; if (WIN32GFX_IsPicassoScreen(mon) && avioutput_originalsize) { struct picasso96_state_struct *state = &picasso96_state[aviout_monid]; avioutput_width = state->Width; @@ -572,7 +572,7 @@ static int AVIOutput_AllocateVideo(void) if (avioutput_width == 0 || avioutput_height == 0) { avioutput_width = workprefs.gfx_monitor[0].gfx_size.width; avioutput_height = workprefs.gfx_monitor[0].gfx_size.height; - avioutput_bits = WIN32GFX_GetDepth(mon, 0); + avioutput_bits = 32; } if (!aviout_height_out) aviout_height_out = avioutput_height; diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index aff85ef8..f79608f8 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -204,7 +204,7 @@ struct d3dstruct int max_texture_w, max_texture_h; int tin_w, tin_h, tout_w, tout_h, window_h, window_w; int tino_w, tino_h; - int t_depth, dmult, dmultxh, dmultxv, dmode; + int dmult, dmultxh, dmultxv, dmode; int required_sl_texture_w, required_sl_texture_h; int vsync2, guimode, maxscanline, variablerefresh; int resetcount; @@ -1242,7 +1242,7 @@ static int createamigatexture (struct d3dstruct *d3d, int w, int h) if (!d3d->texture1 || !d3d->texture2) return 0; d3d->usetexture = d3d->texture1; - write_log (_T("%s: %d*%d main texture, depth %d\n"), D3DHEAD, w, h, d3d->t_depth); + write_log (_T("%s: %d*%d main texture\n"), D3DHEAD, w, h); if (d3d->psActive) { for (int i = 0; i < MAX_SHADERS; i++) { int w2, h2; @@ -1363,13 +1363,13 @@ static void updateleds (struct d3dstruct *d3d) for (int y = 0; y < d3d->ledheight; y++) { uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch; - statusline_single_erase(d3d->num, buf, 32 / 8, y, d3d->ledwidth); + statusline_single_erase(d3d->num, buf, y, d3d->ledwidth); } - statusline_render(d3d->num, (uae_u8*)locked.pBits, 32 / 8, locked.Pitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a); + statusline_render(d3d->num, (uae_u8*)locked.pBits, locked.Pitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a); for (int y = 0; y < d3d->ledheight; y++) { uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch; - draw_status_line_single(d3d->num, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a); + draw_status_line_single(d3d->num, buf, y, d3d->ledwidth, rc, gc, bc, a); } d3d->ledtexture->UnlockRect (0); @@ -1394,7 +1394,7 @@ static int createledtexture (struct d3dstruct *d3d) static int createsltexture (struct d3dstruct *d3d) { - d3d->sltexture = createtext (d3d, d3d->required_sl_texture_w, d3d->required_sl_texture_h, d3d->t_depth < 32 ? D3DFMT_A4R4G4B4 : D3DFMT_A8R8G8B8); + d3d->sltexture = createtext (d3d, d3d->required_sl_texture_w, d3d->required_sl_texture_h, D3DFMT_A8R8G8B8); if (!d3d->sltexture) return 0; write_log (_T("%s: SL %d*%d texture allocated\n"), D3DHEAD, d3d->required_sl_texture_w, d3d->required_sl_texture_h); @@ -1411,7 +1411,6 @@ static void createscanlines (struct d3dstruct *d3d, int force) int l1, l2; int x, y, yy; uae_u8 *sld, *p; - int bpp; if (d3d->scanline_osl1 == d3d->filterd3d->gfx_filter_scanlines && d3d->scanline_osl3 == d3d->filterd3d->gfx_filter_scanlinelevel && @@ -1419,7 +1418,6 @@ static void createscanlines (struct d3dstruct *d3d, int force) d3d->scanline_osl4 == d3d->filterd3d->gfx_filter_scanlineoffset && !force) return; - bpp = d3d->t_depth < 32 ? 2 : 4; d3d->scanline_osl1 = d3d->filterd3d->gfx_filter_scanlines; d3d->scanline_osl3 = d3d->filterd3d->gfx_filter_scanlinelevel; d3d->scanline_osl2 = d3d->filterd3d->gfx_filter_scanlineratio; @@ -1450,27 +1448,21 @@ static void createscanlines (struct d3dstruct *d3d, int force) } sld = (uae_u8*)locked.pBits; for (y = 0; y < d3d->required_sl_texture_h; y++) { - memset(sld + y * locked.Pitch, 0, d3d->required_sl_texture_w * bpp); + memset(sld + y * locked.Pitch, 0, d3d->required_sl_texture_w * 4); } for (y = 0; y < d3d->required_sl_texture_h; y += l1 + l2) { int y2 = y + (d3d->filterd3d->gfx_filter_scanlineoffset % (l1 + 1)); for (yy = 0; yy < l2 && y2 + yy < d3d->required_sl_texture_h; yy++) { for (x = 0; x < d3d->required_sl_texture_w; x++) { uae_u8 sll = sl42; - p = &sld[(y2 + yy) * locked.Pitch + (x * bpp)]; - if (bpp < 4) { - /* 16-bit, A4R4G4B4 */ - p[1] = (sl4 << 4) | (sll << 0); - p[0] = (sll << 4) | (sll << 0); - } else { - /* 32-bit, A8R8G8B8 */ - uae_u8 sll4 = sl4 | (sl4 << 4); - uae_u8 sll2 = sll | (sll << 4); - p[0] = sll2; - p[1] = sll2; - p[2] = sll2; - p[3] = sll4; - } + p = &sld[(y2 + yy) * locked.Pitch + (x * 4)]; + /* 32-bit, A8R8G8B8 */ + uae_u8 sll4 = sl4 | (sl4 << 4); + uae_u8 sll2 = sll | (sll << 4); + p[0] = sll2; + p[1] = sll2; + p[2] = sll2; + p[3] = sll4; } } } @@ -2610,7 +2602,7 @@ static int getd3dadapter (IDirect3D9 *id3d) return D3DADAPTER_DEFAULT; } -static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv) +static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w_h, int *freq, int mmulth, int mmultv) { int monid = d3d->num; struct amigadisplay *ad = &adisplays[monid]; @@ -2638,7 +2630,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w } xfree (d3d->fakebitmap); - d3d->fakebitmap = xmalloc (uae_u8, w_w * depth); + d3d->fakebitmap = xmalloc (uae_u8, w_w * 4); d3dx = LoadLibrary (D3DX9DLL); if (d3dx == NULL) { @@ -2791,7 +2783,6 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w } d3d->d3dhwnd = ahwnd; - d3d->t_depth = depth; flags = D3DCREATE_FPU_PRESERVE | D3DCREATE_MULTITHREADED; // Check if hardware vertex processing is available @@ -2831,7 +2822,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w if (d3d->d3d_ex && D3DEX) { write_log (_T("%s\n"), errmsg); D3DEX = 0; - return D3D_init2(d3d, ahwnd, w_w, w_h, depth, freq, mmulth, mmultv); + return D3D_init2(d3d, ahwnd, w_w, w_h, freq, mmulth, mmultv); } D3D_free(monid, true); return errmsg; @@ -2861,7 +2852,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w write_log (_T("\n")); - write_log (_T("%s: PS=%d.%d VS=%d.%d %d*%d*%d%s%s VS=%d B=%d%s %d-bit %d (%dx%d)\n"), + write_log (_T("%s: PS=%d.%d VS=%d.%d %d*%d*%d%s%s VS=%d B=%d%s %d (%dx%d)\n"), D3DHEAD, (d3dCaps.PixelShaderVersion >> 8) & 0xff, d3dCaps.PixelShaderVersion & 0xff, (d3dCaps.VertexShaderVersion >> 8) & 0xff, d3dCaps.VertexShaderVersion & 0xff, @@ -2871,7 +2862,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w d3d->dpp.Windowed ? _T("") : _T(" FS"), vsync, ap.gfx_backbuffers, ap.gfx_vflip < 0 ? _T("WE") : (ap.gfx_vflip > 0 ? _T("WS") : _T("I")), - d3d->t_depth, adapter, + adapter, d3d->max_texture_w, d3d->max_texture_h ); @@ -2921,19 +2912,7 @@ static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w changed_prefs.gf[d3d->filterd3didx].gfx_filter_scanlines = d3d->filterd3d->gfx_filter_scanlines = 0; } - switch (depth) - { - case 32: - default: - d3d->tformat = D3DFMT_X8R8G8B8; - break; - case 15: - d3d->tformat = D3DFMT_X1R5G5B5; - break; - case 16: - d3d->tformat = D3DFMT_R5G6B5; - break; - } + d3d->tformat = D3DFMT_X8R8G8B8; changed_prefs.leds_on_screen |= STATUSLINE_TARGET; currprefs.leds_on_screen |= STATUSLINE_TARGET; @@ -3001,7 +2980,7 @@ static void D3D_init_start (void *p) D3D_free2 (d3d); sleep_millis (1000); write_log (_T("Threaded D3D_init() start (init)\n")); - const TCHAR *t = D3D_init2 (d3d, d3dargs.hwnd, d3dargs.w, d3dargs.h,d3dargs.depth, d3dargs.freq, d3dargs.mmulth, d3dargs.mmultv); + const TCHAR *t = D3D_init2 (d3d, d3dargs.hwnd, d3dargs.w, d3dargs.h, d3dargs.freq, d3dargs.mmulth, d3dargs.mmultv); if (t) { gui_message (_T("Threaded D3D_init() returned error '%s'\n"), t); } @@ -3021,12 +3000,12 @@ static void D3D_init_start (void *p) d3d->fakemode = false; } -static const TCHAR *xD3D_init (HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv, int *errp) +static const TCHAR *xD3D_init (HWND ahwnd, int monid, int w_w, int w_h, int *freq, int mmulth, int mmultv, int *errp) { struct d3dstruct *d3d = &d3ddata[monid]; if (!fakemodewaitms) { - const TCHAR *v = D3D_init2(d3d, ahwnd, w_w, w_h, depth, freq, mmulth, mmultv); + const TCHAR *v = D3D_init2(d3d, ahwnd, w_w, w_h, freq, mmulth, mmultv); if (v != NULL) { *errp = 1; } @@ -3036,7 +3015,6 @@ static const TCHAR *xD3D_init (HWND ahwnd, int monid, int w_w, int w_h, int dept d3dargs.hwnd = ahwnd; d3dargs.w = w_w; d3dargs.h = w_h; - d3dargs.depth = depth; d3dargs.mmulth = mmulth; d3dargs.mmultv = mmultv; d3dargs.freq = freq; @@ -4005,44 +3983,17 @@ static void xD3D_refresh (int monid) } } -void D3D_getpixelformat (int depth, int *rb, int *gb, int *bb, int *rs, int *gs, int *bs, int *ab, int *as, int *a) +void D3D_getpixelformat (int *rb, int *gb, int *bb, int *rs, int *gs, int *bs, int *ab, int *as, int *a) { - switch (depth) - { - case 32: - *rb = 8; - *gb = 8; - *bb = 8; - *ab = 8; - *rs = 16; - *gs = 8; - *bs = 0; - *as = 24; - *a = 0; - break; - case 15: - *rb = 5; - *gb = 5; - *bb = 5; - *ab = 1; - *rs = 10; - *gs = 5; - *bs = 0; - *as = 15; - *a = 0; - break; - case 16: - *rb = 5; - *gb = 6; - *bb = 5; - *ab = 0; - *rs = 11; - *gs = 5; - *bs = 0; - *as = 0; - *a = 0; - break; - } + *rb = 8; + *gb = 8; + *bb = 8; + *ab = 8; + *rs = 16; + *gs = 8; + *bs = 0; + *as = 24; + *a = 0; } static float xD3D_getrefreshrate(int monid) @@ -4111,7 +4062,7 @@ LPDIRECT3DSURFACE9 D3D_capture(int monid, int *w, int *h, int *bits, bool render } *w = d3d->window_w; *h = d3d->window_h; - *bits = d3d->t_depth; + *bits = 32; return ret; } diff --git a/od-win32/direct3d.h b/od-win32/direct3d.h index 426b582f..1157d344 100644 --- a/od-win32/direct3d.h +++ b/od-win32/direct3d.h @@ -8,7 +8,7 @@ struct extoverlay }; extern void(*D3D_free)(int, bool immediate); -extern const TCHAR* (*D3D_init)(HWND ahwnd, int, int w_w, int h_h, int depth, int *freq, int mmulth, int mmultv, int *errp); +extern const TCHAR* (*D3D_init)(HWND ahwnd, int, int w_w, int h_h, int *freq, int mmulth, int mmultv, int *errp); extern bool(*D3D_alloctexture)(int, int, int); extern void(*D3D_refresh)(int); extern bool(*D3D_renderframe)(int, int,bool); @@ -37,10 +37,10 @@ extern bool(*D3D_getscanline)(int*, bool*); extern bool(*D3D_extoverlay)(struct extoverlay*, int); extern void(*D3D_paint)(void); -extern LPDIRECT3DSURFACE9 D3D_capture(int, int*,int*,int*,bool); -extern bool D3D11_capture(int, void**,int*, int*, int*,int*,bool); +extern LPDIRECT3DSURFACE9 D3D_capture(int, int*,int*, int*, bool); +extern bool D3D11_capture(int, void**,int*, int*, int*, int*, bool); -void D3D_getpixelformat(int depth, int *rb, int *gb, int *bb, int *rs, int *gs, int *bs, int *ab, int *as, int *a); +void D3D_getpixelformat(int *rb, int *gb, int *bb, int *rs, int *gs, int *bs, int *ab, int *as, int *a); void d3d9_select(void); void d3d11_select(void); diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index e49e0dfe..d181b162 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -46,7 +46,7 @@ using Microsoft::WRL::ComPtr; #include void (*D3D_free)(int, bool immediate); -const TCHAR *(*D3D_init)(HWND ahwnd, int, int w_w, int h_h, int depth, int *freq, int mmulth, int mmultv, int *err); +const TCHAR *(*D3D_init)(HWND ahwnd, int monid, int w_w, int h_h, int *freq, int mmulth, int mmultv, int *err); bool (*D3D_alloctexture)(int, int, int); void(*D3D_refresh)(int); bool(*D3D_renderframe)(int, int,bool); @@ -1640,13 +1640,13 @@ static void updateleds(struct d3d11struct *d3d) } for (int y = 0; y < d3d->osd.height; y++) { uae_u8 *buf = (uae_u8*)map.pData + y * map.RowPitch; - statusline_single_erase(d3d->num, buf, 32 / 8, y, d3d->ledwidth); + statusline_single_erase(d3d->num, buf, y, d3d->ledwidth); } - statusline_render(d3d->num, (uae_u8*)map.pData, 32 / 8, map.RowPitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a); + statusline_render(d3d->num, (uae_u8*)map.pData, map.RowPitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a); for (int y = 0; y < d3d->osd.height; y++) { uae_u8 *buf = (uae_u8*)map.pData + y * map.RowPitch; - draw_status_line_single(d3d->num, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a); + draw_status_line_single(d3d->num, buf, y, d3d->ledwidth, rc, gc, bc, a); } d3d->m_deviceContext->Unmap(d3d->osd.texture, 0); @@ -3418,7 +3418,7 @@ static float xD3D_getrefreshrate(int monid) return d3d->vblank; } -static bool xD3D11_initvals(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int depth, int *freq, int mmulth, int mmultv, bool doalloc) +static bool xD3D11_initvals(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int *freq, int mmulth, int mmultv, bool doalloc) { struct d3d11struct *d3d = &d3d11data[monid]; bool changed = false; @@ -3437,7 +3437,7 @@ static bool xD3D11_initvals(HWND ahwnd, int monid, int w_w, int w_h, int t_w, in return changed; } -static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int depth, int *freq, int mmulth, int mmultv) +static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t_h, int *freq, int mmulth, int mmultv) { struct d3d11struct *d3d = &d3d11data[monid]; struct amigadisplay *ad = &adisplays[monid]; @@ -3456,7 +3456,7 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t DXGI_MODE_DESC1 *displayModeList; DXGI_ADAPTER_DESC adapterDesc; - write_log(_T("D3D11 init start. (%d*%d) (%d*%d) RTG=%d Depth=%d.\n"), w_w, w_h, t_w, t_h, ad->picasso_on, depth); + write_log(_T("D3D11 init start. (%d*%d) (%d*%d) RTG=%d\n"), w_w, w_h, t_w, t_h, ad->picasso_on); d3d->filterd3didx = ad->gf_index; d3d->filterd3d = &currprefs.gf[d3d->filterd3didx]; @@ -3464,15 +3464,11 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t d3d->delayedfs = 0; d3d->device_errors = 0; - if (depth != 32) { - return 0; - } - if (!can_D3D11(false)) { return 0; } - xD3D11_initvals(ahwnd, monid, w_w, w_h, t_w, t_h, depth, freq, mmulth, mmultv, false); + xD3D11_initvals(ahwnd, monid, w_w, w_h, t_w, t_h, freq, mmulth, mmultv, false); d3d->ahwnd = ahwnd; @@ -3799,14 +3795,8 @@ static int xxD3D11_init2(HWND ahwnd, int monid, int w_w, int w_h, int t_w, int t UINT flags = 0; result = d3d->m_device->CheckFormatSupport(d3d->texformat, &flags); if (FAILED(result) || !(flags & D3D11_FORMAT_SUPPORT_TEXTURE2D)) { - if (depth != 32) - write_log(_T("Direct3D11: 16-bit texture format is not supported %08x\n"), result); - else - write_log(_T("Direct3D11: 32-bit texture format is not supported!? %08x\n"), result); - if (depth == 32) - return 0; - write_log(_T("Direct3D11: Retrying in 32-bit mode\n"), result); - return -1; + write_log(_T("Direct3D11: 32-bit texture format is not supported!? %08x\n"), result); + return 0; } // Initialize the swap chain description. @@ -4150,12 +4140,12 @@ static void xD3D11_free(int monid, bool immediate) write_log(_T("D3D11 free end\n")); } -static int xxD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv) +static int xxD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int *freq, int mmulth, int mmultv) { - return xxD3D11_init2(ahwnd, monid, w_w, w_h, w_w, w_h, depth, freq, mmulth, mmultv); + return xxD3D11_init2(ahwnd, monid, w_w, w_h, w_w, w_h, freq, mmulth, mmultv); } -static const TCHAR *xD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv, int *errp) +static const TCHAR *xD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int *freq, int mmulth, int mmultv, int *errp) { bool reset = false; if (!can_D3D11(false)) { @@ -4207,7 +4197,7 @@ static const TCHAR *xD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int dep } if (reset) { xD3D11_free(monid, true); - int v = xxD3D11_init(ahwnd, monid, w_w, w_h, depth, freq, mmulth, mmultv); + int v = xxD3D11_init(ahwnd, monid, w_w, w_h, freq, mmulth, mmultv); if (v > 0) { return NULL; } @@ -4219,7 +4209,7 @@ static const TCHAR *xD3D11_init(HWND ahwnd, int monid, int w_w, int w_h, int dep return _T("D3D11 INITIALIZATION ERROR"); } else { struct d3d11struct *d3d = &d3d11data[monid]; - if (xD3D11_initvals(ahwnd, monid, w_w, w_h, w_w, w_h, depth, freq, mmulth, mmultv, true)) { + if (xD3D11_initvals(ahwnd, monid, w_w, w_h, w_w, w_h, freq, mmulth, mmultv, true)) { d3d->fsresizedo = true; } else { *errp = -1; @@ -5041,7 +5031,7 @@ static bool recheck(struct d3d11struct *d3d, int monid) d3d->delayedfs = 0; ShowWindow(d3d->ahwnd, SW_SHOWNORMAL); int freq = 0; - if (!xxD3D11_init2(d3d->ahwnd, d3d->num, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth2, d3d->m_bitmapHeight2, 32, &freq, d3d->dmultxh, d3d->dmultxv)) + if (!xxD3D11_init2(d3d->ahwnd, d3d->num, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth2, d3d->m_bitmapHeight2, &freq, d3d->dmultxh, d3d->dmultxv)) d3d->invalidmode = true; return false; } diff --git a/od-win32/gdirender.cpp b/od-win32/gdirender.cpp index b06d690f..51d937ed 100644 --- a/od-win32/gdirender.cpp +++ b/od-win32/gdirender.cpp @@ -45,7 +45,6 @@ struct gdistruct int enabled; int num; int wwidth, wheight; - int depth; HWND hwnd; HDC hdc; HGDIOBJ oldbm; @@ -197,10 +196,9 @@ static bool allocsprite(struct gdistruct *gdi, struct gdibm *bm, int w, int h) bmi.bV4Height = -h; bmi.bV4Planes = 1; bmi.bV4V4Compression = BI_RGB; - bmi.bV4BitCount = gdi->depth; + bmi.bV4BitCount = 32; bm->width = w; bm->height = h; - bm->depth = gdi->depth; bm->pitch = ((w * bmi.bV4BitCount + 31) / 32) * 4; bmi.bV4SizeImage = bm->pitch * h; bm->hbm = CreateDIBSection(gdi->hdc, (const BITMAPINFO*)&bmi, DIB_RGB_COLORS, &bm->bits, NULL, 0); @@ -275,13 +273,13 @@ static void updateleds(struct gdistruct *gdi) for (int y = 0; y < gdi->osd.height; y++) { uae_u8 *buf = (uae_u8*)gdi->osd.bits + y * gdi->osd.pitch; - statusline_single_erase(gdi->num, buf, gdi->osd.depth / 8, y, gdi->ledwidth); + statusline_single_erase(gdi->num, buf, y, gdi->ledwidth); } - statusline_render(gdi->num, (uae_u8*)gdi->osd.bits, gdi->osd.depth / 8, gdi->osd.pitch, gdi->ledwidth, gdi->ledheight, rc, gc, bc, a); + statusline_render(gdi->num, (uae_u8*)gdi->osd.bits, gdi->osd.pitch, gdi->ledwidth, gdi->ledheight, rc, gc, bc, a); for (int y = 0; y < gdi->osd.height; y++) { uae_u8 *buf = (uae_u8*)gdi->osd.bits + y * gdi->osd.pitch; - draw_status_line_single(gdi->num, buf, gdi->osd.depth / 8, y, gdi->ledwidth, rc, gc, bc, a); + draw_status_line_single(gdi->num, buf, y, gdi->ledwidth, rc, gc, bc, a); } } @@ -431,7 +429,7 @@ void gdi_free(int monid, bool immediate) gdi->extoverlays = NULL; } -static const TCHAR *gdi_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv, int *errp) +static const TCHAR *gdi_init(HWND ahwnd, int monid, int w_w, int w_h, int *freq, int mmulth, int mmultv, int *errp) { struct gdistruct *gdi = &gdidata[monid]; @@ -441,7 +439,6 @@ static const TCHAR *gdi_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, } gdi_free(monid, true); gdi->hwnd = ahwnd; - gdi->depth = depth; gdi->wwidth = w_w; gdi->wheight = w_h; if (allocsprite(gdi, &gdi->buf, gdi->wwidth, gdi->wheight)) { @@ -451,7 +448,7 @@ static const TCHAR *gdi_init(HWND ahwnd, int monid, int w_w, int w_h, int depth, allocsprite(gdi, &gdi->osd, gdi->ledwidth, gdi->ledheight); allocsprite(gdi, &gdi->cursor, CURSORMAXWIDTH, CURSORMAXHEIGHT); gdi->enabled = 1; - write_log(_T("GDI mode initialized %d*%d*%d\n"), w_w, w_h, depth); + write_log(_T("GDI mode initialized %d*%d\n"), w_w, w_h); return NULL; } @@ -480,10 +477,6 @@ static bool gdi_setcursor(int monid, int x, int y, int width, int height, float struct gdistruct *gdi = &gdidata[monid]; int cx, cy; - if (gdi->depth < 32) { - return false; - } - if (width < 0 || height < 0) { return true; } @@ -517,10 +510,6 @@ static uae_u8 *gdi_setcursorsurface(int monid, bool query, int *pitch) return (uae_u8 *)gdi->cursor.bits; } - if (gdi->depth < 32) { - return NULL; - } - if (pitch) { *pitch = gdi->cursor.pitch; return (uae_u8*)gdi->cursor.bits; @@ -546,10 +535,6 @@ static bool gdi_extoverlay(struct extoverlay *ext, int monid) struct gdioverlay *ov, *ovprev, *ov2; struct gdibm *s = NULL; - if (gdi->depth < 32) { - return false; - } - gdi->eraseneeded = true; ov = gdi->extoverlays; diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index 92db31aa..cc170e7f 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -4590,11 +4590,11 @@ void picasso_statusline(int monid, uae_u8 *dst) dst_width = vidinfo->width; pitch = vidinfo->rowbytes; statusline_getpos(monid, &slx, &sly, state->Width, dst_height); - statusline_render(monid, dst + sly * pitch, vidinfo->pixbytes, pitch, dst_width, dst_height, p96rc, p96gc, p96bc, NULL); + statusline_render(monid, dst + sly * pitch, pitch, dst_width, dst_height, p96rc, p96gc, p96bc, NULL); int m = statusline_get_multiplier(monid) / 100; for (y = 0; y < TD_TOTAL_HEIGHT * m; y++) { uae_u8 *buf = dst + (y + sly) * pitch; - draw_status_line_single(monid, buf, vidinfo->pixbytes, y, dst_width, p96rc, p96gc, p96bc, NULL); + draw_status_line_single(monid, buf, y, dst_width, p96rc, p96gc, p96bc, NULL); } } diff --git a/od-win32/render.h b/od-win32/render.h index 2d3ebb23..d3120f60 100644 --- a/od-win32/render.h +++ b/od-win32/render.h @@ -52,8 +52,8 @@ extern int amigamonid; struct winuae_currentmode { unsigned int flags; - int native_width, native_height, native_depth, pitch; - int current_width, current_height, current_depth; + int native_width, native_height; + int current_width, current_height; int amiga_width, amiga_height; int initdone; int fullfill; diff --git a/od-win32/screenshot.cpp b/od-win32/screenshot.cpp index 7395cc5f..706c2608 100644 --- a/od-win32/screenshot.cpp +++ b/od-win32/screenshot.cpp @@ -428,9 +428,9 @@ donormal: height = state->Height; } if (D3D_isenabled(0) == 2) { - int w, h, pitch, bits = 32, d; + int w, h, bits, pitch; void *data; - bool got = D3D11_capture(monid, &data, &w, &h, &d, &pitch, renderTarget); + bool got = D3D11_capture(monid, &data, &w, &h, &bits, &pitch, renderTarget); int dpitch = (((width * depth + 31) & ~31) / 8); lpvBits = xmalloc(uae_u8, dpitch * height); @@ -448,7 +448,7 @@ donormal: bi->bmiHeader.biClrUsed = 0; bi->bmiHeader.biClrImportant = 0; - if (got && lpvBits && d <= 32) { + if (got && lpvBits && bits <= 32) { for (int y = 0; y < h && y < height; y++) { uae_u8 *d = (uae_u8*)lpvBits + (height - y - 1) * dpitch; uae_u32 *s = (uae_u32*)((uae_u8*)data + y * pitch); @@ -495,41 +495,19 @@ donormal: bi->bmiHeader.biClrImportant = 0; if (lpvBits) { - if (bits == 32) { - for (int y = 0; y < h && y < height; y++) { - uae_u8 *d = (uae_u8*)lpvBits + (height - y - 1) * dpitch; - uae_u32 *s = (uae_u32*)((uae_u8*)l.pBits + y * l.Pitch); - for (int x = 0; x < w && x < width; x++) { - uae_u32 v = *s++; - d[0] = v >> 0; - d[1] = v >> 8; - d[2] = v >> 16; - if (depth == 32) { - d[3] = v >> 24; - d += 4; - } else { - d += 3; - } - } - } - } else if (bits == 16 || bits == 15) { - for (int y = 0; y < h && y < height; y++) { - uae_u8 *d = (uae_u8*)lpvBits + (height - y - 1) * dpitch; - uae_u16 *s = (uae_u16*)((uae_u8*)l.pBits + y * l.Pitch); - for (int x = 0; x < w && x < width; x++) { - uae_u16 v = s[x]; - uae_u16 v2 = v; - if (bits == 16) { - v2 = v & 31; - v2 |= ((v & (31 << 5)) << 1) | (((v >> 5) & 1) << 5); - v2 |= (v & (31 << 10)) << 1; - } else { - v2 = v & 31; - v2 |= (v >> 1) & (31 << 5); - v2 |= (v >> 1) & (31 << 10); - } - ((uae_u16*)d)[0] = v2; - d += 2; + for (int y = 0; y < h && y < height; y++) { + uae_u8 *d = (uae_u8*)lpvBits + (height - y - 1) * dpitch; + uae_u32 *s = (uae_u32*)((uae_u8*)l.pBits + y * l.Pitch); + for (int x = 0; x < w && x < width; x++) { + uae_u32 v = *s++; + d[0] = v >> 0; + d[1] = v >> 8; + d[2] = v >> 16; + if (depth == 32) { + d[3] = v >> 24; + d += 4; + } else { + d += 3; } } } diff --git a/od-win32/statusline_win32.cpp b/od-win32/statusline_win32.cpp index 540d434c..00d45f60 100644 --- a/od-win32/statusline_win32.cpp +++ b/od-win32/statusline_win32.cpp @@ -416,7 +416,7 @@ void statusline_updated(int monid) PostMessage(mon->hStatusWnd, SB_SETTEXT, (WPARAM)((window_led_msg_start) | SBT_OWNERDRAW), (LPARAM)_T("")); } -void statusline_render(int monid, uae_u8 *buf, int bpp, int pitch, int maxwidth, int maxheight, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha) +void statusline_render(int monid, uae_u8 *buf, int pitch, int maxwidth, int maxheight, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha) { struct AmigaMonitor *mon = &AMonitors[monid]; uae_u32 white = rc[0xff] | gc[0xff] | bc[0xff] | (alpha ? alpha[0xff] : 0); diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 4da8fea4..723748ad 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -8,8 +8,6 @@ * Copyright 1997-2000 Brian King */ -#define FORCE16BIT 0 - #include "sysconfig.h" #include @@ -142,13 +140,6 @@ int isfullscreen(void) return isfullscreen_2(&currprefs); } -int WIN32GFX_GetDepth(struct AmigaMonitor *mon, int real) -{ - if (!mon->currentmode.native_depth) - return mon->currentmode.current_depth; - return real ? mon->currentmode.native_depth : mon->currentmode.current_depth; -} - int WIN32GFX_GetWidth(struct AmigaMonitor *mon) { return mon->currentmode.current_width; @@ -163,9 +154,6 @@ static BOOL doInit (struct AmigaMonitor*); int default_freq = 60; -static uae_u8 *scrlinebuf; - - static struct MultiDisplay *getdisplay2(struct uae_prefs *p, int index) { struct AmigaMonitor *mon = &AMonitors[0]; @@ -1783,11 +1771,7 @@ static void update_gfxparams(struct AmigaMonitor *mon) #ifdef PICASSO96 } #endif -#if FORCE16BIT - mon->currentmode.current_depth = 16; -#else - mon->currentmode.current_depth = 32; -#endif + mon->currentmode.amiga_width = mon->currentmode.current_width; mon->currentmode.amiga_height = mon->currentmode.current_height; @@ -2547,20 +2531,11 @@ void init_colors(int monid) { struct AmigaMonitor *mon = &AMonitors[monid]; /* init colors */ - D3D_getpixelformat (mon->currentmode.current_depth, - &red_bits, &green_bits, &blue_bits, &red_shift, &green_shift, &blue_shift, &alpha_bits, &alpha_shift, &alpha); - - if (!(mon->currentmode.flags & (DM_D3D))) { - if (mon->currentmode.current_depth != mon->currentmode.native_depth) { - if (mon->currentmode.current_depth == 16) { - red_bits = 5; green_bits = 6; blue_bits = 5; - red_shift = 11; green_shift = 5; blue_shift = 0; - } else { - red_bits = green_bits = blue_bits = 8; - red_shift = 16; green_shift = 8; blue_shift = 0; - } - } - } + D3D_getpixelformat(&red_bits, &green_bits, &blue_bits, &red_shift, &green_shift, &blue_shift, &alpha_bits, &alpha_shift, &alpha); + + red_bits = green_bits = blue_bits = 8; + red_shift = 16; green_shift = 8; blue_shift = 0; + alloc_colors64k(monid, red_bits, green_bits, blue_bits, red_shift,green_shift, blue_shift, alpha_bits, alpha_shift, alpha, 0); notice_new_xcolors (); #ifdef AVIOUTPUT @@ -2697,7 +2672,6 @@ bool vsync_switchmode(int monid, int hz) static int oldhz; int w = mon->currentmode.native_width; int h = mon->currentmode.native_height; - int d = mon->currentmode.native_depth / 8; struct MultiDisplay *md = getdisplay(&currprefs, monid); struct PicassoResolution *found; int newh, i, cnt; @@ -2825,15 +2799,12 @@ static int modeswitchneeded(struct AmigaMonitor *mon, struct winuae_currentmode return 1; if (state->Width == wc->current_width && state->Height == wc->current_height) { - if (state->BytesPerPixel * 8 == wc->current_depth || state->BytesPerPixel == 1) - return 0; - return 0; + return 0; } return 1; } else { if (mon->currentmode.current_width != wc->current_width || - mon->currentmode.current_height != wc->current_height || - mon->currentmode.current_depth != wc->current_depth) + mon->currentmode.current_height != wc->current_height) return -1; } } else if (isfullscreen () == 0) { @@ -2926,12 +2897,11 @@ static void updatepicasso96(struct AmigaMonitor *mon) #ifdef PICASSO96 struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[mon->monitor_id]; vidinfo->rowbytes = 0; - vidinfo->pixbytes = mon->currentmode.current_depth / 8; + vidinfo->pixbytes = 32 / 8; vidinfo->rgbformat = 0; vidinfo->extra_mem = 1; vidinfo->height = mon->currentmode.current_height; vidinfo->width = mon->currentmode.current_width; - vidinfo->depth = mon->currentmode.current_depth; vidinfo->offset = 0; vidinfo->splitypos = -1; #endif @@ -3750,9 +3720,10 @@ static int create_windows(struct AmigaMonitor *mon) return 1; } -static void allocsoftbuffer(int monid, const TCHAR *name, struct vidbuffer *buf, int flags, int width, int height, int depth) +static void allocsoftbuffer(int monid, const TCHAR *name, struct vidbuffer *buf, int flags, int width, int height) { struct vidbuf_description *vidinfo = &adisplays[monid].gfxvidinfo; + int depth = 32; if (buf->initialized && buf->vram_buffer) { return; @@ -3773,8 +3744,6 @@ static void allocsoftbuffer(int monid, const TCHAR *name, struct vidbuffer *buf, buf->bufmem_allocated = NULL; buf->vram_buffer = true; - write_log(_T("Mon %d reserved %s draw buffer (%d*%d*%d)\n"), monid, name, width, height, depth); - } else { xfree(buf->realbufmem); @@ -3786,8 +3755,6 @@ static void allocsoftbuffer(int monid, const TCHAR *name, struct vidbuffer *buf, buf->bufmem_allocated = buf->bufmem = buf->realbufmem + (h / 2) * buf->rowbytes + (w / 2) * buf->pixbytes; buf->bufmemend = buf->realbufmem + size - buf->rowbytes; - write_log(_T("Mon %d allocated %s temp buffer (%d*%d*%d) = %p\n"), monid, name, width, height, depth, buf->realbufmem); - } } @@ -3796,7 +3763,6 @@ static int oldtex_w[MAX_AMIGAMONITORS], oldtex_h[MAX_AMIGAMONITORS], oldtex_rtg[ static BOOL doInit(struct AmigaMonitor *mon) { - int tmp_depth; int ret = 0; bool modechanged; @@ -3816,8 +3782,6 @@ retry: for (;;) { updatemodes(mon); - mon->currentmode.native_depth = 0; - tmp_depth = mon->currentmode.current_depth; if (mon->currentmode.flags & DM_W_FULLSCREEN) { RECT rc = getdisplay(&currprefs, mon->monitor_id)->rect; @@ -3831,14 +3795,11 @@ retry: break; } else { #endif - mon->currentmode.native_depth = mon->currentmode.current_depth; - if (currprefs.gfx_resolution > avidinfo->gfx_resolution_reserved) avidinfo->gfx_resolution_reserved = currprefs.gfx_resolution; if (currprefs.gfx_vresolution > avidinfo->gfx_vresolution_reserved) avidinfo->gfx_vresolution_reserved = currprefs.gfx_vresolution; - //gfxvidinfo.drawbuffer.gfx_resolution_reserved = RES_SUPERHIRES; #if defined (GFXFILTER) if (mon->currentmode.flags & DM_D3D) { @@ -3921,7 +3882,7 @@ retry: } int errv = 0; const TCHAR *err = D3D_init(mon->hAmigaWnd, mon->monitor_id, mon->currentmode.native_width, mon->currentmode.native_height, - mon->currentmode.current_depth, &mon->currentmode.freq, fmh, fmv, &errv); + &mon->currentmode.freq, fmh, fmv, &errv); if (errv > 0) { if (errv == 2 && currprefs.gfx_api == 0) { write_log("Retrying D3D %s\n", err); @@ -3937,7 +3898,7 @@ retry: error_log(_T("Direct3D11 failed to initialize ('%s'), falling back to Direct3D9."), err); errv = 0; err = D3D_init(mon->hAmigaWnd, mon->monitor_id, mon->currentmode.native_width, mon->currentmode.native_height, - mon->currentmode.current_depth, &mon->currentmode.freq, fmh, fmv, &errv); + &mon->currentmode.freq, fmh, fmv, &errv); } if (errv > 0) { D3D_free(0, true); @@ -3953,12 +3914,11 @@ retry: error_log(_T("Direct3D9/11 failed to initialize ('%s'), falling back to GDI."), err); errv = 0; err = D3D_init(mon->hAmigaWnd, mon->monitor_id, mon->currentmode.native_width, mon->currentmode.native_height, - mon->currentmode.current_depth, &mon->currentmode.freq, fmh, fmv, &errv); + &mon->currentmode.freq, fmh, fmv, &errv); if (errv) { error_log(_T("Failed to initialize any rendering modes.")); } } - mon->currentmode.current_depth = mon->currentmode.native_depth; gfxmode_reset(mon->monitor_id); ret = -1; goto oops; diff --git a/od-win32/win32gfx.h b/od-win32/win32gfx.h index 040fa1b4..0141269b 100644 --- a/od-win32/win32gfx.h +++ b/od-win32/win32gfx.h @@ -12,11 +12,10 @@ extern void reenumeratemonitors(void); int WIN32GFX_IsPicassoScreen(struct AmigaMonitor*); int WIN32GFX_GetWidth(struct AmigaMonitor*); int WIN32GFX_GetHeight(struct AmigaMonitor*); -int WIN32GFX_GetDepth(struct AmigaMonitor*, int real); void WIN32GFX_DisplayChangeRequested(int); void DX_Invalidate(struct AmigaMonitor*, int x, int y, int width, int height); -int WIN32GFX_AdjustScreenmode(struct MultiDisplay *md, int *pwidth, int *pheight, int *ppixbits); +int WIN32GFX_AdjustScreenmode(struct MultiDisplay *md, int *pwidth, int *pheight); extern HCURSOR normalcursor; extern int default_freq; diff --git a/statusline.cpp b/statusline.cpp index 26aeb6d0..7cfd3f5a 100644 --- a/statusline.cpp +++ b/statusline.cpp @@ -73,7 +73,7 @@ static const char *numbers_default = { /* ugly 0123456789CHD%+-PNKV */ static const char *numbers = numbers_default; -STATIC_INLINE uae_u32 ledcolor(uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *a) +static uae_u32 ledcolor(uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *a) { uae_u32 v = rc[(c >> 16) & 0xff] | gc[(c >> 8) & 0xff] | bc[(c >> 0) & 0xff]; if (a) @@ -81,7 +81,7 @@ STATIC_INLINE uae_u32 ledcolor(uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, return v; } -static void write_tdnumber(uae_u8 *buf, int bpp, int x, int y, int num, uae_u32 c1, uae_u32 c2, int mult) +static void write_tdnumber(uae_u8 *buf, int x, int y, int num, uae_u32 c1, uae_u32 c2, int mult) { int j; const char *numptr; @@ -90,9 +90,9 @@ static void write_tdnumber(uae_u8 *buf, int bpp, int x, int y, int num, uae_u32 for (j = 0; j < td_numbers_width; j++) { for (int k = 0; k < mult; k++) { if (*numptr == 'x') - putpixel(buf, NULL, bpp, x + j * mult + k, c1); + putpixel(buf, NULL, x + j * mult + k, c1); else if (*numptr == '+') - putpixel(buf, NULL, bpp, x + j * mult + k, c2); + putpixel(buf, NULL, x + j * mult + k, c2); } numptr++; } @@ -158,7 +158,7 @@ int statusline_get_multiplier(int monid) return statusline_mult[idx]; } -void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha) +void draw_status_line_single(int monid, uae_u8 *buf, int y, int totalwidth, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *alpha) { struct amigadisplay *ad = &adisplays[monid]; int x_start, j, led, border; @@ -403,13 +403,13 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi x = x_start + pos * td_width * mult; for (int xx = 0; xx < mult; xx++) { if (!border) { - putpixel(buf, NULL, bpp, x - mult + xx, cb); + putpixel(buf, NULL, x - mult + xx, cb); } for (j = 0; j < td_led_width * mult; j += mult) { - putpixel(buf, NULL, bpp, x + j + xx, c); + putpixel(buf, NULL, x + j + xx, c); } if (!border) { - putpixel(buf, NULL, bpp, x + j + xx, cb); + putpixel(buf, NULL, x + j + xx, cb); } } @@ -417,19 +417,19 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi if (num3 >= 0) { x += (td_led_width - am * td_numbers_width) * mult / 2; if (num1 > 0) { - write_tdnumber(buf, bpp, x, y - td_numbers_pady, num1, pen_rgb, c2, mult); + write_tdnumber(buf, x, y - td_numbers_pady, num1, pen_rgb, c2, mult); x += td_numbers_width * mult; } if (num2 >= 0) { - write_tdnumber(buf, bpp, x, y - td_numbers_pady, num2, pen_rgb, c2, mult); + write_tdnumber(buf, x, y - td_numbers_pady, num2, pen_rgb, c2, mult); x += td_numbers_width * mult; } else if (num2 < -1) { x += td_numbers_width * mult; } - write_tdnumber(buf, bpp, x, y - td_numbers_pady, num3, pen_rgb, c2, mult); + write_tdnumber(buf, x, y - td_numbers_pady, num3, pen_rgb, c2, mult); x += td_numbers_width * mult; if (num4 > 0) - write_tdnumber(buf, bpp, x, y - td_numbers_pady, num4, pen_rgb, c2, mult); + write_tdnumber(buf, x, y - td_numbers_pady, num4, pen_rgb, c2, mult); } } } @@ -562,7 +562,7 @@ void statusline_vsync(void) statusline_update_notification(); } -void statusline_single_erase(int monid, uae_u8 *buf, int bpp, int y, int totalwidth) +void statusline_single_erase(int monid, uae_u8 *buf, int y, int totalwidth) { - memset(buf, 0, bpp * totalwidth); + memset(buf, 0, 4 * totalwidth); }