|
wavelength 1.0.0
|
The PlayStation 2 renderer. More...
#include <ps.h>


Public Member Functions | |
| Ps () | |
| Construct a renderer with a full-screen blur rectangle and register the toggle_heapnum command. | |
| virtual | ~Ps () |
| Release the frame's pending memory handles list. | |
| void | Init () override |
| Read the configuration, round the display to a size the GS shows, and set the display up. | |
| void | Terminate () override |
| Restore the generic factories, stop the vertical blank handler, and release the MFIFO ring. | |
| void | SetClearColor (const Color &color) override |
| Set the colour the frame is cleared to and write it into the clears of both buffers. | |
| void | DumpStats () override |
| Pass the drawing statistics and the free GS memory to DebugPrint(). | |
| void | ScreenDump (const char *pszName) override |
| Save the buffer on display to a numbered BMP file. | |
| void | DrawRect (const Rect &rect, const Color &color) override |
| Fill a rectangle of the screen, blended and in front of everything. | |
| float | DrawString (const char *pszText, const Vector2 &pos, const Vector2 &charSize, const Color &color) override |
| Draw text with the line font. | |
| void | BeginFrame () override |
| Swap the buffers, restart the MFIFO drain, and set the frame up. | |
| void | EndFrame () override |
| Draw the blur when it is active, end the packet, and send it. | |
| void | ClearAndFlip () override |
| Clear the buffer being drawn and show it outside a frame. | |
| void | RestoreFrameBufferTarget () override |
| Point FRAME_1 and XYOFFSET_1 at the buffer being drawn, and dither a 16-bit display. | |
| float | AspectRatio () override |
| Report the ratio of the height of the display to its width, fixed at 3 to 4. | |
| bool | SupportsTextures () override |
| Report that the renderer reads texture files. | |
| void | ShowModal (int *pState, const char *pszText) |
| Show a message on a dark blue screen until the player presses a button. | |
| int | GetReservedVramWords () const |
| Report the GS memory the frame buffers and the depth buffer occupy. | |
| void | ReleaseForMovie () |
| Give the display up to the movie player. | |
| void | RestoreAfterMovie () |
| Set the display up, the first time from Init() and again after the movie player. | |
| void | SaveScratchpad () |
| Copy the scratchpad to a new block in main memory, releasing an earlier copy. | |
| void | RestoreScratchpad () |
| Copy the block SaveScratchpad() made back to the scratchpad and release it. | |
| void | SetGsReg (int nReg, unsigned long long qwValue, unsigned long long qwMask) |
| Write a GS register through an A+D tag unless its shadow already has the value. | |
| int | PacketQwordsFree () const |
| Report how many quadwords the packet being built still has room for. | |
| void | Flush () |
| Send the packet being built and start the next one in the other half of the scratchpad. | |
| void | SwapBuffers () |
| Release the memory handles of the frame, wait for the vertical blank, and swap the buffers. | |
| void | DrawBlur () |
| Draw the frame back over itself, offset and translucent, inside mBlurRect. | |
| void | ReleaseAfterFrame (MemHandle *pHandle) |
| Release a memory handle at the next buffer swap, once the GS no longer reads it. | |
| int | GetBlurActive () const |
| void | SetBlurActive (int nBlurActive) |
| float | GetBlurAmount () const |
| void | SetBlurAmount (float fBlurAmount) |
| int | GetBlurCount () const |
| void | SetBlurCount (int nBlurCount) |
| const float * | GetBlurRect () const |
| float * | GetBlurRect () |
| void | SetBlurRect (int nIndex, float fValue) |
| Set one entry of the part of the screen DrawBlur() covers, x, y, w, and h. | |
| int | GetDepthBytes () const |
| int | GetNtsc () const |
| Public Member Functions inherited from RndRenderer | |
| RndRenderer () | |
| Set an opaque grey of 0.3, a display of 640 by 480 at 16 bits, and a timer ceiling of 50. | |
| virtual void | SetShowTimers (int bShow, int nMaxMs) |
| Show or hide the timer overlay. | |
| virtual void | SetShowStats (int bShow) |
| Show or hide the statistics overlay. | |
| virtual void | SetShowRate (int bShow) |
| Show or hide the frame rate overlay. | |
| const Color & | GetClearColor () const |
| int | GetFrameCount () const |
| int | GetScreenHeight () const |
| int | GetScreenWidth () const |
| int | GetTimerMaxMs () const |
Static Public Member Functions | |
| static void | ModalCallback (int *pState, const char *pszText) |
| Show a message through ThePs, the routine Init() gives TheDebug. | |
Static Public Attributes | |
| static constexpr int | kGsRegCount = 128 |
| The number of GS registers mGsRegs shadows. | |
| static constexpr float | kAspect = 0.75f |
| The ratio AspectRatio() reports. | |
Additional Inherited Members | |
| Protected Attributes inherited from RndRenderer | |
| Color | mClearColor |
| int | mScreenWidth |
| int | mScreenHeight |
| int | mScreenBpp |
| int | mTimerMaxMs |
| int | mFrameCount |
| int | mShowTimers |
| int | mShowStats |
| int | mShowRate |
The PlayStation 2 renderer.
The RTTI includes the name and records RndRenderer as the one base. ThePs is the one instance, and TheRnd points at it. The frame is built in the scratchpad by DmaPacket::shared() and sent from there through the MFIFO ring in main memory to VIF1. mGsRegs shadows the GS registers, and SetGsReg() writes a register only when its value changes.
| Ps::Ps | ( | ) |
Construct a renderer with a full-screen blur rectangle and register the toggle_heapnum command.
|
virtual |
Release the frame's pending memory handles list.
|
overridevirtual |
Read the configuration, round the display to a size the GS shows, and set the display up.
The width becomes 640, 512, 384, or 256, and the height 512, 448, 256, or 224, each the largest that does not exceed the request. A height of 448 or 224 selects NTSC output. The MFIFO ring is allocated, the packet builder is placed after it in the scratchpad, and the PlayStation 2 factories replace the generic ones. The modal message routine of TheDebug becomes ModalCallback().
Reimplemented from RndRenderer.
|
overridevirtual |
Restore the generic factories, stop the vertical blank handler, and release the MFIFO ring.
Reimplemented from RndRenderer.
|
overridevirtual |
Set the colour the frame is cleared to and write it into the clears of both buffers.
| color | The colour. |
Reimplemented from RndRenderer.
|
overridevirtual |
Pass the drawing statistics and the free GS memory to DebugPrint().
Reimplemented from RndRenderer.
|
overridevirtual |
Save the buffer on display to a numbered BMP file.
An open frame is closed first and opened again afterwards.
| pszName | The base name of the file. |
Reimplemented from RndRenderer.
Fill a rectangle of the screen, blended and in front of everything.
| rect | The rectangle in pixels. |
| color | The colour. |
Reimplemented from RndRenderer.
|
overridevirtual |
Draw text with the line font.
The characters from A to _, the lowercase letters, and the characters from ' to : have glyphs. Every other character draws nothing. Every character but a newline advances the pen by one and a half cells, and a newline starts a line two cells lower.
| pszText | The text. |
| pos | The top left corner in pixels. |
| charSize | The size of a cell in pixels. |
| color | The colour. |
Reimplemented from RndRenderer.
|
overridevirtual |
Swap the buffers, restart the MFIFO drain, and set the frame up.
The statistics are cleared, the default camera and the default material are applied, the texture cache ages, and every named timer is reset.
Reimplemented from RndRenderer.
|
overridevirtual |
Draw the blur when it is active, end the packet, and send it.
Reimplemented from RndRenderer.
|
overridevirtual |
Clear the buffer being drawn and show it outside a frame.
Reimplemented from RndRenderer.
|
overridevirtual |
Point FRAME_1 and XYOFFSET_1 at the buffer being drawn, and dither a 16-bit display.
Reimplemented from RndRenderer.
|
inlineoverridevirtual |
Report the ratio of the height of the display to its width, fixed at 3 to 4.
Reimplemented from RndRenderer.
|
inlineoverridevirtual |
Report that the renderer reads texture files.
Reimplemented from RndRenderer.
| void Ps::ShowModal | ( | int * | pState, |
| const char * | pszText ) |
Show a message on a dark blue screen until the player presses a button.
The overlays are hidden while the message shows, and an open frame is closed first and opened again afterwards. A state of 2 is cleared when the button is the one at bit 11. The name is inferred.
| pState | The caller's state. |
| pszText | The message. |
|
static |
Show a message through ThePs, the routine Init() gives TheDebug.
The name is inferred.
| pState | The caller's state. |
| pszText | The message. |
| int Ps::GetReservedVramWords | ( | ) | const |
Report the GS memory the frame buffers and the depth buffer occupy.
The name is inferred.
| void Ps::ReleaseForMovie | ( | ) |
Give the display up to the movie player.
The scratchpad is saved, the GS path is drained, and the GIF interrupt handler is removed. The name is inferred.
| void Ps::RestoreAfterMovie | ( | ) |
Set the display up, the first time from Init() and again after the movie player.
The register shadow is cleared, the GS is reset, the display buffers are placed for the depth, the VU microprograms are sent, and the MFIFO ring is restarted. A depth other than 16, 24, or 32 bits becomes 32. The name is inferred.
| void Ps::SaveScratchpad | ( | ) |
Copy the scratchpad to a new block in main memory, releasing an earlier copy.
The name is inferred.
| void Ps::RestoreScratchpad | ( | ) |
Copy the block SaveScratchpad() made back to the scratchpad and release it.
The name is inferred.
| void Ps::SetGsReg | ( | int | nReg, |
| unsigned long long | qwValue, | ||
| unsigned long long | qwMask ) |
Write a GS register through an A+D tag unless its shadow already has the value.
A mask of 0 writes the whole value without the comparison. Otherwise only the bits of the mask are compared and changed.
| nReg | The register. |
| qwValue | The value. |
| qwMask | The bits to set, or 0 for all of them. |
| int Ps::PacketQwordsFree | ( | ) | const |
Report how many quadwords the packet being built still has room for.
The name is inferred.
| void Ps::Flush | ( | ) |
Send the packet being built and start the next one in the other half of the scratchpad.
The routine waits until the MFIFO ring has room. An empty packet is not sent. The name is inferred.
| void Ps::SwapBuffers | ( | ) |
Release the memory handles of the frame, wait for the vertical blank, and swap the buffers.
The shadow takes the context 1 registers of the new draw environment. The name is inferred.
| void Ps::DrawBlur | ( | ) |
Draw the frame back over itself, offset and translucent, inside mBlurRect.
The texture is the buffer on display, and the sprite does not test or write depth. The title is inferred.
| void Ps::ReleaseAfterFrame | ( | MemHandle * | pHandle | ) |
Release a memory handle at the next buffer swap, once the GS no longer reads it.
A null handle is ignored. The name is inferred.
| pHandle | The handle, or null. |
|
inline |
|
inline |
| nBlurActive | BlurActive. |
|
inline |
|
inline |
| fBlurAmount | The opacity of the frame DrawBlur() draws. |
|
inline |
|
inline |
| nBlurCount | The offset of the frame DrawBlur() draws, in 1/16 pixel. |
|
inline |
|
inline |
|
inline |
Set one entry of the part of the screen DrawBlur() covers, x, y, w, and h.
| nIndex | The entry. |
| fValue | The value. |
|
inline |
|
inline |
|
staticconstexpr |
The number of GS registers mGsRegs shadows.
|
staticconstexpr |
The ratio AspectRatio() reports.