Port PR#199 from pcem to 86Box.
Source: https://github.com/sarah-walker-pcem/pcem/pull/199
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2008-2020 Sarah Walker.
|
* Copyright 2008-2020 Sarah Walker.
|
||||||
*/
|
*/
|
||||||
|
#include <assert.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -2267,9 +2268,10 @@ banshee_overlay_draw(svga_t *svga, int displine)
|
|||||||
|
|
||||||
case VIDPROCCFG_FILTER_MODE_DITHER_4X4:
|
case VIDPROCCFG_FILTER_MODE_DITHER_4X4:
|
||||||
if (banshee->voodoo->scrfilter && banshee->voodoo->scrfilterEnabled) {
|
if (banshee->voodoo->scrfilter && banshee->voodoo->scrfilterEnabled) {
|
||||||
uint8_t *fil = malloc((svga->overlay_latch.cur_xsize) * 3);
|
uint8_t fil[64 * 3];
|
||||||
uint8_t *fil3 = malloc((svga->overlay_latch.cur_xsize) * 3);
|
uint8_t fil3[64 * 3];
|
||||||
|
|
||||||
|
assert(svga->overlay_latch.cur_xsize <= 64);
|
||||||
if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) /* leilei HACK - don't know of real 4x1 hscaled behavior yet, double for now */
|
if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) /* leilei HACK - don't know of real 4x1 hscaled behavior yet, double for now */
|
||||||
{
|
{
|
||||||
for (x = 0; x < svga->overlay_latch.cur_xsize; x++) {
|
for (x = 0; x < svga->overlay_latch.cur_xsize; x++) {
|
||||||
@@ -2320,9 +2322,6 @@ banshee_overlay_draw(svga_t *svga, int displine)
|
|||||||
fil[(x) *3 + 2] = vb_filter_v1_rb[fil[x * 3 + 2]][fil3[(x + 1) * 3 + 2]];
|
fil[(x) *3 + 2] = vb_filter_v1_rb[fil[x * 3 + 2]][fil3[(x + 1) * 3 + 2]];
|
||||||
p[x] = (fil[x * 3 + 2] << 16) | (fil[x * 3 + 1] << 8) | fil[x * 3];
|
p[x] = (fil[x * 3 + 2] << 16) | (fil[x * 3 + 1] << 8) | fil[x * 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
free(fil);
|
|
||||||
free(fil3);
|
|
||||||
} else /* filter disabled by emulator option */
|
} else /* filter disabled by emulator option */
|
||||||
{
|
{
|
||||||
if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) {
|
if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) {
|
||||||
@@ -2339,15 +2338,16 @@ banshee_overlay_draw(svga_t *svga, int displine)
|
|||||||
|
|
||||||
case VIDPROCCFG_FILTER_MODE_DITHER_2X2:
|
case VIDPROCCFG_FILTER_MODE_DITHER_2X2:
|
||||||
if (banshee->voodoo->scrfilter && banshee->voodoo->scrfilterEnabled) {
|
if (banshee->voodoo->scrfilter && banshee->voodoo->scrfilterEnabled) {
|
||||||
uint8_t *fil = malloc((svga->overlay_latch.cur_xsize) * 3);
|
uint8_t fil[64 * 3];
|
||||||
uint8_t *soak = malloc((svga->overlay_latch.cur_xsize) * 3);
|
uint8_t soak[64 * 3];
|
||||||
uint8_t *soak2 = malloc((svga->overlay_latch.cur_xsize) * 3);
|
uint8_t soak2[64 * 3];
|
||||||
|
|
||||||
uint8_t *samp1 = malloc((svga->overlay_latch.cur_xsize) * 3);
|
uint8_t samp1[64 * 3];
|
||||||
uint8_t *samp2 = malloc((svga->overlay_latch.cur_xsize) * 3);
|
uint8_t samp2[64 * 3];
|
||||||
uint8_t *samp3 = malloc((svga->overlay_latch.cur_xsize) * 3);
|
uint8_t samp3[64 * 3];
|
||||||
uint8_t *samp4 = malloc((svga->overlay_latch.cur_xsize) * 3);
|
uint8_t samp4[64 * 3];
|
||||||
|
|
||||||
|
assert(svga->overlay_latch.cur_xsize <= 64);
|
||||||
src = &svga->vram[src_addr2 & svga->vram_mask];
|
src = &svga->vram[src_addr2 & svga->vram_mask];
|
||||||
OVERLAY_SAMPLE(banshee->overlay_buffer[1]);
|
OVERLAY_SAMPLE(banshee->overlay_buffer[1]);
|
||||||
for (x = 0; x < svga->overlay_latch.cur_xsize; x++) {
|
for (x = 0; x < svga->overlay_latch.cur_xsize; x++) {
|
||||||
@@ -2395,14 +2395,6 @@ banshee_overlay_draw(svga_t *svga, int displine)
|
|||||||
p[x] = (fil[x * 3 + 2] << 16) | (fil[x * 3 + 1] << 8) | fil[x * 3];
|
p[x] = (fil[x * 3 + 2] << 16) | (fil[x * 3 + 1] << 8) | fil[x * 3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(fil);
|
|
||||||
free(soak);
|
|
||||||
free(soak2);
|
|
||||||
free(samp1);
|
|
||||||
free(samp2);
|
|
||||||
free(samp3);
|
|
||||||
free(samp4);
|
|
||||||
} else /* filter disabled by emulator option */
|
} else /* filter disabled by emulator option */
|
||||||
{
|
{
|
||||||
if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) {
|
if (banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) {
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2008-2020 Sarah Walker.
|
* Copyright 2008-2020 Sarah Walker.
|
||||||
*/
|
*/
|
||||||
|
#include <assert.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -373,8 +374,9 @@ voodoo_filterline_v1(voodoo_t *voodoo, uint8_t *fil, int column, uint16_t *src,
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// Scratchpad for avoiding feedback streaks
|
// Scratchpad for avoiding feedback streaks
|
||||||
uint8_t *fil3 = malloc((voodoo->h_disp) * 3);
|
uint8_t fil3[4096 * 3];
|
||||||
|
|
||||||
|
assert(voodoo->h_disp <= 4096);
|
||||||
/* 16 to 32-bit */
|
/* 16 to 32-bit */
|
||||||
for (x = 0; x < column; x++) {
|
for (x = 0; x < column; x++) {
|
||||||
fil[x * 3] = ((src[x] & 31) << 3);
|
fil[x * 3] = ((src[x] & 31) << 3);
|
||||||
@@ -422,8 +424,6 @@ voodoo_filterline_v1(voodoo_t *voodoo, uint8_t *fil, int column, uint16_t *src,
|
|||||||
fil[(x) *3 + 1] = voodoo->thefilterg[fil3[x * 3 + 1]][fil3[(x + 1) * 3 + 1]];
|
fil[(x) *3 + 1] = voodoo->thefilterg[fil3[x * 3 + 1]][fil3[(x + 1) * 3 + 1]];
|
||||||
fil[(x) *3 + 2] = voodoo->thefilter[fil3[x * 3 + 2]][fil3[(x + 1) * 3 + 2]];
|
fil[(x) *3 + 2] = voodoo->thefilter[fil3[x * 3 + 2]][fil3[(x + 1) * 3 + 2]];
|
||||||
}
|
}
|
||||||
|
|
||||||
free(fil3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -432,8 +432,9 @@ voodoo_filterline_v2(voodoo_t *voodoo, uint8_t *fil, int column, uint16_t *src,
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
// Scratchpad for blending filter
|
// Scratchpad for blending filter
|
||||||
uint8_t *fil3 = malloc((voodoo->h_disp) * 3);
|
uint8_t fil3[4096 * 3];
|
||||||
|
|
||||||
|
assert(voodoo->h_disp <= 4096);
|
||||||
/* 16 to 32-bit */
|
/* 16 to 32-bit */
|
||||||
for (x = 0; x < column; x++) {
|
for (x = 0; x < column; x++) {
|
||||||
// Blank scratchpads
|
// Blank scratchpads
|
||||||
@@ -487,8 +488,6 @@ voodoo_filterline_v2(voodoo_t *voodoo, uint8_t *fil, int column, uint16_t *src,
|
|||||||
fil3[(column - 1) * 3] = voodoo->thefilterb[fil[(column - 1) * 3]][((src[column] & 31) << 3)];
|
fil3[(column - 1) * 3] = voodoo->thefilterb[fil[(column - 1) * 3]][((src[column] & 31) << 3)];
|
||||||
fil3[(column - 1) * 3 + 1] = voodoo->thefilterg[fil[(column - 1) * 3 + 1]][(((src[column] >> 5) & 63) << 2)];
|
fil3[(column - 1) * 3 + 1] = voodoo->thefilterg[fil[(column - 1) * 3 + 1]][(((src[column] >> 5) & 63) << 2)];
|
||||||
fil3[(column - 1) * 3 + 2] = voodoo->thefilter[fil[(column - 1) * 3 + 2]][(((src[column] >> 11) & 31) << 3)];
|
fil3[(column - 1) * 3 + 2] = voodoo->thefilter[fil[(column - 1) * 3 + 2]][(((src[column] >> 11) & 31) << 3)];
|
||||||
|
|
||||||
free(fil3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -537,8 +536,9 @@ voodoo_callback(void *p)
|
|||||||
monitor->target_buffer->line[voodoo->line + 8][x] = 0x00000000;
|
monitor->target_buffer->line[voodoo->line + 8][x] = 0x00000000;
|
||||||
|
|
||||||
if (voodoo->scrfilter && voodoo->scrfilterEnabled) {
|
if (voodoo->scrfilter && voodoo->scrfilterEnabled) {
|
||||||
uint8_t *fil = malloc((voodoo->h_disp) * 3); /* interleaved 24-bit RGB */
|
uint8_t fil[4096 * 3]; /* interleaved 24-bit RGB */
|
||||||
|
|
||||||
|
assert(voodoo->h_disp <= 4096);
|
||||||
if (voodoo->type == VOODOO_2)
|
if (voodoo->type == VOODOO_2)
|
||||||
voodoo_filterline_v2(voodoo, fil, voodoo->h_disp, src, voodoo->line);
|
voodoo_filterline_v2(voodoo, fil, voodoo->h_disp, src, voodoo->line);
|
||||||
else
|
else
|
||||||
@@ -547,8 +547,6 @@ voodoo_callback(void *p)
|
|||||||
for (x = 0; x < voodoo->h_disp; x++) {
|
for (x = 0; x < voodoo->h_disp; x++) {
|
||||||
p[x] = (voodoo->clutData256[fil[x * 3]].b << 0 | voodoo->clutData256[fil[x * 3 + 1]].g << 8 | voodoo->clutData256[fil[x * 3 + 2]].r << 16);
|
p[x] = (voodoo->clutData256[fil[x * 3]].b << 0 | voodoo->clutData256[fil[x * 3 + 1]].g << 8 | voodoo->clutData256[fil[x * 3 + 2]].r << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(fil);
|
|
||||||
} else {
|
} else {
|
||||||
for (x = 0; x < voodoo->h_disp; x++) {
|
for (x = 0; x < voodoo->h_disp; x++) {
|
||||||
p[x] = draw_voodoo->video_16to32[src[x]];
|
p[x] = draw_voodoo->video_16to32[src[x]];
|
||||||
|
Reference in New Issue
Block a user