diff options
| author | iCatButler <i.am.catbutler@gmail.com> | 2016-06-07 15:57:46 +0100 |
|---|---|---|
| committer | iCatButler <i.am.catbutler@gmail.com> | 2016-06-07 15:57:46 +0100 |
| commit | f70082329d751ee8a358437feb34134e283b27d8 (patch) | |
| tree | c97c99835067e9a20725943b4b4c63d44d4e3bdc /libpcsxcore/pgxp_value.h | |
| parent | 7ecfee1f664eeb92b653104f5f3c915cc6fe6bcb (diff) | |
| download | pcsxr-f70082329d751ee8a358437feb34134e283b27d8.tar.gz | |
Initial PGXP CPU commit
- Restructured project to base interface on PSX instructions
- Support for all relevant CPU arithmetic and logic instructions
- Debug output available via deferred PGXP calls
- Remove most dependencies on PCSXR
- Still very much a work in progress (lots of errors)
- Add extra debug information to GPU plugin (w values)
Diffstat (limited to 'libpcsxcore/pgxp_value.h')
| -rw-r--r-- | libpcsxcore/pgxp_value.h | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/libpcsxcore/pgxp_value.h b/libpcsxcore/pgxp_value.h new file mode 100644 index 00000000..09bd8925 --- /dev/null +++ b/libpcsxcore/pgxp_value.h @@ -0,0 +1,116 @@ +/*************************************************************************** +* Copyright (C) 2016 by iCatButler * +* * +* 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 * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* 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. * +***************************************************************************/ + +/************************************************************************** +* pgxp_value.h +* PGXP - Parallel/Precision Geometry Xform Pipeline +* +* Created on: 07 Jun 2016 +* Author: iCatButler +***************************************************************************/ + +#ifndef _PGXP_VALUE_H_ +#define _PGXP_VALUE_H_ + +#include "psxcommon.h" + +typedef union { +#if defined(__BIGENDIAN__) + struct { u8 h3, h2, h, l; } b; + struct { s8 h3, h2, h, l; } sb; + struct { u16 h, l; } w; + struct { s16 h, l; } sw; +#else + struct { u8 l, h, h2, h3; } b; + struct { u16 l, h; } w; + struct { s8 l, h, h2, h3; } sb; + struct { s16 l, h; } sw; +#endif + u32 d; + s32 sd; +} psx_value; + +typedef struct PGXP_value_Tag +{ + float x; + float y; + float z; + unsigned int valid; + unsigned int count; + unsigned int value; + + unsigned short gFlags; + unsigned char lFlags; + unsigned char hFlags; +} PGXP_value; + +typedef enum +{ + INVALID_ADDRESS = (1 << 1), +} PGXP_value_flags; + +typedef enum +{ + VALID_HALF = (1 << 0) +} PGXP_half_flags; + +static const PGXP_value PGXP_value_invalid_address = { 0.f, 0.f, 0.f, 0, 0, 0, INVALID_ADDRESS, 0, 0 }; +static const PGXP_value PGXP_value_zero = { 0.f, 0.f, 0.f, 0, 0, 1, 0, 0, 0 }; + +inline void MakeValid(PGXP_value *pV, u32 psxV) +{ + psx_value psx; + psx.d = psxV; + if (!pV->valid) + { + pV->x = (float)psx.sw.l; + pV->y = (float)psx.sw.h; + pV->valid = 1; + pV->value = psx.d; + } +} + +inline void Validate(PGXP_value *pV, u32 psxV) +{ + // assume pV is not NULL + pV->valid = (pV->valid) && (pV->value == psxV); +} + +inline void MaskValidate(PGXP_value *pV, u32 psxV, u32 mask) +{ + // assume pV is not NULL + pV->valid = (pV->valid) && ((pV->value & mask) == (psxV & mask)); +} + +typedef union +{ + struct + { + s16 x; + s16 y; + }; + struct + { + u16 ux; + u16 uy; + }; + u32 word; +} low_value; + +#endif//_PGX_VALUE_H_ |
