summaryrefslogtreecommitdiff
path: root/win32/plugins
diff options
context:
space:
mode:
authoriCatButler <i.am.catbutler@gmail.com>2016-03-25 16:25:15 +0000
committeriCatButler <i.am.catbutler@gmail.com>2016-03-25 16:25:15 +0000
commit7767ea4acbae995cd8e6302bdb7c97e89748dfd8 (patch)
treeb4a3025b703f8f3f383626aa5a651b2954c3a512 /win32/plugins
parent106f6594c9e2ad601deb7ad9bdf5eab8a568c01b (diff)
downloadpcsxr-7767ea4acbae995cd8e6302bdb7c97e89748dfd8.tar.gz
Initial upload of PGXP.
Diffstat (limited to 'win32/plugins')
-rwxr-xr-xwin32/plugins/peopsxgl/gpuPeopsOpenGL.def1
-rwxr-xr-xwin32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj2
-rwxr-xr-xwin32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj.filters6
-rw-r--r--win32/plugins/peopsxgl/pgxp_gpu.c90
-rw-r--r--win32/plugins/peopsxgl/pgxp_gpu.h34
5 files changed, 133 insertions, 0 deletions
diff --git a/win32/plugins/peopsxgl/gpuPeopsOpenGL.def b/win32/plugins/peopsxgl/gpuPeopsOpenGL.def
index 17d2e66c..83d853a7 100755
--- a/win32/plugins/peopsxgl/gpuPeopsOpenGL.def
+++ b/win32/plugins/peopsxgl/gpuPeopsOpenGL.def
@@ -34,3 +34,4 @@ EXPORTS
GPUsetframelimit @27
GPUvisualVibration @28
GPUaddVertex @29
+ GPUpgxpMemory @30
diff --git a/win32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj b/win32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj
index b72348bd..f65ce2cb 100755
--- a/win32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj
+++ b/win32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj
@@ -152,6 +152,7 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="pgxp_gpu.c" />
<ClCompile Include="winsrc\cfg.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -221,6 +222,7 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="pgxp_gpu.h" />
<ClInclude Include="winsrc\ssave.h" />
<ClInclude Include="..\..\..\plugins\peopsxgl\cfg.h" />
<ClInclude Include="..\..\..\plugins\peopsxgl\draw.h" />
diff --git a/win32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj.filters b/win32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj.filters
index 69b2b9b9..d34a9a34 100755
--- a/win32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj.filters
+++ b/win32/plugins/peopsxgl/gpuPeopsOpenGL.vcxproj.filters
@@ -45,6 +45,9 @@
<ClCompile Include="..\..\..\plugins\peopsxgl\texture.c">
<Filter>peopsxgl</Filter>
</ClCompile>
+ <ClCompile Include="pgxp_gpu.c">
+ <Filter>peopsxgl</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="winsrc\ssave.h">
@@ -90,6 +93,9 @@
<Filter>peopsxgl</Filter>
</ClInclude>
<ClInclude Include="resource.h" />
+ <ClInclude Include="pgxp_gpu.h">
+ <Filter>peopsxgl</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\gpu.bmp" />
diff --git a/win32/plugins/peopsxgl/pgxp_gpu.c b/win32/plugins/peopsxgl/pgxp_gpu.c
new file mode 100644
index 00000000..5b64382a
--- /dev/null
+++ b/win32/plugins/peopsxgl/pgxp_gpu.c
@@ -0,0 +1,90 @@
+/***************************************************************************
+* 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_gpu.c
+* PGXP - Parallel/Precision Geometry Xform Pipeline
+*
+* Created on: 25 Mar 2016
+* Author: iCatButler
+***************************************************************************/
+
+#include "pgxp_gpu.h"
+#include "stdafx.h"
+#include "externals.h"
+
+#include <math.h>
+
+typedef struct
+{
+ float x;
+ float y;
+ float z;
+ unsigned int valid;
+ unsigned int count;
+} PGXP_vertex;
+
+const unsigned int primStrideTable[] = { 1, 2, 1, 2, 2, 3, 2, 3, 0 };
+const unsigned int primCountTable[] = { 3, 3, 4, 4, 3, 3, 4, 4, 0 };
+
+PGXP_vertex* PGXP_Mem = NULL; // pointer to parallel memory
+unsigned int currentAddr = 0; // address of current DMA
+
+// Set current DMA address and pointer to parallel memory
+void CALLBACK GPUpgxpMemory(unsigned int addr, unsigned char* pVRAM)
+{
+ if (pVRAM)
+ PGXP_Mem = (PGXP_vertex*)(pVRAM);
+ currentAddr = addr;
+}
+
+// Set current DMA address
+void PGXP_SetAddress(unsigned int addr)
+{
+ currentAddr = addr;
+}
+
+// Get parallel vertex values
+int PGXP_GetVertices(unsigned int* addr, void* pOutput)
+{
+ unsigned int primCmd = ((*addr >> 24) & 0xff); // primitive command
+ unsigned int primIdx = (primCmd - 0x20) >> 2; // index to primitive lookup
+ OGLVertex* pVertex = (OGLVertex*)pOutput; // pointer to output vertices
+ unsigned int stride = primStrideTable[primIdx]; // stride between vertices
+ unsigned int count = primCountTable[primIdx]; // number of vertices
+ PGXP_vertex* primStart = NULL; // pointer to first vertex
+
+ if (PGXP_Mem == NULL)
+ return 0;
+
+ // Offset to start of primitive
+ primStart = &PGXP_Mem[currentAddr + 1];
+
+ for (unsigned i = 0; i < count; ++i)
+ {
+ if (primStart[stride * i].valid)
+ {
+ pVertex[i].x = primStart[stride * i].x;
+ pVertex[i].y = primStart[stride * i].y;
+ }
+ }
+
+ return 1;
+}
+
diff --git a/win32/plugins/peopsxgl/pgxp_gpu.h b/win32/plugins/peopsxgl/pgxp_gpu.h
new file mode 100644
index 00000000..1777dc19
--- /dev/null
+++ b/win32/plugins/peopsxgl/pgxp_gpu.h
@@ -0,0 +1,34 @@
+/***************************************************************************
+* 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_gpu.h
+* PGXP - Parallel/Precision Geometry Xform Pipeline
+*
+* Created on: 25 Mar 2016
+* Author: iCatButler
+***************************************************************************/
+
+#ifndef _PGXP_GPU_H_
+#define _PGXP_GPU_H_
+
+void PGXP_SetAddress(unsigned int addr);
+int PGXP_GetVertices(unsigned int* addr, void* pOutput);
+
+#endif // _PGXP_GPU_H_