Skip to content

Conversation

@freezy
Copy link
Owner

@freezy freezy commented Oct 4, 2025

This PR adds support for DmdDevice's new Render_Lum_And_Raw() API, which computes frame data based on PWM emulation and is much closer to real DMD behavior. This impacts mostly GTS3 games, but has also subtle effects on other type of games.

This new mode receives frames at one byte per pixel and is thus called gray8. The renderer of the virtual DMD has been updated to support this format natively. All physical devices need a firmware update, the closest right now is the colored-gray6 conversion, which results in 64 gray scale values (instead of the original 256).

Since these PWM frames aren't stable (they receive averaged values based on the ROM's internal clock), they cannot used for colorization matching. Thus, we continue sending the original frames ("identification frames") to the colorization plugins. These frames are tagged so they don't reach the renderers.

This PR is dependent on vpinball/pinmame#486, so make sure to use the latest VPM build when testing this. Closes #540.

@freezy freezy requested a review from Copilot October 4, 2025 22:37
@freezy freezy self-assigned this Oct 4, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for PWM (Pulse Width Modulation) frames through a new Render_Lum_And_Raw API that produces 8-bit grayscale frames (gray8) from PWM emulation, providing behavior closer to real DMD hardware. This primarily affects GTS3 games but has subtle impacts on other game types as well.

  • Introduces gray8 frame format (8-bit, 256 shades) from PWM dithering
  • Adds dual-frame rendering with separate luminance and identification frames
  • Updates virtual DMD renderer to support native gray8 format with colored-gray6 conversion for physical devices

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
PinMameDevice/DmdDevice.cs Adds new RenderLumRaw export function and internal rendering method for dual-frame PWM support
LibDmd/RenderGraph.cs Extends rendering pipeline with gray8 support, adds palette generation, and updates frame source method signatures
LibDmd/Output/Virtual/Dmd/VirtualDmdControl.xaml.cs Implements IGray8Destination interface and adds gray8 palette support to virtual DMD
LibDmd/Output/Virtual/Dmd/Convert.frag Adds GLSL shader function for gray8 frame decoding
LibDmd/Output/IGray8Destination.cs Defines new interface for 8-bit grayscale frame rendering
LibDmd/Input/IGray8Source.cs Defines new interface for 8-bit grayscale frame sources
LibDmd/Input/Passthrough/PassthroughGray8Source.cs Implements passthrough source for gray8 frames with deduplication
LibDmd/Frame/DmdFrame.cs Adds identification frame support and gray8 conversion methods
LibDmd/DmdDevice/DmdDevice.cs Integrates gray8 source into device pipeline and adds dual-frame rendering
LibDmd/Common/FrameUtil.cs Adds utility function for converting gray8 to lower bit depths

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@freezy freezy merged commit a2bcd46 into master Oct 5, 2025
4 checks passed
@freezy freezy deleted the pwm-frames branch October 5, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correct renderer for GTS3 (Gottlieb System 3)

2 participants