Previous 199869 Revisions Next

r34147 Thursday 1st January, 2015 at 21:13:55 UTC by Couriersud
Palettes are now copied during get_primlist. This should fix
multithreading related palette issues. Along the way also
- added constructors to SDL osd structs
- changed related malloc to global_alloc
- added a copyfrom routine to dynamic_array
- minor code simplifications.
[src/emu]render.c render.h rendersw.inc
[src/lib/util]coretmpl.h palette.h
[src/osd/sdl]blit13.h draw13.c drawogl.c window.c
[src/osd/windows]d3dhlsl.c drawd3d.c

trunk/src/emu/render.c
r242658r242659
201201   return item_layer(layer);
202202}
203203
204//**************************************************************************
205//  render_texinfo
206//**************************************************************************
204207
208render_texinfo &render_texinfo::operator=(const render_texinfo &src)
209{
210    free_palette();
211    base = src.base;
212    rowpixels = src.rowpixels;
213    width = src.width;
214    height = src.height;
215    seqid = src.seqid;
216    osddata = src.osddata;
217    m_palette = src.m_palette;
218    if (m_palette != NULL)
219    {
220        m_palette->ref_count++;
221    }
222    return *this;
223}
205224
225void render_texinfo::set_palette(const dynamic_array<rgb_t> *source)
226{
227    free_palette();
228    if (source != NULL)
229    {
230        m_palette = global_alloc(render_palette_copy);
231        m_palette->palette.copyfrom(*source);
232        m_palette->ref_count = 1;
233    }
234    else
235    {
236        m_palette = NULL;
237    }
238}
239
240void render_texinfo::free_palette()
241{
242    if (m_palette != NULL)
243    {
244        m_palette->ref_count--;
245        if (m_palette->ref_count == 0)
246        {
247            global_free(m_palette);
248        }
249    }
250    m_palette = NULL;
251}
252
253
206254//**************************************************************************
207255//  RENDER PRIMITIVE
208256//**************************************************************************
r242658r242659
214262
215263void render_primitive::reset()
216264{
217   memset(&type, 0, FPTR(&texcoords + 1) - FPTR(&type));
265    // public state
266    type = INVALID;
267    bounds.x0 = 0;
268    bounds.y0 = 0;
269    bounds.x1 = 0;
270    bounds.y1 = 0;
271    color.a = 0;
272    color.r = 0;
273    color.g = 0;
274    color.b = 0;
275    flags = 0;
276    width = 0.0f;
277    // texcoords; FIXME
278
279    // do not clear m_next!
280    // memset(&type, 0, FPTR(&texcoords + 1) - FPTR(&type));
281
282    texture.set_palette(NULL);
283    texture = render_texinfo();
218284}
219285
220286
r242658r242659
447513//  get_scaled - get a scaled bitmap (if we can)
448514//-------------------------------------------------
449515
450bool render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist)
516void render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist)
451517{
452518   // source width/height come from the source bounds
453519   int swidth = m_sbounds.width();
r242658r242659
460526   texinfo.osddata = m_osddata;
461527
462528   // are we scaler-free? if so, just return the source bitmap
463   const rgb_t *palbase = (m_format == TEXFORMAT_PALETTE16 || m_format == TEXFORMAT_PALETTEA16) ? m_bitmap->palette()->entry_list_adjusted() : NULL;
464529   if (m_scaler == NULL || (m_bitmap != NULL && swidth == dwidth && sheight == dheight))
465530   {
466531      // add a reference and set up the source bitmap
r242658r242659
469534      texinfo.rowpixels = m_bitmap->rowpixels();
470535      texinfo.width = swidth;
471536      texinfo.height = sheight;
472      texinfo.palette = palbase;
537      // will be set later
538        texinfo.set_palette(NULL);
473539      texinfo.seqid = ++m_curseq;
474      return true;
475540   }
541   else
542   {
543        // make sure we can recover the original argb32 bitmap
544        bitmap_argb32 dummy;
545        bitmap_argb32 &srcbitmap = (m_bitmap != NULL) ? downcast<bitmap_argb32 &>(*m_bitmap) : dummy;
476546
477   // make sure we can recover the original argb32 bitmap
478   bitmap_argb32 dummy;
479   bitmap_argb32 &srcbitmap = (m_bitmap != NULL) ? downcast<bitmap_argb32 &>(*m_bitmap) : dummy;
547        // is it a size we already have?
548        scaled_texture *scaled = NULL;
549        int scalenum;
550        for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
551        {
552            scaled = &m_scaled[scalenum];
480553
481   // is it a size we already have?
482   scaled_texture *scaled = NULL;
483   int scalenum;
484   for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
485   {
486      scaled = &m_scaled[scalenum];
554            // we need a non-NULL bitmap with matching dest size
555            if (scaled->bitmap != NULL && dwidth == scaled->bitmap->width() && dheight == scaled->bitmap->height())
556                break;
557        }
487558
488      // we need a non-NULL bitmap with matching dest size
489      if (scaled->bitmap != NULL && dwidth == scaled->bitmap->width() && dheight == scaled->bitmap->height())
490         break;
491   }
559        // did we get one?
560        if (scalenum == ARRAY_LENGTH(m_scaled))
561        {
562            int lowest = -1;
492563
493   // did we get one?
494   if (scalenum == ARRAY_LENGTH(m_scaled))
495   {
496      int lowest = -1;
564            // didn't find one -- take the entry with the lowest seqnum
565            for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
566                if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap))
567                    lowest = scalenum;
568            assert_always(lowest != -1, "Too many live texture instances!");
497569
498      // didn't find one -- take the entry with the lowest seqnum
499      for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++)
500         if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap))
501            lowest = scalenum;
502      assert_always(lowest != -1, "Too many live texture instances!");
570            // throw out any existing entries
571            scaled = &m_scaled[lowest];
572            if (scaled->bitmap != NULL)
573            {
574                m_manager->invalidate_all(scaled->bitmap);
575                global_free(scaled->bitmap);
576            }
503577
504      // throw out any existing entries
505      scaled = &m_scaled[lowest];
506      if (scaled->bitmap != NULL)
507      {
508         m_manager->invalidate_all(scaled->bitmap);
509         global_free(scaled->bitmap);
510      }
578            // allocate a new bitmap
579            scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight));
580            scaled->seqid = ++m_curseq;
511581
512      // allocate a new bitmap
513      scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight));
514      scaled->seqid = ++m_curseq;
582            // let the scaler do the work
583            (*m_scaler)(*scaled->bitmap, srcbitmap, m_sbounds, m_param);
584        }
515585
516      // let the scaler do the work
517      (*m_scaler)(*scaled->bitmap, srcbitmap, m_sbounds, m_param);
586        // finally fill out the new info
587        primlist.add_reference(scaled->bitmap);
588        texinfo.base = &scaled->bitmap->pix32(0);
589        texinfo.rowpixels = scaled->bitmap->rowpixels();
590        texinfo.width = dwidth;
591        texinfo.height = dheight;
592        // will be set later
593        texinfo.set_palette(NULL);
594        texinfo.seqid = scaled->seqid;
518595   }
519
520   // finally fill out the new info
521   primlist.add_reference(scaled->bitmap);
522   texinfo.base = &scaled->bitmap->pix32(0);
523   texinfo.rowpixels = scaled->bitmap->rowpixels();
524   texinfo.width = dwidth;
525   texinfo.height = dheight;
526   texinfo.palette = palbase;
527   texinfo.seqid = scaled->seqid;
528   return true;
529596}
530597
531598
r242658r242659
534601//  palette for a texture
535602//-------------------------------------------------
536603
537const rgb_t *render_texture::get_adjusted_palette(render_container &container)
604const dynamic_array<rgb_t> *render_texture::get_adjusted_palette(render_container &container)
538605{
539606   // override the palette with our adjusted palette
540607   switch (m_format)
r242658r242659
546613
547614         // if no adjustment necessary, return the raw palette
548615         if (!container.has_brightness_contrast_gamma_changes())
549            return m_bitmap->palette()->entry_list_adjusted();
616            return m_bitmap->palette()->entry_list_adjusted_darray();
550617
551618         // otherwise, return our adjusted palette
552619         return container.bcg_lookup_table(m_format, m_bitmap->palette());
r242658r242659
582649      m_manager(manager),
583650      m_screen(screen),
584651      m_overlaybitmap(NULL),
585      m_overlaytexture(NULL)
652      m_overlaytexture(NULL),
653      m_bcglookup256(0x400)
586654{
587655   // make sure it is empty
588656   empty();
r242658r242659
722790//  given texture mode
723791//-------------------------------------------------
724792
725const rgb_t *render_container::bcg_lookup_table(int texformat, palette_t *palette)
793const dynamic_array<rgb_t> *render_container::bcg_lookup_table(int texformat, palette_t *palette)
726794{
727795   switch (texformat)
728796   {
r242658r242659
736804            recompute_lookups();
737805         }
738806         assert (palette == &m_palclient->palette());
739         return m_bcglookup;
807         return &m_bcglookup;
740808
741809      case TEXFORMAT_RGB32:
742810      case TEXFORMAT_ARGB32:
743811      case TEXFORMAT_YUY16:
744         return m_bcglookup256;
812         return &m_bcglookup256;
745813
746814      default:
747815         return NULL;
r242658r242659
17261794               int height = (finalorient & ORIENTATION_SWAP_XY) ? (prim->bounds.x1 - prim->bounds.x0) : (prim->bounds.y1 - prim->bounds.y0);
17271795               width = MIN(width, m_maxtexwidth);
17281796               height = MIN(height, m_maxtexheight);
1729               if (curitem->texture()->get_scaled(width, height, prim->texture, list))
1730               {
1731                  // set the palette
1732                  prim->texture.palette = curitem->texture()->get_adjusted_palette(container);
17331797
1734                  // determine UV coordinates and apply clipping
1735                  prim->texcoords = oriented_texcoords[finalorient];
1736                  clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
1798               curitem->texture()->get_scaled(width, height, prim->texture, list);
1799                    // set the palette
1800#if 1
1801               const dynamic_array<rgb_t> *adjusted_pal = curitem->texture()->get_adjusted_palette(container);
1802                    prim->texture.set_palette(adjusted_pal);
1803#else
1804                    prim->texture.palette = curitem->texture()->get_adjusted_palette(container);
1805#endif
17371806
1738                  // apply the final orientation from the quad flags and then build up the final flags
1739                  prim->flags = (curitem->flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) |
1740                              PRIMFLAG_TEXORIENT(finalorient) |
1741                              PRIMFLAG_TEXFORMAT(curitem->texture()->format());
1742                  if (blendmode != -1)
1743                     prim->flags |= PRIMFLAG_BLENDMODE(blendmode);
1744                  else
1745                     prim->flags |= PRIMFLAG_BLENDMODE(PRIMFLAG_GET_BLENDMODE(curitem->flags()));
1746               }
1807                    // determine UV coordinates and apply clipping
1808                    prim->texcoords = oriented_texcoords[finalorient];
1809                    clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
1810
1811                    // apply the final orientation from the quad flags and then build up the final flags
1812                    prim->flags = (curitem->flags() & ~(PRIMFLAG_TEXORIENT_MASK | PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) |
1813                                    PRIMFLAG_TEXORIENT(finalorient) |
1814                                    PRIMFLAG_TEXFORMAT(curitem->texture()->format());
1815                    if (blendmode != -1)
1816                        prim->flags |= PRIMFLAG_BLENDMODE(blendmode);
1817                    else
1818                        prim->flags |= PRIMFLAG_BLENDMODE(PRIMFLAG_GET_BLENDMODE(curitem->flags()));
17471819            }
17481820            else
17491821            {
r242658r242659
17781850      width = render_round_nearest(prim->bounds.x1) - render_round_nearest(prim->bounds.x0);
17791851      height = render_round_nearest(prim->bounds.y1) - render_round_nearest(prim->bounds.y0);
17801852
1781      bool got_scaled = container.overlay()->get_scaled(
1853      container.overlay()->get_scaled(
17821854            (container_xform.orientation & ORIENTATION_SWAP_XY) ? height : width,
17831855            (container_xform.orientation & ORIENTATION_SWAP_XY) ? width : height, prim->texture, list);
1784      if (got_scaled)
1785      {
1786         // determine UV coordinates
1787         prim->texcoords = oriented_texcoords[container_xform.orientation];
17881856
1789         // set the flags and add it to the list
1790         prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation) |
1791                     PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY) |
1792                     PRIMFLAG_TEXFORMAT(container.overlay()->format()) |
1793                     PRIMFLAG_TEXSHADE(1);
1794      }
1795      list.append_or_return(*prim, !got_scaled);
1857      // determine UV coordinates
1858        prim->texcoords = oriented_texcoords[container_xform.orientation];
1859
1860        // set the flags and add it to the list
1861        prim->flags = PRIMFLAG_TEXORIENT(container_xform.orientation) |
1862                        PRIMFLAG_BLENDMODE(BLENDMODE_RGB_MULTIPLY) |
1863                        PRIMFLAG_TEXFORMAT(container.overlay()->format()) |
1864                        PRIMFLAG_TEXSHADE(1);
1865
1866        list.append_or_return(*prim, false);
17961867   }
17971868}
17981869
r242658r242659
18301901      height = MIN(height, m_maxtexheight);
18311902
18321903      // get the scaled texture and append it
1833      bool clipped = true;
1834      if (texture->get_scaled(width, height, prim->texture, list))
1835      {
1836         // compute the clip rect
1837         render_bounds cliprect;
1838         cliprect.x0 = render_round_nearest(xform.xoffs);
1839         cliprect.y0 = render_round_nearest(xform.yoffs);
1840         cliprect.x1 = render_round_nearest(xform.xoffs + xform.xscale);
1841         cliprect.y1 = render_round_nearest(xform.yoffs + xform.yscale);
1842         sect_render_bounds(&cliprect, &m_bounds);
18431904
1844         // determine UV coordinates and apply clipping
1845         prim->texcoords = oriented_texcoords[xform.orientation];
1846         clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
1847      }
1905      texture->get_scaled(width, height, prim->texture, list);
18481906
1907        // compute the clip rect
1908        render_bounds cliprect;
1909        cliprect.x0 = render_round_nearest(xform.xoffs);
1910        cliprect.y0 = render_round_nearest(xform.yoffs);
1911        cliprect.x1 = render_round_nearest(xform.xoffs + xform.xscale);
1912        cliprect.y1 = render_round_nearest(xform.yoffs + xform.yscale);
1913        sect_render_bounds(&cliprect, &m_bounds);
1914
1915        // determine UV coordinates and apply clipping
1916        prim->texcoords = oriented_texcoords[xform.orientation];
1917        bool clipped = render_clip_quad(&prim->bounds, &cliprect, &prim->texcoords);
1918
18491919      // add to the list or free if we're clipped out
18501920      list.append_or_return(*prim, clipped);
18511921   }
trunk/src/emu/render.h
r242658r242659
167167// texture scaling callback
168168typedef void (*texture_scaler_func)(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param);
169169
170
171170// render_bounds - floating point bounding rectangle
172171struct render_bounds
173172{
r242658r242659
210209
211210
212211// render_texinfo - texture information
213struct render_texinfo
212
213
214struct render_palette_copy
214215{
216    int ref_count;
217    dynamic_array<rgb_t> palette;
218};
219
220class render_texinfo
221{
222private:
223    render_texinfo(const render_texinfo &src) {}
224public:
225    render_texinfo()
226    : base(NULL), rowpixels(0), width(0), height(0),
227      seqid(0), osddata(0), m_palette(NULL)
228    {}
229    ~render_texinfo()
230    {
231        free_palette();
232    }
233
234    render_texinfo &operator=(const render_texinfo &src);
235
215236   void *              base;               // base of the data
216237   UINT32              rowpixels;          // pixels per row
217238   UINT32              width;              // width of the image
218239   UINT32              height;             // height of the image
219   const rgb_t *       palette;            // palette for PALETTE16 textures, LUTs for RGB15/RGB32
220240   UINT32              seqid;              // sequence ID
221241   UINT64              osddata;            // aux data to pass to osd
242
243    const rgb_t *       palette() const { return ((m_palette == NULL) ? NULL : &m_palette->palette[0]); }
244
245    void set_palette(const dynamic_array<rgb_t> *source);
246
247private:
248    void free_palette();
249
250    render_palette_copy *m_palette;     // palette for PALETTE16 textures, LUTs for RGB15/RGB32
222251};
223252
224253
r242658r242659
433462
434463private:
435464   // internal helpers
436   bool get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist);
437   const rgb_t *get_adjusted_palette(render_container &container);
465   void get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &texinfo, render_primitive_list &primlist);
466   const dynamic_array<rgb_t> *get_adjusted_palette(render_container &container);
438467
439468   static const int MAX_TEXTURE_SCALES = 8;
440469
r242658r242659
524553   bool has_brightness_contrast_gamma_changes() const { return (m_user.m_brightness != 1.0f || m_user.m_contrast != 1.0f || m_user.m_gamma != 1.0f); }
525554   UINT8 apply_brightness_contrast_gamma(UINT8 value);
526555   float apply_brightness_contrast_gamma_fp(float value);
527   const rgb_t *bcg_lookup_table(int texformat, palette_t *palette = NULL);
556   const dynamic_array<rgb_t> *bcg_lookup_table(int texformat, palette_t *palette = NULL);
528557
529558private:
530559   // an item describes a high level primitive that is added to a container
r242658r242659
576605   render_texture *        m_overlaytexture;       // overlay texture
577606   auto_pointer<palette_client> m_palclient;       // client to the screen palette
578607   dynamic_array<rgb_t>    m_bcglookup;            // full palette lookup with bcg adjustments
579   rgb_t                   m_bcglookup256[0x400];  // lookup table for brightness/contrast/gamma
608   dynamic_array<rgb_t>    m_bcglookup256;         // lookup table for brightness/contrast/gamma
580609};
581610
582611
trunk/src/emu/rendersw.inc
r242658r242659
130130
131131   static inline UINT32 get_texel_palette16(const render_texinfo &texture, INT32 curu, INT32 curv)
132132   {
133      const rgb_t *palbase = texture.palette();
133134      if (_BilinearFilter)
134135      {
135136         INT32 u0 = curu >> 16;
r242658r242659
144145         const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base);
145146         texbase += v0 * texture.rowpixels + u0;
146147
147         UINT32 pix00 = texture.palette[texbase[0]];
148         UINT32 pix01 = texture.palette[texbase[u1]];
149         UINT32 pix10 = texture.palette[texbase[v1]];
150         UINT32 pix11 = texture.palette[texbase[u1 + v1]];
148         UINT32 pix00 = palbase[texbase[0]];
149         UINT32 pix01 = palbase[texbase[u1]];
150         UINT32 pix10 = palbase[texbase[v1]];
151         UINT32 pix11 = palbase[texbase[u1 + v1]];
151152         return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8);
152153      }
153154      else
154155      {
155156         const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16);
156         return texture.palette[texbase[0]];
157         return palbase[texbase[0]];
157158      }
158159   }
159160
r242658r242659
165166
166167   static inline UINT32 get_texel_palette16a(const render_texinfo &texture, INT32 curu, INT32 curv)
167168   {
169      const rgb_t *palbase = texture.palette();
168170      if (_BilinearFilter)
169171      {
170172         INT32 u0 = curu >> 16;
r242658r242659
179181         const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base);
180182         texbase += v0 * texture.rowpixels + u0;
181183
182         UINT32 pix00 = texture.palette[texbase[0]];
183         UINT32 pix01 = texture.palette[texbase[u1]];
184         UINT32 pix10 = texture.palette[texbase[v1]];
185         UINT32 pix11 = texture.palette[texbase[u1 + v1]];
184         UINT32 pix00 = palbase[texbase[0]];
185         UINT32 pix01 = palbase[texbase[u1]];
186         UINT32 pix10 = palbase[texbase[v1]];
187         UINT32 pix11 = palbase[texbase[u1 + v1]];
186188         return rgba_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8);
187189      }
188190      else
189191      {
190192         const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16);
191         return texture.palette[texbase[0]];
193         return palbase[texbase[0]];
192194      }
193195   }
194196
r242658r242659
912914
913915   static void draw_quad_yuy16_none(const render_primitive &prim, _PixelType *dstdata, UINT32 pitch, quad_setup_data &setup)
914916   {
915      const rgb_t *palbase = prim.texture.palette;
917      const rgb_t *palbase = prim.texture.palette();
916918      INT32 dudx = setup.dudx;
917919      INT32 dvdx = setup.dvdx;
918920      INT32 endx = setup.endx;
r242658r242659
10821084
10831085   static void draw_quad_rgb32(const render_primitive &prim, _PixelType *dstdata, UINT32 pitch, quad_setup_data &setup)
10841086   {
1085      const rgb_t *palbase = prim.texture.palette;
1087      const rgb_t *palbase = prim.texture.palette();
10861088      INT32 dudx = setup.dudx;
10871089      INT32 dvdx = setup.dvdx;
10881090      INT32 endx = setup.endx;
r242658r242659
12521254
12531255   static void draw_quad_rgb32_add(const render_primitive &prim, _PixelType *dstdata, UINT32 pitch, quad_setup_data &setup)
12541256   {
1255      const rgb_t *palbase = prim.texture.palette;
1257      const rgb_t *palbase = prim.texture.palette();
12561258      INT32 dudx = setup.dudx;
12571259      INT32 dvdx = setup.dvdx;
12581260      INT32 endx = setup.endx;
r242658r242659
13901392
13911393   static void draw_quad_argb32_alpha(const render_primitive &prim, _PixelType *dstdata, UINT32 pitch, quad_setup_data &setup)
13921394   {
1393      const rgb_t *palbase = prim.texture.palette;
1395      const rgb_t *palbase = prim.texture.palette();
13941396      INT32 dudx = setup.dudx;
13951397      INT32 dvdx = setup.dvdx;
13961398      INT32 endx = setup.endx;
r242658r242659
15361538
15371539   static void draw_quad_argb32_multiply(const render_primitive &prim, _PixelType *dstdata, UINT32 pitch, quad_setup_data &setup)
15381540   {
1539      const rgb_t *palbase = prim.texture.palette;
1541      const rgb_t *palbase = prim.texture.palette();
15401542      INT32 dudx = setup.dudx;
15411543      INT32 dvdx = setup.dvdx;
15421544      INT32 endx = setup.endx;
r242658r242659
16551657
16561658   static void draw_quad_argb32_add(const render_primitive &prim, _PixelType *dstdata, UINT32 pitch, quad_setup_data &setup)
16571659   {
1658      const rgb_t *palbase = prim.texture.palette;
1660      const rgb_t *palbase = prim.texture.palette();
16591661      INT32 dudx = setup.dudx;
16601662      INT32 dvdx = setup.dvdx;
16611663      INT32 endx = setup.endx;
trunk/src/lib/util/coretmpl.h
r242658r242659
9999   void resize_and_clear(int count, UINT8 data = 0) { resize(count); clear(data); }
100100   void resize_keep_and_clear_new(int count, UINT8 data = 0) { int oldcount = m_count; resize_keep(count); if (oldcount < m_count) clear_internal(oldcount, m_count - oldcount, data); }
101101
102   // batch operations
103    void copyfrom(const dynamic_array<_ElementType> &source)
104    {
105        resize(source.count());
106        for (int i=0; i < source.count(); i++)
107            m_array[i] = source[i];
108    }
109
102110private:
103111   // internal helpers
104112   void expand_internal(int count)
trunk/src/lib/util/palette.h
r242658r242659
170170
171171   // entry list getters
172172   const rgb_t *entry_list_raw() const { return m_entry_color; }
173   const rgb_t *entry_list_adjusted() const { return m_adjusted_color; }
173   const dynamic_array<rgb_t> *entry_list_adjusted_darray() const { return &m_adjusted_color; }
174    const rgb_t *entry_list_adjusted() const { return m_adjusted_color; }
174175   const rgb_t *entry_list_adjusted_rgb15() const { return m_adjusted_rgb15; }
175176
176177   // group adjustments
trunk/src/osd/sdl/blit13.h
r242658r242659
5353#define OP_RGB32_ARGB32(_src) ((_src) | 0xff000000)
5454
5555#define OP_RGB32PAL_ARGB32(_src) \
56   (texsource->palette[0x200 + (((_src) >> 16) & 0xff) ] | \
57      texsource->palette[0x100 + (((_src) >> 8) & 0xff) ] | \
58      texsource->palette[((_src) & 0xff) ] | 0xff000000)
56   (palbase[0x200 + (((_src) >> 16) & 0xff) ] | \
57      palbase[0x100 + (((_src) >> 8) & 0xff) ] | \
58      palbase[((_src) & 0xff) ] | 0xff000000)
5959
60#define OP_PAL16_ARGB32(_src) (0xff000000 | texsource->palette[_src])
60#define OP_PAL16_ARGB32(_src) (0xff000000 | palbase[_src])
6161
62#define OP_PAL16A_ARGB32(_src) (texsource->palette[_src])
62#define OP_PAL16A_ARGB32(_src) (palbase[_src])
6363
6464#define OP_RGB15_ARGB32(_src) (0xff000000 | ((_src & 0x7c00) << 9) | ((_src & 0x03e0) << 6) | ((_src & 0x001f) << 3) | \
6565   ((((_src & 0x7c00) << 9) | ((_src & 0x03e0) << 6) | ((_src & 0x001f) << 3) >> 5) & 0x070707))
6666
67#define OP_RGB15PAL_ARGB32(_src) (0xff000000 | texsource->palette[0x40 + ((_src >> 10) & 0x1f)] | \
68      texsource->palette[0x20 + ((_src >> 5) & 0x1f)] | texsource->palette[0x00 + ((_src >> 0) & 0x1f)])
67#define OP_RGB15PAL_ARGB32(_src) (0xff000000 | palbase[0x40 + ((_src >> 10) & 0x1f)] | \
68      palbase[0x20 + ((_src >> 5) & 0x1f)] | palbase[0x00 + ((_src >> 0) & 0x1f)])
6969
7070#define OP_ARGB32_RGB32(_pixel) premult32(_pixel)
7171
72#define OP_PAL16A_RGB32(_src) premult32(texsource->palette[_src])
72#define OP_PAL16A_RGB32(_src) premult32(palbase[_src])
7373
74#define OP_PAL16_ARGB1555(_src) ((texsource->palette[_src]&0xf80000) >> 9 | \
75         (texsource->palette[_src]&0x00f800) >> 6 | \
76         (texsource->palette[_src]&0x0000f8) >> 3 | 0x8000)
74#define OP_PAL16_ARGB1555(_src) ((palbase[_src]&0xf80000) >> 9 | \
75         (palbase[_src]&0x00f800) >> 6 | \
76         (palbase[_src]&0x0000f8) >> 3 | 0x8000)
7777
7878#define OP_RGB15_ARGB1555(_src) ((_src) | 0x8000)
7979
80#define OP_RGB15PAL_ARGB1555(_src) ((texsource->palette[(_src) >> 10] & 0xf8) << 7 | \
81         (texsource->palette[((_src) >> 5) & 0x1f] & 0xf8) << 2 | \
82         (texsource->palette[(_src) & 0x1f] & 0xf8) >> 3 | 0x8000)
80#define OP_RGB15PAL_ARGB1555(_src) ((palbase[(_src) >> 10] & 0xf8) << 7 | \
81         (palbase[((_src) >> 5) & 0x1f] & 0xf8) << 2 | \
82         (palbase[(_src) & 0x1f] & 0xf8) >> 3 | 0x8000)
8383
8484#define OP_YUV16_UYVY(_src) (_src)
8585
86#define OP_YUV16PAL_UYVY(_src) ((texsource->palette[((_src) >> 8) & 0xff] << 8) | ((_src) & 0x00ff))
86#define OP_YUV16PAL_UYVY(_src) ((palbase[((_src) >> 8) & 0xff] << 8) | ((_src) & 0x00ff))
8787
88#define OP_YUV16PAL_YVYU(_src) ((texsource->palette[((_src) >> 8) & 0xff] & 0xff) | ((_src & 0xff) << 8))
88#define OP_YUV16PAL_YVYU(_src) ((palbase[((_src) >> 8) & 0xff] & 0xff) | ((_src & 0xff) << 8))
8989
9090#define OP_YUV16_YVYU(_src) ((((_src) >> 8) & 0xff) | ((_src & 0xff) << 8))
9191
9292#define OP_YUV16_YUY2(_src) ( ((_src) & 0xff00ff00) | \
9393   (((_src)>>16)&0xff) | (((_src)<<16)&0xff0000) )
9494
95#define OP_YUV16PAL_YUY2(_src) ( (texsource->palette[((_src)>>8) & 0xff]) | \
96      (texsource->palette[((_src)>>24) & 0xff]<<16) | \
95#define OP_YUV16PAL_YUY2(_src) ( (palbase[((_src)>>8) & 0xff]) | \
96      (palbase[((_src)>>24) & 0xff]<<16) | \
9797   (((_src)<<8)&0xff00ff00) )
9898
9999#define OP_YUV16_ARGB32(_src) \
r242658r242659
101101   | ((UINT64)ycc_to_rgb(((_src) >> 24) & 0xff, (_src) & 0xff , ((_src)>>16) & 0xff) << 32)
102102
103103#define OP_YUV16PAL_ARGB32(_src) \
104      (UINT64)ycc_to_rgb(texsource->palette[((_src) >>  8) & 0xff], (_src) & 0xff , ((_src)>>16) & 0xff) \
105   | ((UINT64)ycc_to_rgb(texsource->palette[((_src) >> 24) & 0xff], (_src) & 0xff , ((_src)>>16) & 0xff) << 32)
104      (UINT64)ycc_to_rgb(palbase[((_src) >>  8) & 0xff], (_src) & 0xff , ((_src)>>16) & 0xff) \
105   | ((UINT64)ycc_to_rgb(palbase[((_src) >> 24) & 0xff], (_src) & 0xff , ((_src)>>16) & 0xff) << 32)
106106
107107#define OP_YUV16_ARGB32ROT(_src) pixel_ycc_to_rgb(&(_src))
108108
109#define OP_YUV16PAL_ARGB32ROT(_src) pixel_ycc_to_rgb_pal(&(_src), texsource->palette)
109#define OP_YUV16PAL_ARGB32ROT(_src) pixel_ycc_to_rgb_pal(&(_src), palbase)
110110
111111//============================================================
112112//  Copy and rotation
r242658r242659
114114
115115#define TEXCOPY_M( _name, _src_type, _dest_type,  _op, _len_div) \
116116INLINE void texcopy_##_name (texture_info *texture, const render_texinfo *texsource) { \
117    const rgb_t *palbase = texsource->palette(); \
117118   int x, y; \
118119   /* loop over Y */ \
119120   for (y = 0; y < texsource->height; y++) { \
r242658r242659
133134
134135#define TEXROT( _name, _src_type, _dest_type, _op) \
135136INLINE void texcopy_rot_##_name (texture_info *texture, const render_texinfo *texsource) { \
137    const rgb_t *palbase = texsource->palette(); \
136138   int x, y; \
137139   quad_setup_data *setup = &texture->setup; \
138140   int dudx = setup->dudx; \
trunk/src/osd/sdl/draw13.c
r242658r242659
6060
6161struct quad_setup_data
6262{
63    quad_setup_data()
64    : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0),
65      rotwidth(0), rotheight(0)
66    {}
6367   INT32           dudx, dvdx, dudy, dvdy;
6468   INT32           startu, startv;
6569   INT32           rotwidth, rotheight;
r242658r242659
9094/* texture_info holds information about a texture */
9195struct texture_info
9296{
97    texture_info()
98    : next(NULL), hash(0), flags(0), rawwidth(0), rawheight(0), format(0),
99      pixels(NULL), pitch(0), pixels_own(0), texture_id(NULL), copyinfo(NULL),
100      sdl_access(0), sdl_blendmode(SDL_BLENDMODE_NONE), is_rotated(0), last_access(0)
101    {
102    }
93103   texture_info *      next;               // next texture in the list
94104
95105   HashT               hash;               // hash value for the texture (must be >= pointer size)
r242658r242659
117127/* sdl_info is the information about SDL for the current screen */
118128struct sdl_info
119129{
130    sdl_info()
131    : blittimer(0), extra_flags(0), sdl_renderer(NULL), texlist(NULL),
132      texture_max_width(0), texture_max_height(0), last_hofs(0), last_vofs(0),
133      resize_pending(0), resize_width(0), resize_height(0),
134      last_blit_time(0), last_blit_pixels(0)
135    {}
120136   INT32           blittimer;
121137   UINT32          extra_flags;
122138
r242658r242659
441457
442458static void add_list(copy_info **head, copy_info *element, Uint32 bm)
443459{
444   copy_info *newci = (copy_info *) osd_malloc(sizeof(copy_info));
460   copy_info *newci = global_alloc(copy_info);
445461   *newci = *element;
446462
447463   newci->bm_mask = bm;
r242658r242659
515531                  (int) bi->perf);
516532         freeme = bi;
517533         bi = bi->next;
518         osd_free(freeme);
534         global_free(freeme);
519535      }
520536}
521537
r242658r242659
543559static int drawsdl2_window_create(sdl_window_info *window, int width, int height)
544560{
545561   // allocate memory for our structures
546   sdl_info *sdl = (sdl_info *) osd_malloc(sizeof(*sdl));
562   sdl_info *sdl = global_alloc(sdl_info);
547563
548564   osd_printf_verbose("Enter drawsdl2_window_create\n");
549565
550   memset(sdl, 0, sizeof(*sdl));
551
552566   window->dxdata = sdl;
553567
554568   sdl->extra_flags = (window->fullscreen() ?
r242658r242659
819833
820834   SDL_DestroyWindow(window->sdl_window);
821835
822   osd_free(sdl);
836   global_free(sdl);
823837   window->dxdata = NULL;
824838}
825839
r242658r242659
879893   texture_info *texture;
880894
881895   // allocate a new texture
882   texture = (texture_info *) osd_malloc(sizeof(*texture));
883   memset(texture, 0, sizeof(*texture));
896   texture = global_alloc(texture_info);
884897
885898   // fill in the core data
886899   texture->hash = texture_compute_hash(texsource, flags);
r242658r242659
897910         texture->format = SDL_TEXFORMAT_ARGB32;
898911         break;
899912      case TEXFORMAT_RGB32:
900         texture->format = texsource->palette ? SDL_TEXFORMAT_RGB32_PALETTED : SDL_TEXFORMAT_RGB32;
913         texture->format = texsource->palette() ? SDL_TEXFORMAT_RGB32_PALETTED : SDL_TEXFORMAT_RGB32;
901914         break;
902915      case TEXFORMAT_PALETTE16:
903916         texture->format = SDL_TEXFORMAT_PALETTE16;
r242658r242659
906919         texture->format = SDL_TEXFORMAT_PALETTE16A;
907920         break;
908921      case TEXFORMAT_YUY16:
909         texture->format = texsource->palette ? SDL_TEXFORMAT_YUY16_PALETTED : SDL_TEXFORMAT_YUY16;
922         texture->format = texsource->palette() ? SDL_TEXFORMAT_YUY16_PALETTED : SDL_TEXFORMAT_YUY16;
910923         break;
911924
912925      default:
r242658r242659
940953
941954   if ( (texture->copyinfo->func != NULL) && (texture->sdl_access == SDL_TEXTUREACCESS_STATIC))
942955   {
943      texture->pixels = osd_malloc_array(texture->setup.rotwidth * texture->setup.rotheight * texture->copyinfo->dst_bpp);
956      texture->pixels = malloc(texture->setup.rotwidth * texture->setup.rotheight * texture->copyinfo->dst_bpp);
944957      texture->pixels_own=TRUE;
945958   }
946959   /* add us to the texture list */
r242658r242659
11351148   SDL_DestroyTexture(texture->texture_id);
11361149   if ( texture->pixels_own )
11371150   {
1138      osd_free(texture->pixels);
1151      free(texture->pixels);
11391152      texture->pixels=NULL;
11401153      texture->pixels_own=FALSE;
11411154   }
r242658r242659
11471160      sdl->texlist = NULL;
11481161   else
11491162      p->next = texture->next;
1150   osd_free(texture);
1163   global_free(texture);
11511164}
11521165
11531166static void drawsdl2_destroy_all_textures(sdl_window_info *window)
trunk/src/osd/sdl/drawogl.c
r242658r242659
161161/* texture_info holds information about a texture */
162162struct texture_info
163163{
164    texture_info()
165    : hash(0), flags(0), rawwidth(0), rawheight(0),
166      rawwidth_create(0), rawheight_create(0),
167      type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0),
168      texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL),
169      data_own(0), texCoordBufferName(0)
170    {
171        for (int i=0; i<2; i++)
172        {
173            mpass_textureunit[i] = 0;
174            mpass_texture_mamebm[i] = 0;
175            mpass_fbo_mamebm[i] = 0;
176            mpass_texture_scrn[i] = 0;
177            mpass_fbo_scrn[i] = 0;
178        }
179        for (int i=0; i<8; i++)
180            texCoord[i] = 0.0f;
181    }
182
164183   HashT               hash;               // hash value for the texture (must be >= pointer size)
165184   UINT32              flags;              // rendering flags
166185   render_texinfo      texinfo;            // copy of the texture info
r242658r242659
198217/* sdl_info is the information about SDL for the current screen */
199218struct sdl_info
200219{
220    sdl_info()
221    : blittimer(0), extra_flags(0),
222#if (SDLMAME_SDL2)
223      gl_context_id(0),
224#else
225      sdlsurf(NULL),
226#endif
227      initialized(0),
228      last_blendmode(0),
229      texture_max_width(0),
230      texture_max_height(0),
231      texpoweroftwo(0),
232      usevbo(0), usepbo(0), usefbo(0), useglsl(0), glsl(NULL),
233      glsl_program_num(0),
234      glsl_program_mb2sc(0),
235      usetexturerect(0),
236      init_context(0),
237      last_hofs(0.0f),
238      last_vofs(0.0f),
239      surf_w(0),
240      surf_h(0)
241    {
242        for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++)
243            texhash[i] = NULL;
244        for (int i=0; i < 2*GLSL_SHADER_MAX; i++)
245            glsl_program[i] = 0;
246        for (int i=0; i < 8; i++)
247            texVerticex[i] = 0.0f;
248    }
249
201250   INT32           blittimer;
202251   UINT32          extra_flags;
203252
r242658r242659
487536   int has_and_allow_texturerect = 0;
488537
489538   // allocate memory for our structures
490   sdl = (sdl_info *) osd_malloc(sizeof(*sdl));
491   memset(sdl, 0, sizeof(*sdl));
539   sdl = global_alloc(sdl_info);
492540
493541   window->dxdata = sdl;
494542
r242658r242659
16121660   }
16131661#endif
16141662
1615   osd_free(sdl);
1663   global_free(sdl);
16161664   window->dxdata = NULL;
16171665}
16181666
r242658r242659
16541702   if    ( texture_copy_properties[texture->format][SDL_TEXFORMAT_SRC_EQUALS_DEST] &&
16551703         !texture_copy_properties[texture->format][SDL_TEXFORMAT_SRC_HAS_PALETTE] &&
16561704         texture->xprescale == 1 && texture->yprescale == 1 &&
1657         !texture->borderpix && !texsource->palette &&
1705         !texture->borderpix && !texsource->palette() &&
16581706         texsource->rowpixels <= sdl->texture_max_width )
16591707   {
16601708      texture->nocopy = TRUE;
r242658r242659
20682116   texture_info *texture;
20692117
20702118   // allocate a new texture
2071   texture = (texture_info *) malloc(sizeof(*texture));
2072   memset(texture, 0, sizeof(*texture));
2119   texture = global_alloc(texture_info);
20732120
20742121   // fill in the core data
20752122   texture->hash = texture_compute_hash(texsource, flags);
r242658r242659
21072154         texture->format = SDL_TEXFORMAT_ARGB32;
21082155         break;
21092156      case TEXFORMAT_RGB32:
2110         if (texsource->palette != NULL)
2157         if (texsource->palette() != NULL)
21112158            texture->format = SDL_TEXFORMAT_RGB32_PALETTED;
21122159         else
21132160            texture->format = SDL_TEXFORMAT_RGB32;
r242658r242659
21192166         texture->format = SDL_TEXFORMAT_PALETTE16A;
21202167         break;
21212168      case TEXFORMAT_YUY16:
2122         if (texsource->palette != NULL)
2169         if (texsource->palette() != NULL)
21232170            texture->format = SDL_TEXFORMAT_YUY16_PALETTED;
21242171         else
21252172            texture->format = SDL_TEXFORMAT_YUY16;
r242658r242659
21432190   {
21442191      if ( texture_shader_create(window, texsource, texture, flags) )
21452192      {
2146         free(texture);
2193         global_free(texture);
21472194         return NULL;
21482195      }
21492196   }
r242658r242659
22292276            sdl->texhash[i] = texture;
22302277            break;
22312278         }
2232      assert(i < HASH_SIZE + OVERFLOW_SIZE);
2279      assert_always(i < HASH_SIZE + OVERFLOW_SIZE, "texture hash exhausted ...");
22332280   }
22342281
22352282   if(sdl->usevbo)
r242658r242659
25612608            switch (PRIMFLAG_GET_TEXFORMAT(flags))
25622609            {
25632610               case TEXFORMAT_PALETTE16:
2564                  copyline_palette16((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2611                  copyline_palette16((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette(), texture->borderpix, texture->xprescale);
25652612                  break;
25662613
25672614               case TEXFORMAT_PALETTEA16:
2568                  copyline_palettea16((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2615                  copyline_palettea16((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette(), texture->borderpix, texture->xprescale);
25692616                  break;
25702617
25712618               case TEXFORMAT_RGB32:
2572                  copyline_rgb32((UINT32 *)dst, (UINT32 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2619                  copyline_rgb32((UINT32 *)dst, (UINT32 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette(), texture->borderpix, texture->xprescale);
25732620                  break;
25742621
25752622               case TEXFORMAT_ARGB32:
2576                  copyline_argb32((UINT32 *)dst, (UINT32 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2623                  copyline_argb32((UINT32 *)dst, (UINT32 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette(), texture->borderpix, texture->xprescale);
25772624                  break;
25782625
25792626               case TEXFORMAT_YUY16:
2580                  copyline_yuy16_to_argb((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2627                  copyline_yuy16_to_argb((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette(), texture->borderpix, texture->xprescale);
25812628                  break;
25822629
25832630               default:
r242658r242659
26502697      texture->texinfo.width == prim->texture.width &&
26512698      texture->texinfo.height == prim->texture.height &&
26522699      texture->texinfo.rowpixels == prim->texture.rowpixels &&
2653      texture->texinfo.palette == prim->texture.palette &&
2700      /* texture->texinfo.palette() == prim->texture.palette() && */
26542701      ((texture->flags ^ prim->flags) & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)) == 0)
26552702      return 1;
26562703   else
r242658r242659
30413088      sdl->texhash[i] = NULL;
30423089      if (texture != NULL)
30433090      {
3044      if(sdl->usevbo)
3045      {
3046         pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) );
3047         texture->texCoordBufferName=0;
3048      }
3091            if(sdl->usevbo)
3092            {
3093                pfn_glDeleteBuffers( 1, &(texture->texCoordBufferName) );
3094                texture->texCoordBufferName=0;
3095            }
30493096
3050      if(sdl->usepbo && texture->pbo)
3051      {
3052         pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) );
3053         texture->pbo=0;
3054      }
3097            if(sdl->usepbo && texture->pbo)
3098            {
3099                pfn_glDeleteBuffers( 1, (GLuint *)&(texture->pbo) );
3100                texture->pbo=0;
3101            }
30553102
3056      if( sdl->glsl_program_num > 1 )
3057      {
3058         assert(sdl->usefbo);
3059         pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]);
3060         glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]);
3061      }
3103            if( sdl->glsl_program_num > 1 )
3104            {
3105                assert(sdl->usefbo);
3106                pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_mamebm[0]);
3107                glDeleteTextures(2, (GLuint *)&texture->mpass_texture_mamebm[0]);
3108            }
30623109
3063      if ( sdl->glsl_program_mb2sc < sdl->glsl_program_num - 1 )
3064      {
3065         assert(sdl->usefbo);
3066         pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]);
3067         glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]);
3068      }
3110            if ( sdl->glsl_program_mb2sc < sdl->glsl_program_num - 1 )
3111            {
3112                assert(sdl->usefbo);
3113                pfn_glDeleteFramebuffers(2, (GLuint *)&texture->mpass_fbo_scrn[0]);
3114                glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]);
3115            }
30693116
3070      glDeleteTextures(1, (GLuint *)&texture->texture);
3071      if ( texture->data_own )
3072      {
3073         free(texture->data);
3074         texture->data=NULL;
3075         texture->data_own=FALSE;
3117            glDeleteTextures(1, (GLuint *)&texture->texture);
3118            if ( texture->data_own )
3119            {
3120                free(texture->data);
3121                texture->data=NULL;
3122                texture->data_own=FALSE;
3123            }
3124            global_free(texture);
30763125      }
3077      free(texture);
3078      }
30793126      i++;
30803127   }
30813128   if ( sdl->useglsl )
trunk/src/osd/sdl/window.c
r242658r242659
656656
657657   sdlwindow_update_cursor_state(wp->machine(), wp->window());
658658
659   osd_free(wp);
659660   return NULL;
660661}
661662
trunk/src/osd/windows/d3dhlsl.c
r242658r242659
940940      texture.rowpixels = shadow_bitmap.rowpixels();
941941      texture.width = shadow_bitmap.width();
942942      texture.height = shadow_bitmap.height();
943      texture.palette = NULL;
943      texture.set_palette(NULL);
944944      texture.seqid = 0;
945945
946946      // now create it
trunk/src/osd/windows/drawd3d.c
r242658r242659
528528      texture.rowpixels = m_default_bitmap.rowpixels();
529529      texture.width = m_default_bitmap.width();
530530      texture.height = m_default_bitmap.height();
531      texture.palette = NULL;
531      texture.set_palette(NULL);
532532      texture.seqid = 0;
533533
534534      // now create it
r242658r242659
545545      texture.rowpixels = m_vector_bitmap.rowpixels();
546546      texture.width = m_vector_bitmap.width();
547547      texture.height = m_vector_bitmap.height();
548      texture.palette = NULL;
548      texture.set_palette(NULL);
549549      texture.seqid = 0;
550550
551551      // now create it
r242658r242659
25802580      switch (PRIMFLAG_GET_TEXFORMAT(flags))
25812581      {
25822582         case TEXFORMAT_PALETTE16:
2583            copyline_palette16((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix);
2583            copyline_palette16((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette(), m_xborderpix);
25842584            break;
25852585
25862586         case TEXFORMAT_PALETTEA16:
2587            copyline_palettea16((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix);
2587            copyline_palettea16((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette(), m_xborderpix);
25882588            break;
25892589
25902590         case TEXFORMAT_RGB32:
2591            copyline_rgb32((UINT32 *)dst, (UINT32 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix);
2591            copyline_rgb32((UINT32 *)dst, (UINT32 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette(), m_xborderpix);
25922592            break;
25932593
25942594         case TEXFORMAT_ARGB32:
2595            copyline_argb32((UINT32 *)dst, (UINT32 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix);
2595            copyline_argb32((UINT32 *)dst, (UINT32 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette(), m_xborderpix);
25962596            break;
25972597
25982598         case TEXFORMAT_YUY16:
25992599            if (m_texture_manager->get_yuv_format() == D3DFMT_YUY2)
2600               copyline_yuy16_to_yuy2((UINT16 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix);
2600               copyline_yuy16_to_yuy2((UINT16 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette(), m_xborderpix);
26012601            else if (m_texture_manager->get_yuv_format() == D3DFMT_UYVY)
2602               copyline_yuy16_to_uyvy((UINT16 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix);
2602               copyline_yuy16_to_uyvy((UINT16 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette(), m_xborderpix);
26032603            else
2604               copyline_yuy16_to_argb((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette, m_xborderpix);
2604               copyline_yuy16_to_argb((UINT32 *)dst, (UINT16 *)texsource->base + srcy * texsource->rowpixels, texsource->width, texsource->palette(), m_xborderpix);
26052605            break;
26062606
26072607         default:


Previous 199869 Revisions Next


© 1997-2024 The MAME Team