From 075a8929c676e6815e5d0e4578b74f50f5de33b4 Mon Sep 17 00:00:00 2001 From: yz70s Date: Wed, 24 Dec 2014 18:55:26 +0100 Subject: chihiro: added support for zbuffer and stencil plus render target methods [Samuele Zannoli] --- src/mame/includes/chihiro.h | 55 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) (limited to 'src/mame/includes/chihiro.h') diff --git a/src/mame/includes/chihiro.h b/src/mame/includes/chihiro.h index dda45c9af39..7df854abdab 100644 --- a/src/mame/includes/chihiro.h +++ b/src/mame/includes/chihiro.h @@ -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 most methods set parameters, others actually draw */ -class nv2a_renderer : public poly_manager +class nv2a_renderer : public poly_manager { public: - nv2a_renderer(running_machine &machine) : poly_manager(machine) + nv2a_renderer(running_machine &machine) : poly_manager(machine) { memset(channel, 0, sizeof(channel)); memset(pfifo, 0, sizeof(pfifo)); @@ -158,7 +158,6 @@ public: memset(pmc, 0, sizeof(pmc)); memset(ramin, 0, sizeof(ramin)); computedilated(); - fb.allocate(640, 480); objectdata = &(object_data_alloc()); objectdata->data = this; combiner.used = 0; @@ -169,6 +168,16 @@ public: alpha_test_enabled = false; alpha_reference = 0; 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; blend_equation = nv2a_renderer::FUNC_ADD; blend_color = 0; @@ -176,6 +185,12 @@ public: blend_function_source = nv2a_renderer::ONE; logical_operation_enabled = false; 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_textfile = NULL; 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_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); - 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_stage(int stage_number); void combiner_initialize_final(); @@ -247,6 +262,12 @@ public: UINT32 ramin[0x100000 / 4]; UINT32 dma_offset[2]; UINT32 dma_size[2]; + rectangle limits_rendertarget; + UINT32 pitch_rendertarget; + UINT32 pitch_depthbuffer; + UINT32 *rendertarget; + UINT32 *depthbuffer; + UINT32 *displayedtarget; UINT32 vertexbuffer_address[16]; int vertexbuffer_stride[16]; int vertexbuffer_kind[16]; @@ -371,6 +392,16 @@ public: bool alpha_test_enabled; int alpha_func; 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; int blend_equation; int blend_function_source; @@ -398,7 +429,6 @@ public: int enabled_vertex_attributes; int vertex_attribute_words[16]; int vertex_attribute_offset[16]; - bitmap_rgb32 fb; UINT32 dilated0[16][2048]; UINT32 dilated1[16][2048]; int dilatechose[256]; @@ -406,6 +436,21 @@ public: int debug_grab_texttype; 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 { STOP = 0, POINTS = 1, -- cgit v1.2.3