Refactor: Merge nv3_position_16 and nv3_size_16 into nv3_coord_16, same for bigy and combined: remove dead code

This commit is contained in:
starfrost013
2025-04-23 01:28:54 +01:00
parent 23669c7a63
commit 26ee11e868
12 changed files with 203 additions and 225 deletions

View File

@@ -271,36 +271,29 @@ typedef struct nv3_color_argb_s
uint8_t b;
} nv3_color_argb_t;
/* Generic 16-bit position*/
typedef struct nv3_position_16_s
/* Generic 16-bit coordinate*/
typedef struct nv3_coord_16_s
{
uint16_t x;
uint16_t y;
} nv3_position_16_t;
} nv3_coord_16_t;
/* A big position format with 30:16 = y, 15:11 = nothing, 10:0 = x */
typedef struct nv3_position_16_bigy_s
typedef struct nv3_coord_16_bigy_s
{
// WHOSE IDEA WAS THIS?
uint16_t x : 11;
uint8_t reserved : 5;
uint16_t y : 15;
bool reserved2 : 1;
} nv3_position_16_bigy_t;
/* Generic 16-bit size */
typedef struct nv3_size_16_s
{
uint16_t w;
uint16_t h;
} nv3_size_16_t;
} nv3_coord_16_bigy_t;
/* Generic 32-bit colour + 16-bit position */
typedef struct nv3_color_and_position_16_s
typedef struct nv3_color_and_coord_16_s
{
nv3_color_expanded_t color;
nv3_position_16_t points;
} nv3_color_and_position_16_t;
nv3_coord_16_t points;
} nv3_color_and_coord_16_t;
/* Generic 16-bit clip region */
typedef struct nv3_clip_16_s
@@ -410,8 +403,8 @@ typedef struct nv3_object_class_005
uint32_t set_notify; // Set notifier
/* 16-bit precision */
nv3_position_16_t position;
nv3_size_16_t size;
nv3_coord_16_t position;
nv3_coord_16_t size;
} nv3_clipping_rectangle_t;
@@ -442,8 +435,8 @@ typedef struct nv3_object_class_007
nv3_class_ctx_switch_method_t set_notify_ctx_dma; // Set notifier context for DMA (context switch)
uint32_t set_notify; // Set notifier
uint32_t color; // The colour of the object.
nv3_position_16_t position[16]; // The positions of up to 16 rectangles.
nv3_size_16_t size[16]; // The sizes of up to 16 rectangles
nv3_coord_16_t position[16]; // The positions of up to 16 rectangles.
nv3_coord_16_t size[16]; // The sizes of up to 16 rectangles
} nv3_rectangle_t;
@@ -451,7 +444,7 @@ typedef struct nv3_object_class_007
typedef struct nv3_object_class_008_cpoint_s
{
nv3_color_expanded_t color; // argb-format 32-bit color
nv3_position_16_t position; // position
nv3_coord_16_t position; // position
} nv3_object_class_008_cpoint_t;
/*
@@ -465,7 +458,7 @@ typedef struct nv3_object_class_008
nv3_class_ctx_switch_method_t set_notify_ctx_dma; // Set notifier context for DMA (context switch)
uint32_t set_notify; // Set notifier
nv3_color_expanded_t color; // argb?
nv3_position_16_t point[16]; // Boring points
nv3_coord_16_t point[16]; // Boring points
nv3_position_32_t point32[16]; // Allows you to have points with full 32-bit precision
nv3_object_class_008_cpoint_t cpoint[16]; // Allows you to have c o l o r f u l points!
} nv3_point_t;
@@ -473,8 +466,8 @@ typedef struct nv3_object_class_008
/* Normal line... */
typedef struct nv3_object_class_009_line_s
{
nv3_position_16_t start; // presumably unless it's in reverse order...TODO: check the order
nv3_position_16_t end;
nv3_coord_16_t start; // presumably unless it's in reverse order...TODO: check the order
nv3_coord_16_t end;
} nv3_object_class_009_line_t;
@@ -506,7 +499,7 @@ typedef struct nv3_object_class_009
nv3_object_class_009_line32_t line32[8];
nv3_object_class_009_line_t polyline[32];
nv3_object_class_009_line32_t polyline32[16];
nv3_color_and_position_16_t cpolyline[16]; // List of line points and colours.
nv3_color_and_coord_16_t cpolyline[16]; // List of line points and colours.
} nv3_line_t;
/*
@@ -528,7 +521,7 @@ typedef struct nv3_object_class_00A
nv3_object_class_009_line32_t line32[8];
nv3_object_class_009_line_t polyline[32];
nv3_object_class_009_line32_t polyline32[16];
nv3_color_and_position_16_t cpolyline[16]; // List of line points and colours.
nv3_color_and_coord_16_t cpolyline[16]; // List of line points and colours.
} nv3_lin_t;
@@ -545,7 +538,7 @@ typedef struct nv3_object_class_00B
uint32_t set_notify; // Set notifier
nv3_color_expanded_t color; // argb?
// The points of the triangle.
nv3_position_16_t points[3];
nv3_coord_16_t points[3];
// Another way of filling out the points of the triangle
uint32_t x0;
@@ -555,10 +548,10 @@ typedef struct nv3_object_class_00B
uint32_t y2;
uint32_t x2;
nv3_position_16_t mesh[32]; // Some kind of mesh format. I guess a list of vertex positions?
nv3_coord_16_t mesh[32]; // Some kind of mesh format. I guess a list of vertex positions?
nv3_position_32_t mesh32[16];
nv3_color_and_position_16_t ctriangle[3]; // Triangle with colour
nv3_color_and_position_16_t ctrimesh[16]; // Some kind of mesh format. I guess a list of vertex positions? with colours
nv3_color_and_coord_16_t ctriangle[3]; // Triangle with colour
nv3_color_and_coord_16_t ctrimesh[16]; // Some kind of mesh format. I guess a list of vertex positions? with colours
} nv3_triangle_t;
/*
@@ -567,7 +560,6 @@ typedef struct nv3_object_class_00B
Also 0x4C in context IDs.
GDI text acceleration for Windows 95.
How the fuck does this even work?
*/
typedef struct nv3_object_class_00C
{
@@ -575,8 +567,8 @@ typedef struct nv3_object_class_00C
nv3_class_ctx_switch_method_t set_notify_ctx_dma; // Set notifier context for DMA (context switch)
uint32_t set_notify; // Set notifier
uint32_t color_a; // Color for Clip A
nv3_position_16_t rect_a_position[64];
nv3_size_16_t rect_a_size[64];
nv3_coord_16_t rect_a_position[64];
nv3_coord_16_t rect_a_size[64];
/* Clipped rect */
nv3_clip_16_t clip_b;
uint32_t color_b; // Color for Clip B
@@ -584,23 +576,23 @@ typedef struct nv3_object_class_00C
/* Unclipped transparent bitmap */
nv3_clip_16_t clip_c;
uint32_t color1_c;
nv3_size_16_t size_c;
nv3_position_16_t point_c;
nv3_coord_16_t size_c;
nv3_coord_16_t point_c;
uint32_t bitmap_c[128];
/* Clipped transparent bitmap */
nv3_clip_16_t clip_d;
uint32_t color1_d;
nv3_size_16_t size_in_d;
nv3_size_16_t size_out_d;
nv3_position_16_t point_d;
nv3_coord_16_t size_in_d;
nv3_coord_16_t size_out_d;
nv3_coord_16_t point_d;
uint32_t bitmap_d[128];
/* Clipped 1bpp bitmap */
nv3_clip_16_t clip_e;
uint32_t color0_e;
uint32_t color1_e;
nv3_size_16_t size_in_e;
nv3_size_16_t size_out_e;
nv3_position_16_t point_e;
nv3_coord_16_t size_in_e;
nv3_coord_16_t size_out_e;
nv3_coord_16_t point_e;
uint32_t bitmap_e[128];
} nv3_win95_text_t;
@@ -637,14 +629,14 @@ typedef struct nv3_object_class_00E
{
nv3_class_ctx_switch_method_t set_notify_ctx_dma;
uint32_t set_notify;
nv3_position_16_t clip_0;
nv3_size_16_t clip_1;
nv3_position_16_t rectangle_out_0;
nv3_size_16_t rectangle_out_1;
nv3_coord_16_t clip_0;
nv3_coord_16_t clip_1;
nv3_coord_16_t rectangle_out_0;
nv3_coord_16_t rectangle_out_1;
// Calculus in a graphics card
uint32_t delta_du_dx;
uint32_t delta_dv_dy;
nv3_size_16_t size; // can be size_y if YUV420
nv3_coord_16_t size; // can be size_y if YUV420
uint32_t pitch;
uint32_t offset;
uint32_t point;
@@ -663,16 +655,16 @@ typedef struct nv3_object_class_00E
0x?? (drivers)
Also 0x50 in context IDs.
Represents a blit.
Represents a screen to screen blit. I'm still figuring it out.
*/
typedef struct nv3_object_class_010
{
nv3_class_ctx_switch_method_t set_notify_ctx_dma;
uint32_t set_notify;
nv3_position_16_t point_in;
nv3_position_16_t point_out;
nv3_size_16_t size;
nv3_coord_16_t point_in;
nv3_coord_16_t point_out;
nv3_coord_16_t size;
} nv3_blit_t;
/*
@@ -686,9 +678,9 @@ typedef struct nv3_object_class_011
{
nv3_class_ctx_switch_method_t set_notify_ctx_dma;
uint32_t set_notify;
nv3_position_16_t point;
nv3_size_16_t size;
nv3_size_16_t size_in;
nv3_coord_16_t point;
nv3_coord_16_t size;
nv3_coord_16_t size_in;
nv3_color_expanded_t color[32]; // The colour to use
} nv3_image_t;
@@ -706,9 +698,9 @@ typedef struct nv3_object_class_012
uint32_t set_notify;
nv3_color_expanded_t color_0;
nv3_color_expanded_t color_1;
nv3_position_16_t point; // Top left(?) of the bitmap
nv3_size_16_t size;
nv3_size_16_t size_in;
nv3_coord_16_t point; // Top left(?) of the bitmap
nv3_coord_16_t size;
nv3_coord_16_t size_in;
uint32_t monochrome_bitmap[32];
} nv3_bitmap_t;
@@ -726,8 +718,8 @@ typedef struct nv3_object_class_014
{
nv3_class_ctx_switch_method_t set_notify_ctx_dma;
uint32_t set_notify;
nv3_position_16_t point;
nv3_size_16_t size;
nv3_coord_16_t point;
nv3_coord_16_t size;
uint32_t image_pitch; // bytes per row
uint32_t image_start;
} nv3_image_to_memory_t;
@@ -744,11 +736,11 @@ typedef struct nv3_object_class_015
{
nv3_class_ctx_switch_method_t set_notify_ctx_dma;
uint32_t set_notify;
nv3_size_16_t size_in;
nv3_coord_16_t size_in;
uint32_t delta_dx_du;
uint32_t delta_dy_dv;
nv3_position_16_t clip_0;
nv3_size_16_t clip_1;
nv3_coord_16_t clip_0;
nv3_coord_16_t clip_1;
uint32_t point12d4; /* todo: fraction struct */
// no reserve needed
} nv3_stretched_image_from_cpu_t;
@@ -1154,7 +1146,7 @@ typedef struct nv3_object_class_018
uint32_t set_notify;
nv3_d3d5_control_out_t control_out;
nv3_d3d5_alpha_control_t alpha_control;
nv3_position_16_t point;
nv3_coord_16_t point;
nv3_zeta_buffer_t zeta[8];
} nv3_point_with_zeta_buffer_t;

View File

@@ -18,20 +18,20 @@
#pragma once
/* Core */
void nv3_render_current_bpp(svga_t *svga, nv3_position_16_t position, nv3_size_16_t size, nv3_grobj_t grobj, bool run_render_check, bool use_destination_buffer);
void nv3_render_current_bpp(svga_t *svga, nv3_coord_16_t position, nv3_coord_16_t size, nv3_grobj_t grobj, bool run_render_check, bool use_destination_buffer);
void nv3_render_current_bpp_dfb_8(uint32_t address);
void nv3_render_current_bpp_dfb_16(uint32_t address);
void nv3_render_current_bpp_dfb_32(uint32_t address);
/* Pixel */
void nv3_render_write_pixel(nv3_position_16_t position, uint32_t color, nv3_grobj_t grobj);
uint8_t nv3_render_read_pixel_8(nv3_position_16_t position, nv3_grobj_t grobj);
uint16_t nv3_render_read_pixel_16(nv3_position_16_t position, nv3_grobj_t grobj);
uint32_t nv3_render_read_pixel_32(nv3_position_16_t position, nv3_grobj_t grobj);
void nv3_render_write_pixel(nv3_coord_16_t position, uint32_t color, nv3_grobj_t grobj);
uint8_t nv3_render_read_pixel_8(nv3_coord_16_t position, nv3_grobj_t grobj);
uint16_t nv3_render_read_pixel_16(nv3_coord_16_t position, nv3_grobj_t grobj);
uint32_t nv3_render_read_pixel_32(nv3_coord_16_t position, nv3_grobj_t grobj);
/* Address */
uint32_t nv3_render_get_vram_address(nv3_position_16_t position, nv3_grobj_t grobj);
uint32_t nv3_render_get_vram_address_for_buffer(nv3_position_16_t position, nv3_grobj_t grobj, uint32_t buffer);
uint32_t nv3_render_get_vram_address(nv3_coord_16_t position, nv3_grobj_t grobj);
uint32_t nv3_render_get_vram_address_for_buffer(nv3_coord_16_t position, nv3_grobj_t grobj, uint32_t buffer);
/* Colour Conversion */
uint32_t nv3_render_get_palette_index(uint8_t index); // Get a colour for a palette index. (The colours are 24 bit RGB888 with a 0xFF alpha added for some purposes.)
@@ -43,7 +43,7 @@ uint32_t nv3_render_downconvert_color(nv3_grobj_t grobj, nv3_color_expanded_t co
void nv3_render_set_pattern_color(nv3_color_expanded_t pattern_colour, bool use_color1);
/* Primitives */
void nv3_render_rect(nv3_position_16_t position, nv3_size_16_t size, uint32_t color, nv3_grobj_t grobj); // Render an A (unclipped) GDI rect
void nv3_render_rect(nv3_coord_16_t position, nv3_coord_16_t size, uint32_t color, nv3_grobj_t grobj); // Render an A (unclipped) GDI rect
void nv3_render_rect_clipped(nv3_clip_16_t clip, uint32_t color, nv3_grobj_t grobj); // Render a B (clipped) GDI rect.
/* Chroma */

View File

@@ -834,7 +834,7 @@ extern const device_config_t nv3t_config[]; // Confi
// These are nvidia, licensed from weitek (25-63)
#define NV3_CRTC_REGISTER_RPC0 0x19 // What does this mean?
#define NV3_CRTC_REGISTER_RPC0 0x19 // 7:5 - [10:8] of CRTC. 4:0 - [20:16] of 21-bit display buffer address
#define NV3_CRTC_REGISTER_RPC1 0x1A // What does this mean?
#define NV3_CRTC_REGISTER_READ_BANK 0x1D
#define NV3_CRTC_REGISTER_WRITE_BANK 0x1E
@@ -1199,10 +1199,10 @@ typedef struct nv3_pgraph_s
uint32_t abs_uclip_ymin;
uint32_t abs_uclip_ymax;
// Canvas stuff
nv3_position_16_bigy_t src_canvas_min;
nv3_position_16_bigy_t src_canvas_max;
nv3_position_16_bigy_t dst_canvas_min;
nv3_position_16_bigy_t dst_canvas_max;
nv3_coord_16_bigy_t src_canvas_min;
nv3_coord_16_bigy_t src_canvas_max;
nv3_coord_16_bigy_t dst_canvas_min;
nv3_coord_16_bigy_t dst_canvas_max;
// Pattern stuff
nv3_color_expanded_t pattern_color_0_rgb; // ignore alpha
uint32_t pattern_color_0_alpha; // only 7:0 relevant
@@ -1224,13 +1224,13 @@ typedef struct nv3_pgraph_s
uint32_t notifier;
bool notify_pending; // Determines if a notification is pending.
/* Are these even used */
nv3_position_16_bigy_t clip0_min;
nv3_position_16_bigy_t clip0_max;
nv3_position_16_bigy_t clip1_min;
nv3_position_16_bigy_t clip1_max;
nv3_coord_16_bigy_t clip0_min;
nv3_coord_16_bigy_t clip0_max;
nv3_coord_16_bigy_t clip1_min;
nv3_coord_16_bigy_t clip1_max;
/* idk */
nv3_position_16_t clip_start; // Start of the clipping region
nv3_position_16_t clip_size; // Size of the clipping region.
nv3_coord_16_t clip_start; // Start of the clipping region
nv3_coord_16_t clip_size; // Size of the clipping region.
bool fifo_access; // Determines if PGRAPH can access PFIFO.
nv3_pgraph_status_t status; // Current status of the 3D engine.
uint32_t trapped_address;
@@ -1253,12 +1253,12 @@ typedef struct nv3_pgraph_s
struct nv3_object_class_00C win95_gdi_text;
/* These are here so we can hold the current state of the image draw */
uint32_t win95_gdi_text_bit_count;
nv3_position_16_t win95_gdi_text_current_position;
nv3_coord_16_t win95_gdi_text_current_position;
struct nv3_object_class_00D m2mf;
struct nv3_object_class_00E scaled_image_from_memory;
struct nv3_object_class_010 blit;
struct nv3_object_class_011 image;
nv3_position_16_t image_current_position; /* This is here so we can hold the current state of the image */
nv3_coord_16_t image_current_position; /* This is here so we can hold the current state of the image */
struct nv3_object_class_012 bitmap;
struct nv3_object_class_014 transfer2memory;
struct nv3_object_class_015 stretched_image_from_cpu;
@@ -1439,26 +1439,26 @@ typedef struct nv3_s
nv_base_t nvbase; // Base Nvidia structure
// Config
nv3_straps_t straps;
nv3_pci_config_t pci_config;
nv3_straps_t straps; // OEM Configuration
nv3_pci_config_t pci_config; // PCI Configuration
// Subsystems
nv3_pmc_t pmc; // Master Control
nv3_pfb_t pfb; // Framebuffer/VRAM
nv3_pbus_t pbus; // Bus Control
nv3_pfifo_t pfifo; // FIFO for command submission
nv3_pmc_t pmc; // Master Control
nv3_pfb_t pfb; // Framebuffer/VRAM
nv3_pbus_t pbus; // Bus Control
nv3_pfifo_t pfifo; // FIFO for command submission
nv3_pramdac_t pramdac; // RAMDAC (CLUT etc)
nv3_pgraph_t pgraph; // 2D/3D Graphics
nv3_pextdev_t pextdev; // Chip configuration
nv3_ptimer_t ptimer; // programmable interval timer
nv3_ramin_ramht_t ramht; // hashtable for PGRAPH objects
nv3_ramin_ramro_t ramro; // anti-fuckup mechanism for idiots who fucked up the FIFO submission
nv3_ramin_ramfc_t ramfc; // context for unused channels
nv3_ramin_ramau_t ramau; // auxillary weirdnes
nv3_ramin_t pramin; // Ram for INput of DMA objects. Very important!
nv3_pvideo_t pvideo; // Video overlay
nv3_pme_t pme; // Mediaport - external MPEG decoder and video interface
nv3_pramdac_t pramdac; // RAMDAC (CLUT etc)
nv3_pgraph_t pgraph; // 2D/3D Graphics
nv3_pextdev_t pextdev; // Chip configuration
nv3_ptimer_t ptimer; // programmable interval timer
nv3_ramin_ramht_t ramht; // hashtable for PGRAPH objects
nv3_ramin_ramro_t ramro; // anti-fuckup mechanism for idiots who fucked up the FIFO submission
nv3_ramin_ramfc_t ramfc; // context for unused channels
nv3_ramin_ramau_t ramau; // auxillary weirdnes
nv3_ramin_t pramin; // Ram for INput of DMA objects. Very important!
nv3_pvideo_t pvideo; // Video overlay
nv3_pme_t pme; // Mediaport - external MPEG decoder and video interface
//more here
} nv3_t;

View File

@@ -44,10 +44,10 @@ void nv3_class_007_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
// If the size is submitted, render it.
if (method_id & 0x04)
{
nv3->pgraph.rectangle.size[index].w = param & 0xFFFF;
nv3->pgraph.rectangle.size[index].h = (param >> 16) & 0xFFFF;
nv3->pgraph.rectangle.size[index].x = param & 0xFFFF;
nv3->pgraph.rectangle.size[index].y = (param >> 16) & 0xFFFF;
nv_log("Method Execution: Rect%d Size=%d,%d Color=0x%08x\n", index, nv3->pgraph.rectangle.size[index].w, nv3->pgraph.rectangle.size[index].h, nv3->pgraph.rectangle.color);
nv_log("Method Execution: Rect%d Size=%d,%d Color=0x%08x\n", index, nv3->pgraph.rectangle.size[index].x, nv3->pgraph.rectangle.size[index].y, nv3->pgraph.rectangle.color);
nv3_render_rect(nv3->pgraph.rectangle.position[index], nv3->pgraph.rectangle.size[index], nv3->pgraph.rectangle.color, grobj);
}

View File

@@ -60,11 +60,11 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
nv_log("Method Execution: GDI-C Color 0x%08x\n", nv3->pgraph.win95_gdi_text.color1_c);
break;
case NV3_W95TXT_C_CLIP_SIZE:
nv3->pgraph.win95_gdi_text.size_c.w = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_c.h = ((param >> 16) & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_c.x = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_c.y = ((param >> 16) & 0xFFFF);
nv3->pgraph.win95_gdi_text_bit_count = 0;
nv_log("Method Execution: GDI-C Size In %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_c.w, nv3->pgraph.win95_gdi_text.size_c.h);
nv_log("Method Execution: GDI-C Size In %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_c.x, nv3->pgraph.win95_gdi_text.size_c.y);
break;
case NV3_W95TXT_C_CLIP_POSITION:
nv3->pgraph.win95_gdi_text.point_c.x = (param & 0xFFFF);
@@ -104,14 +104,14 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
nv_log("Method Execution: GDI-D Color 0x%08x\n", nv3->pgraph.win95_gdi_text.color_a);
break;
case NV3_W95TXT_D_CLIP_SIZE_IN:
nv3->pgraph.win95_gdi_text.size_in_d.w = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_in_d.h = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: GDI-D Size In %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_in_d.w, nv3->pgraph.win95_gdi_text.size_in_d.h);
nv3->pgraph.win95_gdi_text.size_in_d.x = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_in_d.y = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: GDI-D Size In %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_in_d.x, nv3->pgraph.win95_gdi_text.size_in_d.y);
break;
case NV3_W95TXT_D_CLIP_SIZE_OUT:
nv3->pgraph.win95_gdi_text.size_out_d.w = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_out_d.h = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: GDI-D Size Out %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_out_d.w, nv3->pgraph.win95_gdi_text.size_out_d.h);
nv3->pgraph.win95_gdi_text.size_out_d.x = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_out_d.y = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: GDI-D Size Out %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_out_d.x, nv3->pgraph.win95_gdi_text.size_out_d.y);
break;
case NV3_W95TXT_D_CLIP_POSITION:
nv3->pgraph.win95_gdi_text.point_d.x = (param & 0xFFFF);
@@ -144,14 +144,14 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
nv_log("Method Execution: GDI-E Color1 0x%08x\n", nv3->pgraph.win95_gdi_text.color_a);
break;
case NV3_W95TXT_E_CLIP_SIZE_IN:
nv3->pgraph.win95_gdi_text.size_in_e.w = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_in_e.h = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: GDI-E Size In %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_in_e.w, nv3->pgraph.win95_gdi_text.size_in_e.h);
nv3->pgraph.win95_gdi_text.size_in_e.x = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_in_e.y = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: GDI-E Size In %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_in_e.x, nv3->pgraph.win95_gdi_text.size_in_e.y);
break;
case NV3_W95TXT_E_CLIP_SIZE_OUT:
nv3->pgraph.win95_gdi_text.size_out_e.w = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_out_e.h = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: GDI-E Size Out %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_out_e.w, nv3->pgraph.win95_gdi_text.size_out_e.h);
nv3->pgraph.win95_gdi_text.size_out_e.x = (param & 0xFFFF);
nv3->pgraph.win95_gdi_text.size_out_e.y = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: GDI-E Size Out %04x,%04x\n", nv3->pgraph.win95_gdi_text.size_out_e.x, nv3->pgraph.win95_gdi_text.size_out_e.y);
break;
case NV3_W95TXT_E_CLIP_POSITION:
nv3->pgraph.win95_gdi_text.point_e.x = (param & 0xFFFF);
@@ -173,11 +173,11 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
// If the size is submitted, render it.
if (method_id & 0x04)
{
nv3->pgraph.win95_gdi_text.rect_a_size[index].w = (param >> 16) & 0xFFFF;
nv3->pgraph.win95_gdi_text.rect_a_size[index].h = param & 0xFFFF;
nv3->pgraph.win95_gdi_text.rect_a_size[index].x = (param >> 16) & 0xFFFF;
nv3->pgraph.win95_gdi_text.rect_a_size[index].y = param & 0xFFFF;
nv_log("Method Execution: Rect GDI-A%d Size=%d,%d", index, nv3->pgraph.win95_gdi_text.rect_a_size[index].w,
nv3->pgraph.win95_gdi_text.rect_a_size[index].h);
nv_log("Method Execution: Rect GDI-A%d Size=%d,%d", index, nv3->pgraph.win95_gdi_text.rect_a_size[index].x,
nv3->pgraph.win95_gdi_text.rect_a_size[index].y);
nv3_render_rect(nv3->pgraph.win95_gdi_text.rect_a_position[index],
nv3->pgraph.win95_gdi_text.rect_a_size[index], nv3->pgraph.win95_gdi_text.color_a, grobj);
@@ -231,7 +231,7 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
/* Mammoth logger! */
nv_log("Method Execution: Rect GDI-C%d Data=%08x Size%04x,%04x Point%04x,%04x Color=%08x Clip Left=0x%04x Right=0x%04x Top=0x%04x Bottom=0x%04x",
index, param, nv3->pgraph.win95_gdi_text.size_c.w, nv3->pgraph.win95_gdi_text.size_c.h,
index, param, nv3->pgraph.win95_gdi_text.size_c.x, nv3->pgraph.win95_gdi_text.size_c.y,
nv3->pgraph.win95_gdi_text.point_c.x, nv3->pgraph.win95_gdi_text.point_c.y,
nv3->pgraph.win95_gdi_text.color1_c,
nv3->pgraph.win95_gdi_text.clip_c.left, nv3->pgraph.win95_gdi_text.clip_c.right,
@@ -249,8 +249,8 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
/* Mammoth logger! */
nv_log("Method Execution: Rect GDI-D%d Data=%08x SizeIn%04x,%04x SizeOut%04x,%04x Point%04x,%04x Color=%08x Clip Left=0x%04x Right=0x%04x Top=0x%04x Bottom=0x%04x",
index, param, nv3->pgraph.win95_gdi_text.size_in_d.w, nv3->pgraph.win95_gdi_text.size_in_d.h,
nv3->pgraph.win95_gdi_text.size_out_d.w, nv3->pgraph.win95_gdi_text.size_out_d.h,
index, param, nv3->pgraph.win95_gdi_text.size_in_d.x, nv3->pgraph.win95_gdi_text.size_in_d.y,
nv3->pgraph.win95_gdi_text.size_out_d.x, nv3->pgraph.win95_gdi_text.size_out_d.y,
nv3->pgraph.win95_gdi_text.point_d.x, nv3->pgraph.win95_gdi_text.point_d.y,
nv3->pgraph.win95_gdi_text.color1_d,
nv3->pgraph.win95_gdi_text.clip_d.left, nv3->pgraph.win95_gdi_text.clip_d.right,
@@ -268,8 +268,8 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
/* Mammoth logger! */
nv_log("Method Execution: Rect GDI-E%d Data=%08x SizeIn%04x,%04x SizeOut%04x,%04x Point%04x,%04x Color=%08x Clip Left=0x%04x Right=0x%04x Top=0x%04x Bottom=0x%04x",
index, param, nv3->pgraph.win95_gdi_text.size_in_e.w, nv3->pgraph.win95_gdi_text.size_in_e.h,
nv3->pgraph.win95_gdi_text.size_out_e.w, nv3->pgraph.win95_gdi_text.size_out_e.h,
index, param, nv3->pgraph.win95_gdi_text.size_in_e.x, nv3->pgraph.win95_gdi_text.size_in_e.y,
nv3->pgraph.win95_gdi_text.size_out_e.x, nv3->pgraph.win95_gdi_text.size_out_e.y,
nv3->pgraph.win95_gdi_text.point_e.x, nv3->pgraph.win95_gdi_text.point_e.y,
nv3->pgraph.win95_gdi_text.color1_e,
nv3->pgraph.win95_gdi_text.clip_e.left, nv3->pgraph.win95_gdi_text.clip_e.right, nv3->pgraph.win95_gdi_text.clip_e.top, nv3->pgraph.win95_gdi_text.clip_e.bottom);

View File

@@ -45,14 +45,9 @@ void nv3_class_010_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
break;
case NV3_BLIT_SIZE:
/* This is the last one*/
nv3->pgraph.blit.size.w = (param & 0xFFFF);
nv3->pgraph.blit.size.h = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: S2SB Size %d,%d grobj_0=0x%08x\n", nv3->pgraph.blit.size.w, nv3->pgraph.blit.size.h, grobj.grobj_0);
/* Some of these seem to have sizes of 0, so skip */
if (nv3->pgraph.blit.size.h == 0
&& nv3->pgraph.blit.size.w == 0)
return;
nv3->pgraph.blit.size.x = (param & 0xFFFF);
nv3->pgraph.blit.size.y = ((param >> 16) & 0xFFFF);
nv_log("Method Execution: S2SB Size %d,%d grobj_0=0x%08x\n", nv3->pgraph.blit.size.x, nv3->pgraph.blit.size.y, grobj.grobj_0);
nv3_render_blit_screen2screen(grobj);

View File

@@ -39,15 +39,15 @@ void nv3_class_011_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
break;
/* Seems to allow scaling of the bitblt. */
case NV3_IMAGE_SIZE:
nv3->pgraph.image.size.w = (param & 0xFFFF);
nv3->pgraph.image.size.h = (param >> 16);
nv_log("Method Execution: Image Size (Clip)=%d,%d\n", nv3->pgraph.image.size.w, nv3->pgraph.image.size.h);
nv3->pgraph.image.size.x = (param & 0xFFFF);
nv3->pgraph.image.size.y = (param >> 16);
nv_log("Method Execution: Image Size (Clip)=%d,%d\n", nv3->pgraph.image.size.x, nv3->pgraph.image.size.y);
break;
case NV3_IMAGE_SIZE_IN:
nv3->pgraph.image.size_in.w = (param & 0xFFFF);
nv3->pgraph.image.size_in.h = (param >> 16);
nv3->pgraph.image.size_in.x = (param & 0xFFFF);
nv3->pgraph.image.size_in.y = (param >> 16);
nv3->pgraph.image_current_position = nv3->pgraph.image.point;
nv_log("Method Execution: Image SizeIn=%d,%d\n", nv3->pgraph.image.size_in.w, nv3->pgraph.image.size_in.h);
nv_log("Method Execution: Image SizeIn=%d,%d\n", nv3->pgraph.image.size_in.x, nv3->pgraph.image.size_in.y);
break;
default:
if (method_id >= NV3_IMAGE_COLOR_START && method_id <= NV3_IMAGE_COLOR_END)

View File

@@ -271,7 +271,7 @@ uint8_t nv3_pci_read(int32_t func, int32_t addr, void* priv)
ret = (NV_PCI_DEVICE_NV3 >> 8);
break;
// various capabilities
// various capabilities enabled by default
// IO space enabled
// Memory space enabled
// Bus master enabled
@@ -281,7 +281,7 @@ uint8_t nv3_pci_read(int32_t func, int32_t addr, void* priv)
// 66Mhz FSB capable
case PCI_REG_COMMAND_L:
ret = nv3->pci_config.pci_regs[PCI_REG_COMMAND_L] ; // we actually respond to the fucking
ret = nv3->pci_config.pci_regs[PCI_REG_COMMAND_L];
break;
case PCI_REG_COMMAND_H:
@@ -536,7 +536,7 @@ void nv3_recalc_timings(svga_t* svga)
case NV3_CRTC_REGISTER_PIXELMODE_16BPP:
/* This is some sketchy shit that is an attempt at an educated guess
at pixel clock differences between 9x and NT only in 16bpp. If there is ever an error on 9x with "interlaced" looking graphics,
this is what's causing it. Possibly fucking *ReactOS* of all things */
this is what's causing it. Possibly fucking up *ReactOS* of all things */
if ((svga->crtc[NV3_CRTC_REGISTER_VRETRACESTART] >> 1) & 0x01)
svga->rowoffset += (svga->crtc[NV3_CRTC_REGISTER_RPC0] & 0xE0) << 2;
else

View File

@@ -34,10 +34,9 @@
void nv3_class_011_check_line_bounds(void)
{
uint32_t relative_x = nv3->pgraph.image_current_position.x - nv3->pgraph.image.point.x;
//uint32_t relative_y = nv3->pgraph.image_current_position.y - nv3->pgraph.image.point.y;
/* In theory, relative_y should never be exceeded...because it only submits enough pixels to render the image*/
if (relative_x >= nv3->pgraph.image.size_in.w)
/* In the case of class 0x11 there is no requirement to check for relative_y because we have exceeded the size of the image */
if (relative_x >= nv3->pgraph.image.size_in.x)
{
nv3->pgraph.image_current_position.y++;
nv3->pgraph.image_current_position.x = nv3->pgraph.image.point.x;
@@ -47,16 +46,13 @@ void nv3_class_011_check_line_bounds(void)
/* Renders an image from cpu */
void nv3_render_blit_image(uint32_t color, nv3_grobj_t grobj)
{
// shift left by 2 because it's 4 bits per size..
uint32_t current_buffer = (nv3->pgraph.context_switch >> NV3_PGRAPH_CONTEXT_SWITCH_SRC_BUFFER) & 0x03;
/* todo: a lot of stuff */
uint32_t pixel0 = 0, pixel1 = 0, pixel2 = 0, pixel3 = 0;
/* Some extra data is sent as padding, we need to clip it off using size_out */
uint16_t clip_x = nv3->pgraph.image.point.x + nv3->pgraph.image.size.w;
uint16_t clip_x = nv3->pgraph.image.point.x + nv3->pgraph.image.size.x;
/* we need to unpack them - IF THIS IS USED SOMEWHERE ELSE, DO SOMETHING ELSE WITH IT */
/* the reverse order is due to the endianness */
switch (nv3->nvbase.svga.bpp)
@@ -126,9 +122,9 @@ uint32_t nv3_s2sb_line_buffer[NV3_MAX_HORIZONTAL_SIZE*NV3_MAX_VERTICAL_SIZE] = {
void nv3_render_blit_screen2screen(nv3_grobj_t grobj)
{
if (nv3->pgraph.blit.size.w < NV3_MAX_HORIZONTAL_SIZE
&& nv3->pgraph.blit.size.h < NV3_MAX_VERTICAL_SIZE)
memset(&nv3_s2sb_line_buffer, 0x00, (sizeof(uint32_t) * nv3->pgraph.blit.size.h) * (sizeof(uint32_t) * nv3->pgraph.blit.size.w));
if (nv3->pgraph.blit.size.x < NV3_MAX_HORIZONTAL_SIZE
&& nv3->pgraph.blit.size.y < NV3_MAX_VERTICAL_SIZE)
memset(&nv3_s2sb_line_buffer, 0x00, (sizeof(uint32_t) * nv3->pgraph.blit.size.y) * (sizeof(uint32_t) * nv3->pgraph.blit.size.x));
/* First calculate our source and destination buffer */
uint32_t src_buffer = (grobj.grobj_0 >> NV3_PGRAPH_CONTEXT_SWITCH_SRC_BUFFER) & 0x03;
@@ -141,11 +137,11 @@ void nv3_render_blit_screen2screen(nv3_grobj_t grobj)
bool cross_buffer_blit = (nv3->pgraph.boffset[src_buffer] != nv3->pgraph.boffset[dst_buffer]);
nv3_position_16_t old_position = nv3->pgraph.blit.point_in;
nv3_position_16_t new_position = nv3->pgraph.blit.point_out;
nv3_coord_16_t old_position = nv3->pgraph.blit.point_in;
nv3_coord_16_t new_position = nv3->pgraph.blit.point_out;
/* Coordinates for copying an entire line at a time */
uint32_t buf_position = 0, vram_position = 0, size_x = nv3->pgraph.blit.size.w;
uint32_t buf_position = 0, vram_position = 0, size_x = nv3->pgraph.blit.size.x;
/* Read the old pixel into the line buffer
Assumption: All data is sent in an unpacked format. In the case of an NVIDIA GPU this means that all data is sent 32 bits at a time regardless of if
@@ -161,9 +157,9 @@ void nv3_render_blit_screen2screen(nv3_grobj_t grobj)
else if (nv3->nvbase.svga.bpp == 32)
size_x <<= 2;
for (int32_t y = 0; y < nv3->pgraph.blit.size.h; y++)
for (int32_t y = 0; y < nv3->pgraph.blit.size.y; y++)
{
buf_position = (nv3->pgraph.blit.size.w * y);
buf_position = (nv3->pgraph.blit.size.x * y);
/* shouldn't matter in non-wtf mode */
vram_position = nv3_render_get_vram_address_for_buffer(old_position, grobj, src_buffer);
@@ -173,9 +169,9 @@ void nv3_render_blit_screen2screen(nv3_grobj_t grobj)
}
/* simply write it all back to vram */
for (int32_t y = 0; y < nv3->pgraph.blit.size.h; y++)
for (int32_t y = 0; y < nv3->pgraph.blit.size.y; y++)
{
buf_position = (nv3->pgraph.blit.size.w * y);
buf_position = (nv3->pgraph.blit.size.x * y);
vram_position = nv3_render_get_vram_address_for_buffer(new_position, grobj, dst_buffer);
memcpy(&nv3->nvbase.svga.vram[vram_position], &nv3_s2sb_line_buffer[buf_position], size_x);
@@ -187,8 +183,8 @@ void nv3_render_blit_screen2screen(nv3_grobj_t grobj)
We also need to update all of the areas of the screen that moved.
*/
nv3_position_16_t blit_position = {0};
nv3_size_16_t blit_size = {0};
nv3_coord_16_t blit_position = {0};
nv3_coord_16_t blit_size = {0};
/* Change the smallest area of the screen that moved */
@@ -200,18 +196,18 @@ void nv3_render_blit_screen2screen(nv3_grobj_t grobj)
else
{
if (nv3->pgraph.blit.point_out.x > nv3->pgraph.blit.point_in.x)
blit_size.w = (nv3->pgraph.blit.point_out.x - nv3->pgraph.blit.point_in.x) + nv3->pgraph.blit.size.w;
blit_size.x = (nv3->pgraph.blit.point_out.x - nv3->pgraph.blit.point_in.x) + nv3->pgraph.blit.size.x;
else if (nv3->pgraph.blit.point_out.x < nv3->pgraph.blit.point_in.x)
blit_size.w = (nv3->pgraph.blit.point_in.x - nv3->pgraph.blit.point_out.x) + nv3->pgraph.blit.size.w;
blit_size.x = (nv3->pgraph.blit.point_in.x - nv3->pgraph.blit.point_out.x) + nv3->pgraph.blit.size.x;
else
blit_size.w = nv3->pgraph.blit.size.w;
blit_size.x = nv3->pgraph.blit.size.x;
if (nv3->pgraph.blit.point_out.y > nv3->pgraph.blit.point_in.y)
blit_size.h = (nv3->pgraph.blit.point_out.y - nv3->pgraph.blit.point_in.y) + nv3->pgraph.blit.size.h;
blit_size.y = (nv3->pgraph.blit.point_out.y - nv3->pgraph.blit.point_in.y) + nv3->pgraph.blit.size.y;
else if (nv3->pgraph.blit.point_out.y < nv3->pgraph.blit.point_in.y)
blit_size.h = (nv3->pgraph.blit.point_in.y - nv3->pgraph.blit.point_out.y) + nv3->pgraph.blit.size.h;
blit_size.y = (nv3->pgraph.blit.point_in.y - nv3->pgraph.blit.point_out.y) + nv3->pgraph.blit.size.y;
else
blit_size.h = nv3->pgraph.blit.size.h;
blit_size.y = nv3->pgraph.blit.size.y;
if (nv3->pgraph.blit.point_out.x > nv3->pgraph.blit.point_in.x)
blit_position.x = nv3->pgraph.blit.point_in.x;

View File

@@ -31,10 +31,10 @@
#include <86box/utils/video_stdlib.h>
/* Functions only used in this translation unit */
void nv3_render_8bpp(nv3_position_16_t position, nv3_size_16_t size, nv3_grobj_t grobj, bool use_destination_buffer);
void nv3_render_15bpp(nv3_position_16_t position, nv3_size_16_t size, nv3_grobj_t grobj, bool use_destination_buffer);
void nv3_render_16bpp(nv3_position_16_t position, nv3_size_16_t size, nv3_grobj_t grobj, bool use_destination_buffer);
void nv3_render_32bpp(nv3_position_16_t position, nv3_size_16_t size, nv3_grobj_t grobj, bool use_destination_buffer);
void nv3_render_8bpp(nv3_coord_16_t position, nv3_coord_16_t size, nv3_grobj_t grobj, bool use_destination_buffer);
void nv3_render_15bpp(nv3_coord_16_t position, nv3_coord_16_t size, nv3_grobj_t grobj, bool use_destination_buffer);
void nv3_render_16bpp(nv3_coord_16_t position, nv3_coord_16_t size, nv3_grobj_t grobj, bool use_destination_buffer);
void nv3_render_32bpp(nv3_coord_16_t position, nv3_coord_16_t size, nv3_grobj_t grobj, bool use_destination_buffer);
/* Expand a colour.
NOTE: THE GPU INTERNALLY OPERATES ON RGB10!!!!!!!!!!!
@@ -229,7 +229,7 @@ void nv3_render_set_pattern_color(nv3_color_expanded_t pattern_colour, bool use_
}
/* Combine the current buffer with the pitch to get the address in the framebuffer to draw from for a given position. */
uint32_t nv3_render_get_vram_address(nv3_position_16_t position, nv3_grobj_t grobj)
uint32_t nv3_render_get_vram_address(nv3_coord_16_t position, nv3_grobj_t grobj)
{
uint32_t vram_x = position.x;
uint32_t vram_y = position.y;
@@ -260,7 +260,7 @@ uint32_t nv3_render_get_vram_address(nv3_position_16_t position, nv3_grobj_t gro
/* Combine the current buffer with the pitch to get the address in the video ram for a specific position relative to a specific framebuffer */
uint32_t nv3_render_get_vram_address_for_buffer(nv3_position_16_t position, nv3_grobj_t grobj, uint32_t buffer)
uint32_t nv3_render_get_vram_address_for_buffer(nv3_coord_16_t position, nv3_grobj_t grobj, uint32_t buffer)
{
uint32_t vram_x = position.x;
uint32_t vram_y = position.y;
@@ -289,9 +289,9 @@ uint32_t nv3_render_get_vram_address_for_buffer(nv3_position_16_t position, nv3_
}
/* Convert a dumb framebuffer address to a position. No buffer setup or anything, but just start at 0,0 for address 0. */
nv3_position_16_t nv3_render_get_dfb_position(uint32_t vram_address)
nv3_coord_16_t nv3_render_get_dfb_position(uint32_t vram_address)
{
nv3_position_16_t pos = {0};
nv3_coord_16_t pos = {0};
uint32_t pitch = nv3->nvbase.svga.hdisp;
@@ -321,7 +321,7 @@ nv3_position_16_t nv3_render_get_dfb_position(uint32_t vram_address)
}
/* Read an 8bpp pixel from the framebuffer. */
uint8_t nv3_render_read_pixel_8(nv3_position_16_t position, nv3_grobj_t grobj)
uint8_t nv3_render_read_pixel_8(nv3_coord_16_t position, nv3_grobj_t grobj)
{
// hope you call it with the right bit
uint32_t vram_address = nv3_render_get_vram_address(position, grobj);
@@ -330,7 +330,7 @@ uint8_t nv3_render_read_pixel_8(nv3_position_16_t position, nv3_grobj_t grobj)
}
/* Read an 16bpp pixel from the framebuffer. */
uint16_t nv3_render_read_pixel_16(nv3_position_16_t position, nv3_grobj_t grobj)
uint16_t nv3_render_read_pixel_16(nv3_coord_16_t position, nv3_grobj_t grobj)
{
// hope you call it with the right bit
uint32_t vram_address = nv3_render_get_vram_address(position, grobj);
@@ -342,7 +342,7 @@ uint16_t nv3_render_read_pixel_16(nv3_position_16_t position, nv3_grobj_t grobj)
}
/* Read an 16bpp pixel from the framebuffer. */
uint32_t nv3_render_read_pixel_32(nv3_position_16_t position, nv3_grobj_t grobj)
uint32_t nv3_render_read_pixel_32(nv3_coord_16_t position, nv3_grobj_t grobj)
{
// hope you call it with the right bit
uint32_t vram_address = nv3_render_get_vram_address(position, grobj);
@@ -354,16 +354,12 @@ uint32_t nv3_render_read_pixel_32(nv3_position_16_t position, nv3_grobj_t grobj)
}
/* Plots a pixel. */
void nv3_render_write_pixel(nv3_position_16_t position, uint32_t color, nv3_grobj_t grobj)
void nv3_render_write_pixel(nv3_coord_16_t position, uint32_t color, nv3_grobj_t grobj)
{
// PFB_0 is always set to hardcoded "NO_TILING" value of 0x1114.
// It seems, you are meant to
/* put this here for debugging + it may be needed later. */
#ifdef DEBUG
uint8_t color_format_object = (grobj.grobj_0 >> NV3_PGRAPH_CONTEXT_SWITCH_COLOR_FORMAT) & 0x07;
#endif
bool alpha_enabled = (grobj.grobj_0 >> NV3_PGRAPH_CONTEXT_SWITCH_ALPHA) & 0x01;
uint32_t framebuffer_bpp = nv3->nvbase.svga.bpp; // maybe y16 too?z
@@ -489,8 +485,8 @@ void nv3_render_write_pixel(nv3_position_16_t position, uint32_t color, nv3_grob
}
/* Go write the pixel */
nv3_size_16_t size = {0};
size.w = size.h = 1;
nv3_coord_16_t size = {0};
size.x = size.y = 1;
nv3_render_current_bpp(&nv3->nvbase.svga, position, size, grobj, true, false);
}
@@ -529,10 +525,10 @@ void nv3_render_ensure_screen_size(void)
/* Blit to the monitor from DFB, 8bpp */
void nv3_render_current_bpp_dfb_8(uint32_t address)
{
nv3_size_16_t size = {0};
size.w = size.h = 1;
nv3_coord_16_t size = {0};
size.x = size.y = 1;
nv3_position_16_t pos = nv3_render_get_dfb_position(address);
nv3_coord_16_t pos = nv3_render_get_dfb_position(address);
uint32_t* p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
uint32_t data = *(uint32_t*)&(nv3->nvbase.svga.vram[address]);
@@ -543,10 +539,10 @@ void nv3_render_current_bpp_dfb_8(uint32_t address)
/* Blit to the monitor from DFB, 15/16bpp */
void nv3_render_current_bpp_dfb_16(uint32_t address)
{
nv3_size_16_t size = {0};
size.w = size.h = 1;
nv3_coord_16_t size = {0};
size.x = size.y = 1;
nv3_position_16_t pos = nv3_render_get_dfb_position(address);
nv3_coord_16_t pos = nv3_render_get_dfb_position(address);
uint32_t* p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
uint32_t data = *(uint32_t*)&(nv3->nvbase.svga.vram[address]);
@@ -564,10 +560,10 @@ void nv3_render_current_bpp_dfb_16(uint32_t address)
/* Blit to the monitor from DFB, 32bpp */
void nv3_render_current_bpp_dfb_32(uint32_t address)
{
nv3_size_16_t size = {0};
size.w = size.h = 1;
nv3_coord_16_t size = {0};
size.x = size.y = 1;
nv3_position_16_t pos = nv3_render_get_dfb_position(address);
nv3_coord_16_t pos = nv3_render_get_dfb_position(address);
uint32_t data = *(uint32_t*)&(nv3->nvbase.svga.vram[address]);
@@ -592,7 +588,7 @@ void nv3_render_current_bpp_dfb_32(uint32_t address)
/* Blit to the monitor from GPU, current bpp */
void nv3_render_current_bpp(svga_t *svga, nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t grobj, bool run_render_check, bool use_destination_buffer)
void nv3_render_current_bpp(svga_t *svga, nv3_coord_16_t pos, nv3_coord_16_t size, nv3_grobj_t grobj, bool run_render_check, bool use_destination_buffer)
{
/* Ensure that we are in the correct mode. Modified SVGA core code */
nv3_render_ensure_screen_size();
@@ -647,7 +643,7 @@ void nv3_render_current_bpp(svga_t *svga, nv3_position_16_t pos, nv3_size_16_t s
Blit a certain region from the (destination buffer base + (position in vram)) to the 86Box monitor, indexed 8 bits per pixel format
*/
void nv3_render_8bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t grobj, bool use_destination_buffer)
void nv3_render_8bpp(nv3_coord_16_t pos, nv3_coord_16_t size, nv3_grobj_t grobj, bool use_destination_buffer)
{
if (!nv3)
return;
@@ -659,7 +655,7 @@ void nv3_render_8bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t grob
p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
for (uint32_t y = 0; y < size.h; y++)
for (uint32_t y = 0; y < size.y; y++)
{
/* re-set the vram address because we are basically "jumping" halfway across a line here */
if (use_destination_buffer)
@@ -667,7 +663,7 @@ void nv3_render_8bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t grob
else
vram_base = nv3_render_get_vram_address(pos, grobj) & nv3->nvbase.svga.vram_display_mask;
for (uint32_t x = 0; x < size.w; x++)
for (uint32_t x = 0; x < size.x; x++)
{
p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
data = *(uint32_t*)&nv3->nvbase.svga.vram[vram_base];
@@ -688,7 +684,7 @@ void nv3_render_8bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t grob
Blit a certain region from the (destination buffer base + (position in vram)) to the 86Box monitor, 15 bits per pixel format
*/
void nv3_render_15bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t grobj, bool use_destination_buffer)
void nv3_render_15bpp(nv3_coord_16_t pos, nv3_coord_16_t size, nv3_grobj_t grobj, bool use_destination_buffer)
{
if (!nv3)
return;
@@ -700,7 +696,7 @@ void nv3_render_15bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t gro
p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
for (uint32_t y = 0; y < size.h; y++)
for (uint32_t y = 0; y < size.y; y++)
{
/* re-set the vram address because we are basically "jumping" halfway across a line here */
if (use_destination_buffer)
@@ -708,7 +704,7 @@ void nv3_render_15bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t gro
else
vram_base = nv3_render_get_vram_address(pos, grobj) & nv3->nvbase.svga.vram_display_mask;
for (uint32_t x = 0; x < size.w; x++)
for (uint32_t x = 0; x < size.x; x++)
{
p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
data = *(uint32_t*)&nv3->nvbase.svga.vram[vram_base];
@@ -729,7 +725,7 @@ void nv3_render_15bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t gro
Blit a certain region from the (destination buffer base + (position in vram)) to the 86Box monitor, 16 bits per pixel format
*/
void nv3_render_16bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t grobj, bool use_destination_buffer)
void nv3_render_16bpp(nv3_coord_16_t pos, nv3_coord_16_t size, nv3_grobj_t grobj, bool use_destination_buffer)
{
if (!nv3)
return;
@@ -741,7 +737,7 @@ void nv3_render_16bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t gro
p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
for (uint32_t y = 0; y < size.h; y++)
for (uint32_t y = 0; y < size.y; y++)
{
/* re-set the vram address because we are basically "jumping" halfway across a line here */
if (use_destination_buffer)
@@ -749,7 +745,7 @@ void nv3_render_16bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t gro
else
vram_base = nv3_render_get_vram_address(pos, grobj) & nv3->nvbase.svga.vram_display_mask;
for (uint32_t x = 0; x < size.w; x++)
for (uint32_t x = 0; x < size.x; x++)
{
p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
data = *(uint32_t*)&nv3->nvbase.svga.vram[vram_base];
@@ -770,7 +766,7 @@ void nv3_render_16bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t gro
Blit a certain region from the (destination buffer base + (position in vram)) to the 86Box monitor, 32 bits per pixel format
*/
void nv3_render_32bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t grobj, bool use_destination_buffer)
void nv3_render_32bpp(nv3_coord_16_t pos, nv3_coord_16_t size, nv3_grobj_t grobj, bool use_destination_buffer)
{
if (!nv3)
return;
@@ -782,7 +778,7 @@ void nv3_render_32bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t gro
p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
for (uint32_t y = 0; y < size.h; y++)
for (uint32_t y = 0; y < size.y; y++)
{
/* re-set the vram address because we are basically "jumping" halfway across a line here */
if (use_destination_buffer)
@@ -790,7 +786,7 @@ void nv3_render_32bpp(nv3_position_16_t pos, nv3_size_16_t size, nv3_grobj_t gro
else
vram_base = nv3_render_get_vram_address(pos, grobj) & nv3->nvbase.svga.vram_display_mask;
for (uint32_t x = 0; x < size.w; x++)
for (uint32_t x = 0; x < size.x; x++)
{
p = &nv3->nvbase.svga.monitor->target_buffer->line[pos.y][pos.x];
data = *(uint32_t*)&nv3->nvbase.svga.vram[vram_base];

View File

@@ -29,15 +29,15 @@
#include <86box/nv/vid_nv3.h>
#include <86box/utils/video_stdlib.h>
void nv3_render_rect(nv3_position_16_t position, nv3_size_16_t size, uint32_t color, nv3_grobj_t grobj)
void nv3_render_rect(nv3_coord_16_t position, nv3_coord_16_t size, uint32_t color, nv3_grobj_t grobj)
{
nv3_position_16_t current_pos = {0};
nv3_coord_16_t current_pos = {0};
for (int32_t y = position.y; y < (position.y + size.h); y++)
for (int32_t y = position.y; y < (position.y + size.y); y++)
{
current_pos.y = y;
for (int32_t x = position.x; x < (position.x + size.w); x++)
for (int32_t x = position.x; x < (position.x + size.x); x++)
{
current_pos.x = x;
@@ -49,7 +49,7 @@ void nv3_render_rect(nv3_position_16_t position, nv3_size_16_t size, uint32_t co
/* Render GDI-B clipped rectangle */
void nv3_render_rect_clipped(nv3_clip_16_t clip, uint32_t color, nv3_grobj_t grobj)
{
nv3_position_16_t current_pos = {0};
nv3_coord_16_t current_pos = {0};
for (int32_t y = clip.top; y < clip.bottom; y++)
{
@@ -89,8 +89,8 @@ void nv3_render_gdi_transparent_bitmap_blit(bool bit, bool clip, uint32_t color,
Also clip if we are outside of the SIZE_OUT range
We only need to do this in one direction just to get rid of the crud sent by NV
*/
uint32_t clip_x = nv3->pgraph.win95_gdi_text.point_d.x + (nv3->pgraph.win95_gdi_text.size_out_d.w);
uint32_t clip_y = nv3->pgraph.win95_gdi_text.point_d.y + (nv3->pgraph.win95_gdi_text.size_out_d.h);
uint32_t clip_x = nv3->pgraph.win95_gdi_text.point_d.x + (nv3->pgraph.win95_gdi_text.size_out_d.x);
uint32_t clip_y = nv3->pgraph.win95_gdi_text.point_d.y + (nv3->pgraph.win95_gdi_text.size_out_d.y);
if (nv3->pgraph.win95_gdi_text_current_position.x >= clip_x
|| nv3->pgraph.win95_gdi_text_current_position.y >= clip_y)
@@ -106,7 +106,7 @@ void nv3_render_gdi_transparent_bitmap_blit(bool bit, bool clip, uint32_t color,
Because we check the bits in reverse, we go forward (bits 7,6,5 were set for a 1x3 bitmap)
*/
uint32_t end_x = (clip) ? nv3->pgraph.win95_gdi_text.point_d.x + nv3->pgraph.win95_gdi_text.size_in_d.w : nv3->pgraph.win95_gdi_text.point_c.x + nv3->pgraph.win95_gdi_text.size_c.w;
uint32_t end_x = (clip) ? nv3->pgraph.win95_gdi_text.point_d.x + nv3->pgraph.win95_gdi_text.size_in_d.x : nv3->pgraph.win95_gdi_text.point_c.x + nv3->pgraph.win95_gdi_text.size_c.x;
nv3->pgraph.win95_gdi_text_current_position.x++;
@@ -135,7 +135,7 @@ void nv3_render_gdi_transparent_bitmap(bool clip, uint32_t color, uint32_t bitma
We store a global bit count for this purpose.
*/
uint32_t bitmap_size = (clip) ? nv3->pgraph.win95_gdi_text.size_in_d.w * nv3->pgraph.win95_gdi_text.size_in_d.h : nv3->pgraph.win95_gdi_text.size_c.w * nv3->pgraph.win95_gdi_text.size_c.h;
uint32_t bitmap_size = (clip) ? nv3->pgraph.win95_gdi_text.size_in_d.x * nv3->pgraph.win95_gdi_text.size_in_d.y : nv3->pgraph.win95_gdi_text.size_c.x * nv3->pgraph.win95_gdi_text.size_c.y;
uint32_t bits_remaining_in_bitmap = bitmap_size - nv3->pgraph.win95_gdi_text_bit_count;
/* we have to interpret every bit in reverse bit order but in the right byte order */
@@ -231,8 +231,8 @@ void nv3_render_gdi_1bpp_bitmap_blit(bool bit, uint32_t color0, uint32_t color1,
Also clip if we are outside of the SIZE_OUT range
We only need to do this in one direction just to get rid of the crud sent by NV
*/
uint32_t clip_x = nv3->pgraph.win95_gdi_text.point_e.x + (nv3->pgraph.win95_gdi_text.size_out_e.w);
uint32_t clip_y = nv3->pgraph.win95_gdi_text.point_e.y + (nv3->pgraph.win95_gdi_text.size_out_e.h);
uint32_t clip_x = nv3->pgraph.win95_gdi_text.point_e.x + (nv3->pgraph.win95_gdi_text.size_out_e.x);
uint32_t clip_y = nv3->pgraph.win95_gdi_text.point_e.y + (nv3->pgraph.win95_gdi_text.size_out_e.y);
if (nv3->pgraph.win95_gdi_text_current_position.x >= clip_x
|| nv3->pgraph.win95_gdi_text_current_position.y >= clip_y)
@@ -253,7 +253,7 @@ void nv3_render_gdi_1bpp_bitmap_blit(bool bit, uint32_t color0, uint32_t color1,
Because we check the bits in reverse, we go forward (bits 7,6,5 were set for a 1x3 bitmap)
*/
uint32_t end_x = nv3->pgraph.win95_gdi_text.point_e.x + nv3->pgraph.win95_gdi_text.size_in_e.w;
uint32_t end_x = nv3->pgraph.win95_gdi_text.point_e.x + nv3->pgraph.win95_gdi_text.size_in_e.x;
nv3->pgraph.win95_gdi_text_current_position.x++;
@@ -278,7 +278,7 @@ void nv3_render_gdi_1bpp_bitmap(uint32_t color0, uint32_t color1, uint32_t bitma
We store a global bit count for this purpose.
*/
uint32_t bitmap_size = nv3->pgraph.win95_gdi_text.size_in_e.w * nv3->pgraph.win95_gdi_text.size_in_e.h;
uint32_t bitmap_size = nv3->pgraph.win95_gdi_text.size_in_e.x * nv3->pgraph.win95_gdi_text.size_in_e.y;
uint32_t bits_remaining_in_bitmap = bitmap_size - nv3->pgraph.win95_gdi_text_bit_count;
/* we have to interpret every bit in reverse bit order but in the right byte order */

View File

@@ -380,12 +380,11 @@ void nv3_pfifo_trigger_dma_if_required(void)
/*
page size is 0x1000
*/
uint32_t final_address = final_page_base + (tlb_pt_entry << 10); //x86 page size is 0x1000
uint32_t final_address = final_page_base + (tlb_pt_entry << 10) + where_to_send; //x86 page size is 0x1000 (maybe rsh where_to_send by 2)
nv_log_verbose_only("DMA Engine: DMA to %08x length=%08x", final_address, bytes_to_send);
//dma_bm_write()
//-dma_bm_write()
}
//we're done
@@ -576,7 +575,7 @@ void nv3_pfifo_write(uint32_t address, uint32_t val)
nv3->pfifo.runout_put = val & (NV3_RAMIN_RAMRO_SIZE_1 - 0x07);
break;
/* Cache1 is handled below */
/* Cache1 Context is handled below */
case NV3_PFIFO_CACHE0_CTX:
nv3->pfifo.cache0_settings.context[0] = val;
break;