chihiro: added support for zbuffer and stencil plus render target methods [Samuele Zannoli]

This commit is contained in:
yz70s 2014-12-24 18:55:26 +01:00
parent f815c4fe2a
commit 075a8929c6
2 changed files with 685 additions and 340 deletions

View File

@ -147,10 +147,10 @@ offset in ramht+4 contains in the lower 16 bits the offset in RAMIN divided by 1
objects have methods used to do drawing objects have methods used to do drawing
most methods set parameters, others actually draw most methods set parameters, others actually draw
*/ */
class nv2a_renderer : public poly_manager<float, nvidia_object_data, 12, 8192> class nv2a_renderer : public poly_manager<float, nvidia_object_data, 13, 8192>
{ {
public: public:
nv2a_renderer(running_machine &machine) : poly_manager<float, nvidia_object_data, 12, 8192>(machine) nv2a_renderer(running_machine &machine) : poly_manager<float, nvidia_object_data, 13, 8192>(machine)
{ {
memset(channel, 0, sizeof(channel)); memset(channel, 0, sizeof(channel));
memset(pfifo, 0, sizeof(pfifo)); memset(pfifo, 0, sizeof(pfifo));
@ -158,7 +158,6 @@ public:
memset(pmc, 0, sizeof(pmc)); memset(pmc, 0, sizeof(pmc));
memset(ramin, 0, sizeof(ramin)); memset(ramin, 0, sizeof(ramin));
computedilated(); computedilated();
fb.allocate(640, 480);
objectdata = &(object_data_alloc()); objectdata = &(object_data_alloc());
objectdata->data = this; objectdata->data = this;
combiner.used = 0; combiner.used = 0;
@ -169,6 +168,16 @@ public:
alpha_test_enabled = false; alpha_test_enabled = false;
alpha_reference = 0; alpha_reference = 0;
alpha_func = nv2a_renderer::ALWAYS; alpha_func = nv2a_renderer::ALWAYS;
depth_test_enabled = false;
depth_function = nv2a_renderer::LESS;
depth_write_enabled = false;
stencil_test_enabled = false;
stencil_func = nv2a_renderer::ALWAYS;
stencil_ref = 0;
stencil_mask = -1;
stencil_op_fail = nv2a_renderer::KEEP;
stencil_op_zfail = nv2a_renderer::KEEP;
stencil_op_zpass = nv2a_renderer::KEEP;
blending_enabled = false; blending_enabled = false;
blend_equation = nv2a_renderer::FUNC_ADD; blend_equation = nv2a_renderer::FUNC_ADD;
blend_color = 0; blend_color = 0;
@ -176,6 +185,12 @@ public:
blend_function_source = nv2a_renderer::ONE; blend_function_source = nv2a_renderer::ONE;
logical_operation_enabled = false; logical_operation_enabled = false;
logical_operation = nv2a_renderer::COPY; logical_operation = nv2a_renderer::COPY;
limits_rendertarget.set(0, 0, 640, 480);
pitch_rendertarget = 0;
pitch_depthbuffer = 0;
rendertarget = NULL;
depthbuffer = NULL;
displayedtarget = NULL;
debug_grab_texttype = -1; debug_grab_texttype = -1;
debug_grab_textfile = NULL; debug_grab_textfile = NULL;
memset(vertex_attribute_words, 0, sizeof(vertex_attribute_words)); memset(vertex_attribute_words, 0, sizeof(vertex_attribute_words));
@ -195,7 +210,7 @@ public:
void geforce_read_dma_object(UINT32 handle, UINT32 &offset, UINT32 &size); void geforce_read_dma_object(UINT32 handle, UINT32 &offset, UINT32 &size);
void geforce_exec_method(address_space &space, UINT32 channel, UINT32 subchannel, UINT32 method, UINT32 address, int &countlen); void geforce_exec_method(address_space &space, UINT32 channel, UINT32 subchannel, UINT32 method, UINT32 address, int &countlen);
UINT32 texture_get_texel(int number, int x, int y); UINT32 texture_get_texel(int number, int x, int y);
void write_pixel(int x, int y, UINT32 color); void write_pixel(int x, int y, UINT32 color, UINT32 depth);
void combiner_initialize_registers(UINT32 argb8[6]); void combiner_initialize_registers(UINT32 argb8[6]);
void combiner_initialize_stage(int stage_number); void combiner_initialize_stage(int stage_number);
void combiner_initialize_final(); void combiner_initialize_final();
@ -247,6 +262,12 @@ public:
UINT32 ramin[0x100000 / 4]; UINT32 ramin[0x100000 / 4];
UINT32 dma_offset[2]; UINT32 dma_offset[2];
UINT32 dma_size[2]; UINT32 dma_size[2];
rectangle limits_rendertarget;
UINT32 pitch_rendertarget;
UINT32 pitch_depthbuffer;
UINT32 *rendertarget;
UINT32 *depthbuffer;
UINT32 *displayedtarget;
UINT32 vertexbuffer_address[16]; UINT32 vertexbuffer_address[16];
int vertexbuffer_stride[16]; int vertexbuffer_stride[16];
int vertexbuffer_kind[16]; int vertexbuffer_kind[16];
@ -371,6 +392,16 @@ public:
bool alpha_test_enabled; bool alpha_test_enabled;
int alpha_func; int alpha_func;
int alpha_reference; int alpha_reference;
bool depth_test_enabled;
int depth_function;
bool depth_write_enabled;
bool stencil_test_enabled;
int stencil_func;
int stencil_ref;
int stencil_mask;
int stencil_op_fail;
int stencil_op_zfail;
int stencil_op_zpass;
bool blending_enabled; bool blending_enabled;
int blend_equation; int blend_equation;
int blend_function_source; int blend_function_source;
@ -398,7 +429,6 @@ public:
int enabled_vertex_attributes; int enabled_vertex_attributes;
int vertex_attribute_words[16]; int vertex_attribute_words[16];
int vertex_attribute_offset[16]; int vertex_attribute_offset[16];
bitmap_rgb32 fb;
UINT32 dilated0[16][2048]; UINT32 dilated0[16][2048];
UINT32 dilated1[16][2048]; UINT32 dilated1[16][2048];
int dilatechose[256]; int dilatechose[256];
@ -406,6 +436,21 @@ public:
int debug_grab_texttype; int debug_grab_texttype;
char *debug_grab_textfile; char *debug_grab_textfile;
enum VERTEX_PARAMETER {
PARAM_COLOR_B = 0,
PARAM_COLOR_G = 1,
PARAM_COLOR_R = 2,
PARAM_COLOR_A = 3,
PARAM_TEXTURE0_U = 4,
PARAM_TEXTURE0_V = 5,
PARAM_TEXTURE1_U = 6,
PARAM_TEXTURE1_V = 7,
PARAM_TEXTURE2_U = 8,
PARAM_TEXTURE2_V = 9,
PARAM_TEXTURE3_U = 10,
PARAM_TEXTURE3_V = 11,
PARAM_Z = 12
};
enum NV2A_BEGIN_END { enum NV2A_BEGIN_END {
STOP = 0, STOP = 0,
POINTS = 1, POINTS = 1,

File diff suppressed because it is too large Load Diff