openMSX
V9990SDLRasterizer.hh
Go to the documentation of this file.
1#ifndef V9990SDLRASTERIZER_HH
2#define V9990SDLRASTERIZER_HH
3
4#include "V9990Rasterizer.hh"
6#include "V9990PxConverter.hh"
7
8#include "Observer.hh"
9
10#include <array>
11#include <cstdint>
12#include <memory>
13
14namespace openmsx {
15
16class Display;
17class V9990;
18class V9990VRAM;
19class RawFrame;
20class OutputSurface;
21class RenderSettings;
22class Setting;
23class PostProcessor;
24
28 , private Observer<Setting>
29{
30public:
31 using Pixel = uint32_t;
32
34 V9990& vdp, Display& display, OutputSurface& screen,
35 std::unique_ptr<PostProcessor> postProcessor);
40 ~V9990SDLRasterizer() override;
41
42 // Rasterizer interface:
43 [[nodiscard]] PostProcessor* getPostProcessor() const override;
44 [[nodiscard]] bool isActive() override;
45 void reset() override;
46 void frameStart() override;
47 void frameEnd(EmuTime::param time) override;
48 void setDisplayMode(V9990DisplayMode displayMode) override;
49 void setColorMode(V9990ColorMode colorMode) override;
50 void setPalette(int index, byte r, byte g, byte b, bool ys) override;
51 void setSuperimpose(bool enabled) override;
52 void drawBorder(int fromX, int fromY, int limitX, int limitY) override;
53 void drawDisplay(int fromX, int fromY, int toX, int toY,
54 int displayX,
55 int displayY, int displayYA, int displayYB) override;
56 [[nodiscard]] bool isRecording() const override;
57
60 void preCalcPalettes();
61 void resetPalette();
62
63 void drawP1Mode(int fromX, int fromY, int displayX,
64 int displayY, int displayYA, int displayYB,
65 int displayWidth, int displayHeight, bool drawSprites);
66 void drawP2Mode(int fromX, int fromY, int displayX,
67 int displayY, int displayYA,
68 int displayWidth, int displayHeight, bool drawSprites);
69 void drawBxMode(int fromX, int fromY, int displayX,
70 int displayY, int displayYA,
71 int displayWidth, int displayHeight, bool drawSprites);
72
73 // Observer<Setting>
74 void update(const Setting& setting) noexcept override;
75
76private:
79 static constexpr int SCREEN_WIDTH = 320;
80
83 static constexpr int SCREEN_HEIGHT = 240;
84
87 V9990& vdp;
88
91 V9990VRAM& vram;
92
95 OutputSurface& screen;
96
99 std::unique_ptr<RawFrame> workFrame;
100
103 RenderSettings& renderSettings;
104
108 int lineRenderTop;
109
114 int colZero;
115
118 V9990DisplayMode displayMode = V9990DisplayMode::P1; // dummy value
119 V9990ColorMode colorMode = V9990ColorMode::PP; // avoid UMR
120
123 std::array<Pixel, 32768> palette32768;
124
127 std::array<Pixel, 256> palette256; // from index to host Pixel color
128 std::array<int16_t, 256> palette256_32768; // from index to 15bpp V9990 color
129 // invariant: palette256[i] == palette32768[palette256_32768[i]]
130
134 std::array<Pixel, 64> palette64; // from index to host Pixel color
135 std::array<int16_t, 64> palette64_32768; // from index to 15bpp V9990 color
136 // invariant: palette64[i] == palette32768[palette64_32768[i]]
137
141 const std::unique_ptr<PostProcessor> postProcessor;
142
143 V9990BitmapConverter bitmapConverter;
144 V9990P1Converter p1Converter;
145 V9990P2Converter p2Converter;
146};
147
148} // namespace openmsx
149
150#endif
BaseSetting * setting
int g
Represents the output window/screen of openMSX.
Definition Display.hh:31
Generic Gang-of-Four Observer class, templatized edition.
Definition Observer.hh:10
A frame buffer where pixels can be written to.
A post processor builds the frame that is displayed from the MSX frame, while applying effects such a...
Class containing all settings for renderers.
Utility class to convert VRAM content to host pixels.
If this seems awfully familiar, take a look at Rasterizer.hh It's virtually the same class,...
V9990SDLRasterizer & operator=(const V9990SDLRasterizer &)=delete
void setPalette(int index, byte r, byte g, byte b, bool ys) override
Set RGB values for a palette entry.
void setDisplayMode(V9990DisplayMode displayMode) override
The display mode determines the screens geometry and how V9990 pixels are mapped to pixels on screen.
void drawBorder(int fromX, int fromY, int limitX, int limitY) override
Render a rectangle of border pixels on the host screen.
V9990SDLRasterizer & operator=(V9990SDLRasterizer &&)=delete
void drawP1Mode(int fromX, int fromY, int displayX, int displayY, int displayYA, int displayYB, int displayWidth, int displayHeight, bool drawSprites)
void preCalcPalettes()
Fill the palettes.
PostProcessor * getPostProcessor() const override
See V9990::getPostProcessor().
bool isActive() override
Will the output of this Rasterizer be displayed? There is no point in producing a frame that will not...
void setColorMode(V9990ColorMode colorMode) override
The color mode determines how the V9990 VRAM data gets converted to pixel colors.
V9990SDLRasterizer(const V9990SDLRasterizer &)=delete
void frameStart() override
Indicates the start of a new frame.
void update(const Setting &setting) noexcept override
void drawBxMode(int fromX, int fromY, int displayX, int displayY, int displayYA, int displayWidth, int displayHeight, bool drawSprites)
void drawP2Mode(int fromX, int fromY, int displayX, int displayY, int displayYA, int displayWidth, int displayHeight, bool drawSprites)
void setSuperimpose(bool enabled) override
Is superimpose enabled?
bool isRecording() const override
Is video recording active?
void drawDisplay(int fromX, int fromY, int toX, int toY, int displayX, int displayY, int displayYA, int displayYB) override
Render a rectangle of display pixels on the host screen.
void frameEnd(EmuTime::param time) override
Indicates the end of the current frame.
V9990SDLRasterizer(V9990SDLRasterizer &&)=delete
void reset() override
Resynchronize with VDP - flush caches etc.
Video RAM for the V9990.
Definition V9990VRAM.hh:17
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.
Definition V9990.hh:35
This file implemented 3 utility functions:
Definition Autofire.cc:11