Previous 199869 Revisions Next

r41720 Saturday 14th November, 2015 at 02:29:56 UTC by Samuele Zannoli
chihiro.c: some cleanup, wait vblank enabled by default (nw)
[src/mame/includes]chihiro.h
[src/mame/machine]xbox.cpp
[src/mame/video]chihiro.cpp

trunk/src/mame/includes/chihiro.h
r250231r250232
232232      depthbuffer = NULL;
233233      displayedtarget = NULL;
234234      puller_channel = 0;
235      puller_subchannel = 0;
236235      puller_waiting = 0;
237236      debug_grab_texttype = -1;
238237      debug_grab_textfile = NULL;
239      waitvblank_used = 0;
238      waitvblank_used = 1;
240239      memset(vertex_attribute_words, 0, sizeof(vertex_attribute_words));
241240      memset(vertex_attribute_offset, 0, sizeof(vertex_attribute_offset));
242241   }
r250231r250232
254253   int geforce_commandkind(UINT32 word);
255254   UINT32 geforce_object_offset(UINT32 handle);
256255   void geforce_read_dma_object(UINT32 handle, UINT32 &offset, UINT32 &size);
256   void geforce_assign_object(address_space &space, UINT32 chanel, UINT32 subchannel, UINT32 address);
257257   int geforce_exec_method(address_space &space, UINT32 channel, UINT32 subchannel, UINT32 method, UINT32 address, int &countlen);
258258   UINT32 texture_get_texel(int number, int x, int y);
259   UINT8 *read_pixel(int x, int y, UINT32 c[4]);
259   UINT8 *read_pixel(int x, int y, INT32 c[4]);
260260   void write_pixel(int x, int y, UINT32 color, UINT32 depth);
261261   void combiner_initialize_registers(UINT32 argb8[6]);
262262   void combiner_initialize_stage(int stage_number);
r250231r250232
496496   int vertex_attribute_offset[16];
497497   emu_timer *puller_timer;
498498   int puller_channel;
499   int puller_subchannel;
500499   int puller_waiting;
501500   address_space *puller_space;
502501   UINT32 dilated0[16][2048];
r250231r250232
660659      NV2A_RT_DEPTH_FORMAT_Z16 = 0x0001,
661660      NV2A_RT_DEPTH_FORMAT_Z24S8 = 0x0002
662661   };
663
664662   enum NV2A_COLOR_FORMAT {
665      NV2A_COLOR_FORMAT_X1R5G6B5 = 0x0002,
666      NV2A_COLOR_FORMAT_R5G6B5 = 0x0003,
667      NV2A_COLOR_FORMAT_UNKNOWN4 = 0x0004,
668      NV2A_COLOR_FORMAT_X8R8G8B8 = 0x0005,
669      NV2A_COLOR_FORMAT_X1A7R8G8B8 = 0x0007,
670      NV2A_COLOR_FORMAT_A8R8G8B8 = 0x0008,
671      NV2A_COLOR_FORMAT_B8 = 0x0009,
672      NV2A_COLOR_FORMAT_G8B8 = 0x000a
663      NV2A_COLOR_FORMAT_X1R5G5B5_Z1R5G5B5 = 1,
664      NV2A_COLOR_FORMAT_X1R5G5B5_X1R5G5B5 = 2,
665      NV2A_COLOR_FORMAT_R5G6B5 = 3,
666      NV2A_COLOR_FORMAT_X8R8G8B8_Z8R8G8B8 = 4,
667      NV2A_COLOR_FORMAT_X8R8G8B8_X8R8G8B8 = 5,
668      NV2A_COLOR_FORMAT_X1A7R8G8B8_Z1A7R8G8B8 = 6,
669      NV2A_COLOR_FORMAT_X1A7R8G8B8_X1A7R8G8B8 = 7,
670      NV2A_COLOR_FORMAT_A8R8G8B8 = 8,
671      NV2A_COLOR_FORMAT_B8 = 9,
672      NV2A_COLOR_FORMAT_G8B8 = 10
673673   };
674674};
trunk/src/mame/machine/xbox.cpp
r250231r250232
11901190static void hubintiasbridg_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask)
11911191{
11921192#ifdef LOG_PCI
1193   if (reg >= 16) device->logerror("  bus:0 function:%d register:%d data:%08X mask:%08X\n", function, reg, data, mem_mask);
1193   if (reg >= 16) busdevice->logerror("  bus:0 function:%d register:%d data:%08X mask:%08X\n", function, reg, data, mem_mask);
11941194#endif
11951195}
11961196
r250231r250232
12091209static void dummy_pci_w(device_t *busdevice, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask)
12101210{
12111211#ifdef LOG_PCI
1212   if (reg >= 16) device->logerror("  bus:0 function:%d register:%d data:%08X mask:%08X\n", function, reg, data, mem_mask);
1212   if (reg >= 16) busdevice->logerror("  bus:0 function:%d register:%d data:%08X mask:%08X\n", function, reg, data, mem_mask);
12131213#endif
12141214}
12151215
trunk/src/mame/video/chihiro.cpp
r250231r250232
12401240   }
12411241}
12421242
1243inline UINT8 *nv2a_renderer::read_pixel(int x, int y, UINT32 c[4])
1243inline UINT8 *nv2a_renderer::read_pixel(int x, int y, INT32 c[4])
12441244{
12451245   UINT32 offset;
12461246   UINT32 color;
r250231r250232
12611261      c[1] = pal6bit((color & 0x07e0) >> 5);
12621262      c[0] = pal5bit(color & 0x1f);
12631263      return (UINT8 *)addr16;
1264   case NV2A_COLOR_FORMAT_UNKNOWN4:
1265   case NV2A_COLOR_FORMAT_X8R8G8B8:
1264   case NV2A_COLOR_FORMAT_X8R8G8B8_Z8R8G8B8:
1265   case NV2A_COLOR_FORMAT_X8R8G8B8_X8R8G8B8:
12661266      addr = (UINT32 *)((UINT8 *)rendertarget + offset);
12671267      color = *addr;
12681268
r250231r250232
12951295   UINT32 *daddr32;
12961296   UINT16 *daddr16;
12971297   UINT32 deptsten;
1298   UINT32 c[4], fb[4], s[4], d[4], cc[4];
1298   INT32 c[4], fb[4], s[4], d[4], cc[4];
12991299   UINT32 dep, sten, stenc, stenv;
13001300   bool stencil_passed;
13011301   bool depth_passed;
r250231r250232
18541854   if (color_mask != 0) {
18551855      UINT32 ct,ft,w;
18561856
1857      ct = (c[3] << 24) | (c[2] << 16) | (c[1] << 8) | c[0];
1858      ft = (fb[3] << 24) | (fb[2] << 16) | (fb[1] << 8) | fb[0];
1857      ct = ((UINT32)c[3] << 24) | ((UINT32)c[2] << 16) | ((UINT32)c[1] << 8) | (UINT32)c[0];
1858      ft = ((UINT32)fb[3] << 24) | ((UINT32)fb[2] << 16) | ((UINT32)fb[1] << 8) | (UINT32)fb[0];
18591859      w = (ft & ~color_mask) | (ct & color_mask);
18601860      switch (colorformat_rendertarget) {
18611861      case NV2A_COLOR_FORMAT_R5G6B5:
18621862         w = ((w >> 8) & 0xf800) + ((w >> 5) & 0x7e0) + ((w >> 3) & 0x1f);
18631863         *((UINT16 *)addr) = (UINT16)w;
18641864         break;
1865      case NV2A_COLOR_FORMAT_UNKNOWN4:
1866      case NV2A_COLOR_FORMAT_X8R8G8B8:
1865      case NV2A_COLOR_FORMAT_X8R8G8B8_Z8R8G8B8:
1866      case NV2A_COLOR_FORMAT_X8R8G8B8_X8R8G8B8:
18671867         *((UINT32 *)addr) = w;
18681868         break;
18691869      case NV2A_COLOR_FORMAT_A8R8G8B8:
r250231r250232
28622862         m = 1;
28632863      // possible buffers: color, depth, stencil
28642864      // clear framebuffer
2865      if (data & 0xf0) {
2865      if ((data & 0xf0) == 0xf0) {
28662866         if (bytespixel_rendertarget == 4) {
28672867            bitmap_rgb32 bm(rendertarget, (limits_rendertarget.right() + 1) * m, (limits_rendertarget.bottom() + 1) * m, pitch_rendertarget / 4);
28682868
r250231r250232
29132913      case NV2A_COLOR_FORMAT_R5G6B5:
29142914         bytespixel_rendertarget = 2;
29152915         break;
2916      case NV2A_COLOR_FORMAT_UNKNOWN4:
2917      case NV2A_COLOR_FORMAT_X8R8G8B8:
2916      case NV2A_COLOR_FORMAT_X8R8G8B8_Z8R8G8B8:
2917      case NV2A_COLOR_FORMAT_X8R8G8B8_X8R8G8B8:
29182918      case NV2A_COLOR_FORMAT_A8R8G8B8:
29192919         bytespixel_rendertarget = 4;
29202920         break;
r250231r250232
40184018   return 0;
40194019}
40204020
4021void nv2a_renderer::geforce_assign_object(address_space & space, UINT32 chanel, UINT32 subchannel, UINT32 address)
4022{
4023   int handle, objclass;
4024
4025   handle = space.read_dword(address);
4026   handle = geforce_object_offset(handle);
4027#ifdef LOG_NV2A
4028   machine().logerror("  assign to subchannel %d object at %d", subch, handle);
4029#endif
4030   channel[chanel][subchannel].object.objhandle = handle;
4031   handle = ramin[handle / 4];
4032   objclass = handle & 0xff;
4033#ifdef LOG_NV2A
4034   machine().logerror(" class %03X\n", objclass);
4035#endif
4036   channel[chanel][subchannel].object.objclass = objclass;
4037}
4038
40214039TIMER_CALLBACK_MEMBER(nv2a_renderer::puller_timer_work)
40224040{
4023   int chanel, subchannel;
4024   int method, count, handle, objclass;
4041   int chanel;
4042   int method, count;
40254043   UINT32 *dmaput, *dmaget;
40264044   UINT32 cmd, cmdtype;
40274045   int countlen;
r250231r250232
40304048   UINT32 subch;
40314049
40324050   chanel = puller_channel;
4033   subchannel = puller_subchannel;
4034   dmaput = &channel[chanel][subchannel].regs[0x40 / 4];
4035   dmaget = &channel[chanel][subchannel].regs[0x44 / 4];
4051   dmaput = &channel[chanel][0].regs[0x40 / 4];
4052   dmaget = &channel[chanel][0].regs[0x44 / 4];
40364053   while (*dmaget != *dmaput) {
40374054      cmd = space->read_dword(*dmaget);
40384055      *dmaget += 4;
r250231r250232
40414058      {
40424059      case 6: // jump
40434060#ifdef LOG_NV2A
4044         printf("jump dmaget %08X", *dmaget);
4061         machine().logerror("jump dmaget %08X", *dmaget);
40454062#endif
40464063         *dmaget = cmd & 0xfffffffc;
40474064#ifdef LOG_NV2A
4048         printf(" -> %08X\n\r", *dmaget);
4065         machine().logerror(" -> %08X\n\r", *dmaget);
40494066#endif
40504067         break;
40514068      case 0: // increasing method
r250231r250232
40534070         subch = (cmd >> 13) & 7;
40544071         count = (cmd >> 18) & 2047;
40554072         if ((method == 0) && (count == 1)) {
4056            handle = space->read_dword(*dmaget);
4057            handle = geforce_object_offset(handle);
4058#ifdef LOG_NV2A
4059            machine().logerror("  assign to subchannel %d object at %d", subch, handle);
4060#endif
4061            channel[chanel][subch].object.objhandle = handle;
4062            handle = ramin[handle / 4];
4063            objclass = handle & 0xff;
4064#ifdef LOG_NV2A
4065            machine().logerror(" class %03X\n", objclass);
4066#endif
4067            channel[chanel][subch].object.objclass = objclass;
4073            geforce_assign_object(*space, chanel, subch, *dmaget);
40684074            *dmaget += 4;
40694075         }
40704076         else {
r250231r250232
40934099         subch = (cmd >> 13) & 7;
40944100         count = (cmd >> 18) & 2047;
40954101         if ((method == 0) && (count == 1)) {
4096            handle = space->read_dword(*dmaget);
4097            handle = geforce_object_offset(handle);
4098#ifdef LOG_NV2A
4099            machine().logerror("  assign to subchannel %d object at %d", subch, handle);
4100#endif
4101            channel[chanel][subch].object.objhandle = handle;
4102            handle = ramin[handle / 4];
4103            objclass = handle & 0xff;
4104#ifdef LOG_NV2A
4105            machine().logerror(" class %03X\n", objclass);
4106#endif
4107            channel[chanel][subch].object.objclass = objclass;
4102            geforce_assign_object(*space, chanel, subch, *dmaget);
41084103            *dmaget += 4;
41094104         }
41104105         else {
r250231r250232
41254120         count = space->read_dword(*dmaget);
41264121         *dmaget += 4;
41274122         if ((method == 0) && (count == 1)) {
4128            handle = space->read_dword(*dmaget);
4129            handle = geforce_object_offset(handle);
4130#ifdef LOG_NV2A
4131            machine().logerror("  assign to subchannel %d object at %d", subch, handle);
4132#endif
4133            channel[chanel][subch].object.objhandle = handle;
4134            handle = ramin[handle / 4];
4135            objclass = handle & 0xff;
4136#ifdef LOG_NV2A
4137            machine().logerror(" class %03X\n", objclass);
4138#endif
4139            channel[chanel][subch].object.objclass = objclass;
4123            geforce_assign_object(*space, chanel, subch, *dmaget);
41404124            *dmaget += 4;
41414125         }
41424126         else {
r250231r250232
42944278      subchannel = (suboffset >> (13 - 2)) & 7;
42954279      suboffset = suboffset & 0x7ff;
42964280      //machine().logerror("NV_2A: write channel[%02X,%d,%04X]=%08X\n",chanel,subchannel,suboffset*4,data & mem_mask);
4281      COMBINE_DATA(&channel[chanel][subchannel].regs[suboffset]);
42974282      if (suboffset >= 0x80 / 4)
42984283         return;
4299      COMBINE_DATA(&channel[chanel][subchannel].regs[suboffset]);
43004284      if ((suboffset == 0x40 / 4) || (suboffset == 0x44 / 4)) { // DMA_PUT or DMA_GET
43014285         UINT32 *dmaput, *dmaget;
43024286
4303         dmaput = &channel[chanel][subchannel].regs[0x40 / 4];
4304         dmaget = &channel[chanel][subchannel].regs[0x44 / 4];
4287         dmaput = &channel[chanel][0].regs[0x40 / 4];
4288         dmaget = &channel[chanel][0].regs[0x44 / 4];
43054289         //printf("dmaget %08X dmaput %08X\n\r",*dmaget,*dmaput);
4306         if ((*dmaput == 0x048cf000) && (*dmaget == 0x07f4d000)) {
4290         if ((*dmaput == 0x048cf000) && (*dmaget == 0x07f4d000)) { // only for outr2
43074291            *dmaget = *dmaput;
43084292            puller_waiting = 0;
43094293            puller_timer->enable(false);
r250231r250232
43124296         if (*dmaget != *dmaput) {
43134297            if (puller_waiting == 0) {
43144298               puller_channel = chanel;
4315               puller_subchannel = subchannel;
43164299               puller_space = &space;
43174300               puller_timer->enable();
43184301               puller_timer->adjust(attotime::zero);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team