update GPU to update to Mednafen 0.9.39-unstable

This commit is contained in:
zeromus 2020-04-05 22:56:00 -04:00
parent 21c7ac4b8b
commit b5b962c180
7 changed files with 520 additions and 475 deletions

View File

@ -88,4 +88,13 @@
[OK] psx/gte : Cleanup [OK] psx/gte : Cleanup
[OK] psx/psx : Cleanup [OK] psx/psx : Cleanup
[OK] psx/timer : Major functional changes [OK] psx/timer : Major functional changes
[NO] psx/timer : Added loadstate sanity checks [NO] psx/timer : Added loadstate sanity checks
0.9.38.7 -> 0.9.39-unstable
[OK] psx/cdc : promote "Fantastic Pinball Kyutenkai" logic to unconditional; add MDFN_COLD
[OK] psx/cpu : various improvements
[OK] psx/fastfifo : .h copyright header
[NO] psx/debug : (file not used)
[OK] psx/dis : rename opcode, copyright header
[OK] psx/dma : copyright header
[OK] psx/frontio : copyright header and minor stuff
[OK] psx/gpu : copyright, change ctor, member org changes, minor stuff

View File

@ -1,78 +1,84 @@
/* Mednafen - Multi-system Emulator /******************************************************************************/
* /* Mednafen Sony PS1 Emulation Module */
* This program is free software; you can redistribute it and/or modify /******************************************************************************/
* it under the terms of the GNU General Public License as published by /* gpu.cpp:
* the Free Software Foundation; either version 2 of the License, or ** Copyright (C) 2011-2016 Mednafen Team
* (at your option) any later version. **
* ** This program is free software; you can redistribute it and/or
* This program is distributed in the hope that it will be useful, ** modify it under the terms of the GNU General Public License
* but WITHOUT ANY WARRANTY; without even the implied warranty of ** as published by the Free Software Foundation; either version 2
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** of the License, or (at your option) any later version.
* GNU General Public License for more details. **
* ** This program is distributed in the hope that it will be useful,
* You should have received a copy of the GNU General Public License ** but WITHOUT ANY WARRANTY; without even the implied warranty of
* along with this program; if not, write to the Free Software ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** GNU General Public License for more details.
*/ **
** You should have received a copy of the GNU General Public License
#include <assert.h> ** along with this program; if not, write to the Free Software Foundation, Inc.,
#include "psx.h" ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "timer.h" */
#include "math_ops.h"
//#pragma GCC optimize ("unroll-loops")
/*
GPU display timing master clock is nominally 53.693182 MHz for NTSC PlayStations, and 53.203425 MHz for PAL PlayStations. #include <assert.h>
Non-interlaced NTSC mode line timing notes(real-world times calculated via PS1 timer and math with nominal CPU clock value): #include "psx.h"
#include "timer.h"
263 lines per frame #include "math_ops.h"
~16714.85 us per frame, average. /* FIXME: Respect horizontal timing register values in relation to hsync/hblank/hretrace/whatever signal sent to the timers */
~63.55456 us per line, average.
/*
Multiplying the results of counter 0 in pixel clock mode by the clock divider of the current dot clock mode/width gives a result that's slightly less GPU display timing master clock is nominally 53.693182 MHz for NTSC PlayStations, and 53.203425 MHz for PAL PlayStations.
than expected; the dot clock divider is probably being reset each scanline.
Non-interlaced NTSC mode line timing notes(real-world times calculated via PS1 timer and math with nominal CPU clock value):
Non-interlaced PAL mode(but with an NTSC source clock in an NTSC PS1; calculated same way as NTSC values):
263 lines per frame
314 lines per frame
~16714.85 us per frame, average.
~19912.27 us per frame, average. ~63.55456 us per line, average.
~63.41486 us per line, average.
Multiplying the results of counter 0 in pixel clock mode by the clock divider of the current dot clock mode/width gives a result that's slightly less
FB X and Y display positions can be changed during active display; and Y display position appears to be treated as an offset to the current Y readout than expected; the dot clock divider is probably being reset each scanline.
position that gets reset around vblank time.
Non-interlaced PAL mode(but with an NTSC source clock in an NTSC PS1; calculated same way as NTSC values):
*/
314 lines per frame
/*
November 29, 2012 notes: ~19912.27 us per frame, average.
~63.41486 us per line, average.
PAL mode can be turned on, and then off again, mid-frame(creates a neat effect).
FB X and Y display positions can be changed during active display; and Y display position appears to be treated as an offset to the current Y readout
Pixel clock can be changed mid-frame with effect(the effect is either instantaneous, or cached at some point in the scanline, not tested to see which); position that gets reset around vblank time.
interestingly, alignment is off on a PS1 when going 5MHz->10MHz>5MHz with a grid image.
*/
Vertical start and end can be changed during active display, with effect(though it needs to be vs0->ve0->vs1->ve1->..., vs0->vs1->ve0 doesn't apparently do anything
different from vs0->ve0. /*
*/ November 29, 2012 notes:
namespace MDFN_IEN_PSX PAL mode can be turned on, and then off again, mid-frame(creates a neat effect).
{
Pixel clock can be changed mid-frame with effect(the effect is either instantaneous, or cached at some point in the scanline, not tested to see which);
//static data interestingly, alignment is off on a PS1 when going 5MHz->10MHz>5MHz with a grid image.
uint8 PS_GPU::DitherLUT[4][4][512]; // Y, X, 8-bit source value(256 extra for saturation)
Vertical start and end can be changed during active display, with effect(though it needs to be vs0->ve0->vs1->ve1->..., vs0->vs1->ve0 doesn't apparently do anything
static const int8 dither_table[4][4] = different from vs0->ve0.
{ */
{ -4, 0, -3, 1 },
{ 2, -2, 3, -1 }, namespace MDFN_IEN_PSX
{ -3, 1, -4, 0 }, {
{ 3, -1, 2, -2 },
static const int8 dither_table[4][4] =
{
{ -4, 0, -3, 1 },
{ 2, -2, 3, -1 },
{ -3, 1, -4, 0 },
{ 3, -1, 2, -2 },
}; };
void PS_GPU::StaticInitialize() void PS_GPU::StaticInitialize()
{ {
static bool initialized = false; static bool initialized = false;
if(initialized) return; if(initialized) return;
@ -106,13 +112,14 @@ void PS_GPU::StaticInitialize()
memcpy(&Commands[0x80], Commands_80_FF, sizeof(Commands_80_FF)); memcpy(&Commands[0x80], Commands_80_FF, sizeof(Commands_80_FF));
} }
PS_GPU::PS_GPU(bool pal_clock_and_tv) PS_GPU::PS_GPU(bool pal_clock_and_tv) : HardwarePALType(pal_clock_and_tv)
{ {
//printf("%zu\n", (size_t)((uintptr_t)DitherLUT - (uintptr_t)this));
//printf("%zu\n", (size_t)((uintptr_t)GPURAM - (uintptr_t)this));
//
//todo - not thread safe //todo - not thread safe
StaticInitialize(); StaticInitialize();
HardwarePALType = pal_clock_and_tv;
if(HardwarePALType == false) // NTSC clock if(HardwarePALType == false) // NTSC clock
{ {
GPUClockRatio = 103896; // 65536 * 53693181.818 / (44100 * 768) GPUClockRatio = 103896; // 65536 * 53693181.818 / (44100 * 768)
@ -1309,8 +1316,8 @@ pscpu_timestamp_t PS_GPU::Update(const pscpu_timestamp_t sys_timestamp)
char buffer[256]; char buffer[256];
snprintf(buffer, sizeof(buffer), ("VIDEO STANDARD MISMATCH")); snprintf(buffer, sizeof(buffer), ("VIDEO STANDARD MISMATCH"));
//DrawTextTrans(surface->pixels + ((DisplayRect->h / 2) - (13 / 2)) * surface->pitch32, surface->pitch32 << 2, DisplayRect->w, buffer, /*DrawText(surface, 0, (DisplayRect->h / 2) - (13 / 2), buffer,
//surface->MakeColor(0x00, 0xFF, 0x00), true, MDFN_FONT_6x13_12x13); surface->MakeColor(0x00, 0xFF, 0x00), MDFN_FONT_6x13_12x13, DisplayRect->w);*/
} }
} }
else else

View File

@ -1,170 +1,188 @@
// WARNING WARNING WARNING: ONLY use CanRead() method of BlitterFIFO, and NOT CanWrite(), since the FIFO is larger than the actual PS1 GPU FIFO to accommodate /******************************************************************************/
// our lack of fancy superscalarish command sequencer. /* Mednafen Sony PS1 Emulation Module */
/******************************************************************************/
#pragma once /* gpu.h:
** Copyright (C) 2011-2016 Mednafen Team
#include "FastFIFO.h" **
#include "git.h" ** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License
struct ShockRenderOptions; ** as published by the Free Software Foundation; either version 2
** of the License, or (at your option) any later version.
namespace MDFN_IEN_PSX **
{ ** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
class PS_GPU; ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
struct CTEntry **
{ ** You should have received a copy of the GNU General Public License
void (*func[4][8])(PS_GPU* g, const uint32 *cb); ** along with this program; if not, write to the Free Software Foundation, Inc.,
uint8 len; ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
uint8 fifo_fb_len; */
bool ss_cmd;
}; // WARNING WARNING WARNING: ONLY use CanRead() method of BlitterFIFO, and NOT CanWrite(), since the FIFO is larger than the actual PS1 GPU FIFO to accommodate
// our lack of fancy superscalarish command sequencer.
struct tri_vertex
{ #pragma once
int32 x, y;
int32 u, v; #include "FastFIFO.h"
int32 r, g, b; #include "git.h"
};
struct ShockRenderOptions;
struct i_group;
struct i_deltas; namespace MDFN_IEN_PSX
{
struct line_point
{ class PS_GPU;
int32 x, y;
uint8 r, g, b; struct CTEntry
}; {
void (*func[4][8])(PS_GPU* g, const uint32 *cb);
class PS_GPU uint8 len;
{ uint8 fifo_fb_len;
public: bool ss_cmd;
};
struct tri_vertex
{
int32 x, y;
int32 u, v;
int32 r, g, b;
};
struct i_group;
struct i_deltas;
struct line_point
{
int32 x, y;
uint8 r, g, b;
};
class PS_GPU
{
public:
void SetRenderOptions(ShockRenderOptions* opts); void SetRenderOptions(ShockRenderOptions* opts);
PS_GPU(bool pal_clock_and_tv) MDFN_COLD; PS_GPU(bool pal_clock_and_tv) MDFN_COLD;
~PS_GPU() MDFN_COLD; ~PS_GPU() MDFN_COLD;
static void StaticInitialize() MDFN_COLD; static void StaticInitialize() MDFN_COLD;
template<bool isReader>void SyncState(EW::NewState *ns); template<bool isReader>void SyncState(EW::NewState *ns);
void FillVideoParams(MDFNGI* gi) MDFN_COLD; void FillVideoParams(MDFNGI* gi) MDFN_COLD;
void Power(void) MDFN_COLD; void Power(void) MDFN_COLD;
void ResetTS(void); void ResetTS(void);
void StartFrame(EmulateSpecStruct *espec); void StartFrame(EmulateSpecStruct *espec);
pscpu_timestamp_t Update(const pscpu_timestamp_t timestamp); pscpu_timestamp_t Update(const pscpu_timestamp_t timestamp);
void Write(const pscpu_timestamp_t timestamp, uint32 A, uint32 V); void Write(const pscpu_timestamp_t timestamp, uint32 A, uint32 V);
INLINE bool CalcFIFOReadyBit(void) INLINE bool CalcFIFOReadyBit(void)
{ {
if(InCmd & (INCMD_PLINE | INCMD_QUAD)) if(InCmd & (INCMD_PLINE | INCMD_QUAD))
return(false); return(false);
if(BlitterFIFO.CanRead() == 0) if(BlitterFIFO.CanRead() == 0)
return(true); return(true);
if(InCmd & (INCMD_FBREAD | INCMD_FBWRITE)) if(InCmd & (INCMD_FBREAD | INCMD_FBWRITE))
return(false); return(false);
if(BlitterFIFO.CanRead() >= Commands[BlitterFIFO.Peek() >> 24].fifo_fb_len) if(BlitterFIFO.CanRead() >= Commands[BlitterFIFO.Peek() >> 24].fifo_fb_len)
return(false); return(false);
return(true); return(true);
} }
INLINE bool DMACanWrite(void) INLINE bool DMACanWrite(void)
{ {
return CalcFIFOReadyBit(); return CalcFIFOReadyBit();
} }
void WriteDMA(uint32 V); void WriteDMA(uint32 V);
uint32 ReadDMA(void); uint32 ReadDMA(void);
uint32 Read(const pscpu_timestamp_t timestamp, uint32 A); uint32 Read(const pscpu_timestamp_t timestamp, uint32 A);
inline int32 GetScanlineNum(void) inline int32 GetScanlineNum(void)
{ {
return(scanline); return(scanline);
} }
INLINE uint16 PeekRAM(uint32 A) INLINE uint16 PeekRAM(uint32 A)
{ {
return(GPURAM[(A >> 10) & 0x1FF][A & 0x3FF]); return(GPURAM[(A >> 10) & 0x1FF][A & 0x3FF]);
} }
INLINE void PokeRAM(uint32 A, uint16 V) INLINE void PokeRAM(uint32 A, uint16 V)
{ {
GPURAM[(A >> 10) & 0x1FF][A & 0x3FF] = V; GPURAM[(A >> 10) & 0x1FF][A & 0x3FF] = V;
} }
// Y, X private:
uint16 GPURAM[512][1024];
uint16 CLUT_Cache[256];
private: uint32 CLUT_Cache_VB; // Don't try to be clever and reduce it to 16 bits... ~0U is value for invalidated state.
uint16 CLUT_Cache[256]; template<uint32 TexMode_TA>
uint32 CLUT_Cache_VB; // Don't try to be clever and reduce it to 16 bits... ~0U is value for invalidated state. void Update_CLUT_Cache(uint16 raw_clut);
template<uint32 TexMode_TA> struct // Speedup-cache varibles, derived from other variables; shouldn't be saved in save states.
void Update_CLUT_Cache(uint16 raw_clut); {
// TW*_* variables derived from tww, twh, twx, twy, TexPageX, TexPageY
struct // Speedup-cache varibles, derived from other variables; shouldn't be saved in save states. uint32 TWX_AND;
{ uint32 TWX_ADD;
// TW*_* variables derived from tww, twh, twx, twy, TexPageX, TexPageY
uint32 TWX_AND; uint32 TWY_AND;
uint32 TWX_ADD; uint32 TWY_ADD;
} SUCV;
uint32 TWY_AND; void RecalcTexWindowStuff(void);
uint32 TWY_ADD;
} SUCV; struct
void RecalcTexWindowStuff(void); {
uint16 Data[4];
struct tTexCache uint32 Tag;
{ } TexCache[256];
uint16 Data[4];
uint32 Tag; void InvalidateTexCache(void);
} TexCache[256]; void InvalidateCache(void);
void InvalidateTexCache(void); void SetTPage(uint32);
void InvalidateCache(void);
void ProcessFIFO(void);
void SetTPage(uint32); void WriteCB(uint32 data);
uint32 ReadData(void);
void ProcessFIFO(void); void SoftReset(void);
void WriteCB(uint32 data);
uint32 ReadData(void); uint32 DMAControl;
void SoftReset(void);
//
uint32 DMAControl; // Drawing stuff
//
// //int32 TexPageX; // 0, 64, 128, 192, etc up to 960
// Drawing stuff //int32 TexPageY; // 0 or 256
// //uint32 abr; // Semi-transparency mode(0~3)
//int32 TexPageX; // 0, 64, 128, 192, etc up to 960 //bool dtd; // Dithering enable
//int32 TexPageY; // 0 or 256
//uint32 abr; // Semi-transparency mode(0~3) int32 ClipX0;
//bool dtd; // Dithering enable int32 ClipY0;
int32 ClipX1;
int32 ClipX0; int32 ClipY1;
int32 ClipY0;
int32 ClipX1; int32 OffsX;
int32 ClipY1; int32 OffsY;
int32 OffsX;
int32 OffsY;
bool dtd;
bool dfe;
uint32 MaskSetOR; uint32 MaskSetOR;
uint32 MaskEvalAND; uint32 MaskEvalAND;
bool dtd;
bool dfe;
bool TexDisable; bool TexDisable;
bool TexDisableAllowChange; bool TexDisableAllowChange;
@ -173,174 +191,170 @@ class PS_GPU
uint32 TexPageX; uint32 TexPageX;
uint32 TexPageY; uint32 TexPageY;
uint32 SpriteFlip; uint32 SpriteFlip;
uint32 abr; uint32 abr;
uint32 TexMode; uint32 TexMode;
static uint8 DitherLUT[4][4][512]; // Y, X, 8-bit source value(256 extra for saturation) bool LineSkipTest(unsigned y);
bool LineSkipTest(unsigned y); template<int BlendMode, bool MaskEval_TA, bool textured>
void PlotPixel(uint32 x, uint32 y, uint16 pix);
template<int BlendMode, bool MaskEval_TA, bool textured>
void PlotPixel(uint32 x, uint32 y, uint16 pix); template<uint32 TexMode_TA>
uint16 GetTexel(uint32 u, uint32 v);
template<uint32 TexMode_TA>
uint16 GetTexel(uint32 u, uint32 v); uint16 ModTexel(uint16 texel, int32 r, int32 g, int32 b, const int32 dither_x, const int32 dither_y);
uint16 ModTexel(uint16 texel, int32 r, int32 g, int32 b, const int32 dither_x, const int32 dither_y); template<bool goraud, bool textured, int BlendMode, bool TexMult, uint32 TexMode, bool MaskEval_TA>
void DrawSpan(int y, const int32 x_start, const int32 x_bound, i_group ig, const i_deltas &idl);
template<bool goraud, bool textured, int BlendMode, bool TexMult, uint32 TexMode, bool MaskEval_TA>
void DrawSpan(int y, const int32 x_start, const int32 x_bound, i_group ig, const i_deltas &idl); template<bool shaded, bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
void DrawTriangle(tri_vertex *vertices);
template<bool shaded, bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
void DrawTriangle(tri_vertex *vertices); template<bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA, bool FlipX, bool FlipY>
void DrawSprite(int32 x_arg, int32 y_arg, int32 w, int32 h, uint8 u_arg, uint8 v_arg, uint32 color);
template<bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA, bool FlipX, bool FlipY>
void DrawSprite(int32 x_arg, int32 y_arg, int32 w, int32 h, uint8 u_arg, uint8 v_arg, uint32 color); template<bool goraud, int BlendMode, bool MaskEval_TA>
void DrawLine(line_point *vertices);
template<bool goraud, int BlendMode, bool MaskEval_TA>
void DrawLine(line_point *vertices);
public:
template<int numvertices, bool shaded, bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
public: void Command_DrawPolygon(const uint32 *cb);
template<int numvertices, bool shaded, bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
void Command_DrawPolygon(const uint32 *cb); template<uint8 raw_size, bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
void Command_DrawSprite(const uint32 *cb);
template<uint8 raw_size, bool textured, int BlendMode, bool TexMult, uint32 TexMode_TA, bool MaskEval_TA>
void Command_DrawSprite(const uint32 *cb); template<bool polyline, bool goraud, int BlendMode, bool MaskEval_TA>
void Command_DrawLine(const uint32 *cb);
template<bool polyline, bool goraud, int BlendMode, bool MaskEval_TA>
void Command_DrawLine(const uint32 *cb); void Command_ClearCache(const uint32 *cb);
void Command_IRQ(const uint32 *cb);
void Command_ClearCache(const uint32 *cb);
void Command_IRQ(const uint32 *cb); void Command_FBFill(const uint32 *cb);
void Command_FBCopy(const uint32 *cb);
void Command_FBFill(const uint32 *cb); void Command_FBWrite(const uint32 *cb);
void Command_FBCopy(const uint32 *cb); void Command_FBRead(const uint32 *cb);
void Command_FBWrite(const uint32 *cb);
void Command_FBRead(const uint32 *cb); void Command_DrawMode(const uint32 *cb);
void Command_TexWindow(const uint32 *cb);
void Command_DrawMode(const uint32 *cb); void Command_Clip0(const uint32 *cb);
void Command_TexWindow(const uint32 *cb); void Command_Clip1(const uint32 *cb);
void Command_Clip0(const uint32 *cb); void Command_DrawingOffset(const uint32 *cb);
void Command_Clip1(const uint32 *cb); void Command_MaskSetting(const uint32 *cb);
void Command_DrawingOffset(const uint32 *cb);
void Command_MaskSetting(const uint32 *cb); private:
static CTEntry Commands[256];
private: static const CTEntry Commands_00_1F[0x20];
static CTEntry Commands[256]; static const CTEntry Commands_20_3F[0x20];
static const CTEntry Commands_00_1F[0x20]; static const CTEntry Commands_40_5F[0x20];
static const CTEntry Commands_20_3F[0x20]; static const CTEntry Commands_60_7F[0x20];
static const CTEntry Commands_40_5F[0x20]; static const CTEntry Commands_80_FF[0x80];
static const CTEntry Commands_60_7F[0x20];
static const CTEntry Commands_80_FF[0x80];
FastFIFO<uint32, 0x20> BlitterFIFO; // 0x10 on actual PS1 GPU, 0x20 here(see comment at top of gpu.h) FastFIFO<uint32, 0x20> BlitterFIFO; // 0x10 on actual PS1 GPU, 0x20 here(see comment at top of gpu.h)
uint32 DataReadBuffer; uint32 DataReadBuffer;
uint32 DataReadBufferEx; uint32 DataReadBufferEx;
bool IRQPending; bool IRQPending;
// //
// //
// //
// Powers of 2 for faster multiple equality testing(just for multi-testing; InCmd itself will only contain 0, or a power of 2). // Powers of 2 for faster multiple equality testing(just for multi-testing; InCmd itself will only contain 0, or a power of 2).
enum enum
{ {
INCMD_NONE = 0, INCMD_NONE = 0,
INCMD_PLINE = (1 << 0), INCMD_PLINE = (1 << 0),
INCMD_QUAD = (1 << 1), INCMD_QUAD = (1 << 1),
INCMD_FBWRITE = (1 << 2), INCMD_FBWRITE = (1 << 2),
INCMD_FBREAD = (1 << 3) INCMD_FBREAD = (1 << 3)
}; };
uint8 InCmd; uint8 InCmd;
uint8 InCmd_CC; uint8 InCmd_CC;
tri_vertex InQuad_F3Vertices[3]; tri_vertex InQuad_F3Vertices[3];
line_point InPLine_PrevPoint; line_point InPLine_PrevPoint;
uint32 FBRW_X; uint32 FBRW_X;
uint32 FBRW_Y; uint32 FBRW_Y;
uint32 FBRW_W; uint32 FBRW_W;
uint32 FBRW_H; uint32 FBRW_H;
uint32 FBRW_CurY; uint32 FBRW_CurY;
uint32 FBRW_CurX; uint32 FBRW_CurX;
// //
// Display Parameters // Display Parameters
// //
uint32 DisplayMode; uint32 DisplayFB_XStart;
uint32 DisplayFB_YStart;
bool DisplayOff;
uint32 DisplayFB_XStart; uint32 HorizStart;
uint32 DisplayFB_YStart; uint32 HorizEnd;
uint32 HorizStart; uint32 VertStart;
uint32 HorizEnd; uint32 VertEnd;
uint32 DisplayMode;
uint32 VertStart; bool DisplayOff;
uint32 VertEnd;
//
// // Display work vars
// Display work vars //
// bool PhaseChange;
uint32 DisplayFB_CurYOffset; bool InVBlank;
uint32 DisplayFB_CurLineYReadout; bool sl_zero_reached;
bool skip;
bool InVBlank; bool hide_hoverscan;
bool field;
// bool field_ram_readout;
// uint32 DisplayFB_CurYOffset;
// uint32 DisplayFB_CurLineYReadout;
uint32 LinesPerField;
uint32 scanline; //
bool field; //
bool field_ram_readout; //
bool PhaseChange; uint64 GPUClockCounter;
uint32 GPUClockRatio;
uint32 DotClockCounter; uint32 LinesPerField;
uint32 scanline;
uint64 GPUClockCounter; uint32 DotClockCounter;
uint32 GPUClockRatio;
int32 LineClockCounter; int32 LineClockCounter;
int32 LinePhase; int32 LinePhase;
int32 DrawTimeAvail; int32 DrawTimeAvail;
pscpu_timestamp_t lastts; pscpu_timestamp_t lastts;
// static uint8 DitherLUT[4][4][512]; // Y, X, 8-bit source value(256 extra for saturation)
// //
// //
int32 hmc_to_visible; //
bool hide_hoverscan; bool dump_framebuffer;
bool dump_framebuffer; //
//
bool sl_zero_reached; //
// EmulateSpecStruct *espec;
// MDFN_Surface *surface;
MDFN_Rect *DisplayRect;
EmulateSpecStruct *espec; int32 *LineWidths;
MDFN_Surface *surface; int LineVisFirst, LineVisLast;
MDFN_Rect *DisplayRect; int32 hmc_to_visible;
int32 *LineWidths; const bool HardwarePALType;
bool skip; uint32 OutputLUT[384];
public: //
bool HardwarePALType; //
private: // Y, X
int LineVisFirst, LineVisLast; uint16 GPURAM[512][1024];
void ReorderRGB_Var(uint32 out_Rshift, uint32 out_Gshift, uint32 out_Bshift, bool bpp24, const uint16 *src, uint32 *dest, const int32 dx_start, const int32 dx_end, int32 fb_x);
uint32 OutputLUT[384];
void ReorderRGB_Var(uint32 out_Rshift, uint32 out_Gshift, uint32 out_Bshift, bool bpp24, const uint16 *src, uint32 *dest, const int32 dx_start, const int32 dx_end, int32 fb_x); template<uint32 out_Rshift, uint32 out_Gshift, uint32 out_Bshift>
void ReorderRGB(bool bpp24, const uint16 *src, uint32 *dest, const int32 dx_start, const int32 dx_end, int32 fb_x) NO_INLINE;
template<uint32 out_Rshift, uint32 out_Gshift, uint32 out_Bshift>
void ReorderRGB(bool bpp24, const uint16 *src, uint32 *dest, const int32 dx_start, const int32 dx_end, int32 fb_x) NO_INLINE; public:
uint32 GetVertStart() { return VertStart; }
public: uint32 GetVertEnd() { return VertEnd; }
uint32 GetVertStart() { return VertStart; } int FirstLine;
uint32 GetVertEnd() { return VertEnd; } };
int FirstLine;
}; }
}

View File

@ -1,19 +1,23 @@
/* Mednafen - Multi-system Emulator /******************************************************************************/
* /* Mednafen Sony PS1 Emulation Module */
* This program is free software; you can redistribute it and/or modify /******************************************************************************/
* it under the terms of the GNU General Public License as published by /* gpu_common.inc:
* the Free Software Foundation; either version 2 of the License, or ** Copyright (C) 2011-2016 Mednafen Team
* (at your option) any later version. **
* ** This program is free software; you can redistribute it and/or
* This program is distributed in the hope that it will be useful, ** modify it under the terms of the GNU General Public License
* but WITHOUT ANY WARRANTY; without even the implied warranty of ** as published by the Free Software Foundation; either version 2
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** of the License, or (at your option) any later version.
* GNU General Public License for more details. **
* ** This program is distributed in the hope that it will be useful,
* You should have received a copy of the GNU General Public License ** but WITHOUT ANY WARRANTY; without even the implied warranty of
* along with this program; if not, write to the Free Software ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** GNU General Public License for more details.
*/ **
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software Foundation, Inc.,
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
template<int BlendMode, bool MaskEval_TA, bool textured> template<int BlendMode, bool MaskEval_TA, bool textured>
INLINE void PS_GPU::PlotPixel(uint32 x, uint32 y, uint16 fore_pix) INLINE void PS_GPU::PlotPixel(uint32 x, uint32 y, uint16 fore_pix)

View File

@ -1,19 +1,23 @@
/* Mednafen - Multi-system Emulator /******************************************************************************/
* /* Mednafen Sony PS1 Emulation Module */
* This program is free software; you can redistribute it and/or modify /******************************************************************************/
* it under the terms of the GNU General Public License as published by /* gpu_line.cpp:
* the Free Software Foundation; either version 2 of the License, or ** Copyright (C) 2011-2016 Mednafen Team
* (at your option) any later version. **
* ** This program is free software; you can redistribute it and/or
* This program is distributed in the hope that it will be useful, ** modify it under the terms of the GNU General Public License
* but WITHOUT ANY WARRANTY; without even the implied warranty of ** as published by the Free Software Foundation; either version 2
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** of the License, or (at your option) any later version.
* GNU General Public License for more details. **
* ** This program is distributed in the hope that it will be useful,
* You should have received a copy of the GNU General Public License ** but WITHOUT ANY WARRANTY; without even the implied warranty of
* along with this program; if not, write to the Free Software ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** GNU General Public License for more details.
*/ **
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software Foundation, Inc.,
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "psx.h" #include "psx.h"
#include "gpu.h" #include "gpu.h"

View File

@ -1,20 +1,23 @@
/* Mednafen - Multi-system Emulator /******************************************************************************/
* /* Mednafen Sony PS1 Emulation Module */
* This program is free software; you can redistribute it and/or modify /******************************************************************************/
* it under the terms of the GNU General Public License as published by /* gpu_polygon.cpp:
* the Free Software Foundation; either version 2 of the License, or ** Copyright (C) 2011-2016 Mednafen Team
* (at your option) any later version. **
* ** This program is free software; you can redistribute it and/or
* This program is distributed in the hope that it will be useful, ** modify it under the terms of the GNU General Public License
* but WITHOUT ANY WARRANTY; without even the implied warranty of ** as published by the Free Software Foundation; either version 2
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** of the License, or (at your option) any later version.
* GNU General Public License for more details. **
* ** This program is distributed in the hope that it will be useful,
* You should have received a copy of the GNU General Public License ** but WITHOUT ANY WARRANTY; without even the implied warranty of
* along with this program; if not, write to the Free Software ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** GNU General Public License for more details.
*/ **
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software Foundation, Inc.,
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _MSC_VER #ifndef _MSC_VER
#pragma GCC optimize ("no-unroll-loops,no-peel-loops") #pragma GCC optimize ("no-unroll-loops,no-peel-loops")
#endif #endif

View File

@ -1,19 +1,23 @@
/* Mednafen - Multi-system Emulator /******************************************************************************/
* /* Mednafen Sony PS1 Emulation Module */
* This program is free software; you can redistribute it and/or modify /******************************************************************************/
* it under the terms of the GNU General Public License as published by /* gpu_sprite.cpp:
* the Free Software Foundation; either version 2 of the License, or ** Copyright (C) 2011-2016 Mednafen Team
* (at your option) any later version. **
* ** This program is free software; you can redistribute it and/or
* This program is distributed in the hope that it will be useful, ** modify it under the terms of the GNU General Public License
* but WITHOUT ANY WARRANTY; without even the implied warranty of ** as published by the Free Software Foundation; either version 2
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** of the License, or (at your option) any later version.
* GNU General Public License for more details. **
* ** This program is distributed in the hope that it will be useful,
* You should have received a copy of the GNU General Public License ** but WITHOUT ANY WARRANTY; without even the implied warranty of
* along with this program; if not, write to the Free Software ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** GNU General Public License for more details.
*/ **
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software Foundation, Inc.,
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "psx.h" #include "psx.h"
#include "gpu.h" #include "gpu.h"