Write the pullers and some graphics object skeletons.

This commit is contained in:
starfrost013
2025-02-01 22:30:46 +00:00
parent 1e8c804cfd
commit 3a77b631b4
29 changed files with 683 additions and 46 deletions

View File

@@ -50,7 +50,7 @@ typedef struct nv3_class_ctx_switch_method_s
uint32_t data;
uint16_t instance;
uint8_t channel_id : 6;
uint8_t channel : 6;
uint16_t reserved : 9;
bool reset_if_volatile; // ????
} set_notify_ctx_dma; // Set notifier context for DMA (context switch)
@@ -1085,5 +1085,63 @@ typedef struct nv3_object_class_01C
uint8_t reserved3[0x1C3F];
} nv3_image_in_memory_t;
// See envytools. This is where we finally end up after this mess, it allows parameters to be passed to the methods.
typedef struct nv3_grobj_s
{
uint32_t grobj_0;
uint32_t grobj_1;
uint32_t grobj_2;
uint32_t grobj_3;
} nv3_grobj_t;
// TODO: PATCHCORDS!!!! TO LINK ALL OF THIS TOGETHER!!!
#pragma pack(pop) // return packing to whatever it was before this disaster
#pragma pack(pop) // return packing to whatever it was before this disaster
// Class methods
void nv3_generic_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_001_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_002_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_003_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_004_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_005_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_006_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_007_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_008_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_008_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_009_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_00a_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_00b_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_00c_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_00d_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_00e_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_010_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_011_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_012_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_014_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_015_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_017_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_018_method(uint32_t method_id, nv3_grobj_t grobj);
void nv3_class_01c_method(uint32_t method_id, nv3_grobj_t grobj);
// This area is used for holding universal representations of the U* registers...
extern struct nv3_object_class_001 nv3_beta_factor;
extern struct nv3_object_class_002 nv3_rop;
extern struct nv3_object_class_003 nv3_chroma_key;
extern struct nv3_object_class_004 nv3_plane_mask;
extern struct nv3_object_class_005 nv3_clipping_rectangle;
extern struct nv3_object_class_006 nv3_pattern;
extern struct nv3_object_class_007 nv3_triangle;
extern struct nv3_object_class_008 nv3_point;
extern struct nv3_object_class_009 nv3_line;
extern struct nv3_object_class_00a nv3_lin;
extern struct nv3_object_class_00b nv3_triangle;
extern struct nv3_object_class_00c nv3_win95_gdi_text;
extern struct nv3_object_class_00d nv3_m2mf;
extern struct nv3_object_class_00e nv3_scaled_image_from_memory;
extern struct nv3_object_class_010 nv3_blit;
extern struct nv3_object_class_011 nv3_image;
extern struct nv3_object_class_012 nv3_bitmap;
extern struct nv3_object_class_014 nv3_transfer2memory;
extern struct nv3_object_class_015 nv3_stretched_image_from_cpu;
extern struct nv3_object_class_017 nv3_d3d5_tri;
extern struct nv3_object_class_018 nv3_point_zeta_buffer;
extern struct nv3_object_class_01c nv3_image_in_memory;

View File

@@ -41,7 +41,7 @@ extern const device_config_t nv3_config[];
#define NV3_DMA_CHANNELS 8
#define NV3_DMA_SUBCHANNELS_PER_CHANNEL 8
#define NV3_86BOX_TIMER_SYSTEM_FIX_QUOTIENT 10 // The amount by which we have to ration out the memory clock because it's not fast enough...
#define NV3_86BOX_TIMER_SYSTEM_FIX_QUOTIENT 1 // The amount by which we have to ration out the memory clock because it's not fast enough...
// Multiply by this value to get the real clock speed.
#define NV3_LAST_VALID_GRAPHICS_OBJECT_ID 0x1F
@@ -298,7 +298,7 @@ extern const device_config_t nv3_config[];
//todo: merge stuff
#define NV3_PFIFO_CACHE1_PULLER_CONTROL_ENABLED 0
#define NV3_PFIFO_CACHE1_PULLER_CONTROL_HASH_FAILURE 4
#define NV3_PFIFO_CACHE1_PULLER_CONTROL_SOFTWARE_METHOD 8 // 0=software, 1=hardware
#define NV3_PFIFO_CACHE1_PULLER_CONTROL_SOFTWARE_METHOD 8 // 0=software, 1=hardware
#define NV3_PFIFO_CACHE1_PULLER_STATE1 0x3250
#define NV3_PFIFO_CACHE1_PULLER_CTX_IS_DIRTY 4
#define NV3_PFIFO_CACHE1_GET 0x3270
@@ -792,7 +792,7 @@ typedef struct nv3_pfifo_cache_s
bool access_enabled; // Can we even access this cache?
uint8_t put_address; // Trigger a DMA into the value you put here.
uint8_t get_address; // Trigger a DMA from the value you put here into where you were going.
uint8_t channel_id; // The DMA channel ID of this cache.
uint8_t channel; // The DMA channel ID of this cache.
uint32_t status;
uint32_t puller_control;
uint32_t control;
@@ -821,7 +821,7 @@ typedef struct nv3_pfifo_cache_s
typedef struct nv3_pfifo_cache_entry_s
{
uint8_t subchannel_id : 3;
uint8_t subchannel : 3;
uint16_t method : 11; // method id depending on class (offset from entry channel start in ramin)
uint32_t data; // is this the context
@@ -845,7 +845,7 @@ typedef struct nv3_pfifo_s
nv3_pfifo_cache_t cache0_settings;
nv3_pfifo_cache_t cache1_settings;
nv3_pfifo_cache_entry_t cache0_entries[1];
nv3_pfifo_cache_entry_t cache0_entry; // It only has 1 entry
nv3_pfifo_cache_entry_t cache1_entries[NV3_PFIFO_CACHE1_SIZE_MAX]; // ONLY 32 USED ON REVISION A/B CARDS
@@ -1080,7 +1080,7 @@ typedef struct nv3_ramin_context_s
struct
{
bool reserved : 1;
uint8_t channel_id : 7;
uint8_t channel : 7;
bool is_rendering : 1;
uint8_t class_id : 7;
uint16_t ramin_offset;
@@ -1238,6 +1238,9 @@ bool nv3_ramin_arbitrate_write(uint32_t address, uint32_t value); /
// RAMIN functions
uint32_t nv3_ramht_hash(uint32_t name, uint32_t channel);
bool nv3_ramin_find_object(uint32_t name, uint32_t cache_num, uint32_t channel_id, uint32_t subchannel_id);
#ifndef RELEASE_BUILD
void nv3_debug_ramin_print_context_info(uint32_t name, nv3_ramin_context_t context);
#endif
uint32_t nv3_ramfc_read(uint32_t address);
void nv3_ramfc_write(uint32_t address, uint32_t value);

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_001 beta_factor;
void nv3_class_001_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_002 nv3_rop;
void nv3_class_002_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_003 nv3_chroma_key;
void nv3_class_003_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_004 nv3_plane_mask;
void nv3_class_004_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,24 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_005 nv3_clipping_rectangle;
void nv3_class_005_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_006 nv3_pattern;
void nv3_class_006_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_007 nv3_rectangle;
void nv3_class_007_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_008 nv3_point;
void nv3_class_008_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_009 nv3_line;
void nv3_class_009_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,26 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_00a nv3_lin;
void nv3_class_00a_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_00b nv3_triangle;
void nv3_class_00b_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_00c nv3_win95_gdi_text;
void nv3_class_00c_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_00d nv3_m2mf;
void nv3_class_00d_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_00e nv3_scaled_image_from_mem;
void nv3_class_00e_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_010 nv3_blit;
void nv3_class_010_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_011 nv3_image;
void nv3_class_011_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,26 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_012 nv3_bitmap;
void nv3_class_012_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,26 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_014 nv3_transfer2memory;
void nv3_class_014_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -6,11 +6,32 @@
*
* This file is part of the 86Box distribution.
*
* NV3: Methods for class 0x15 (stretched image to memory)
* NV3: Methods for class 0x15 (stretched image from cpu to memory)
*
*
*
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_014 nv3_stretched_image_from_cpu;
void nv3_class_015_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_017 nv3_d3d5_tri;
void nv3_class_017_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_018 nv3_d3d5_point_zeta_buffer;
void nv3_class_018_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -13,4 +13,25 @@
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
struct nv3_object_class_01c nv3_image_in_memory;
void nv3_class_01c_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -64,5 +64,4 @@ const char* nv3_class_names[] =
"NV3 INVALID class 0x1D",
"NV3 INVALID class 0x1E",
"NV3 INVALID class 0x1F",
};

View File

@@ -0,0 +1,35 @@
/*
* 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.
*
* NV3: Methods shared across multiple classes
*
*
*
* Authors: Connor Hyde, <mario64crashed@gmail.com> I need a better email address ;^)
*
* Copyright 2024-2025 Connor Hyde
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box/86box.h>
#include <86Box/device.h>
#include <86Box/mem.h>
#include <86box/pci.h>
#include <86Box/rom.h>
#include <86Box/video.h>
#include <86Box/nv/vid_nv.h>
#include <86Box/nv/vid_nv3.h>
#include <86box/nv/classes/vid_nv3_classes.h>
void nv3_generic_method(uint32_t method_id, nv3_grobj_t grobj)
{
}

View File

@@ -152,10 +152,10 @@ uint32_t nv3_pfifo_read(uint32_t address)
ret = nv3->pfifo.cache1_settings.access_enabled;
break;
case NV3_PFIFO_CACHE0_PUSH_CHANNEL_ID:
ret = nv3->pfifo.cache0_settings.channel_id;
ret = nv3->pfifo.cache0_settings.channel;
break;
case NV3_PFIFO_CACHE1_PUSH_CHANNEL_ID:
ret = nv3->pfifo.cache1_settings.channel_id;
ret = nv3->pfifo.cache1_settings.channel;
break;
case NV3_PFIFO_CACHE0_STATUS:
uint32_t ret = 0x00;
@@ -351,10 +351,10 @@ void nv3_pfifo_write(uint32_t address, uint32_t value)
nv3->pfifo.cache1_settings.access_enabled = value;
break;
case NV3_PFIFO_CACHE0_PUSH_CHANNEL_ID:
nv3->pfifo.cache0_settings.channel_id = value;
nv3->pfifo.cache0_settings.channel = value;
break;
case NV3_PFIFO_CACHE1_PUSH_CHANNEL_ID:
nv3->pfifo.cache1_settings.channel_id = value;
nv3->pfifo.cache1_settings.channel = value;
break;
// CACHE0_STATUS and CACHE1_STATUS are not writable
case NV3_PFIFO_CACHE0_METHOD:
@@ -441,7 +441,38 @@ void nv3_pfifo_cache0_pull()
if (nv3->pfifo.cache0_settings.put_address == nv3->pfifo.cache0_settings.get_address)
return;
// There is only one entry
// There is only one entry for cache0
uint16_t current_channel = nv3->pfifo.cache0_settings.channel;
uint32_t current_subchannel = nv3->pfifo.cache0_entry.subchannel;
uint32_t current_name = nv3->pfifo.cache0_entry.data;
uint32_t current_method = nv3->pfifo.cache0_entry.method;
// i.e. there is no method in cache0, so we have to find the object.
if (!current_method)
{
if (!nv3_ramin_find_object(current_name, 0, current_channel, current_subchannel))
return; // interrupt was fired, and we went to ramro
}
uint32_t current_context = nv3->pfifo.cache0_settings.context[0]; // only 1 entry for CACHE0 so basically ignore the other context entries?
// Tell the CPU if we found a software method
if (current_context & 0x800000)
{
nv3->pfifo.cache0_settings.puller_control |= NV3_PFIFO_CACHE0_PULLER_CONTROL_SOFTWARE_METHOD;
nv3->pfifo.cache0_settings.puller_control &= ~NV3_PFIFO_CACHE0_PULLER_CONTROL_ENABLED;
nv3_pfifo_interrupt(NV3_PFIFO_INTR_CACHE_ERROR, true);
}
// Is this needed?
nv3->pfifo.cache0_settings.get_address ^= 0x04;
#ifndef RELEASE_BUILD
nv_log("NV3: ***** SUBMITTING GRAPHICS COMMANDS CURRENTLY UNIMPLEMENTED - CACHE0 PULLED ****** Contextual information below\n");
nv3_debug_ramin_print_context_info(current_name, *(nv3_ramin_context_t*)current_context);
#endif
}
void nv3_pfifo_cache1_push()
@@ -458,6 +489,50 @@ void nv3_pfifo_cache1_pull()
// Do nothing if there is nothing in cache1 to pull
if (nv3->pfifo.cache1_settings.put_address == nv3->pfifo.cache1_settings.get_address)
return;
// There is only one entry for cache0
uint32_t get_address = nv3->pfifo.cache1_settings.get_address >> 2; // 32 bit aligned probably
uint16_t current_channel = nv3->pfifo.cache1_settings.channel;
uint32_t current_subchannel = nv3->pfifo.cache1_entries[get_address].subchannel;
uint32_t current_name = nv3->pfifo.cache1_entries[get_address].data;
uint32_t current_method = nv3->pfifo.cache1_entries[get_address].method;
// i.e. there is no method in cache0, so we have to find the object.
if (!current_method)
{
if (!nv3_ramin_find_object(current_name, 0, current_channel, current_subchannel))
return; // interrupt was fired, and we went to ramro
}
uint32_t current_context = nv3->pfifo.cache0_settings.context[0]; // only 1 entry for CACHE0 so basically ignore the other context entries?
// Tell the CPU if we found a software method
if (current_context & 0x800000)
{
nv3->pfifo.cache0_settings.puller_control |= NV3_PFIFO_CACHE0_PULLER_CONTROL_SOFTWARE_METHOD;
nv3->pfifo.cache0_settings.puller_control &= ~NV3_PFIFO_CACHE0_PULLER_CONTROL_ENABLED;
nv3_pfifo_interrupt(NV3_PFIFO_INTR_CACHE_ERROR, true);
}
// start by incrementing
uint32_t next_get_address = nv3_pfifo_cache1_gray2normal(get_address) + 1;
if (nv3->nvbase.gpu_revision >= NV3_BOOT_REG_REV_C00) // RIVA 128ZX#
next_get_address &= NV3_PFIFO_CACHE1_SIZE_REV_C;
else
next_get_address &= NV3_PFIFO_CACHE1_SIZE_REV_AB;
// Is this needed?
nv3->pfifo.cache0_settings.get_address = nv3_pfifo_cache1_normal2gray(next_get_address) << 2;
#ifndef RELEASE_BUILD
nv_log("NV3: ***** SUBMITTING GRAPHICS COMMANDS CURRENTLY UNIMPLEMENTED - CACHE1 PULLED ****** Contextual information below\n");
nv3_debug_ramin_print_context_info(current_name, *(nv3_ramin_context_t*)current_context);
#endif
//Todo: finish it
}
bool nv3_pfifo_cache1_is_free()

View File

@@ -49,16 +49,19 @@ void nv3_pramdac_init()
}
// Polls the pixel clock.
// This updates the 2D/3D engine PGRAPH
void nv3_pramdac_pixel_clock_poll(double real_time)
{
// TODO: ????
}
// Polls the memory clock.
// This updates the 2D/3D engine PGRAPH, PTIMER and more
void nv3_pramdac_memory_clock_poll(double real_time)
{
nv3_ptimer_tick(real_time);
nv3_pfifo_cache0_pull();
nv3_pfifo_cache1_pull();
// TODO: UPDATE PGRAPH!
}

View File

@@ -347,7 +347,7 @@ bool nv3_ramin_arbitrate_write(uint32_t address, uint32_t value)
}
// THIS IS THE MOST IMPORTANT FUNCTION!
bool nv3_ramin_find_object(uint32_t name, uint32_t cache_num, uint32_t channel_id, uint32_t subchannel_id)
bool nv3_ramin_find_object(uint32_t name, uint32_t cache_num, uint32_t channel, uint32_t subchannel)
{
// TODO: WRITE IT!!!
// Set the number of entries to search based on the ramht size (2*(size+1))
@@ -358,7 +358,7 @@ bool nv3_ramin_find_object(uint32_t name, uint32_t cache_num, uint32_t channel_i
uint32_t ramht_base = ((nv3->pfifo.ramht_config >> NV3_PFIFO_CONFIG_RAMHT_BASE_ADDRESS) & 0x0F) << NV3_PFIFO_CONFIG_RAMHT_BASE_ADDRESS;
uint32_t ramht_cur_address = ramht_base;
nv_log("NV3: Beginning search for graphics object at RAMHT base=0x%04x, Cache%d, channel=%d, subchannel=%d)", name, cache_num, channel_id, subchannel_id);
nv_log("NV3: Beginning search for graphics object at RAMHT base=0x%04x, Cache%d, channel=%d, subchannel=%d)", name, cache_num, channel, subchannel);
bool found_object = false;
@@ -376,7 +376,7 @@ bool nv3_ramin_find_object(uint32_t name, uint32_t cache_num, uint32_t channel_i
// see if the object is in the right channel
if (found_obj_name == name
&& obj_context_struct.channel_id == channel_id)
&& obj_context_struct.channel == channel)
{
found_object = true;
break;
@@ -421,8 +421,8 @@ bool nv3_ramin_find_object(uint32_t name, uint32_t cache_num, uint32_t channel_i
fatal("NV3: Invalid graphics object class ID name=0x%04x type=%04x, interpreted by pgraph as: %04x (Contact starfrost)",
name, obj_context_struct.class_id, obj_context_struct.class_id & 0x1F);
}
else if (obj_context_struct.channel_id > NV3_DMA_CHANNELS)
fatal("NV3: Super fucked up graphics object. Contact starfrost with the error string: DMA Channel ID=%d, it should be 0-8", obj_context_struct.channel_id);
else if (obj_context_struct.channel > NV3_DMA_CHANNELS)
fatal("NV3: Super fucked up graphics object. Contact starfrost with the error string: DMA Channel ID=%d, it should be 0-8", obj_context_struct.channel);
// Illegal accesses sent to RAMRO, so ignore here
// TODO: SEND THESE TO RAMRO!!!!!
@@ -442,9 +442,9 @@ bool nv3_ramin_find_object(uint32_t name, uint32_t cache_num, uint32_t channel_i
bool is_software = false;
if (!cache_num)
is_software = (nv3->pfifo.cache0_settings.context[subchannel_id] & 0x800000);
is_software = (nv3->pfifo.cache0_settings.context[subchannel] & 0x800000);
else
is_software = (nv3->pfifo.cache1_settings.context[subchannel_id] & 0x800000);
is_software = (nv3->pfifo.cache1_settings.context[subchannel] & 0x800000);
// This isn't an error but it's sent as an interrupt so the drivers can sync
if (is_software)
@@ -487,7 +487,7 @@ void nv3_debug_ramin_print_context_info(uint32_t name, nv3_ramin_context_t conte
nv_log("Name: 0x%04x", name);
nv_log("Context:");
nv_log("DMA Channel %d (0-7 valid)", context.channel_id);
nv_log("DMA Channel %d (0-7 valid)", context.channel);
nv_log("Class ID: as repreesnted in ramin=%04x, Stupid 5 bit version (the actual id)=0x%04x (%s)", context.class_id,
context.class_id & 0x1F, nv3_class_names[context.class_id & 0x1F]);
nv_log("Render Engine %d (0=Software, also DMA? 1=Accelerated Renderer)", context.is_rendering);