Merge branch 'master' into master
This commit is contained in:
@@ -102,8 +102,7 @@ extern int sound_is_float, /* (C) sound uses FP values */
|
||||
SSI2001, /* (C) sound option */
|
||||
voodoo_enabled; /* (C) video option */
|
||||
extern uint32_t mem_size; /* (C) memory size */
|
||||
extern int cpu_manufacturer, /* (C) cpu manufacturer */
|
||||
cpu, /* (C) cpu type */
|
||||
extern int cpu, /* (C) cpu type */
|
||||
cpu_use_dynarec, /* (C) cpu uses/needs Dyna */
|
||||
fpu_type; /* (C) fpu type */
|
||||
extern int time_sync; /* (C) enable time sync */
|
||||
|
||||
@@ -75,7 +75,6 @@ typedef struct {
|
||||
|
||||
/* Machine cateogory */
|
||||
int machine, /* Machine */
|
||||
cpu_manufacturer, /* CPU manufacturer */
|
||||
cpu, /* CPU */
|
||||
#ifdef USE_DYNAREC
|
||||
cpu_use_dynarec, /* CPU recompiler enabled */
|
||||
@@ -145,12 +144,14 @@ extern void config_dump(void);
|
||||
|
||||
extern void config_delete_var(char *head, char *name);
|
||||
extern int config_get_int(char *head, char *name, int def);
|
||||
extern double config_get_double(char *head, char *name, double def);
|
||||
extern int config_get_hex16(char *head, char *name, int def);
|
||||
extern int config_get_hex20(char *head, char *name, int def);
|
||||
extern int config_get_mac(char *head, char *name, int def);
|
||||
extern char *config_get_string(char *head, char *name, char *def);
|
||||
extern wchar_t *config_get_wstring(char *head, char *name, wchar_t *def);
|
||||
extern void config_set_int(char *head, char *name, int val);
|
||||
extern void config_set_double(char *head, char *name, double val);
|
||||
extern void config_set_hex16(char *head, char *name, int val);
|
||||
extern void config_set_hex20(char *head, char *name, int val);
|
||||
extern void config_set_mac(char *head, char *name, int val);
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
#define IDS_2120 2120 // "No ROMs found"
|
||||
#define IDS_2121 2121 // "Save changes\nThis will hard..."
|
||||
#define IDS_2122 2122 // "Discard changes\nAll changes..."
|
||||
#define IDS_2123 2123 // "Cancel\nGo back to the..."
|
||||
#define IDS_2123 2123 // "Do you want to save the settings?"
|
||||
#define IDS_2124 2124 // "About 86Box"
|
||||
#define IDS_2125 2125 // "86Box v" EMU_VERSION
|
||||
#define IDS_2126 2126 // "An emulator of old computers..."
|
||||
|
||||
@@ -85,6 +85,8 @@
|
||||
|
||||
#define IS_ARCH(m, a) (machines[(m)].flags & (a)) ? 1 : 0;
|
||||
|
||||
#define MACHINE_MULTIPLIER_FIXED -1, -1
|
||||
|
||||
|
||||
enum {
|
||||
MACHINE_TYPE_NONE = 0,
|
||||
@@ -142,14 +144,14 @@ typedef struct _machine_ {
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
const char type;
|
||||
struct {
|
||||
const char *name;
|
||||
#ifdef EMU_CPU_H
|
||||
CPU *cpus;
|
||||
#else
|
||||
void *cpus;
|
||||
#endif
|
||||
} cpu[5];
|
||||
uint32_t cpu_package;
|
||||
uint64_t cpu_block;
|
||||
uint32_t cpu_min_bus;
|
||||
uint32_t cpu_max_bus;
|
||||
uint16_t cpu_min_voltage;
|
||||
uint16_t cpu_max_voltage;
|
||||
double cpu_min_multi;
|
||||
double cpu_max_multi;
|
||||
int flags;
|
||||
uint32_t min_ram, max_ram;
|
||||
int ram_granularity;
|
||||
|
||||
@@ -25,6 +25,7 @@ extern const device_t fdc37c663_device;
|
||||
extern const device_t fdc37c665_device;
|
||||
extern const device_t fdc37c666_device;
|
||||
extern const device_t fdc37c669_device;
|
||||
extern const device_t fdc37c669_370_device;
|
||||
extern const device_t fdc37c931apm_device;
|
||||
extern const device_t fdc37c931apm_compaq_device;
|
||||
extern const device_t fdc37c932fr_device;
|
||||
|
||||
4
src/include/86box/vid_ddc.h
Normal file
4
src/include/86box/vid_ddc.h
Normal file
@@ -0,0 +1,4 @@
|
||||
void ddc_init(void);
|
||||
void ddc_i2c_change(int new_clock, int new_data);
|
||||
int ddc_read_clock(void);
|
||||
int ddc_read_data(void);
|
||||
@@ -57,7 +57,7 @@ typedef struct svga_t
|
||||
firstline, lastline, firstline_draw, lastline_draw,
|
||||
displine, fullchange, x_add, y_add, pan,
|
||||
vram_display_mask, vidclock,
|
||||
hwcursor_on, dac_hwcursor_on, overlay_on;
|
||||
hwcursor_on, dac_hwcursor_on, overlay_on, set_override;
|
||||
|
||||
/*The three variables below allow us to implement memory maps like that seen on a 1MB Trio64 :
|
||||
0MB-1MB - VRAM
|
||||
@@ -77,7 +77,7 @@ typedef struct svga_t
|
||||
extra_banks[2],
|
||||
banked_mask,
|
||||
ca, overscan_color,
|
||||
*map8, pallook[256];
|
||||
*map8, pallook[512];
|
||||
|
||||
PALETTE vgapal;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ extern int scrollcache;
|
||||
|
||||
extern uint8_t edatlookup[4][4];
|
||||
|
||||
void svga_render_null(svga_t *svga);
|
||||
void svga_render_blank(svga_t *svga);
|
||||
void svga_render_overscan_left(svga_t *svga);
|
||||
void svga_render_overscan_right(svga_t *svga);
|
||||
|
||||
18
src/include/86box/vid_voodoo_banshee.h
Normal file
18
src/include/86box/vid_voodoo_banshee.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Banshee and 3 specific emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
void banshee_set_overlay_addr(void *p, uint32_t addr);
|
||||
18
src/include/86box/vid_voodoo_banshee_blitter.h
Normal file
18
src/include/86box/vid_voodoo_banshee_blitter.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Banshee and 3 specific emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
void voodoo_2d_reg_writel(voodoo_t *voodoo, uint32_t addr, uint32_t val);
|
||||
20
src/include/86box/vid_voodoo_blitter.h
Normal file
20
src/include/86box/vid_voodoo_blitter.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* 3DFX Voodoo emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
void voodoo_v2_blit_start(voodoo_t *voodoo);
|
||||
void voodoo_v2_blit_data(voodoo_t *voodoo, uint32_t data);
|
||||
void voodoo_fastfill(voodoo_t *voodoo, voodoo_params_t *params);
|
||||
@@ -5,15 +5,16 @@
|
||||
fbzColorPath
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
# include <sys/mman.h>
|
||||
# include <unistd.h>
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if WIN64
|
||||
# include <windows.h>
|
||||
#define BITMAP windows_BITMAP
|
||||
#include <windows.h>
|
||||
#undef BITMAP
|
||||
#endif
|
||||
|
||||
#include <intrin.h>
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#define BLOCK_NUM 8
|
||||
@@ -32,45 +33,51 @@ typedef struct voodoo_x86_data_t
|
||||
uint32_t fbzColorPath;
|
||||
uint32_t textureMode[2];
|
||||
uint32_t tLOD[2];
|
||||
uint32_t trexInit1;
|
||||
uint32_t trexInit1;
|
||||
int is_tiled;
|
||||
} voodoo_x86_data_t;
|
||||
|
||||
//static voodoo_x86_data_t voodoo_x86_data[2][BLOCK_NUM];
|
||||
|
||||
static int last_block[2] = {0, 0};
|
||||
static int next_block_to_write[2] = {0, 0};
|
||||
static int last_block[4] = {0, 0};
|
||||
static int next_block_to_write[4] = {0, 0};
|
||||
|
||||
#define addbyte(val) \
|
||||
if (block_pos < BLOCK_SIZE) \
|
||||
code_block[block_pos++] = val; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n")
|
||||
#define addbyte(val) \
|
||||
do { \
|
||||
code_block[block_pos++] = val; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n"); \
|
||||
} while (0)
|
||||
|
||||
#define addword(val) \
|
||||
*(uint16_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 2; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n")
|
||||
#define addword(val) \
|
||||
do { \
|
||||
*(uint16_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 2; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n"); \
|
||||
} while (0)
|
||||
|
||||
#define addlong(val) \
|
||||
*(uint32_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 4; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n")
|
||||
#define addlong(val) \
|
||||
do { \
|
||||
*(uint32_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 4; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n"); \
|
||||
} while (0)
|
||||
|
||||
#define addquad(val) \
|
||||
*(uint64_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 8; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n")
|
||||
#define addquad(val) \
|
||||
do { \
|
||||
*(uint64_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 8; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n"); \
|
||||
} while (0)
|
||||
|
||||
|
||||
static __m128i xmm_01_w;// = 0x0001000100010001ull;
|
||||
static __m128i xmm_ff_w;// = 0x00ff00ff00ff00ffull;
|
||||
static __m128i xmm_ff_b;// = 0x00000000ffffffffull;
|
||||
|
||||
static uint32_t zero = 0;
|
||||
|
||||
static __m128i alookup[257], aminuslookup[256];
|
||||
static __m128i minus_254;// = 0xff02ff02ff02ff02ull;
|
||||
static __m128i bilinear_lookup[256*2];
|
||||
@@ -157,10 +164,11 @@ static inline int codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, v
|
||||
addbyte(0x89); /*MOV state->tex_s, EBX*/
|
||||
addbyte(0x9f);
|
||||
addlong(offsetof(voodoo_state_t, tex_s));
|
||||
addbyte(0x0f); /*MOVZX EAX, logtable[RAX]*/
|
||||
addbyte(0x41); /*MOVZX EAX, R9(logtable)[RAX]*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0xb6);
|
||||
addbyte(0x80);
|
||||
addlong((uint32_t)(uintptr_t)logtable);
|
||||
addbyte(0x04);
|
||||
addbyte(0x01);
|
||||
addbyte(0x09); /*OR EAX, EDX*/
|
||||
addbyte(0xd0);
|
||||
addbyte(0x03); /*ADD EAX, state->lod*/
|
||||
@@ -334,11 +342,10 @@ static inline int codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, v
|
||||
addbyte(1);
|
||||
if (state->clamp_t[tmu])
|
||||
{
|
||||
addbyte(0x0f); /*CMOVS EDX, zero*/
|
||||
addbyte(0x41); /*CMOVS EDX, R10(alookup[0](zero))*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x48);
|
||||
addbyte(0x14);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&zero);
|
||||
addbyte(0x12);
|
||||
addbyte(0x3b); /*CMP EDX, params->tex_h_mask[ESI]*/
|
||||
addbyte(0x96);
|
||||
addlong(offsetof(voodoo_params_t, tex_h_mask[tmu]));
|
||||
@@ -348,11 +355,10 @@ static inline int codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, v
|
||||
addlong(offsetof(voodoo_params_t, tex_h_mask[tmu]));
|
||||
addbyte(0x85); /*TEST EBX,EBX*/
|
||||
addbyte(0xdb);
|
||||
addbyte(0x0f); /*CMOVS EBX, zero*/
|
||||
addbyte(0x41); /*CMOVS EBX, R10(alookup[0](zero))*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x48);
|
||||
addbyte(0x1c);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&zero);
|
||||
addbyte(0x1a);
|
||||
addbyte(0x3b); /*CMP EBX, params->tex_h_mask[ESI]*/
|
||||
addbyte(0x9e);
|
||||
addlong(offsetof(voodoo_params_t, tex_h_mask[tmu]));
|
||||
@@ -395,11 +401,10 @@ static inline int codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, v
|
||||
addbyte(0x8b); /*MOV ebp_store2, RSI*/
|
||||
addbyte(0xb7);
|
||||
addlong(offsetof(voodoo_state_t, ebp_store));
|
||||
addbyte(0x0f); /*CMOVS EAX, zero*/
|
||||
addbyte(0x41); /*CMOVS EAX, R10(alookup[0](zero))*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x48);
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&zero);
|
||||
addbyte(0x02);
|
||||
addbyte(0x78); /*JS + - clamp on 0*/
|
||||
addbyte(2+3+2+ 5+5+2);
|
||||
addbyte(0x3b); /*CMP EAX, EBP*/
|
||||
@@ -610,11 +615,10 @@ static inline int codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, v
|
||||
{
|
||||
addbyte(0x85); /*TEST EAX, EAX*/
|
||||
addbyte(0xc0);
|
||||
addbyte(0x0f); /*CMOVS EAX, zero*/
|
||||
addbyte(0x41); /*CMOVS EAX, R10(alookup[0](zero))*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x48);
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&zero);
|
||||
addbyte(0x02);
|
||||
addbyte(0x3b); /*CMP EAX, params->tex_w_mask[ESI+ECX*4]*/
|
||||
addbyte(0x84);
|
||||
addbyte(0x8e);
|
||||
@@ -637,11 +641,10 @@ static inline int codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, v
|
||||
{
|
||||
addbyte(0x85); /*TEST EBX, EBX*/
|
||||
addbyte(0xdb);
|
||||
addbyte(0x0f); /*CMOVS EBX, zero*/
|
||||
addbyte(0x41); /*CMOVS EBX, R10(alookup[0](zero))*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x48);
|
||||
addbyte(0x1c);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&zero);
|
||||
addbyte(0x1a);
|
||||
addbyte(0x3b); /*CMP EBX, params->tex_h_mask[ESI+ECX*4]*/
|
||||
addbyte(0x9c);
|
||||
addbyte(0x8e);
|
||||
@@ -707,11 +710,48 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0x57); /*PUSH RDI*/
|
||||
addbyte(0x56); /*PUSH RSI*/
|
||||
addbyte(0x53); /*PUSH RBX*/
|
||||
addbyte(0x41); /*PUSH R12*/
|
||||
addbyte(0x54);
|
||||
addbyte(0x41); /*PUSH R13*/
|
||||
addbyte(0x55);
|
||||
addbyte(0x41); /*PUSH R14*/
|
||||
addbyte(0x56);
|
||||
addbyte(0x41); /*PUSH R15*/
|
||||
addbyte(0x57);
|
||||
|
||||
addbyte(0x49); /*MOV R15, xmm_01_w*/
|
||||
addbyte(0xbf);
|
||||
addquad((uint64_t)(uintptr_t)&xmm_01_w);
|
||||
addbyte(0x66); /*MOVDQA XMM8, [R15]*/
|
||||
addbyte(0x45);
|
||||
addbyte(0x0f);
|
||||
addbyte(0x6f);
|
||||
addbyte(0x07 | (0 << 3));
|
||||
addbyte(0x49); /*MOV R15, xmm_ff_w*/
|
||||
addbyte(0xbf);
|
||||
addquad((uint64_t)(uintptr_t)&xmm_ff_w);
|
||||
addbyte(0x66); /*MOVDQA XMM9, [R15]*/
|
||||
addbyte(0x45);
|
||||
addbyte(0x0f);
|
||||
addbyte(0x6f);
|
||||
addbyte(0x07 | (1 << 3));
|
||||
addbyte(0x49); /*MOV R15, xmm_ff_b*/
|
||||
addbyte(0xbf);
|
||||
addquad((uint64_t)(uintptr_t)&xmm_ff_b);
|
||||
addbyte(0x66); /*MOVDQA XMM10, [R15]*/
|
||||
addbyte(0x45);
|
||||
addbyte(0x0f);
|
||||
addbyte(0x6f);
|
||||
addbyte(0x07 | (2 << 3));
|
||||
addbyte(0x49); /*MOV R15, minus_254*/
|
||||
addbyte(0xbf);
|
||||
addquad((uint64_t)(uintptr_t)&minus_254);
|
||||
addbyte(0x66); /*MOVDQA XMM11, [R15]*/
|
||||
addbyte(0x45);
|
||||
addbyte(0x0f);
|
||||
addbyte(0x6f);
|
||||
addbyte(0x07 | (3 << 3));
|
||||
|
||||
#if WIN64
|
||||
addbyte(0x48); /*MOV RDI, RCX (voodoo_state)*/
|
||||
addbyte(0x89);
|
||||
@@ -723,17 +763,56 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0x89);
|
||||
addbyte(0xce);
|
||||
#else
|
||||
addbyte(0x49); /*MOV R9, RCX (real_y)*/
|
||||
addbyte(0x49); /*MOV R14, RCX (real_y)*/
|
||||
addbyte(0x89);
|
||||
addbyte(0xc9);
|
||||
addbyte(0xce);
|
||||
addbyte(0x49); /*MOV R15, RSI (voodoo_state)*/
|
||||
addbyte(0x89);
|
||||
addbyte(0xf7);
|
||||
#endif
|
||||
|
||||
addbyte(0x49); /*MOV R9, logtable*/
|
||||
addbyte(0xb8 | (9 & 7));
|
||||
addquad((uint64_t)(uintptr_t)&logtable);
|
||||
addbyte(0x49); /*MOV R10, alookup*/
|
||||
addbyte(0xb8 | (10 & 7));
|
||||
addquad((uint64_t)(uintptr_t)&alookup);
|
||||
addbyte(0x49); /*MOV R11, aminuslookup*/
|
||||
addbyte(0xb8 | (11 & 7));
|
||||
addquad((uint64_t)(uintptr_t)&aminuslookup);
|
||||
addbyte(0x49); /*MOV R12, xmm_00_ff_w*/
|
||||
addbyte(0xb8 | (12 & 7));
|
||||
addquad((uint64_t)(uintptr_t)&xmm_00_ff_w);
|
||||
addbyte(0x49); /*MOV R13, i_00_ff_w*/
|
||||
addbyte(0xb8 | (13 & 7));
|
||||
addquad((uint64_t)(uintptr_t)&i_00_ff_w);
|
||||
|
||||
loop_jump_pos = block_pos;
|
||||
addbyte(0x4c); /*MOV RSI, R15*/
|
||||
addbyte(0x89);
|
||||
addbyte(0xfe);
|
||||
if (params->col_tiled || params->aux_tiled)
|
||||
{
|
||||
addbyte(0x8b); /*MOV EAX, state->x[EDI]*/
|
||||
addbyte(0x87);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
addbyte(0x89); /*MOV EBX, EAX*/
|
||||
addbyte(0xc3);
|
||||
addbyte(0x83); /*AND EAX, 63*/
|
||||
addbyte(0xe0);
|
||||
addbyte(63);
|
||||
addbyte(0xc1); /*SHR EBX, 6*/
|
||||
addbyte(0xeb);
|
||||
addbyte(6);
|
||||
addbyte(0xc1); /*SHL EBX, 11 - tile is 128*32, << 12, div 2 because word index*/
|
||||
addbyte(0xe3);
|
||||
addbyte(11);
|
||||
addbyte(0x01); /*ADD EAX, EBX*/
|
||||
addbyte(0xd8);
|
||||
addbyte(0x89); /*MOV state->x_tiled[EDI], EAX*/
|
||||
addbyte(0x87);
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
}
|
||||
addbyte(0x66); /*PXOR XMM2, XMM2*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
@@ -851,7 +930,10 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
{
|
||||
addbyte(0x8b); /*MOV EBX, state->x[EDI]*/
|
||||
addbyte(0x9f);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
if (params->aux_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
addbyte(0x48); /*MOV RCX, aux_mem[RDI]*/
|
||||
addbyte(0x8b);
|
||||
addbyte(0x8f);
|
||||
@@ -1075,27 +1157,26 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
}
|
||||
if (params->textureMode[1] & TEXTUREMODE_TRILINEAR)
|
||||
{
|
||||
addbyte(0x66); /*PXOR XMM0, xmm_00_ff_w[EBX]*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
addbyte(0x83);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_00_ff_w[0]);
|
||||
}
|
||||
else if (!tc_reverse_blend_1)
|
||||
{
|
||||
addbyte(0x66); /*PXOR XMM0, xmm_ff_w*/
|
||||
addbyte(0x66); /*PXOR XMM0, R12(xmm_00_ff_w)[EBX]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_ff_w);
|
||||
addbyte(0x1c);
|
||||
}
|
||||
addbyte(0x66); /*PADDW XMM0, xmm_01_w*/
|
||||
else if (!tc_reverse_blend_1)
|
||||
{
|
||||
addbyte(0x66); /*PXOR XMM0, XMM9(xmm_ff_w)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
addbyte(0xc1);
|
||||
}
|
||||
addbyte(0x66); /*PADDW XMM0, XMM8(xmm_01_w)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_01_w);
|
||||
addbyte(0xc0);
|
||||
addbyte(0xf3); /*MOVQ XMM1, XMM2*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
@@ -1213,10 +1294,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
}
|
||||
if (params->textureMode[1] & TEXTUREMODE_TRILINEAR)
|
||||
{
|
||||
addbyte(0x33); /*XOR EAX, i_00_ff_w[ECX*4]*/
|
||||
addbyte(0x04);
|
||||
addbyte(0x41); /*XOR EAX, R13(i_00_ff_w)[ECX*4]*/
|
||||
addbyte(0x33);
|
||||
addbyte(0x44);
|
||||
addbyte(0x8d);
|
||||
addlong((uint32_t)(uintptr_t)i_00_ff_w);
|
||||
addbyte(0);
|
||||
}
|
||||
else if (!tc_reverse_blend_1)
|
||||
{
|
||||
@@ -1399,27 +1481,26 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
}
|
||||
if (params->textureMode[0] & TEXTUREMODE_TRILINEAR)
|
||||
{
|
||||
addbyte(0x66); /*PXOR XMM4, xmm_00_ff_w[EBX]*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
addbyte(0xa3);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_00_ff_w[0]);
|
||||
}
|
||||
else if (!tc_reverse_blend)
|
||||
{
|
||||
addbyte(0x66); /*PXOR XMM4, FF*/
|
||||
addbyte(0x66); /*PXOR XMM4, R12(xmm_00_ff_w)[EBX]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
addbyte(0x24);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_ff_w);
|
||||
addbyte(0x1c);
|
||||
}
|
||||
addbyte(0x66); /*PADDW XMM4, 1*/
|
||||
else if (!tc_reverse_blend)
|
||||
{
|
||||
addbyte(0x66); /*PXOR XMM4, XMM9(xmm_ff_w)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
addbyte(0xe1);
|
||||
}
|
||||
addbyte(0x66); /*PADDW XMM4, XMM8(xmm_01_w)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x24);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_01_w);
|
||||
addbyte(0xe0);
|
||||
addbyte(0xf3); /*MOVQ XMM5, XMM1*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
@@ -1483,11 +1564,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
}
|
||||
if (tc_invert_output)
|
||||
{
|
||||
addbyte(0x66); /*PXOR XMM1, FF*/
|
||||
addbyte(0x66); /*PXOR XMM1, XMM9(xmm_ff_w)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
addbyte(0x0d);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_ff_w);
|
||||
addbyte(0xc9);
|
||||
}
|
||||
|
||||
addbyte(0x66); /*PACKUSWB XMM0, XMM0*/
|
||||
@@ -1581,10 +1662,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
}
|
||||
if (params->textureMode[0] & TEXTUREMODE_TRILINEAR)
|
||||
{
|
||||
addbyte(0x33); /*XOR EBX, i_00_ff_w[ECX*4]*/
|
||||
addbyte(0x1c);
|
||||
addbyte(0x41); /*XOR EBX, R13(i_00_ff_w)[ECX*4]*/
|
||||
addbyte(0x33);
|
||||
addbyte(0x5c);
|
||||
addbyte(0x8d);
|
||||
addlong((uint32_t)(uintptr_t)i_00_ff_w);
|
||||
addbyte(0);
|
||||
}
|
||||
else if (!tca_reverse_blend)
|
||||
{
|
||||
@@ -2131,19 +2213,17 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0xe0);
|
||||
if (!cc_reverse_blend)
|
||||
{
|
||||
addbyte(0x66); /*PXOR XMM3, 0xff*/
|
||||
addbyte(0x66); /*PXOR XMM3, XMM9(xmm_ff_w)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
addbyte(0x1c);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_ff_w);
|
||||
addbyte(0xd9);
|
||||
}
|
||||
addbyte(0x66); /*PADDW XMM3, 1*/
|
||||
addbyte(0x66); /*PADDW XMM3, XMM8(xmm_01_w)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x1c);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_01_w);
|
||||
addbyte(0xd8);
|
||||
addbyte(0x66); /*PMULLW XMM0, XMM3*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0xd5);
|
||||
@@ -2182,12 +2262,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
|
||||
if (cc_invert_output)
|
||||
{
|
||||
addbyte(0x66); /*PXOR XMM0, 0xff*/
|
||||
addbyte(0x66); /*PXOR XMM0, XMM10(xmm_ff_b)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_ff_b);
|
||||
addbyte(0xc2);
|
||||
}
|
||||
|
||||
if (params->fogMode & FOG_ENABLE)
|
||||
@@ -2344,11 +2423,12 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0xc0);
|
||||
|
||||
addbyte(0x66); /*PMULLW XMM3, alookup+4[EAX*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xd5);
|
||||
addbyte(0x1c);
|
||||
addbyte(0xc5);
|
||||
addlong(((uintptr_t)alookup) + 16);
|
||||
addbyte(0x5c);
|
||||
addbyte(0xc2);
|
||||
addbyte(16);
|
||||
addbyte(0x66); /*PSRAW XMM3, 7*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2437,7 +2517,10 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addquad((uintptr_t)rgb565);
|
||||
addbyte(0x8b); /*MOV EAX, state->x[EDI]*/
|
||||
addbyte(0x87);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
if (params->col_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
addbyte(0x48); /*MOV RBP, fb_mem*/
|
||||
addbyte(0x8b);
|
||||
addbyte(0xaf);
|
||||
@@ -2477,22 +2560,22 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0xe4);
|
||||
break;
|
||||
case AFUNC_ASRC_ALPHA:
|
||||
addbyte(0x66); /*PMULLW XMM4, alookup[EDX*8]*/
|
||||
addbyte(0x66); /*PMULLW XMM4, R10(alookup)[EDX*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xd5);
|
||||
addbyte(0x24);
|
||||
addbyte(0xd5);
|
||||
addlong((uint32_t)(uintptr_t)alookup);
|
||||
addbyte(0xd2);
|
||||
addbyte(0xf3); /*MOVQ XMM5, XMM4*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
addbyte(0xec);
|
||||
addbyte(0x66); /*PADDW XMM4, alookup[1*8]*/
|
||||
addbyte(0x66); /*PADDW XMM4, R10(alookup)[1*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x24);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)alookup + 16);
|
||||
addbyte(0x62);
|
||||
addbyte(8*2);
|
||||
addbyte(0x66); /*PSRLW XMM5, 8*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2517,12 +2600,12 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
addbyte(0xec);
|
||||
addbyte(0x66); /*PADDW XMM4, alookup[1*8]*/
|
||||
addbyte(0x66); /*PADDW XMM4, R10(alookup)[1*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x24);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)alookup + 16);
|
||||
addbyte(0x62);
|
||||
addbyte(8*2);
|
||||
addbyte(0x66); /*PSRLW XMM5, 8*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2543,22 +2626,22 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
case AFUNC_AONE:
|
||||
break;
|
||||
case AFUNC_AOMSRC_ALPHA:
|
||||
addbyte(0x66); /*PMULLW XMM4, aminuslookup[EDX*8]*/
|
||||
addbyte(0x66); /*PMULLW XMM4, R11(aminuslookup)[EDX*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xd5);
|
||||
addbyte(0x24);
|
||||
addbyte(0xd5);
|
||||
addlong((uint32_t)(uintptr_t)aminuslookup);
|
||||
addbyte(0xd3);
|
||||
addbyte(0xf3); /*MOVQ XMM5, XMM4*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
addbyte(0xec);
|
||||
addbyte(0x66); /*PADDW XMM4, alookup[1*8]*/
|
||||
addbyte(0x66); /*PADDW XMM4, R10(alookup)[1*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x24);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)alookup + 16);
|
||||
addbyte(0x62);
|
||||
addbyte(8*2);
|
||||
addbyte(0x66); /*PSRLW XMM5, 8*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2575,12 +2658,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(8);
|
||||
break;
|
||||
case AFUNC_AOM_COLOR:
|
||||
addbyte(0xf3); /*MOVQ XMM5, xmm_ff_w*/
|
||||
addbyte(0xf3); /*MOVQ XMM5, XMM9(xmm_ff_w)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
addbyte(0x2c);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_ff_w);
|
||||
addbyte(0xe9);
|
||||
addbyte(0x66); /*PSUBW XMM5, XMM0*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0xf9);
|
||||
@@ -2594,11 +2676,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0x7e);
|
||||
addbyte(0xec);
|
||||
addbyte(0x66); /*PADDW XMM4, alookup[1*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x24);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)alookup + 16);
|
||||
addbyte(0x62);
|
||||
addbyte(8*2);
|
||||
addbyte(0x66); /*PSRLW XMM5, 8*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2621,22 +2703,21 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0xe4);
|
||||
break;
|
||||
case AFUNC_ASATURATE:
|
||||
addbyte(0x66); /*PMULLW XMM4, minus_254*/
|
||||
addbyte(0x66); /*PMULLW XMM4, XMM11(minus_254)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xd5);
|
||||
addbyte(0x24);
|
||||
addbyte(0xd5);
|
||||
addlong((uint32_t)(uintptr_t)&minus_254);
|
||||
addbyte(0xe3);
|
||||
addbyte(0xf3); /*MOVQ XMM5, XMM4*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
addbyte(0xec);
|
||||
addbyte(0x66); /*PADDW XMM4, alookup[1*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x24);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)alookup + 16);
|
||||
addbyte(0x62);
|
||||
addbyte(8*2);
|
||||
addbyte(0x66); /*PSRLW XMM5, 8*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2662,22 +2743,22 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0xc0);
|
||||
break;
|
||||
case AFUNC_ASRC_ALPHA:
|
||||
addbyte(0x66); /*PMULLW XMM0, alookup[EDX*8]*/
|
||||
addbyte(0x66); /*PMULLW XMM0, R10(alookup)[EDX*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xd5);
|
||||
addbyte(0x04);
|
||||
addbyte(0xd5);
|
||||
addlong((uint32_t)(uintptr_t)alookup);
|
||||
addbyte(0xd2);
|
||||
addbyte(0xf3); /*MOVQ XMM5, XMM0*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
addbyte(0xe8);
|
||||
addbyte(0x66); /*PADDW XMM0, alookup[1*8]*/
|
||||
addbyte(0x66); /*PADDW XMM0, R10(alookup)[1*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)alookup + 16);
|
||||
addbyte(0x42);
|
||||
addbyte(8*2);
|
||||
addbyte(0x66); /*PSRLW XMM5, 8*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2702,12 +2783,12 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
addbyte(0xe8);
|
||||
addbyte(0x66); /*PADDW XMM0, alookup[1*8]*/
|
||||
addbyte(0x66); /*PADDW XMM0, R10(alookup)[1*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)alookup + 16);
|
||||
addbyte(0x42);
|
||||
addbyte(8*2);
|
||||
addbyte(0x66); /*PSRLW XMM5, 8*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2728,22 +2809,22 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
case AFUNC_AONE:
|
||||
break;
|
||||
case AFUNC_AOMSRC_ALPHA:
|
||||
addbyte(0x66); /*PMULLW XMM0, aminuslookup[EDX*8]*/
|
||||
addbyte(0x66); /*PMULLW XMM0, R11(aminuslookup)[EDX*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xd5);
|
||||
addbyte(0x04);
|
||||
addbyte(0xd5);
|
||||
addlong((uint32_t)(uintptr_t)aminuslookup);
|
||||
addbyte(0xd3);
|
||||
addbyte(0xf3); /*MOVQ XMM5, XMM0*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
addbyte(0xe8);
|
||||
addbyte(0x66); /*PADDW XMM0, alookup[1*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)alookup + 16);
|
||||
addbyte(0x42);
|
||||
addbyte(8*2);
|
||||
addbyte(0x66); /*PSRLW XMM5, 8*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2760,12 +2841,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(8);
|
||||
break;
|
||||
case AFUNC_AOM_COLOR:
|
||||
addbyte(0xf3); /*MOVQ XMM5, xmm_ff_w*/
|
||||
addbyte(0xf3); /*MOVQ XMM5, XMM9(xmm_ff_w)*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
addbyte(0x2c);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)&xmm_ff_w);
|
||||
addbyte(0xe9);
|
||||
addbyte(0x66); /*PSUBW XMM5, XMM6*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0xf9);
|
||||
@@ -2779,11 +2859,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0x7e);
|
||||
addbyte(0xe8);
|
||||
addbyte(0x66); /*PADDW XMM0, alookup[1*8]*/
|
||||
addbyte(0x41);
|
||||
addbyte(0x0f);
|
||||
addbyte(0xfd);
|
||||
addbyte(0x04);
|
||||
addbyte(0x25);
|
||||
addlong((uint32_t)(uintptr_t)alookup + 16);
|
||||
addbyte(0x42);
|
||||
addbyte(8*2);
|
||||
addbyte(0x66); /*PSRLW XMM5, 8*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x71);
|
||||
@@ -2822,8 +2902,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
|
||||
addbyte(0x8b); /*MOV EDX, state->x[EDI]*/
|
||||
addbyte(0x97);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
|
||||
if (params->col_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
|
||||
addbyte(0x66); /*MOV EAX, XMM0*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
@@ -2889,7 +2972,10 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
}
|
||||
addbyte(0x8b); /*MOV EDX, state->x[EDI]*/
|
||||
addbyte(0x97);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
if (voodoo->col_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
addbyte(0x4c); /*ADD RSI, R8*/
|
||||
addbyte(0x01);
|
||||
addbyte(0xc6);
|
||||
@@ -2975,6 +3061,12 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
|
||||
if ((params->fbzMode & (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) == (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE))
|
||||
{
|
||||
addbyte(0x8b); /*MOV EDX, state->x[EDI]*/
|
||||
addbyte(0x97);
|
||||
if (params->aux_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
addbyte(0x66); /*MOV AX, new_depth*/
|
||||
addbyte(0x8b);
|
||||
addbyte(0x87);
|
||||
@@ -3234,6 +3326,10 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0x5f);
|
||||
addbyte(0x41); /*POP R14*/
|
||||
addbyte(0x5e);
|
||||
addbyte(0x41); /*POP R13*/
|
||||
addbyte(0x5d);
|
||||
addbyte(0x41); /*POP R12*/
|
||||
addbyte(0x5c);
|
||||
addbyte(0x5b); /*POP RBX*/
|
||||
addbyte(0x5e); /*POP RSI*/
|
||||
addbyte(0x5f); /*POP RDI*/
|
||||
@@ -3241,7 +3337,7 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
|
||||
addbyte(0xC3); /*RET*/
|
||||
}
|
||||
static int voodoo_recomp = 0;
|
||||
int voodoo_recomp = 0;
|
||||
static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int odd_even)
|
||||
{
|
||||
int c;
|
||||
@@ -3251,7 +3347,7 @@ static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params,
|
||||
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
data = &voodoo_x86_data[odd_even + c*2]; //&voodoo_x86_data[odd_even][b];
|
||||
data = &voodoo_x86_data[odd_even + c*4]; //&voodoo_x86_data[odd_even][b];
|
||||
|
||||
if (state->xdir == data->xdir &&
|
||||
params->alphaMode == data->alphaMode &&
|
||||
@@ -3262,7 +3358,8 @@ static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params,
|
||||
params->textureMode[0] == data->textureMode[0] &&
|
||||
params->textureMode[1] == data->textureMode[1] &&
|
||||
(params->tLOD[0] & LOD_MASK) == data->tLOD[0] &&
|
||||
(params->tLOD[1] & LOD_MASK) == data->tLOD[1])
|
||||
(params->tLOD[1] & LOD_MASK) == data->tLOD[1] &&
|
||||
((params->col_tiled || params->aux_tiled) ? 1 : 0) == data->is_tiled)
|
||||
{
|
||||
last_block[odd_even] = b;
|
||||
return data->code_block;
|
||||
@@ -3271,7 +3368,7 @@ static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params,
|
||||
b = (b + 1) & 7;
|
||||
}
|
||||
voodoo_recomp++;
|
||||
data = &voodoo_x86_data[odd_even + next_block_to_write[odd_even]*2];
|
||||
data = &voodoo_x86_data[odd_even + next_block_to_write[odd_even]*4];
|
||||
// code_block = data->code_block;
|
||||
|
||||
voodoo_generate(data->code_block, voodoo, params, state, depth_op);
|
||||
@@ -3286,36 +3383,21 @@ voodoo_recomp++;
|
||||
data->textureMode[1] = params->textureMode[1];
|
||||
data->tLOD[0] = params->tLOD[0] & LOD_MASK;
|
||||
data->tLOD[1] = params->tLOD[1] & LOD_MASK;
|
||||
data->is_tiled = (params->col_tiled || params->aux_tiled) ? 1 : 0;
|
||||
|
||||
next_block_to_write[odd_even] = (next_block_to_write[odd_even] + 1) & 7;
|
||||
|
||||
return data->code_block;
|
||||
}
|
||||
|
||||
static void voodoo_codegen_init(voodoo_t *voodoo)
|
||||
void voodoo_codegen_init(voodoo_t *voodoo)
|
||||
{
|
||||
int c;
|
||||
#ifdef __linux__
|
||||
void *start;
|
||||
size_t len;
|
||||
long pagesize = sysconf(_SC_PAGESIZE);
|
||||
long pagemask = ~(pagesize - 1);
|
||||
#endif
|
||||
|
||||
#if WIN64
|
||||
voodoo->codegen_data = VirtualAlloc(NULL, sizeof(voodoo_x86_data_t) * BLOCK_NUM * 2, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
voodoo->codegen_data = VirtualAlloc(NULL, sizeof(voodoo_x86_data_t) * BLOCK_NUM * 4, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#else
|
||||
voodoo->codegen_data = malloc(sizeof(voodoo_x86_data_t) * BLOCK_NUM * 2);
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
start = (void *)((long)voodoo->codegen_data & pagemask);
|
||||
len = ((sizeof(voodoo_x86_data_t) * BLOCK_NUM * 2) + pagesize) & pagemask;
|
||||
if (mprotect(start, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
|
||||
{
|
||||
perror("mprotect");
|
||||
exit(-1);
|
||||
}
|
||||
voodoo->codegen_data = mmap(0, sizeof(voodoo_x86_data_t) * BLOCK_NUM*4, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, 0, 0);
|
||||
#endif
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
@@ -3340,12 +3422,12 @@ static void voodoo_codegen_init(voodoo_t *voodoo)
|
||||
xmm_00_ff_w[1] = _mm_set_epi32(0, 0, 0xff | (0xff << 16), 0xff | (0xff << 16));
|
||||
}
|
||||
|
||||
static void voodoo_codegen_close(voodoo_t *voodoo)
|
||||
void voodoo_codegen_close(voodoo_t *voodoo)
|
||||
{
|
||||
#if WIN64
|
||||
VirtualFree(voodoo->codegen_data, 0, MEM_RELEASE);
|
||||
#else
|
||||
free(voodoo->codegen_data);
|
||||
munmap(voodoo->codegen_data, sizeof(voodoo_x86_data_t) * BLOCK_NUM*4);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -5,15 +5,16 @@
|
||||
fbzColorPath
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
# include <sys/mman.h>
|
||||
# include <unistd.h>
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||
# include <windows.h>
|
||||
#define BITMAP windows_BITMAP
|
||||
#include <windows.h>
|
||||
#undef BITMAP
|
||||
#endif
|
||||
|
||||
#include <intrin.h>
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#define BLOCK_NUM 8
|
||||
@@ -32,35 +33,43 @@ typedef struct voodoo_x86_data_t
|
||||
uint32_t fbzColorPath;
|
||||
uint32_t textureMode[2];
|
||||
uint32_t tLOD[2];
|
||||
uint32_t trexInit1;
|
||||
uint32_t trexInit1;
|
||||
int is_tiled;
|
||||
} voodoo_x86_data_t;
|
||||
|
||||
static int last_block[2] = {0, 0};
|
||||
static int next_block_to_write[2] = {0, 0};
|
||||
static int last_block[4] = {0, 0};
|
||||
static int next_block_to_write[4] = {0, 0};
|
||||
|
||||
#define addbyte(val) \
|
||||
if (block_pos < BLOCK_SIZE) \
|
||||
code_block[block_pos++] = val; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n")
|
||||
#define addbyte(val) \
|
||||
do { \
|
||||
code_block[block_pos++] = val; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n"); \
|
||||
} while (0)
|
||||
|
||||
#define addword(val) \
|
||||
*(uint16_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 2; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n")
|
||||
#define addword(val) \
|
||||
do { \
|
||||
*(uint16_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 2; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n"); \
|
||||
} while (0)
|
||||
|
||||
#define addlong(val) \
|
||||
*(uint32_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 4; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n")
|
||||
#define addlong(val) \
|
||||
do { \
|
||||
*(uint32_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 4; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n"); \
|
||||
} while (0)
|
||||
|
||||
#define addquad(val) \
|
||||
*(uint64_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 8; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n")
|
||||
#define addquad(val) \
|
||||
do { \
|
||||
*(uint64_t *)&code_block[block_pos] = val; \
|
||||
block_pos += 8; \
|
||||
if (block_pos >= BLOCK_SIZE) \
|
||||
fatal("Over!\n"); \
|
||||
} while (0)
|
||||
|
||||
|
||||
static __m128i xmm_01_w;// = 0x0001000100010001ull;
|
||||
@@ -694,6 +703,28 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
addbyte(0x74);
|
||||
addbyte(0x24);
|
||||
addbyte(8+16);
|
||||
if (params->col_tiled || params->aux_tiled)
|
||||
{
|
||||
addbyte(0x8b); /*MOV EAX, state->x[EDI]*/
|
||||
addbyte(0x87);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
addbyte(0x89); /*MOV EBX, EAX*/
|
||||
addbyte(0xc3);
|
||||
addbyte(0x83); /*AND EAX, 63*/
|
||||
addbyte(0xe0);
|
||||
addbyte(63);
|
||||
addbyte(0xc1); /*SHR EBX, 6*/
|
||||
addbyte(0xeb);
|
||||
addbyte(6);
|
||||
addbyte(0xc1); /*SHL EBX, 11 - tile is 128*32, << 12, div 2 because word index*/
|
||||
addbyte(0xe3);
|
||||
addbyte(11);
|
||||
addbyte(0x01); /*ADD EAX, EBX*/
|
||||
addbyte(0xd8);
|
||||
addbyte(0x89); /*MOV state->x_tiled[EDI], EAX*/
|
||||
addbyte(0x87);
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
}
|
||||
addbyte(0x66); /*PXOR XMM2, XMM2*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0xef);
|
||||
@@ -826,7 +857,10 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
{
|
||||
addbyte(0x8b); /*MOV EBX, state->x[EDI]*/
|
||||
addbyte(0x9f);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
if (voodoo->aux_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
addbyte(0x8b);/*MOV ECX, aux_mem[EDI]*/
|
||||
addbyte(0x8f);
|
||||
addlong(offsetof(voodoo_state_t, aux_mem));
|
||||
@@ -2436,7 +2470,10 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
{
|
||||
addbyte(0x8b); /*MOV EAX, state->x[EDI]*/
|
||||
addbyte(0x87);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
if (params->col_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
addbyte(0x8b); /*MOV EBP, fb_mem*/
|
||||
addbyte(0xaf);
|
||||
addlong(offsetof(voodoo_state_t, fb_mem));
|
||||
@@ -2815,8 +2852,11 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
|
||||
addbyte(0x8b); /*MOV EDX, state->x[EDI]*/
|
||||
addbyte(0x97);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
|
||||
if (params->col_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
|
||||
addbyte(0x66); /*MOV EAX, XMM0*/
|
||||
addbyte(0x0f);
|
||||
addbyte(0x7e);
|
||||
@@ -2884,7 +2924,10 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
}
|
||||
addbyte(0x8b); /*MOV EDX, state->x[EDI]*/
|
||||
addbyte(0x97);
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
if (params->col_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
if (dither2x2)
|
||||
{
|
||||
addbyte(0xc1); /*SHL ECX, 2*/
|
||||
@@ -2968,6 +3011,12 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
|
||||
if ((params->fbzMode & (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) == (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE))
|
||||
{
|
||||
addbyte(0x8b); /*MOV EDX, state->x[EDI]*/
|
||||
addbyte(0x97);
|
||||
if (params->aux_tiled)
|
||||
addlong(offsetof(voodoo_state_t, x_tiled));
|
||||
else
|
||||
addlong(offsetof(voodoo_state_t, x));
|
||||
addbyte(0x66); /*MOV AX, new_depth*/
|
||||
addbyte(0x8b);
|
||||
addbyte(0x87);
|
||||
@@ -3227,7 +3276,7 @@ static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo
|
||||
if (params->textureMode[1] & TEXTUREMODE_TRILINEAR)
|
||||
cs = cs;
|
||||
}
|
||||
static int voodoo_recomp = 0;
|
||||
int voodoo_recomp = 0;
|
||||
|
||||
static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int odd_even)
|
||||
{
|
||||
@@ -3238,7 +3287,7 @@ static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params,
|
||||
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
data = &codegen_data[odd_even + b*2];
|
||||
data = &codegen_data[odd_even + b*4];
|
||||
|
||||
if (state->xdir == data->xdir &&
|
||||
params->alphaMode == data->alphaMode &&
|
||||
@@ -3249,7 +3298,8 @@ static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params,
|
||||
params->textureMode[0] == data->textureMode[0] &&
|
||||
params->textureMode[1] == data->textureMode[1] &&
|
||||
(params->tLOD[0] & LOD_MASK) == data->tLOD[0] &&
|
||||
(params->tLOD[1] & LOD_MASK) == data->tLOD[1])
|
||||
(params->tLOD[1] & LOD_MASK) == data->tLOD[1] &&
|
||||
((params->col_tiled || params->aux_tiled) ? 1 : 0) == data->is_tiled)
|
||||
{
|
||||
last_block[odd_even] = b;
|
||||
return data->code_block;
|
||||
@@ -3258,7 +3308,7 @@ static inline void *voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params,
|
||||
b = (b + 1) & 7;
|
||||
}
|
||||
voodoo_recomp++;
|
||||
data = &codegen_data[odd_even + next_block_to_write[odd_even]*2];
|
||||
data = &codegen_data[odd_even + next_block_to_write[odd_even]*4];
|
||||
// code_block = data->code_block;
|
||||
|
||||
voodoo_generate(data->code_block, voodoo, params, state, depth_op);
|
||||
@@ -3273,16 +3323,17 @@ voodoo_recomp++;
|
||||
data->textureMode[1] = params->textureMode[1];
|
||||
data->tLOD[0] = params->tLOD[0] & LOD_MASK;
|
||||
data->tLOD[1] = params->tLOD[1] & LOD_MASK;
|
||||
data->is_tiled = (params->col_tiled || params->aux_tiled) ? 1 : 0;
|
||||
|
||||
next_block_to_write[odd_even] = (next_block_to_write[odd_even] + 1) & 7;
|
||||
|
||||
return data->code_block;
|
||||
}
|
||||
|
||||
static void voodoo_codegen_init(voodoo_t *voodoo)
|
||||
void voodoo_codegen_init(voodoo_t *voodoo)
|
||||
{
|
||||
int c;
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
void *start;
|
||||
size_t len;
|
||||
long pagesize = sysconf(_SC_PAGESIZE);
|
||||
@@ -3290,19 +3341,9 @@ static void voodoo_codegen_init(voodoo_t *voodoo)
|
||||
#endif
|
||||
|
||||
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||
voodoo->codegen_data = VirtualAlloc(NULL, sizeof(voodoo_x86_data_t) * BLOCK_NUM*2, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
voodoo->codegen_data = VirtualAlloc(NULL, sizeof(voodoo_x86_data_t) * BLOCK_NUM*4, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#else
|
||||
voodoo->codegen_data = malloc(sizeof(voodoo_x86_data_t) * BLOCK_NUM*2);
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
start = (void *)((long)voodoo->codegen_data & pagemask);
|
||||
len = ((sizeof(voodoo_x86_data_t) * BLOCK_NUM*2) + pagesize) & pagemask;
|
||||
if (mprotect(start, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0)
|
||||
{
|
||||
perror("mprotect");
|
||||
exit(-1);
|
||||
}
|
||||
voodoo->codegen_data = mmap(0, sizeof(voodoo_x86_data_t) * BLOCK_NUM*4, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, 0, 0);
|
||||
#endif
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
@@ -3327,11 +3368,11 @@ static void voodoo_codegen_init(voodoo_t *voodoo)
|
||||
xmm_00_ff_w[1] = _mm_set_epi32(0, 0, 0xff | (0xff << 16), 0xff | (0xff << 16));
|
||||
}
|
||||
|
||||
static void voodoo_codegen_close(voodoo_t *voodoo)
|
||||
void voodoo_codegen_close(voodoo_t *voodoo)
|
||||
{
|
||||
#if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||
VirtualFree(voodoo->codegen_data, 0, MEM_RELEASE);
|
||||
#else
|
||||
free(voodoo->codegen_data);
|
||||
munmap(voodoo->codegen_data, sizeof(voodoo_x86_data_t) * BLOCK_NUM*4);
|
||||
#endif
|
||||
}
|
||||
|
||||
516
src/include/86box/vid_voodoo_common.h
Normal file
516
src/include/86box/vid_voodoo_common.h
Normal file
@@ -0,0 +1,516 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Graphics, 2, Banshee, 3 emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
#ifdef CLAMP
|
||||
#undef CLAMP
|
||||
#endif
|
||||
|
||||
#define CLAMP(x) (((x) < 0) ? 0 : (((x) > 0xff) ? 0xff : (x)))
|
||||
#define CLAMP16(x) (((x) < 0) ? 0 : (((x) > 0xffff) ? 0xffff : (x)))
|
||||
|
||||
|
||||
#define LOD_MAX 8
|
||||
|
||||
#define TEX_DIRTY_SHIFT 10
|
||||
|
||||
#define TEX_CACHE_MAX 64
|
||||
|
||||
enum
|
||||
{
|
||||
VOODOO_1 = 0,
|
||||
VOODOO_SB50,
|
||||
VOODOO_2,
|
||||
VOODOO_BANSHEE,
|
||||
VOODOO_3
|
||||
};
|
||||
|
||||
typedef union int_float
|
||||
{
|
||||
uint32_t i;
|
||||
float f;
|
||||
} int_float;
|
||||
|
||||
typedef struct rgbvoodoo_t
|
||||
{
|
||||
uint8_t b, g, r;
|
||||
uint8_t pad;
|
||||
} rgbvoodoo_t;
|
||||
typedef struct rgba8_t
|
||||
{
|
||||
uint8_t b, g, r, a;
|
||||
} rgba8_t;
|
||||
|
||||
typedef union rgba_u
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t b, g, r, a;
|
||||
} rgba;
|
||||
uint32_t u;
|
||||
} rgba_u;
|
||||
|
||||
#define FIFO_SIZE 65536
|
||||
#define FIFO_MASK (FIFO_SIZE - 1)
|
||||
#define FIFO_ENTRY_SIZE (1 << 31)
|
||||
|
||||
#define FIFO_ENTRIES (voodoo->fifo_write_idx - voodoo->fifo_read_idx)
|
||||
#define FIFO_FULL ((voodoo->fifo_write_idx - voodoo->fifo_read_idx) >= FIFO_SIZE-4)
|
||||
#define FIFO_EMPTY (voodoo->fifo_read_idx == voodoo->fifo_write_idx)
|
||||
|
||||
#define FIFO_TYPE 0xff000000
|
||||
#define FIFO_ADDR 0x00ffffff
|
||||
|
||||
enum
|
||||
{
|
||||
FIFO_INVALID = (0x00 << 24),
|
||||
FIFO_WRITEL_REG = (0x01 << 24),
|
||||
FIFO_WRITEW_FB = (0x02 << 24),
|
||||
FIFO_WRITEL_FB = (0x03 << 24),
|
||||
FIFO_WRITEL_TEX = (0x04 << 24),
|
||||
FIFO_WRITEL_2DREG = (0x05 << 24)
|
||||
};
|
||||
|
||||
#define PARAM_SIZE 1024
|
||||
#define PARAM_MASK (PARAM_SIZE - 1)
|
||||
#define PARAM_ENTRY_SIZE (1 << 31)
|
||||
|
||||
#define PARAM_ENTRIES(x) (voodoo->params_write_idx - voodoo->params_read_idx[x])
|
||||
#define PARAM_FULL(x) ((voodoo->params_write_idx - voodoo->params_read_idx[x]) >= PARAM_SIZE)
|
||||
#define PARAM_EMPTY(x) (voodoo->params_read_idx[x] == voodoo->params_write_idx)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t addr_type;
|
||||
uint32_t val;
|
||||
} fifo_entry_t;
|
||||
|
||||
typedef struct voodoo_params_t
|
||||
{
|
||||
int command;
|
||||
|
||||
int32_t vertexAx, vertexAy, vertexBx, vertexBy, vertexCx, vertexCy;
|
||||
|
||||
uint32_t startR, startG, startB, startZ, startA;
|
||||
|
||||
int32_t dBdX, dGdX, dRdX, dAdX, dZdX;
|
||||
|
||||
int32_t dBdY, dGdY, dRdY, dAdY, dZdY;
|
||||
|
||||
int64_t startW, dWdX, dWdY;
|
||||
|
||||
struct
|
||||
{
|
||||
int64_t startS, startT, startW, p1;
|
||||
int64_t dSdX, dTdX, dWdX, p2;
|
||||
int64_t dSdY, dTdY, dWdY, p3;
|
||||
} tmu[2];
|
||||
|
||||
uint32_t color0, color1;
|
||||
|
||||
uint32_t fbzMode;
|
||||
uint32_t fbzColorPath;
|
||||
|
||||
uint32_t fogMode;
|
||||
rgbvoodoo_t fogColor;
|
||||
struct
|
||||
{
|
||||
uint8_t fog, dfog;
|
||||
} fogTable[64];
|
||||
|
||||
uint32_t alphaMode;
|
||||
|
||||
uint32_t zaColor;
|
||||
|
||||
int chromaKey_r, chromaKey_g, chromaKey_b;
|
||||
uint32_t chromaKey;
|
||||
|
||||
uint32_t textureMode[2];
|
||||
uint32_t tLOD[2];
|
||||
|
||||
uint32_t texBaseAddr[2], texBaseAddr1[2], texBaseAddr2[2], texBaseAddr38[2];
|
||||
|
||||
uint32_t tex_base[2][LOD_MAX+2];
|
||||
uint32_t tex_end[2][LOD_MAX+2];
|
||||
int tex_width[2];
|
||||
int tex_w_mask[2][LOD_MAX+2];
|
||||
int tex_w_nmask[2][LOD_MAX+2];
|
||||
int tex_h_mask[2][LOD_MAX+2];
|
||||
int tex_shift[2][LOD_MAX+2];
|
||||
int tex_lod[2][LOD_MAX+2];
|
||||
int tex_entry[2];
|
||||
int detail_max[2], detail_bias[2], detail_scale[2];
|
||||
|
||||
uint32_t draw_offset, aux_offset;
|
||||
|
||||
int tformat[2];
|
||||
|
||||
int clipLeft, clipRight, clipLowY, clipHighY;
|
||||
int clipLeft1, clipRight1, clipLowY1, clipHighY1;
|
||||
|
||||
int sign;
|
||||
|
||||
uint32_t front_offset;
|
||||
|
||||
uint32_t swapbufferCMD;
|
||||
|
||||
uint32_t stipple;
|
||||
|
||||
int col_tiled, aux_tiled;
|
||||
int row_width, aux_row_width;
|
||||
} voodoo_params_t;
|
||||
|
||||
typedef struct texture_t
|
||||
{
|
||||
uint32_t base;
|
||||
uint32_t tLOD;
|
||||
volatile int refcount, refcount_r[4];
|
||||
int is16;
|
||||
uint32_t palette_checksum;
|
||||
uint32_t addr_start[4], addr_end[4];
|
||||
uint32_t *data;
|
||||
} texture_t;
|
||||
|
||||
typedef struct vert_t
|
||||
{
|
||||
float sVx, sVy;
|
||||
float sRed, sGreen, sBlue, sAlpha;
|
||||
float sVz, sWb;
|
||||
float sW0, sS0, sT0;
|
||||
float sW1, sS1, sT1;
|
||||
} vert_t;
|
||||
|
||||
typedef struct clip_t
|
||||
{
|
||||
int x_min, x_max;
|
||||
int y_min, y_max;
|
||||
} clip_t;
|
||||
|
||||
typedef struct voodoo_t
|
||||
{
|
||||
mem_mapping_t mapping;
|
||||
|
||||
int pci_enable;
|
||||
|
||||
uint8_t dac_data[8];
|
||||
int dac_reg, dac_reg_ff;
|
||||
uint8_t dac_readdata;
|
||||
uint16_t dac_pll_regs[16];
|
||||
|
||||
float pixel_clock;
|
||||
uint64_t line_time;
|
||||
|
||||
voodoo_params_t params;
|
||||
|
||||
uint32_t fbiInit0, fbiInit1, fbiInit2, fbiInit3, fbiInit4;
|
||||
uint32_t fbiInit5, fbiInit6, fbiInit7; /*Voodoo 2*/
|
||||
|
||||
uint32_t initEnable;
|
||||
|
||||
uint32_t lfbMode;
|
||||
|
||||
uint32_t memBaseAddr;
|
||||
|
||||
int_float fvertexAx, fvertexAy, fvertexBx, fvertexBy, fvertexCx, fvertexCy;
|
||||
|
||||
uint32_t front_offset, back_offset;
|
||||
|
||||
uint32_t fb_read_offset, fb_write_offset;
|
||||
|
||||
int row_width, aux_row_width;
|
||||
int block_width;
|
||||
|
||||
int col_tiled, aux_tiled;
|
||||
|
||||
uint8_t *fb_mem, *tex_mem[2];
|
||||
uint16_t *tex_mem_w[2];
|
||||
|
||||
int rgb_sel;
|
||||
|
||||
uint32_t trexInit1[2];
|
||||
|
||||
uint32_t tmuConfig;
|
||||
|
||||
mutex_t *swap_mutex;
|
||||
int swap_count;
|
||||
|
||||
int disp_buffer, draw_buffer;
|
||||
pc_timer_t timer;
|
||||
|
||||
int line;
|
||||
svga_t *svga;
|
||||
|
||||
uint32_t backPorch;
|
||||
uint32_t videoDimensions;
|
||||
uint32_t hSync, vSync;
|
||||
|
||||
int h_total, v_total, v_disp;
|
||||
int h_disp;
|
||||
int v_retrace;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t y[4], i[4], q[4];
|
||||
} nccTable[2][2];
|
||||
|
||||
rgba_u palette[2][256];
|
||||
|
||||
rgba_u ncc_lookup[2][2][256];
|
||||
int ncc_dirty[2];
|
||||
|
||||
thread_t *fifo_thread;
|
||||
thread_t *render_thread[4];
|
||||
event_t *wake_fifo_thread;
|
||||
event_t *wake_main_thread;
|
||||
event_t *fifo_not_full_event;
|
||||
event_t *render_not_full_event[4];
|
||||
event_t *wake_render_thread[4];
|
||||
|
||||
int voodoo_busy;
|
||||
int render_voodoo_busy[4];
|
||||
|
||||
int render_threads;
|
||||
int odd_even_mask;
|
||||
|
||||
int pixel_count[4], texel_count[4], tri_count, frame_count;
|
||||
int pixel_count_old[4], texel_count_old[4];
|
||||
int wr_count, rd_count, tex_count;
|
||||
|
||||
int retrace_count;
|
||||
int swap_interval;
|
||||
uint32_t swap_offset;
|
||||
int swap_pending;
|
||||
|
||||
int bilinear_enabled;
|
||||
|
||||
int fb_size;
|
||||
uint32_t fb_mask;
|
||||
|
||||
int texture_size;
|
||||
uint32_t texture_mask;
|
||||
|
||||
int dual_tmus;
|
||||
int type;
|
||||
|
||||
fifo_entry_t fifo[FIFO_SIZE];
|
||||
volatile int fifo_read_idx, fifo_write_idx;
|
||||
volatile int cmd_read, cmd_written, cmd_written_fifo;
|
||||
|
||||
voodoo_params_t params_buffer[PARAM_SIZE];
|
||||
volatile int params_read_idx[4], params_write_idx;
|
||||
|
||||
uint32_t cmdfifo_base, cmdfifo_end, cmdfifo_size;
|
||||
int cmdfifo_rp;
|
||||
volatile int cmdfifo_depth_rd, cmdfifo_depth_wr;
|
||||
volatile int cmdfifo_enabled;
|
||||
uint32_t cmdfifo_amin, cmdfifo_amax;
|
||||
int cmdfifo_holecount;
|
||||
|
||||
uint32_t sSetupMode;
|
||||
vert_t verts[4];
|
||||
unsigned int vertex_ages[3];
|
||||
unsigned int vertex_next_age;
|
||||
int num_verticies;
|
||||
int cull_pingpong;
|
||||
|
||||
int flush;
|
||||
|
||||
int scrfilter;
|
||||
int scrfilterEnabled;
|
||||
int scrfilterThreshold;
|
||||
int scrfilterThresholdOld;
|
||||
|
||||
uint32_t last_write_addr;
|
||||
|
||||
uint32_t fbiPixelsIn;
|
||||
uint32_t fbiChromaFail;
|
||||
uint32_t fbiZFuncFail;
|
||||
uint32_t fbiAFuncFail;
|
||||
uint32_t fbiPixelsOut;
|
||||
|
||||
uint32_t bltSrcBaseAddr;
|
||||
uint32_t bltDstBaseAddr;
|
||||
int bltSrcXYStride, bltDstXYStride;
|
||||
uint32_t bltSrcChromaRange, bltDstChromaRange;
|
||||
int bltSrcChromaMinR, bltSrcChromaMinG, bltSrcChromaMinB;
|
||||
int bltSrcChromaMaxR, bltSrcChromaMaxG, bltSrcChromaMaxB;
|
||||
int bltDstChromaMinR, bltDstChromaMinG, bltDstChromaMinB;
|
||||
int bltDstChromaMaxR, bltDstChromaMaxG, bltDstChromaMaxB;
|
||||
|
||||
int bltClipRight, bltClipLeft;
|
||||
int bltClipHighY, bltClipLowY;
|
||||
|
||||
int bltSrcX, bltSrcY;
|
||||
int bltDstX, bltDstY;
|
||||
int bltSizeX, bltSizeY;
|
||||
int bltRop[4];
|
||||
uint16_t bltColorFg, bltColorBg;
|
||||
|
||||
uint32_t bltCommand;
|
||||
|
||||
uint32_t leftOverlayBuf;
|
||||
|
||||
struct
|
||||
{
|
||||
int dst_x, dst_y;
|
||||
int cur_x;
|
||||
int size_x, size_y;
|
||||
int x_dir, y_dir;
|
||||
int dst_stride;
|
||||
} blt;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t bresError0, bresError1;
|
||||
uint32_t clip0Min, clip0Max;
|
||||
uint32_t clip1Min, clip1Max;
|
||||
uint32_t colorBack, colorFore;
|
||||
uint32_t command, commandExtra;
|
||||
uint32_t dstBaseAddr;
|
||||
uint32_t dstFormat;
|
||||
uint32_t dstSize;
|
||||
uint32_t dstXY;
|
||||
uint32_t rop;
|
||||
uint32_t srcBaseAddr;
|
||||
uint32_t srcFormat;
|
||||
uint32_t srcSize;
|
||||
uint32_t srcXY;
|
||||
|
||||
uint32_t colorPattern[64];
|
||||
|
||||
int bres_error_0, bres_error_1;
|
||||
uint32_t colorPattern8[64], colorPattern16[64], colorPattern24[64];
|
||||
int cur_x, cur_y;
|
||||
uint32_t dstBaseAddr_tiled;
|
||||
uint32_t dstColorkeyMin, dstColorkeyMax;
|
||||
int dstSizeX, dstSizeY;
|
||||
int dstX, dstY;
|
||||
int dst_stride;
|
||||
int patoff_x, patoff_y;
|
||||
uint8_t rops[4];
|
||||
uint32_t srcBaseAddr_tiled;
|
||||
uint32_t srcColorkeyMin, srcColorkeyMax;
|
||||
int srcSizeX, srcSizeY;
|
||||
int srcX, srcY;
|
||||
int src_stride;
|
||||
int old_srcX;
|
||||
|
||||
/*Used for handling packed 24bpp host data*/
|
||||
int host_data_remainder;
|
||||
uint32_t old_host_data;
|
||||
|
||||
/*Polyfill coordinates*/
|
||||
int lx[2], rx[2];
|
||||
int ly[2], ry[2];
|
||||
|
||||
/*Polyfill state*/
|
||||
int error[2];
|
||||
int dx[2], dy[2];
|
||||
int x_inc[2]; /*y_inc is always 1 for polyfill*/
|
||||
int lx_cur, rx_cur;
|
||||
|
||||
clip_t clip[2];
|
||||
|
||||
uint8_t host_data[16384];
|
||||
int host_data_count;
|
||||
int host_data_size_src, host_data_size_dest;
|
||||
int src_stride_src, src_stride_dest;
|
||||
|
||||
int src_bpp;
|
||||
} banshee_blt;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t vidOverlayStartCoords;
|
||||
uint32_t vidOverlayEndScreenCoords;
|
||||
uint32_t vidOverlayDudx, vidOverlayDudxOffsetSrcWidth;
|
||||
uint32_t vidOverlayDvdy, vidOverlayDvdyOffset;
|
||||
//uint32_t vidDesktopOverlayStride;
|
||||
|
||||
int start_x, start_y;
|
||||
int end_x, end_y;
|
||||
int size_x, size_y;
|
||||
int overlay_bytes;
|
||||
|
||||
unsigned int src_y;
|
||||
} overlay;
|
||||
|
||||
rgbvoodoo_t clutData[33];
|
||||
int clutData_dirty;
|
||||
rgbvoodoo_t clutData256[256];
|
||||
uint32_t video_16to32[0x10000];
|
||||
|
||||
uint8_t dirty_line[2048];
|
||||
int dirty_line_low, dirty_line_high;
|
||||
|
||||
int fb_write_buffer, fb_draw_buffer;
|
||||
int buffer_cutoff;
|
||||
|
||||
uint32_t tile_base, tile_stride;
|
||||
int tile_stride_shift, tile_x, tile_x_real;
|
||||
|
||||
int read_time, write_time, burst_time;
|
||||
|
||||
pc_timer_t wake_timer;
|
||||
|
||||
/* screen filter tables */
|
||||
uint8_t thefilter[256][256];
|
||||
uint8_t thefilterg[256][256];
|
||||
uint8_t thefilterb[256][256];
|
||||
uint16_t purpleline[256][3];
|
||||
|
||||
texture_t texture_cache[2][TEX_CACHE_MAX];
|
||||
uint8_t texture_present[2][16384];
|
||||
int texture_last_removed;
|
||||
|
||||
uint32_t palette_checksum[2];
|
||||
int palette_dirty[2];
|
||||
|
||||
uint64_t time;
|
||||
int render_time[4];
|
||||
|
||||
int use_recompiler;
|
||||
void *codegen_data;
|
||||
|
||||
struct voodoo_set_t *set;
|
||||
|
||||
|
||||
uint8_t *vram, *changedvram;
|
||||
|
||||
void *p;
|
||||
} voodoo_t;
|
||||
|
||||
typedef struct voodoo_set_t
|
||||
{
|
||||
voodoo_t *voodoos[2];
|
||||
|
||||
mem_mapping_t snoop_mapping;
|
||||
|
||||
int nr_cards;
|
||||
} voodoo_set_t;
|
||||
|
||||
|
||||
extern rgba8_t rgb332[0x100], ai44[0x100], rgb565[0x10000], argb1555[0x10000], argb4444[0x10000], ai88[0x10000];
|
||||
|
||||
|
||||
void voodoo_generate_vb_filters(voodoo_t *voodoo, int fcr, int fcg);
|
||||
|
||||
void voodoo_recalc(voodoo_t *voodoo);
|
||||
void voodoo_update_ncc(voodoo_t *voodoo, int tmu);
|
||||
|
||||
void *voodoo_2d3d_card_init(int type);
|
||||
void voodoo_card_close(voodoo_t *voodoo);
|
||||
24
src/include/86box/vid_voodoo_display.h
Normal file
24
src/include/86box/vid_voodoo_display.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Graphics, 2, Banshee, 3 emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
void voodoo_update_ncc(voodoo_t *voodoo, int tmu);
|
||||
void voodoo_pixelclock_update(voodoo_t *voodoo);
|
||||
void voodoo_generate_filter_v1(voodoo_t *voodoo);
|
||||
void voodoo_generate_filter_v2(voodoo_t *voodoo);
|
||||
void voodoo_threshold_check(voodoo_t *voodoo);
|
||||
void voodoo_callback(void *p);
|
||||
@@ -1,4 +1,22 @@
|
||||
uint8_t dither_rb[256][4][4] =
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Graphics and 2 specific emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
static const uint8_t dither_rb[256][4][4] =
|
||||
{
|
||||
{
|
||||
{0, 0, 0, 0},
|
||||
@@ -1538,7 +1556,7 @@ uint8_t dither_rb[256][4][4] =
|
||||
},
|
||||
};
|
||||
|
||||
uint8_t dither_g[256][4][4] =
|
||||
static const uint8_t dither_g[256][4][4] =
|
||||
{
|
||||
{
|
||||
{0, 0, 0, 0},
|
||||
@@ -3078,7 +3096,7 @@ uint8_t dither_g[256][4][4] =
|
||||
},
|
||||
};
|
||||
|
||||
uint8_t dither_rb2x2[256][2][2] =
|
||||
static const uint8_t dither_rb2x2[256][2][2] =
|
||||
{
|
||||
{
|
||||
{0, 0},
|
||||
@@ -4106,7 +4124,7 @@ uint8_t dither_rb2x2[256][2][2] =
|
||||
},
|
||||
};
|
||||
|
||||
uint8_t dither_g2x2[256][2][2] =
|
||||
static const uint8_t dither_g2x2[256][2][2] =
|
||||
{
|
||||
{
|
||||
{0, 0},
|
||||
|
||||
22
src/include/86box/vid_voodoo_fb.h
Normal file
22
src/include/86box/vid_voodoo_fb.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Graphics, 2, Banshee, 3 emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
uint16_t voodoo_fb_readw(uint32_t addr, void *p);
|
||||
uint32_t voodoo_fb_readl(uint32_t addr, void *p);
|
||||
void voodoo_fb_writew(uint32_t addr, uint16_t val, void *p);
|
||||
void voodoo_fb_writel(uint32_t addr, uint32_t val, void *p);
|
||||
26
src/include/86box/vid_voodoo_fifo.h
Normal file
26
src/include/86box/vid_voodoo_fifo.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Graphics, 2, Banshee, 3 emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
void voodoo_wake_fifo_thread(voodoo_t *voodoo);
|
||||
void voodoo_wake_fifo_thread_now(voodoo_t *voodoo);
|
||||
void voodoo_wake_timer(void *p);
|
||||
void voodoo_queue_command(voodoo_t *voodoo, uint32_t addr_type, uint32_t val);
|
||||
void voodoo_flush(voodoo_t *voodoo);
|
||||
void voodoo_wake_fifo_threads(voodoo_set_t *set, voodoo_t *voodoo);
|
||||
void voodoo_wait_for_swap_complete(voodoo_t *voodoo);
|
||||
void voodoo_fifo_thread(void *param);
|
||||
19
src/include/86box/vid_voodoo_reg.h
Normal file
19
src/include/86box/vid_voodoo_reg.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Graphics, 2, Banshee, 3 emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
|
||||
void voodoo_reg_writel(uint32_t addr, uint32_t val, void *p);
|
||||
691
src/include/86box/vid_voodoo_regs.h
Normal file
691
src/include/86box/vid_voodoo_regs.h
Normal file
@@ -0,0 +1,691 @@
|
||||
enum
|
||||
{
|
||||
SST_status = 0x000,
|
||||
SST_intrCtrl = 0x004,
|
||||
|
||||
SST_vertexAx = 0x008,
|
||||
SST_vertexAy = 0x00c,
|
||||
SST_vertexBx = 0x010,
|
||||
SST_vertexBy = 0x014,
|
||||
SST_vertexCx = 0x018,
|
||||
SST_vertexCy = 0x01c,
|
||||
|
||||
SST_startR = 0x0020,
|
||||
SST_startG = 0x0024,
|
||||
SST_startB = 0x0028,
|
||||
SST_startZ = 0x002c,
|
||||
SST_startA = 0x0030,
|
||||
SST_startS = 0x0034,
|
||||
SST_startT = 0x0038,
|
||||
SST_startW = 0x003c,
|
||||
|
||||
SST_dRdX = 0x0040,
|
||||
SST_dGdX = 0x0044,
|
||||
SST_dBdX = 0x0048,
|
||||
SST_dZdX = 0x004c,
|
||||
SST_dAdX = 0x0050,
|
||||
SST_dSdX = 0x0054,
|
||||
SST_dTdX = 0x0058,
|
||||
SST_dWdX = 0x005c,
|
||||
|
||||
SST_dRdY = 0x0060,
|
||||
SST_dGdY = 0x0064,
|
||||
SST_dBdY = 0x0068,
|
||||
SST_dZdY = 0x006c,
|
||||
SST_dAdY = 0x0070,
|
||||
SST_dSdY = 0x0074,
|
||||
SST_dTdY = 0x0078,
|
||||
SST_dWdY = 0x007c,
|
||||
|
||||
SST_triangleCMD = 0x0080,
|
||||
|
||||
SST_fvertexAx = 0x088,
|
||||
SST_fvertexAy = 0x08c,
|
||||
SST_fvertexBx = 0x090,
|
||||
SST_fvertexBy = 0x094,
|
||||
SST_fvertexCx = 0x098,
|
||||
SST_fvertexCy = 0x09c,
|
||||
|
||||
SST_fstartR = 0x00a0,
|
||||
SST_fstartG = 0x00a4,
|
||||
SST_fstartB = 0x00a8,
|
||||
SST_fstartZ = 0x00ac,
|
||||
SST_fstartA = 0x00b0,
|
||||
SST_fstartS = 0x00b4,
|
||||
SST_fstartT = 0x00b8,
|
||||
SST_fstartW = 0x00bc,
|
||||
|
||||
SST_fdRdX = 0x00c0,
|
||||
SST_fdGdX = 0x00c4,
|
||||
SST_fdBdX = 0x00c8,
|
||||
SST_fdZdX = 0x00cc,
|
||||
SST_fdAdX = 0x00d0,
|
||||
SST_fdSdX = 0x00d4,
|
||||
SST_fdTdX = 0x00d8,
|
||||
SST_fdWdX = 0x00dc,
|
||||
|
||||
SST_fdRdY = 0x00e0,
|
||||
SST_fdGdY = 0x00e4,
|
||||
SST_fdBdY = 0x00e8,
|
||||
SST_fdZdY = 0x00ec,
|
||||
SST_fdAdY = 0x00f0,
|
||||
SST_fdSdY = 0x00f4,
|
||||
SST_fdTdY = 0x00f8,
|
||||
SST_fdWdY = 0x00fc,
|
||||
|
||||
SST_ftriangleCMD = 0x0100,
|
||||
|
||||
SST_fbzColorPath = 0x104,
|
||||
SST_fogMode = 0x108,
|
||||
|
||||
SST_alphaMode = 0x10c,
|
||||
SST_fbzMode = 0x110,
|
||||
SST_lfbMode = 0x114,
|
||||
|
||||
SST_clipLeftRight = 0x118,
|
||||
SST_clipLowYHighY = 0x11c,
|
||||
|
||||
SST_nopCMD = 0x120,
|
||||
SST_fastfillCMD = 0x124,
|
||||
SST_swapbufferCMD = 0x128,
|
||||
|
||||
SST_fogColor = 0x12c,
|
||||
SST_zaColor = 0x130,
|
||||
SST_chromaKey = 0x134,
|
||||
|
||||
SST_userIntrCMD = 0x13c,
|
||||
SST_stipple = 0x140,
|
||||
SST_color0 = 0x144,
|
||||
SST_color1 = 0x148,
|
||||
|
||||
SST_fbiPixelsIn = 0x14c,
|
||||
SST_fbiChromaFail = 0x150,
|
||||
SST_fbiZFuncFail = 0x154,
|
||||
SST_fbiAFuncFail = 0x158,
|
||||
SST_fbiPixelsOut = 0x15c,
|
||||
|
||||
SST_fogTable00 = 0x160,
|
||||
SST_fogTable01 = 0x164,
|
||||
SST_fogTable02 = 0x168,
|
||||
SST_fogTable03 = 0x16c,
|
||||
SST_fogTable04 = 0x170,
|
||||
SST_fogTable05 = 0x174,
|
||||
SST_fogTable06 = 0x178,
|
||||
SST_fogTable07 = 0x17c,
|
||||
SST_fogTable08 = 0x180,
|
||||
SST_fogTable09 = 0x184,
|
||||
SST_fogTable0a = 0x188,
|
||||
SST_fogTable0b = 0x18c,
|
||||
SST_fogTable0c = 0x190,
|
||||
SST_fogTable0d = 0x194,
|
||||
SST_fogTable0e = 0x198,
|
||||
SST_fogTable0f = 0x19c,
|
||||
SST_fogTable10 = 0x1a0,
|
||||
SST_fogTable11 = 0x1a4,
|
||||
SST_fogTable12 = 0x1a8,
|
||||
SST_fogTable13 = 0x1ac,
|
||||
SST_fogTable14 = 0x1b0,
|
||||
SST_fogTable15 = 0x1b4,
|
||||
SST_fogTable16 = 0x1b8,
|
||||
SST_fogTable17 = 0x1bc,
|
||||
SST_fogTable18 = 0x1c0,
|
||||
SST_fogTable19 = 0x1c4,
|
||||
SST_fogTable1a = 0x1c8,
|
||||
SST_fogTable1b = 0x1cc,
|
||||
SST_fogTable1c = 0x1d0,
|
||||
SST_fogTable1d = 0x1d4,
|
||||
SST_fogTable1e = 0x1d8,
|
||||
SST_fogTable1f = 0x1dc,
|
||||
|
||||
SST_cmdFifoBaseAddr = 0x1e0,
|
||||
SST_cmdFifoBump = 0x1e4,
|
||||
SST_cmdFifoRdPtr = 0x1e8,
|
||||
SST_cmdFifoAMin = 0x1ec,
|
||||
SST_cmdFifoAMax = 0x1f0,
|
||||
SST_cmdFifoDepth = 0x1f4,
|
||||
SST_cmdFifoHoles = 0x1f8,
|
||||
|
||||
SST_colBufferAddr = 0x1ec, /*Banshee*/
|
||||
SST_colBufferStride = 0x1f0, /*Banshee*/
|
||||
SST_auxBufferAddr = 0x1f4, /*Banshee*/
|
||||
SST_auxBufferStride = 0x1f8, /*Banshee*/
|
||||
|
||||
SST_clipLeftRight1 = 0x200, /*Banshee*/
|
||||
SST_clipTopBottom1 = 0x204, /*Banshee*/
|
||||
|
||||
SST_fbiInit4 = 0x200,
|
||||
SST_vRetrace = 0x204,
|
||||
SST_backPorch = 0x208,
|
||||
SST_videoDimensions = 0x20c,
|
||||
SST_fbiInit0 = 0x210,
|
||||
SST_fbiInit1 = 0x214,
|
||||
SST_fbiInit2 = 0x218,
|
||||
SST_fbiInit3 = 0x21c,
|
||||
SST_hSync = 0x220,
|
||||
SST_vSync = 0x224,
|
||||
SST_clutData = 0x228,
|
||||
SST_dacData = 0x22c,
|
||||
|
||||
SST_scrFilter = 0x230,
|
||||
|
||||
SST_hvRetrace = 0x240,
|
||||
SST_fbiInit5 = 0x244,
|
||||
SST_fbiInit6 = 0x248,
|
||||
SST_fbiInit7 = 0x24c,
|
||||
|
||||
SST_swapPending = 0x24c, /*Banshee*/
|
||||
SST_leftOverlayBuf = 0x250, /*Banshee*/
|
||||
|
||||
SST_sSetupMode = 0x260,
|
||||
SST_sVx = 0x264,
|
||||
SST_sVy = 0x268,
|
||||
SST_sARGB = 0x26c,
|
||||
SST_sRed = 0x270,
|
||||
SST_sGreen = 0x274,
|
||||
SST_sBlue = 0x278,
|
||||
SST_sAlpha = 0x27c,
|
||||
SST_sVz = 0x280,
|
||||
SST_sWb = 0x284,
|
||||
SST_sW0 = 0x288,
|
||||
SST_sS0 = 0x28c,
|
||||
SST_sT0 = 0x290,
|
||||
SST_sW1 = 0x294,
|
||||
SST_sS1 = 0x298,
|
||||
SST_sT1 = 0x29c,
|
||||
|
||||
SST_sDrawTriCMD = 0x2a0,
|
||||
SST_sBeginTriCMD = 0x2a4,
|
||||
|
||||
SST_bltSrcBaseAddr = 0x2c0,
|
||||
SST_bltDstBaseAddr = 0x2c4,
|
||||
SST_bltXYStrides = 0x2c8,
|
||||
SST_bltSrcChromaRange = 0x2cc,
|
||||
SST_bltDstChromaRange = 0x2d0,
|
||||
SST_bltClipX = 0x2d4,
|
||||
SST_bltClipY = 0x2d8,
|
||||
|
||||
SST_bltSrcXY = 0x2e0,
|
||||
SST_bltDstXY = 0x2e4,
|
||||
SST_bltSize = 0x2e8,
|
||||
SST_bltRop = 0x2ec,
|
||||
SST_bltColor = 0x2f0,
|
||||
|
||||
SST_bltCommand = 0x2f8,
|
||||
SST_bltData = 0x2fc,
|
||||
|
||||
SST_textureMode = 0x300,
|
||||
SST_tLOD = 0x304,
|
||||
SST_tDetail = 0x308,
|
||||
SST_texBaseAddr = 0x30c,
|
||||
SST_texBaseAddr1 = 0x310,
|
||||
SST_texBaseAddr2 = 0x314,
|
||||
SST_texBaseAddr38 = 0x318,
|
||||
|
||||
SST_trexInit1 = 0x320,
|
||||
|
||||
SST_nccTable0_Y0 = 0x324,
|
||||
SST_nccTable0_Y1 = 0x328,
|
||||
SST_nccTable0_Y2 = 0x32c,
|
||||
SST_nccTable0_Y3 = 0x330,
|
||||
SST_nccTable0_I0 = 0x334,
|
||||
SST_nccTable0_I1 = 0x338,
|
||||
SST_nccTable0_I2 = 0x33c,
|
||||
SST_nccTable0_I3 = 0x340,
|
||||
SST_nccTable0_Q0 = 0x344,
|
||||
SST_nccTable0_Q1 = 0x348,
|
||||
SST_nccTable0_Q2 = 0x34c,
|
||||
SST_nccTable0_Q3 = 0x350,
|
||||
|
||||
SST_nccTable1_Y0 = 0x354,
|
||||
SST_nccTable1_Y1 = 0x358,
|
||||
SST_nccTable1_Y2 = 0x35c,
|
||||
SST_nccTable1_Y3 = 0x360,
|
||||
SST_nccTable1_I0 = 0x364,
|
||||
SST_nccTable1_I1 = 0x368,
|
||||
SST_nccTable1_I2 = 0x36c,
|
||||
SST_nccTable1_I3 = 0x370,
|
||||
SST_nccTable1_Q0 = 0x374,
|
||||
SST_nccTable1_Q1 = 0x378,
|
||||
SST_nccTable1_Q2 = 0x37c,
|
||||
SST_nccTable1_Q3 = 0x380,
|
||||
|
||||
SST_remap_status = 0x000 | 0x400,
|
||||
|
||||
SST_remap_vertexAx = 0x008 | 0x400,
|
||||
SST_remap_vertexAy = 0x00c | 0x400,
|
||||
SST_remap_vertexBx = 0x010 | 0x400,
|
||||
SST_remap_vertexBy = 0x014 | 0x400,
|
||||
SST_remap_vertexCx = 0x018 | 0x400,
|
||||
SST_remap_vertexCy = 0x01c | 0x400,
|
||||
|
||||
SST_remap_startR = 0x0020 | 0x400,
|
||||
SST_remap_startG = 0x002c | 0x400,
|
||||
SST_remap_startB = 0x0038 | 0x400,
|
||||
SST_remap_startZ = 0x0044 | 0x400,
|
||||
SST_remap_startA = 0x0050 | 0x400,
|
||||
SST_remap_startS = 0x005c | 0x400,
|
||||
SST_remap_startT = 0x0068 | 0x400,
|
||||
SST_remap_startW = 0x0074 | 0x400,
|
||||
|
||||
SST_remap_dRdX = 0x0024 | 0x400,
|
||||
SST_remap_dGdX = 0x0030 | 0x400,
|
||||
SST_remap_dBdX = 0x003c | 0x400,
|
||||
SST_remap_dZdX = 0x0048 | 0x400,
|
||||
SST_remap_dAdX = 0x0054 | 0x400,
|
||||
SST_remap_dSdX = 0x0060 | 0x400,
|
||||
SST_remap_dTdX = 0x006c | 0x400,
|
||||
SST_remap_dWdX = 0x0078 | 0x400,
|
||||
|
||||
SST_remap_dRdY = 0x0028 | 0x400,
|
||||
SST_remap_dGdY = 0x0034 | 0x400,
|
||||
SST_remap_dBdY = 0x0040 | 0x400,
|
||||
SST_remap_dZdY = 0x004c | 0x400,
|
||||
SST_remap_dAdY = 0x0058 | 0x400,
|
||||
SST_remap_dSdY = 0x0064 | 0x400,
|
||||
SST_remap_dTdY = 0x0070 | 0x400,
|
||||
SST_remap_dWdY = 0x007c | 0x400,
|
||||
|
||||
SST_remap_triangleCMD = 0x0080 | 0x400,
|
||||
|
||||
SST_remap_fvertexAx = 0x088 | 0x400,
|
||||
SST_remap_fvertexAy = 0x08c | 0x400,
|
||||
SST_remap_fvertexBx = 0x090 | 0x400,
|
||||
SST_remap_fvertexBy = 0x094 | 0x400,
|
||||
SST_remap_fvertexCx = 0x098 | 0x400,
|
||||
SST_remap_fvertexCy = 0x09c | 0x400,
|
||||
|
||||
SST_remap_fstartR = 0x00a0 | 0x400,
|
||||
SST_remap_fstartG = 0x00ac | 0x400,
|
||||
SST_remap_fstartB = 0x00b8 | 0x400,
|
||||
SST_remap_fstartZ = 0x00c4 | 0x400,
|
||||
SST_remap_fstartA = 0x00d0 | 0x400,
|
||||
SST_remap_fstartS = 0x00dc | 0x400,
|
||||
SST_remap_fstartT = 0x00e8 | 0x400,
|
||||
SST_remap_fstartW = 0x00f4 | 0x400,
|
||||
|
||||
SST_remap_fdRdX = 0x00a4 | 0x400,
|
||||
SST_remap_fdGdX = 0x00b0 | 0x400,
|
||||
SST_remap_fdBdX = 0x00bc | 0x400,
|
||||
SST_remap_fdZdX = 0x00c8 | 0x400,
|
||||
SST_remap_fdAdX = 0x00d4 | 0x400,
|
||||
SST_remap_fdSdX = 0x00e0 | 0x400,
|
||||
SST_remap_fdTdX = 0x00ec | 0x400,
|
||||
SST_remap_fdWdX = 0x00f8 | 0x400,
|
||||
|
||||
SST_remap_fdRdY = 0x00a8 | 0x400,
|
||||
SST_remap_fdGdY = 0x00b4 | 0x400,
|
||||
SST_remap_fdBdY = 0x00c0 | 0x400,
|
||||
SST_remap_fdZdY = 0x00cc | 0x400,
|
||||
SST_remap_fdAdY = 0x00d8 | 0x400,
|
||||
SST_remap_fdSdY = 0x00e4 | 0x400,
|
||||
SST_remap_fdTdY = 0x00f0 | 0x400,
|
||||
SST_remap_fdWdY = 0x00fc | 0x400,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
LFB_WRITE_FRONT = 0x0000,
|
||||
LFB_WRITE_BACK = 0x0010,
|
||||
LFB_WRITE_MASK = 0x0030
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
LFB_READ_FRONT = 0x0000,
|
||||
LFB_READ_BACK = 0x0040,
|
||||
LFB_READ_AUX = 0x0080,
|
||||
LFB_READ_MASK = 0x00c0
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
LFB_FORMAT_RGB565 = 0,
|
||||
LFB_FORMAT_RGB555 = 1,
|
||||
LFB_FORMAT_ARGB1555 = 2,
|
||||
LFB_FORMAT_ARGB8888 = 5,
|
||||
LFB_FORMAT_DEPTH = 15,
|
||||
LFB_FORMAT_MASK = 15
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
LFB_WRITE_COLOUR = 1,
|
||||
LFB_WRITE_DEPTH = 2
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FBZ_CHROMAKEY = (1 << 1),
|
||||
FBZ_W_BUFFER = (1 << 3),
|
||||
FBZ_DEPTH_ENABLE = (1 << 4),
|
||||
|
||||
FBZ_DITHER = (1 << 8),
|
||||
FBZ_RGB_WMASK = (1 << 9),
|
||||
FBZ_DEPTH_WMASK = (1 << 10),
|
||||
FBZ_DITHER_2x2 = (1 << 11),
|
||||
|
||||
FBZ_DRAW_FRONT = 0x0000,
|
||||
FBZ_DRAW_BACK = 0x4000,
|
||||
FBZ_DRAW_MASK = 0xc000,
|
||||
|
||||
FBZ_DEPTH_BIAS = (1 << 16),
|
||||
|
||||
FBZ_DEPTH_SOURCE = (1 << 20),
|
||||
|
||||
FBZ_PARAM_ADJUST = (1 << 26)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TEX_RGB332 = 0x0,
|
||||
TEX_Y4I2Q2 = 0x1,
|
||||
TEX_A8 = 0x2,
|
||||
TEX_I8 = 0x3,
|
||||
TEX_AI8 = 0x4,
|
||||
TEX_PAL8 = 0x5,
|
||||
TEX_APAL8 = 0x6,
|
||||
TEX_ARGB8332 = 0x8,
|
||||
TEX_A8Y4I2Q2 = 0x9,
|
||||
TEX_R5G6B5 = 0xa,
|
||||
TEX_ARGB1555 = 0xb,
|
||||
TEX_ARGB4444 = 0xc,
|
||||
TEX_A8I8 = 0xd,
|
||||
TEX_APAL88 = 0xe
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TEXTUREMODE_NCC_SEL = (1 << 5),
|
||||
TEXTUREMODE_TCLAMPS = (1 << 6),
|
||||
TEXTUREMODE_TCLAMPT = (1 << 7),
|
||||
TEXTUREMODE_TRILINEAR = (1 << 30)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FBIINIT0_VGA_PASS = 1,
|
||||
FBIINIT0_GRAPHICS_RESET = (1 << 1)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FBIINIT1_MULTI_SST = (1 << 2), /*Voodoo Graphics only*/
|
||||
FBIINIT1_VIDEO_RESET = (1 << 8),
|
||||
FBIINIT1_SLI_ENABLE = (1 << 23)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FBIINIT2_SWAP_ALGORITHM_MASK = (3 << 9)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FBIINIT2_SWAP_ALGORITHM_DAC_VSYNC = (0 << 9),
|
||||
FBIINIT2_SWAP_ALGORITHM_DAC_DATA = (1 << 9),
|
||||
FBIINIT2_SWAP_ALGORITHM_PCI_FIFO_STALL = (2 << 9),
|
||||
FBIINIT2_SWAP_ALGORITHM_SLI_SYNC = (3 << 9)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FBIINIT3_REMAP = 1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FBIINIT5_MULTI_CVG = (1 << 14)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FBIINIT7_CMDFIFO_ENABLE = (1 << 8)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CC_LOCALSELECT_ITER_RGB = 0,
|
||||
CC_LOCALSELECT_TEX = 1,
|
||||
CC_LOCALSELECT_COLOR1 = 2,
|
||||
CC_LOCALSELECT_LFB = 3
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CCA_LOCALSELECT_ITER_A = 0,
|
||||
CCA_LOCALSELECT_COLOR0 = 1,
|
||||
CCA_LOCALSELECT_ITER_Z = 2
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
C_SEL_ITER_RGB = 0,
|
||||
C_SEL_TEX = 1,
|
||||
C_SEL_COLOR1 = 2,
|
||||
C_SEL_LFB = 3
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
A_SEL_ITER_A = 0,
|
||||
A_SEL_TEX = 1,
|
||||
A_SEL_COLOR1 = 2,
|
||||
A_SEL_LFB = 3
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CC_MSELECT_ZERO = 0,
|
||||
CC_MSELECT_CLOCAL = 1,
|
||||
CC_MSELECT_AOTHER = 2,
|
||||
CC_MSELECT_ALOCAL = 3,
|
||||
CC_MSELECT_TEX = 4,
|
||||
CC_MSELECT_TEXRGB = 5
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CCA_MSELECT_ZERO = 0,
|
||||
CCA_MSELECT_ALOCAL = 1,
|
||||
CCA_MSELECT_AOTHER = 2,
|
||||
CCA_MSELECT_ALOCAL2 = 3,
|
||||
CCA_MSELECT_TEX = 4
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TC_MSELECT_ZERO = 0,
|
||||
TC_MSELECT_CLOCAL = 1,
|
||||
TC_MSELECT_AOTHER = 2,
|
||||
TC_MSELECT_ALOCAL = 3,
|
||||
TC_MSELECT_DETAIL = 4,
|
||||
TC_MSELECT_LOD_FRAC = 5
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TCA_MSELECT_ZERO = 0,
|
||||
TCA_MSELECT_CLOCAL = 1,
|
||||
TCA_MSELECT_AOTHER = 2,
|
||||
TCA_MSELECT_ALOCAL = 3,
|
||||
TCA_MSELECT_DETAIL = 4,
|
||||
TCA_MSELECT_LOD_FRAC = 5
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CC_ADD_CLOCAL = 1,
|
||||
CC_ADD_ALOCAL = 2
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CCA_ADD_CLOCAL = 1,
|
||||
CCA_ADD_ALOCAL = 2
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AFUNC_AZERO = 0x0,
|
||||
AFUNC_ASRC_ALPHA = 0x1,
|
||||
AFUNC_A_COLOR = 0x2,
|
||||
AFUNC_ADST_ALPHA = 0x3,
|
||||
AFUNC_AONE = 0x4,
|
||||
AFUNC_AOMSRC_ALPHA = 0x5,
|
||||
AFUNC_AOM_COLOR = 0x6,
|
||||
AFUNC_AOMDST_ALPHA = 0x7,
|
||||
AFUNC_ASATURATE = 0xf
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AFUNC_ACOLORBEFOREFOG = 0xf
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AFUNC_NEVER = 0,
|
||||
AFUNC_LESSTHAN = 1,
|
||||
AFUNC_EQUAL = 2,
|
||||
AFUNC_LESSTHANEQUAL = 3,
|
||||
AFUNC_GREATERTHAN = 4,
|
||||
AFUNC_NOTEQUAL = 5,
|
||||
AFUNC_GREATERTHANEQUAL = 6,
|
||||
AFUNC_ALWAYS = 7
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
DEPTHOP_NEVER = 0,
|
||||
DEPTHOP_LESSTHAN = 1,
|
||||
DEPTHOP_EQUAL = 2,
|
||||
DEPTHOP_LESSTHANEQUAL = 3,
|
||||
DEPTHOP_GREATERTHAN = 4,
|
||||
DEPTHOP_NOTEQUAL = 5,
|
||||
DEPTHOP_GREATERTHANEQUAL = 6,
|
||||
DEPTHOP_ALWAYS = 7
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FOG_ENABLE = 0x01,
|
||||
FOG_ADD = 0x02,
|
||||
FOG_MULT = 0x04,
|
||||
FOG_ALPHA = 0x08,
|
||||
FOG_Z = 0x10,
|
||||
FOG_W = 0x18,
|
||||
FOG_CONSTANT = 0x20
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
LOD_ODD = (1 << 18),
|
||||
LOD_SPLIT = (1 << 19),
|
||||
LOD_S_IS_WIDER = (1 << 20),
|
||||
LOD_TMULTIBASEADDR = (1 << 24),
|
||||
LOD_TMIRROR_S = (1 << 28),
|
||||
LOD_TMIRROR_T = (1 << 29)
|
||||
};
|
||||
enum
|
||||
{
|
||||
CMD_INVALID = 0,
|
||||
CMD_DRAWTRIANGLE,
|
||||
CMD_FASTFILL,
|
||||
CMD_SWAPBUF
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FBZCP_TEXTURE_ENABLED = (1 << 27)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
BLTCMD_SRC_TILED = (1 << 14),
|
||||
BLTCMD_DST_TILED = (1 << 15)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
INITENABLE_SLI_MASTER_SLAVE = (1 << 11)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SETUPMODE_RGB = (1 << 0),
|
||||
SETUPMODE_ALPHA = (1 << 1),
|
||||
SETUPMODE_Z = (1 << 2),
|
||||
SETUPMODE_Wb = (1 << 3),
|
||||
SETUPMODE_W0 = (1 << 4),
|
||||
SETUPMODE_S0_T0 = (1 << 5),
|
||||
SETUPMODE_W1 = (1 << 6),
|
||||
SETUPMODE_S1_T1 = (1 << 7),
|
||||
|
||||
SETUPMODE_STRIP_MODE = (1 << 16),
|
||||
SETUPMODE_CULLING_ENABLE = (1 << 17),
|
||||
SETUPMODE_CULLING_SIGN = (1 << 18),
|
||||
SETUPMODE_DISABLE_PINGPONG = (1 << 19)
|
||||
};
|
||||
|
||||
#define TEXTUREMODE_MASK 0x3ffff000
|
||||
#define TEXTUREMODE_PASSTHROUGH 0
|
||||
|
||||
#define TEXTUREMODE_LOCAL_MASK 0x00643000
|
||||
#define TEXTUREMODE_LOCAL 0x00241000
|
||||
|
||||
|
||||
#define SLI_ENABLED (voodoo->fbiInit1 & FBIINIT1_SLI_ENABLE)
|
||||
#define TRIPLE_BUFFER ((voodoo->fbiInit2 & 0x10) || (voodoo->fbiInit5 & 0x600) == 0x400)
|
||||
|
||||
|
||||
#define _rgb_sel ( params->fbzColorPath & 3)
|
||||
#define a_sel ( (params->fbzColorPath >> 2) & 3)
|
||||
#define cc_localselect ( params->fbzColorPath & (1 << 4))
|
||||
#define cca_localselect ( (params->fbzColorPath >> 5) & 3)
|
||||
#define cc_localselect_override ( params->fbzColorPath & (1 << 7))
|
||||
#define cc_zero_other ( params->fbzColorPath & (1 << 8))
|
||||
#define cc_sub_clocal ( params->fbzColorPath & (1 << 9))
|
||||
#define cc_mselect ( (params->fbzColorPath >> 10) & 7)
|
||||
#define cc_reverse_blend ( params->fbzColorPath & (1 << 13))
|
||||
#define cc_add ( (params->fbzColorPath >> 14) & 3)
|
||||
#define cc_add_alocal ( params->fbzColorPath & (1 << 15))
|
||||
#define cc_invert_output ( params->fbzColorPath & (1 << 16))
|
||||
#define cca_zero_other ( params->fbzColorPath & (1 << 17))
|
||||
#define cca_sub_clocal ( params->fbzColorPath & (1 << 18))
|
||||
#define cca_mselect ( (params->fbzColorPath >> 19) & 7)
|
||||
#define cca_reverse_blend ( params->fbzColorPath & (1 << 22))
|
||||
#define cca_add ( (params->fbzColorPath >> 23) & 3)
|
||||
#define cca_invert_output ( params->fbzColorPath & (1 << 25))
|
||||
#define tc_zero_other (params->textureMode[0] & (1 << 12))
|
||||
#define tc_sub_clocal (params->textureMode[0] & (1 << 13))
|
||||
#define tc_mselect ((params->textureMode[0] >> 14) & 7)
|
||||
#define tc_reverse_blend (params->textureMode[0] & (1 << 17))
|
||||
#define tc_add_clocal (params->textureMode[0] & (1 << 18))
|
||||
#define tc_add_alocal (params->textureMode[0] & (1 << 19))
|
||||
#define tc_invert_output (params->textureMode[0] & (1 << 20))
|
||||
#define tca_zero_other (params->textureMode[0] & (1 << 21))
|
||||
#define tca_sub_clocal (params->textureMode[0] & (1 << 22))
|
||||
#define tca_mselect ((params->textureMode[0] >> 23) & 7)
|
||||
#define tca_reverse_blend (params->textureMode[0] & (1 << 26))
|
||||
#define tca_add_clocal (params->textureMode[0] & (1 << 27))
|
||||
#define tca_add_alocal (params->textureMode[0] & (1 << 28))
|
||||
#define tca_invert_output (params->textureMode[0] & (1 << 29))
|
||||
|
||||
#define tc_sub_clocal_1 (params->textureMode[1] & (1 << 13))
|
||||
#define tc_mselect_1 ((params->textureMode[1] >> 14) & 7)
|
||||
#define tc_reverse_blend_1 (params->textureMode[1] & (1 << 17))
|
||||
#define tc_add_clocal_1 (params->textureMode[1] & (1 << 18))
|
||||
#define tc_add_alocal_1 (params->textureMode[1] & (1 << 19))
|
||||
#define tca_sub_clocal_1 (params->textureMode[1] & (1 << 22))
|
||||
#define tca_mselect_1 ((params->textureMode[1] >> 23) & 7)
|
||||
#define tca_reverse_blend_1 (params->textureMode[1] & (1 << 26))
|
||||
#define tca_add_clocal_1 (params->textureMode[1] & (1 << 27))
|
||||
#define tca_add_alocal_1 (params->textureMode[1] & (1 << 28))
|
||||
|
||||
#define src_afunc ( (params->alphaMode >> 8) & 0xf)
|
||||
#define dest_afunc ( (params->alphaMode >> 12) & 0xf)
|
||||
#define alpha_func ( (params->alphaMode >> 1) & 7)
|
||||
#define a_ref ( params->alphaMode >> 24)
|
||||
#define depth_op ( (params->fbzMode >> 5) & 7)
|
||||
#define dither ( params->fbzMode & FBZ_DITHER)
|
||||
#define dither2x2 (params->fbzMode & FBZ_DITHER_2x2)
|
||||
338
src/include/86box/vid_voodoo_render.h
Normal file
338
src/include/86box/vid_voodoo_render.h
Normal file
@@ -0,0 +1,338 @@
|
||||
#if !(defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined WIN32 || defined _WIN32 || defined _WIN32) && !(defined __amd64__)
|
||||
#define NO_CODEGEN
|
||||
#endif
|
||||
|
||||
#ifndef NO_CODEGEN
|
||||
void voodoo_codegen_init(voodoo_t *voodoo);
|
||||
void voodoo_codegen_close(voodoo_t *voodoo);
|
||||
#endif
|
||||
|
||||
#define DEPTH_TEST(comp_depth) \
|
||||
do \
|
||||
{ \
|
||||
switch (depth_op) \
|
||||
{ \
|
||||
case DEPTHOP_NEVER: \
|
||||
voodoo->fbiZFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
case DEPTHOP_LESSTHAN: \
|
||||
if (!(comp_depth < old_depth)) \
|
||||
{ \
|
||||
voodoo->fbiZFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case DEPTHOP_EQUAL: \
|
||||
if (!(comp_depth == old_depth)) \
|
||||
{ \
|
||||
voodoo->fbiZFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case DEPTHOP_LESSTHANEQUAL: \
|
||||
if (!(comp_depth <= old_depth)) \
|
||||
{ \
|
||||
voodoo->fbiZFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case DEPTHOP_GREATERTHAN: \
|
||||
if (!(comp_depth > old_depth)) \
|
||||
{ \
|
||||
voodoo->fbiZFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case DEPTHOP_NOTEQUAL: \
|
||||
if (!(comp_depth != old_depth)) \
|
||||
{ \
|
||||
voodoo->fbiZFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case DEPTHOP_GREATERTHANEQUAL: \
|
||||
if (!(comp_depth >= old_depth)) \
|
||||
{ \
|
||||
voodoo->fbiZFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case DEPTHOP_ALWAYS: \
|
||||
break; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define APPLY_FOG(src_r, src_g, src_b, z, ia, w) \
|
||||
do \
|
||||
{ \
|
||||
if (params->fogMode & FOG_CONSTANT) \
|
||||
{ \
|
||||
src_r += params->fogColor.r; \
|
||||
src_g += params->fogColor.g; \
|
||||
src_b += params->fogColor.b; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
int fog_r, fog_g, fog_b, fog_a = 0; \
|
||||
int fog_idx; \
|
||||
\
|
||||
if (!(params->fogMode & FOG_ADD)) \
|
||||
{ \
|
||||
fog_r = params->fogColor.r; \
|
||||
fog_g = params->fogColor.g; \
|
||||
fog_b = params->fogColor.b; \
|
||||
} \
|
||||
else \
|
||||
fog_r = fog_g = fog_b = 0; \
|
||||
\
|
||||
if (!(params->fogMode & FOG_MULT)) \
|
||||
{ \
|
||||
fog_r -= src_r; \
|
||||
fog_g -= src_g; \
|
||||
fog_b -= src_b; \
|
||||
} \
|
||||
\
|
||||
switch (params->fogMode & (FOG_Z|FOG_ALPHA)) \
|
||||
{ \
|
||||
case 0: \
|
||||
fog_idx = (w_depth >> 10) & 0x3f; \
|
||||
\
|
||||
fog_a = params->fogTable[fog_idx].fog; \
|
||||
fog_a += (params->fogTable[fog_idx].dfog * ((w_depth >> 2) & 0xff)) >> 10; \
|
||||
break; \
|
||||
case FOG_Z: \
|
||||
fog_a = (z >> 20) & 0xff; \
|
||||
break; \
|
||||
case FOG_ALPHA: \
|
||||
fog_a = CLAMP(ia >> 12); \
|
||||
break; \
|
||||
case FOG_W: \
|
||||
fog_a = CLAMP((w >> 32) & 0xff); \
|
||||
break; \
|
||||
} \
|
||||
fog_a++; \
|
||||
\
|
||||
fog_r = (fog_r * fog_a) >> 8; \
|
||||
fog_g = (fog_g * fog_a) >> 8; \
|
||||
fog_b = (fog_b * fog_a) >> 8; \
|
||||
\
|
||||
if (params->fogMode & FOG_MULT) \
|
||||
{ \
|
||||
src_r = fog_r; \
|
||||
src_g = fog_g; \
|
||||
src_b = fog_b; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
src_r += fog_r; \
|
||||
src_g += fog_g; \
|
||||
src_b += fog_b; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
src_r = CLAMP(src_r); \
|
||||
src_g = CLAMP(src_g); \
|
||||
src_b = CLAMP(src_b); \
|
||||
} while (0)
|
||||
|
||||
#define ALPHA_TEST(src_a) \
|
||||
do \
|
||||
{ \
|
||||
switch (alpha_func) \
|
||||
{ \
|
||||
case AFUNC_NEVER: \
|
||||
voodoo->fbiAFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
case AFUNC_LESSTHAN: \
|
||||
if (!(src_a < a_ref)) \
|
||||
{ \
|
||||
voodoo->fbiAFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case AFUNC_EQUAL: \
|
||||
if (!(src_a == a_ref)) \
|
||||
{ \
|
||||
voodoo->fbiAFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case AFUNC_LESSTHANEQUAL: \
|
||||
if (!(src_a <= a_ref)) \
|
||||
{ \
|
||||
voodoo->fbiAFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case AFUNC_GREATERTHAN: \
|
||||
if (!(src_a > a_ref)) \
|
||||
{ \
|
||||
voodoo->fbiAFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case AFUNC_NOTEQUAL: \
|
||||
if (!(src_a != a_ref)) \
|
||||
{ \
|
||||
voodoo->fbiAFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case AFUNC_GREATERTHANEQUAL: \
|
||||
if (!(src_a >= a_ref)) \
|
||||
{ \
|
||||
voodoo->fbiAFuncFail++; \
|
||||
goto skip_pixel; \
|
||||
} \
|
||||
break; \
|
||||
case AFUNC_ALWAYS: \
|
||||
break; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ALPHA_BLEND(src_r, src_g, src_b, src_a) \
|
||||
do \
|
||||
{ \
|
||||
int _a; \
|
||||
int newdest_r = 0, newdest_g = 0, newdest_b = 0; \
|
||||
\
|
||||
switch (dest_afunc) \
|
||||
{ \
|
||||
case AFUNC_AZERO: \
|
||||
newdest_r = newdest_g = newdest_b = 0; \
|
||||
break; \
|
||||
case AFUNC_ASRC_ALPHA: \
|
||||
newdest_r = (dest_r * src_a) / 255; \
|
||||
newdest_g = (dest_g * src_a) / 255; \
|
||||
newdest_b = (dest_b * src_a) / 255; \
|
||||
break; \
|
||||
case AFUNC_A_COLOR: \
|
||||
newdest_r = (dest_r * src_r) / 255; \
|
||||
newdest_g = (dest_g * src_g) / 255; \
|
||||
newdest_b = (dest_b * src_b) / 255; \
|
||||
break; \
|
||||
case AFUNC_ADST_ALPHA: \
|
||||
newdest_r = (dest_r * dest_a) / 255; \
|
||||
newdest_g = (dest_g * dest_a) / 255; \
|
||||
newdest_b = (dest_b * dest_a) / 255; \
|
||||
break; \
|
||||
case AFUNC_AONE: \
|
||||
newdest_r = dest_r; \
|
||||
newdest_g = dest_g; \
|
||||
newdest_b = dest_b; \
|
||||
break; \
|
||||
case AFUNC_AOMSRC_ALPHA: \
|
||||
newdest_r = (dest_r * (255-src_a)) / 255; \
|
||||
newdest_g = (dest_g * (255-src_a)) / 255; \
|
||||
newdest_b = (dest_b * (255-src_a)) / 255; \
|
||||
break; \
|
||||
case AFUNC_AOM_COLOR: \
|
||||
newdest_r = (dest_r * (255-src_r)) / 255; \
|
||||
newdest_g = (dest_g * (255-src_g)) / 255; \
|
||||
newdest_b = (dest_b * (255-src_b)) / 255; \
|
||||
break; \
|
||||
case AFUNC_AOMDST_ALPHA: \
|
||||
newdest_r = (dest_r * (255-dest_a)) / 255; \
|
||||
newdest_g = (dest_g * (255-dest_a)) / 255; \
|
||||
newdest_b = (dest_b * (255-dest_a)) / 255; \
|
||||
break; \
|
||||
case AFUNC_ASATURATE: \
|
||||
_a = MIN(src_a, 1-dest_a); \
|
||||
newdest_r = (dest_r * _a) / 255; \
|
||||
newdest_g = (dest_g * _a) / 255; \
|
||||
newdest_b = (dest_b * _a) / 255; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
switch (src_afunc) \
|
||||
{ \
|
||||
case AFUNC_AZERO: \
|
||||
src_r = src_g = src_b = 0; \
|
||||
break; \
|
||||
case AFUNC_ASRC_ALPHA: \
|
||||
src_r = (src_r * src_a) / 255; \
|
||||
src_g = (src_g * src_a) / 255; \
|
||||
src_b = (src_b * src_a) / 255; \
|
||||
break; \
|
||||
case AFUNC_A_COLOR: \
|
||||
src_r = (src_r * dest_r) / 255; \
|
||||
src_g = (src_g * dest_g) / 255; \
|
||||
src_b = (src_b * dest_b) / 255; \
|
||||
break; \
|
||||
case AFUNC_ADST_ALPHA: \
|
||||
src_r = (src_r * dest_a) / 255; \
|
||||
src_g = (src_g * dest_a) / 255; \
|
||||
src_b = (src_b * dest_a) / 255; \
|
||||
break; \
|
||||
case AFUNC_AONE: \
|
||||
break; \
|
||||
case AFUNC_AOMSRC_ALPHA: \
|
||||
src_r = (src_r * (255-src_a)) / 255; \
|
||||
src_g = (src_g * (255-src_a)) / 255; \
|
||||
src_b = (src_b * (255-src_a)) / 255; \
|
||||
break; \
|
||||
case AFUNC_AOM_COLOR: \
|
||||
src_r = (src_r * (255-dest_r)) / 255; \
|
||||
src_g = (src_g * (255-dest_g)) / 255; \
|
||||
src_b = (src_b * (255-dest_b)) / 255; \
|
||||
break; \
|
||||
case AFUNC_AOMDST_ALPHA: \
|
||||
src_r = (src_r * (255-dest_a)) / 255; \
|
||||
src_g = (src_g * (255-dest_a)) / 255; \
|
||||
src_b = (src_b * (255-dest_a)) / 255; \
|
||||
break; \
|
||||
case AFUNC_ACOLORBEFOREFOG: \
|
||||
fatal("AFUNC_ACOLORBEFOREFOG\n"); \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
src_r += newdest_r; \
|
||||
src_g += newdest_g; \
|
||||
src_b += newdest_b; \
|
||||
\
|
||||
src_r = CLAMP(src_r); \
|
||||
src_g = CLAMP(src_g); \
|
||||
src_b = CLAMP(src_b); \
|
||||
} while(0)
|
||||
|
||||
|
||||
|
||||
void voodoo_render_thread_1(void *param);
|
||||
void voodoo_render_thread_2(void *param);
|
||||
void voodoo_render_thread_3(void *param);
|
||||
void voodoo_render_thread_4(void *param);
|
||||
void voodoo_queue_triangle(voodoo_t *voodoo, voodoo_params_t *params);
|
||||
|
||||
extern int voodoo_recomp;
|
||||
extern int tris;
|
||||
|
||||
static __inline void voodoo_wake_render_thread(voodoo_t *voodoo)
|
||||
{
|
||||
thread_set_event(voodoo->wake_render_thread[0]); /*Wake up render thread if moving from idle*/
|
||||
if (voodoo->render_threads >= 2)
|
||||
thread_set_event(voodoo->wake_render_thread[1]); /*Wake up render thread if moving from idle*/
|
||||
if (voodoo->render_threads == 4)
|
||||
{
|
||||
thread_set_event(voodoo->wake_render_thread[2]); /*Wake up render thread if moving from idle*/
|
||||
thread_set_event(voodoo->wake_render_thread[3]); /*Wake up render thread if moving from idle*/
|
||||
}
|
||||
}
|
||||
|
||||
static __inline void voodoo_wait_for_render_thread_idle(voodoo_t *voodoo)
|
||||
{
|
||||
while (!PARAM_EMPTY(0) || (voodoo->render_threads >= 2 && !PARAM_EMPTY(1)) ||
|
||||
(voodoo->render_threads == 4 && (!PARAM_EMPTY(2) || !PARAM_EMPTY(3))) ||
|
||||
voodoo->render_voodoo_busy[0] || (voodoo->render_threads >= 2 && voodoo->render_voodoo_busy[1]) ||
|
||||
(voodoo->render_threads == 4 && (voodoo->render_voodoo_busy[2] || voodoo->render_voodoo_busy[3])))
|
||||
{
|
||||
voodoo_wake_render_thread(voodoo);
|
||||
if (!PARAM_EMPTY(0) || voodoo->render_voodoo_busy[0])
|
||||
thread_wait_event(voodoo->render_not_full_event[0], 1);
|
||||
if (voodoo->render_threads >= 2 && (!PARAM_EMPTY(1) || voodoo->render_voodoo_busy[1]))
|
||||
thread_wait_event(voodoo->render_not_full_event[1], 1);
|
||||
if (voodoo->render_threads == 4 && (!PARAM_EMPTY(2) || voodoo->render_voodoo_busy[2]))
|
||||
thread_wait_event(voodoo->render_not_full_event[2], 1);
|
||||
if (voodoo->render_threads == 4 && (!PARAM_EMPTY(3) || voodoo->render_voodoo_busy[3]))
|
||||
thread_wait_event(voodoo->render_not_full_event[3], 1);
|
||||
}
|
||||
}
|
||||
18
src/include/86box/vid_voodoo_setup.h
Normal file
18
src/include/86box/vid_voodoo_setup.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Graphics, 2, Banshee, 3 emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
void voodoo_triangle_setup(voodoo_t *voodoo);
|
||||
36
src/include/86box/vid_voodoo_texture.h
Normal file
36
src/include/86box/vid_voodoo_texture.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Voodoo Graphics, 2, Banshee, 3 emulation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* leilei
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
*/
|
||||
static const uint32_t texture_offset[LOD_MAX+3] =
|
||||
{
|
||||
0,
|
||||
256*256,
|
||||
256*256 + 128*128,
|
||||
256*256 + 128*128 + 64*64,
|
||||
256*256 + 128*128 + 64*64 + 32*32,
|
||||
256*256 + 128*128 + 64*64 + 32*32 + 16*16,
|
||||
256*256 + 128*128 + 64*64 + 32*32 + 16*16 + 8*8,
|
||||
256*256 + 128*128 + 64*64 + 32*32 + 16*16 + 8*8 + 4*4,
|
||||
256*256 + 128*128 + 64*64 + 32*32 + 16*16 + 8*8 + 4*4 + 2*2,
|
||||
256*256 + 128*128 + 64*64 + 32*32 + 16*16 + 8*8 + 4*4 + 2*2 + 1*1,
|
||||
256*256 + 128*128 + 64*64 + 32*32 + 16*16 + 8*8 + 4*4 + 2*2 + 1*1 + 1
|
||||
};
|
||||
|
||||
void voodoo_recalc_tex(voodoo_t *voodoo, int tmu);
|
||||
void voodoo_use_texture(voodoo_t *voodoo, voodoo_params_t *params, int tmu);
|
||||
void voodoo_tex_writel(uint32_t addr, uint32_t val, void *p);
|
||||
void flush_texture_cache(voodoo_t *voodoo, uint32_t dirty_addr, int tmu);
|
||||
@@ -362,6 +362,10 @@ extern const device_t ps1vga_mca_device;
|
||||
|
||||
/* 3DFX Voodoo Graphics */
|
||||
extern const device_t voodoo_device;
|
||||
extern const device_t voodoo_banshee_device;
|
||||
extern const device_t creative_voodoo_banshee_device;
|
||||
extern const device_t voodoo_3_2000_device;
|
||||
extern const device_t voodoo_3_3000_device;
|
||||
|
||||
/* Wyse 700 */
|
||||
extern const device_t wy700_device;
|
||||
|
||||
Reference in New Issue
Block a user