Commit Graph

11 Commits

Author SHA1 Message Date
Aaron Giles
7f5529c2cd Templatized the palette generators and made naming consistent.
Moved video/generic flip screen management into the base
driver_device class and updated all callers.
2012-04-09 17:30:29 +00:00
Aaron Giles
194397db29 Moved all drivers to using the paletteram helpers defined in the
driver_device base class. The palette base is now specified via an
AM_SHARE of "paletteram" or "paletteram2". The driver_device base
class now finds these pointers and places them in 
m_generic_paletteram_8/_16/_32 and m_generic_paletteram2_8/_16/_32.

Removed machine.generic.paletteram*, and machine.generic entirely.
Removed AM_BASE_GENERIC/AM_SIZE_GENERIC as they don't apply anymore.

Changed required_/optional_shared_ptr to support set_target with
base and size for manually configuring a shared pointer, and a new
allocate method for dynamically allocating (and registering the
memory for save states).

A few subsequent cleanups are coming related to this, but wanted
to get this in before the next modern push.
2012-04-05 07:44:51 +00:00
Aaron Giles
bd24fb23c1 Results of running the latest srcclean. 2009-12-28 09:04:00 +00:00
Aaron Giles
2d22e450f2 Cleanups and version bump. 2009-10-12 08:45:25 +00:00
Aaron Giles
a6c5893732 Assert copyright ownership of core library files, and relicense
under standard BSD license.
2009-10-09 05:25:04 +00:00
Aaron Giles
ac0abd1706 Major drawgfx cleanup, global removal, and feature enhancements:
- Added built-in dirty tile tracking to the gfx_element. This removes
    the need for all drivers that had dynamically populated graphics
    to do their own dirty tracking. Tiles are marked dirty via the
    new function gfx_element_mark_dirty(). Any driver that needs access
    to the decoded data must call gfx_element_get_data() in order to
    ensure that the referenced tile is clean before proceeding.
    
 - In order to support dirty tracking, the gfx_element was enhanced to
    keep track of the original source pointer, so that it can go back
    and regenerate tiles on demand. For systems that set NULL for the
    region in the gfxdecode, they must use gfx_element_set_source()
    to specify a pointer to the raw data before drawing anything.
 
 - Changed allocgfx() to gfx_element_alloc(), and added parameters to
    specify the source data pointer, base color index, and total colors.
    Many drivers had to whack these values in after the fact, so this
    allowed for some minor additional cleanup.
 
 - Added a dirtyseq member to the gfx_element struct. This is 
    incremented on each tile dirty, and can be used to sniff if 
    something has changed.
 
 - Added logic in the tilemap engine to track which gfx_elements are
    used for a given tilemap, and automatically detect changes to the
    tiles so that drivers no longer have to explicitly invalidate the
    tilemap when tiles change. In the future, this may grow smarter to
    only invalidate the affected tiles, but for now it invalidates the
    entire tilemap.
 
 - Updated a number of drivers to remove their own dirty handling and
    leverage the new internal dirty marking.

 - Because the source data must always be present, updated the atarigen
    zwackery and mystwarr graphics handing code to support this.

 - Thanks to the dirty tracking, this actually allows all gfx decoding
    to happen on the fly instead of all at once up front. Since there 
    was some concern that this would cause undesirable behavior due to 
    decoding lots of tiles on the fly, it is controlled with a compile-
    time constant in mame.h (PREDECODE_GFX). Set this to 1 to get the
    old behavior back.
    
 - Moved decodechar() and decodegfx() to deprecat.h. All drivers in MAME
    have been updated to simply mark tiles dirty and let the rendering
    system decode them as needed, so these functions may go away in the
    future.

 - Rewrote entirely the rendering code in drawgfx. This code previously
    used extensive recursive #includes and tricks to build, and was
    very difficult to understand. The new code is based off of a set of 
    macros defined in drawgfxm.h. These new macros separate the core 
    rendering logic from the per-pixel operation, allowing the operation 
    to be easily "plugged" into any of the renderers. These macros are
    also available to any driver that wants custom rendering behavior
    that is similar to existing core behavior, without needing to
    populate the core with esoteric one-off rendering behaviors.
 
 - Added a set of new functions for [p]drawgfx[zoom], one for each
    transparency type. The old [p]drawgfx[zoom] functions are still
    present, but now switch off the transparency type and call through
    to one of these new transparency-specific functions. The old
    functions are also now reduced to only supporting TRANSPARENCY_NONE,
    TRANSPARENCY_PEN, and TRANSPARENCY_PENS. All other rendering types
    must use the new functions.
 
 - All new rendering functions have extensive asserts to catch improper
    clipping rectangles and other common errors.
    
 - All new rendering functions automatically downgrade to optimized
    versions where appropriate. For example, calling drawgfx_transpen
    with an out-of-range pen automatically falls back to drawgfx_opaque.
    And drawgfxzoom_* with xscale=yscale=1.0 automatically falls back
    to drawgfx_*. And many other examples. In general, this relieves 
    drivers from needing to make these sorts of decisions.
 
 - All new rendering functions have a consistent parameter order that
    is a bit different from the existing functions. The cliprect
    parameter is now specified immediately after the destination bitmap,
    to match the convention used throughout the rest of the system.
    The core parameters are followed by the scale parameters (for the
    zoom functions), and then followed by the priority parameters (for
    the pdrawgfx* functions), finally followed by any PIXEL_OP*-specific
    parameters (such as transparent pen, alpha, drawing tables, etc.)
  
 - Removed drawgfx_alpha_cache, alpha_set_level(), and the inline 
    functions alpha_blend16() and alpha_blend32(). To render graphics 
    with alpha, use the new [p]drawgfx[zoom]_alpha functions, which 
    take an explicit alpha value. To render tilemaps with alpha, the 
    TILEMAP_DRAW_ALPHA option now takes an explicit alpha parameter. 
    And to do you own alpha blending, use the alpha_blend_r16() and
    alpha_blend_r32() functions, which take an explicit alpha.
  
 - Updated a number of drivers as a result of removing the implicit
    alpha in the drawgfx_alpha_cache. 

 - Removed drawgfx_pen_table and TRANSPARENCY_PEN_TABLE. To achieve 
    the same effect, build your own table and pass it to 
    [p]drawgfx[zoom]_transtable, along with a pointer to the 
    machine->shadow_table to use for shadows. Eventually 
    machine->shadow_table is likely to go away, and drivers will need 
    to fetch the shadow table from the palette directly.
    
 - Updated a number of drivers to remove use of drawgfx_pen_table.
 
 - Removed TRANSPARENCY_ALPHARANGE; it was only used by the psikyosh
    driver, so it is now moved locally into that driver and built
    using the macros in drawgfxm.h.
 
 - Removed TRANSPARENCY_PEN_RAW; to achieve the same effect, call the
    new [p]drawgfx[zoom]_transpen_raw() functions. Updated drivers to
    make this change.
 
 - Removed the unused mdrawgfx* functions entirely.
 
 - Added new function gfx_element_set_source_clip() to specify a
    source clipping rectangle for any element. This replaces the nasty 
    hacks that were being used in bnstars, ms32, namcos86, and namcos1
    to achieve similar behaviors.
    
 - Simplified the copyrozbitmap() functions to match the copybitmap()
    functions in having separate opaque and transparent versions. Also
    removed the 'priority' parameter which was only used by one driver,
    and moved that logic into a custom renderer built using macros in
    drawgfxm.h. Updated copyrozbitmap* to use the destbitmap, cliprect
    parameter ordering convention as well.
 
 - Simplified the draw_scanline*() functions to always render opaque.
    Only one driver was doing otherwise, and it now does its work
    internally (draw_scanline is dead-simple ever since we moved 
    rotation to the OSD code; I almost just removed it entirely).
 
Other changes:

 - Added a cliprect to the bitmap_t type, which describes the full 
    bitmap.
    
 - Removed tilemap_set_pen_data_offset; unfortunately, this adds a
    random tile offset behind the scenes and goes against the dirty
    tile detection and invalidation. Updated the mainsnk, snk, and 
    snk68 drivers to use old fashioned tile banking. (Sorry Nicola.)
 
 - Changed zac2650 gfxdecode to use scale factors.

 - Added function video_assert_out_of_range_pixels() to help find
    the source of invalid pixels (generally out-of-range palette
    entries due to invalid data or sloppy calculations). Place this
    after each step in your rendering in a debug build to discover
    which code is generating improper pixels.
2009-01-12 11:05:15 +00:00
Aaron Giles
296347baab Plumbed machine parameters through the renderer. Removed need for
deprecat.h.

Changed render_texture_set_bitmap() to accept a palette object 
instead of a palette index. The renderer remains optimized for the 
system palette but will work if objects have their own palette as 
well.

Changed renderer to permit palettes for RGB and YUY textures. If
specified, these palettes specify a 32-entry (RGB15) or 256-entry
(others) lookup for applying additional brightness/contrast/gamma
on a per-texture basis.

Removed rescale notification. It never really worked that well and 
violated proper layering.

Renamed palette_set_brightness() to palette_set_pen_contrast() for 
clarity.

Changed palette objects to support global brightness/contrast/gamma
in addition to per-group and per-entry controls.
2008-09-29 08:02:58 +00:00
Aaron Giles
9766dc2367 Changed MAKE_RGB macro to set the alpha to 255 instead of 0. Updated
palette.c to preserve the alpha when transforming palette values.
These changes should be transparent to almost all drivers and rendering
(ha-ha), but there may be an occasional instance where a driver relied
on the alpha being 0 in the system palette. This also means that the
palette_set_color() function preserves any alpha value that is set.

Changed Firefox to RGB32 to allow for mid-screen palette changes. Because
of the above change, the hacky alpha manipulation that was previously
required is no longer necessary; the alpha is set directly in the palette
entry.
2008-09-27 20:36:04 +00:00
Aaron Giles
4c5cebc661 From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Fix some comments

Hi mamedev,

The following patch updates the initialization comments at the top of
mame.c and corrects/adds a few filename declarations at the top of a
handful of files.

~aa
2008-02-03 00:56:06 +00:00
Aaron Giles
ee9f88963c Copyright cleanup:
- removed years from copyright notices
 - removed redundant (c) from copyright notices
 - updated "the MAME Team" to be "Nicola Salmoria and the MAME Team"
2008-01-06 00:47:40 +00:00
Aaron Giles
7b77f12186 Initial checkin of MAME 0.121. 2007-12-17 15:19:59 +00:00