mirror of
https://github.com/holub/mame
synced 2025-10-07 09:25:34 +03:00
chihiro.cpp: 3d accelerator update, better support for antialiasing\supersampling (nw)
This commit is contained in:
parent
e6bd4f678a
commit
6606503825
@ -210,15 +210,15 @@ public:
|
|||||||
POLYGON = 10
|
POLYGON = 10
|
||||||
};
|
};
|
||||||
enum class NV2A_VERTEX_ATTR {
|
enum class NV2A_VERTEX_ATTR {
|
||||||
POS = 0,
|
POS = 0, // position
|
||||||
WEIGHT = 1,
|
WEIGHT = 1, // blend weigth
|
||||||
NORMAL = 2,
|
NORMAL = 2,
|
||||||
COLOR0 = 3, // diffuse
|
COLOR0 = 3, // diffuse
|
||||||
COLOR1 = 4, // specular
|
COLOR1 = 4, // specular
|
||||||
FOG = 5,
|
FOG = 5,
|
||||||
BACKCOLOR0 = 7, // diffuse
|
BACKCOLOR0 = 7, // back diffuse
|
||||||
BACKCOLOR1 = 8, // specular
|
BACKCOLOR1 = 8, // back specular
|
||||||
TEX0 = 9,
|
TEX0 = 9, // texture coordinate
|
||||||
TEX1 = 10,
|
TEX1 = 10,
|
||||||
TEX2 = 11,
|
TEX2 = 11,
|
||||||
TEX3 = 12
|
TEX3 = 12
|
||||||
@ -395,6 +395,8 @@ public:
|
|||||||
blend_function_source = NV2A_BLEND_FACTOR::ONE;
|
blend_function_source = NV2A_BLEND_FACTOR::ONE;
|
||||||
logical_operation_enabled = false;
|
logical_operation_enabled = false;
|
||||||
logical_operation = NV2A_LOGIC_OP::COPY;
|
logical_operation = NV2A_LOGIC_OP::COPY;
|
||||||
|
for (int n = 0; n < 8; n++)
|
||||||
|
clippingwindows[n].set(0, 0, 640, 480);
|
||||||
limits_rendertarget.set(0, 0, 640, 480);
|
limits_rendertarget.set(0, 0, 640, 480);
|
||||||
pitch_rendertarget = 0;
|
pitch_rendertarget = 0;
|
||||||
pitch_depthbuffer = 0;
|
pitch_depthbuffer = 0;
|
||||||
@ -409,16 +411,20 @@ public:
|
|||||||
clear_rendertarget.set(0, 0, 639, 479);
|
clear_rendertarget.set(0, 0, 639, 479);
|
||||||
primitive_type = NV2A_BEGIN_END::STOP;
|
primitive_type = NV2A_BEGIN_END::STOP;
|
||||||
antialias_control = 0;
|
antialias_control = 0;
|
||||||
|
supersample_factor_x = 1.0;
|
||||||
|
supersample_factor_y = 1.0;
|
||||||
rendertarget = nullptr;
|
rendertarget = nullptr;
|
||||||
depthbuffer = nullptr;
|
depthbuffer = nullptr;
|
||||||
displayedtarget = nullptr;
|
displayedtarget = nullptr;
|
||||||
puller_channel = 0;
|
|
||||||
puller_waiting = 0;
|
puller_waiting = 0;
|
||||||
debug_grab_texttype = -1;
|
debug_grab_texttype = -1;
|
||||||
debug_grab_textfile = nullptr;
|
debug_grab_textfile = nullptr;
|
||||||
waitvblank_used = 1;
|
waitvblank_used = 1;
|
||||||
memset(vertex_attribute_words, 0, sizeof(vertex_attribute_words));
|
memset(vertex_attribute_words, 0, sizeof(vertex_attribute_words));
|
||||||
memset(vertex_attribute_offset, 0, sizeof(vertex_attribute_offset));
|
memset(vertex_attribute_offset, 0, sizeof(vertex_attribute_offset));
|
||||||
|
memset(&persistvertexattr, 0, sizeof(persistvertexattr));
|
||||||
|
for (int n = 0; n < 16; n++)
|
||||||
|
persistvertexattr.attribute[n].fv[3] = 1;
|
||||||
}
|
}
|
||||||
DECLARE_READ32_MEMBER(geforce_r);
|
DECLARE_READ32_MEMBER(geforce_r);
|
||||||
DECLARE_WRITE32_MEMBER(geforce_w);
|
DECLARE_WRITE32_MEMBER(geforce_w);
|
||||||
@ -470,12 +476,15 @@ public:
|
|||||||
void debug_grab_vertex_program_slot(int slot, UINT32 *instruction);
|
void debug_grab_vertex_program_slot(int slot, UINT32 *instruction);
|
||||||
void start(address_space *cpu_space);
|
void start(address_space *cpu_space);
|
||||||
void savestate_items();
|
void savestate_items();
|
||||||
|
void compute_supersample_factors(float &horizontal, float &vertical);
|
||||||
|
void compute_limits_rendertarget(UINT32 chanel, UINT32 subchannel);
|
||||||
void read_vertex(address_space & space, offs_t address, vertex_nv &vertex, int attrib);
|
void read_vertex(address_space & space, offs_t address, vertex_nv &vertex, int attrib);
|
||||||
int read_vertices_0x1800(address_space & space, vertex_nv *destination, UINT32 address, int limit);
|
int read_vertices_0x1800(address_space & space, vertex_nv *destination, UINT32 address, int limit);
|
||||||
int read_vertices_0x1808(address_space & space, vertex_nv *destination, UINT32 address, int limit);
|
int read_vertices_0x1808(address_space & space, vertex_nv *destination, UINT32 address, int limit);
|
||||||
int read_vertices_0x1810(address_space & space, vertex_nv *destination, int offset, int limit);
|
int read_vertices_0x1810(address_space & space, vertex_nv *destination, int offset, int limit);
|
||||||
int read_vertices_0x1818(address_space & space, vertex_nv *destination, UINT32 address, int limit);
|
int read_vertices_0x1818(address_space & space, vertex_nv *destination, UINT32 address, int limit);
|
||||||
void convert_vertices_poly(vertex_nv *source, vertex_t *destination, int count);
|
void convert_vertices_poly(vertex_nv *source, vertex_t *destination, int count);
|
||||||
|
void assemble_primitive(vertex_nv *source, int count, render_delegate &renderspans);
|
||||||
UINT32 render_triangle_culling(const rectangle &cliprect, render_delegate callback, int paramcount, const vertex_t &_v1, const vertex_t &_v2, const vertex_t &_v3);
|
UINT32 render_triangle_culling(const rectangle &cliprect, render_delegate callback, int paramcount, const vertex_t &_v1, const vertex_t &_v2, const vertex_t &_v3);
|
||||||
void clear_render_target(int what, UINT32 value);
|
void clear_render_target(int what, UINT32 value);
|
||||||
void clear_depth_buffer(int what, UINT32 value);
|
void clear_depth_buffer(int what, UINT32 value);
|
||||||
@ -488,6 +497,7 @@ public:
|
|||||||
UINT32 objhandle;
|
UINT32 objhandle;
|
||||||
UINT32 objclass;
|
UINT32 objclass;
|
||||||
UINT32 method[0x2000 / 4];
|
UINT32 method[0x2000 / 4];
|
||||||
|
// int execute_method(address_space & space, UINT32 method, UINT32 address, int &countlen); // for the future
|
||||||
} object;
|
} object;
|
||||||
} channel[32][8];
|
} channel[32][8];
|
||||||
UINT32 pfifo[0x2000 / 4];
|
UINT32 pfifo[0x2000 / 4];
|
||||||
@ -498,7 +508,9 @@ public:
|
|||||||
UINT32 dma_offset[2];
|
UINT32 dma_offset[2];
|
||||||
UINT32 dma_size[2];
|
UINT32 dma_size[2];
|
||||||
UINT8 *basemempointer;
|
UINT8 *basemempointer;
|
||||||
|
UINT8 *topmempointer;
|
||||||
pic8259_device *interruptdevice;
|
pic8259_device *interruptdevice;
|
||||||
|
rectangle clippingwindows[8];
|
||||||
rectangle limits_rendertarget;
|
rectangle limits_rendertarget;
|
||||||
UINT32 pitch_rendertarget;
|
UINT32 pitch_rendertarget;
|
||||||
UINT32 pitch_depthbuffer;
|
UINT32 pitch_depthbuffer;
|
||||||
@ -512,6 +524,8 @@ public:
|
|||||||
int bytespixel_rendertarget;
|
int bytespixel_rendertarget;
|
||||||
rectangle clear_rendertarget;
|
rectangle clear_rendertarget;
|
||||||
UINT32 antialias_control;
|
UINT32 antialias_control;
|
||||||
|
float supersample_factor_x;
|
||||||
|
float supersample_factor_y;
|
||||||
UINT32 *rendertarget;
|
UINT32 *rendertarget;
|
||||||
UINT32 *depthbuffer;
|
UINT32 *depthbuffer;
|
||||||
UINT32 *displayedtarget;
|
UINT32 *displayedtarget;
|
||||||
@ -526,18 +540,35 @@ public:
|
|||||||
int sizew;
|
int sizew;
|
||||||
int dilate;
|
int dilate;
|
||||||
NV2A_TEX_FORMAT format;
|
NV2A_TEX_FORMAT format;
|
||||||
|
bool rectangle;
|
||||||
int rectangle_pitch;
|
int rectangle_pitch;
|
||||||
void *buffer;
|
void *buffer;
|
||||||
|
int dma0;
|
||||||
|
int dma1;
|
||||||
|
int cubic;
|
||||||
|
int noborder;
|
||||||
|
int dims;
|
||||||
|
int mipmap;
|
||||||
|
int colorkey;
|
||||||
|
int imagefield;
|
||||||
|
int aniso;
|
||||||
|
int mipmapmaxlod;
|
||||||
|
int mipmapminlod;
|
||||||
|
int rectheight;
|
||||||
|
int rectwidth;
|
||||||
} texture[4];
|
} texture[4];
|
||||||
NV2A_BEGIN_END primitive_type;
|
NV2A_BEGIN_END primitive_type;
|
||||||
int primitives_count;
|
UINT32 primitives_count;
|
||||||
int indexesleft_count;
|
int indexesleft_count;
|
||||||
int indexesleft_first;
|
int indexesleft_first;
|
||||||
UINT32 indexesleft[1024]; // vertex indices sent by the software to the 3d accelerator
|
UINT32 indexesleft[1024]; // vertex indices sent by the software to the 3d accelerator
|
||||||
int vertex_count;
|
int vertex_count;
|
||||||
unsigned int vertex_first;
|
unsigned int vertex_first;
|
||||||
|
int vertex_accumulated;
|
||||||
vertex_nv vertex_software[1024+2]; // vertex attributes sent by the software to the 3d accelerator
|
vertex_nv vertex_software[1024+2]; // vertex attributes sent by the software to the 3d accelerator
|
||||||
vertex_t vertex_xy[1024+2]; // vertex attributes computed by the 3d accelerator
|
vertex_t vertex_xy[1024+2]; // vertex attributes computed by the 3d accelerator
|
||||||
|
vertex_nv persistvertexattr; // persistent vertex attributes
|
||||||
|
render_delegate render_spans_callback;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
float variable_A[4]; // 0=R 1=G 2=B 3=A
|
float variable_A[4]; // 0=R 1=G 2=B 3=A
|
||||||
@ -687,7 +718,6 @@ public:
|
|||||||
int vertex_attribute_words[16];
|
int vertex_attribute_words[16];
|
||||||
int vertex_attribute_offset[16];
|
int vertex_attribute_offset[16];
|
||||||
emu_timer *puller_timer;
|
emu_timer *puller_timer;
|
||||||
int puller_channel;
|
|
||||||
int puller_waiting;
|
int puller_waiting;
|
||||||
address_space *puller_space;
|
address_space *puller_space;
|
||||||
UINT32 dilated0[16][2048];
|
UINT32 dilated0[16][2048];
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user