Skip to content

Commit

Permalink
Threaded GLideN64 calls
Browse files Browse the repository at this point in the history
  • Loading branch information
fzurita committed Apr 7, 2019
1 parent 36078a0 commit cc242ec
Show file tree
Hide file tree
Showing 40 changed files with 9,976 additions and 760 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ src/Revision.h
/projects/msvc/GLideN64.VC.VC.opendb
/projects/msvc/GLideN64.VC.db
/projects/msvc/GeneratedFiles
.vs
28 changes: 28 additions & 0 deletions licenses/readerwriterqueue/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
This license applies to all the code in this repository except that written by third
parties, namely the files in benchmarks/ext, which have their own licenses, and Jeff
Preshing's semaphore implementation (used in the blocking queue) which has a zlib
license (embedded in atomicops.h).

Simplified BSD License:

Copyright (c) 2013-2015, Cameron Desrochers
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 changes: 19 additions & 0 deletions projects/msvc/GLideN64.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,17 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\opengl_UnbufferedDrawer.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\opengl_Utils.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\opengl_BufferedDrawer.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_Wrapper.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_WrappedFunctions.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_Command.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_ObjectPool.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\RingBufferPool.cpp" />
<ClCompile Include="..\..\src\Graphics\OpenGLContext\windows\windows_DisplayWindow.cpp">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_mupenplus'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\windows\WindowsWGL.cpp">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_mupenplus'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\gSP.cpp" />
<ClCompile Include="..\..\src\iob.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='Win32'">true</ExcludedFromBuild>
Expand Down Expand Up @@ -404,6 +412,17 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\opengl_UnbufferedDrawer.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\opengl_Utils.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\opengl_BufferedDrawer.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\atomicops.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_Wrapper.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_WrappedFunctions.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\BlockingQueue.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_Command.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_ObjectPool.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\readerwriterqueue.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\RingBufferPool.h" />
<ClInclude Include="..\..\src\Graphics\OpenGLContext\windows\WindowsWGL.h">
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_mupenplus'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\Parameter.h" />
<ClInclude Include="..\..\src\Graphics\Parameters.h" />
<ClInclude Include="..\..\src\Graphics\PixelBuffer.h" />
Expand Down
51 changes: 51 additions & 0 deletions projects/msvc/GLideN64.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
<Filter Include="Source Files\Graphics\OpenGL\mupen64plus">
<UniqueIdentifier>{77259791-9942-4601-a63f-5a0468e69e49}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Graphics\OpenGL\ThreadedOpenGL">
<UniqueIdentifier>{09919f83-2933-4b48-a4c7-f7bf6e790304}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Graphics\OpenGL\ThreadedOpenGL">
<UniqueIdentifier>{32e9be50-cb55-445a-9562-bbe05085bbe1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\Combiner.cpp">
Expand Down Expand Up @@ -260,6 +266,9 @@
<ClCompile Include="..\..\src\Graphics\OpenGLContext\windows\windows_DisplayWindow.cpp">
<Filter>Source Files\Graphics\OpenGL\windows</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\windows\WindowsWGL.cpp">
<Filter>Source Files\Graphics\OpenGL\windows</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\mupen64plus\mupen64plus_DisplayWindow.cpp">
<Filter>Source Files\Graphics\OpenGL\mupen64plus</Filter>
</ClCompile>
Expand Down Expand Up @@ -398,6 +407,21 @@
<ClCompile Include="..\..\src\mupenplus\MemoryStatus_mupenplus.cpp">
<Filter>Source Files\mupenplus</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_Wrapper.cpp">
<Filter>Source Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_WrappedFunctions.cpp">
<Filter>Source Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_Command.cpp">
<Filter>Source Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_ObjectPool.cpp">
<Filter>Source Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClCompile>
<ClCompile Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\RingBufferPool.cpp">
<Filter>Source Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\3DMath.h">
Expand Down Expand Up @@ -634,6 +658,9 @@
<ClInclude Include="..\..\src\Graphics\OpenGLContext\opengl_ColorBufferReaderWithReadPixels.h">
<Filter>Header Files\Graphics\OpenGL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\windows\WindowsWGL.h">
<Filter>Header Files\Graphics\OpenGL\windows</Filter>
</ClInclude>
<ClInclude Include="..\..\src\TexrectDrawer.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -730,5 +757,29 @@
<ClInclude Include="..\..\src\MemoryStatus.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_Wrapper.h">
<Filter>Header Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_WrappedFunctions.h">
<Filter>Header Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\BlockingQueue.h">
<Filter>Header Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_Command.h">
<Filter>Header Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\opengl_ObjectPool.h">
<Filter>Header Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\RingBufferPool.h">
<Filter>Header Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\atomicops.h">
<Filter>Header Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClInclude>
<ClInclude Include="..\..\src\Graphics\OpenGLContext\ThreadedOpenGl\readerwriterqueue.h">
<Filter>Header Files\Graphics\OpenGL\ThreadedOpenGL</Filter>
</ClInclude>
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ set(GLideN64_SOURCES
Graphics/CombinerProgram.cpp
Graphics/ObjectHandle.cpp
Graphics/OpenGLContext/GLFunctions.cpp
Graphics/OpenGLContext/ThreadedOpenGl/opengl_Command.cpp
Graphics/OpenGLContext/ThreadedOpenGl/opengl_ObjectPool.cpp
Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.cpp
Graphics/OpenGLContext/ThreadedOpenGl/opengl_WrappedFunctions.cpp
Graphics/OpenGLContext/ThreadedOpenGl/RingBufferPool.cpp
Graphics/OpenGLContext/opengl_Attributes.cpp
Graphics/OpenGLContext/opengl_BufferedDrawer.cpp
Graphics/OpenGLContext/opengl_BufferManipulationObjectFactory.cpp
Expand Down
1 change: 1 addition & 0 deletions src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void Config::resetToDefaults()
video.fxaa = 0;
video.multisampling = 0;
video.verticalSync = 0;
video.threadedVideo = 0;

texture.maxAnisotropy = 0;
texture.bilinearMode = BILINEAR_STANDARD;
Expand Down
1 change: 1 addition & 0 deletions src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct Config
u32 fxaa;
u32 multisampling;
u32 verticalSync;
u32 threadedVideo;
} video;

struct
Expand Down
3 changes: 3 additions & 0 deletions src/GLideNUI/ConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ void ConfigDialog::_init()
ui->aliasingLabelVal->setText(QString::number(config.video.multisampling));
ui->anisotropicSlider->setValue(config.texture.maxAnisotropy);
ui->vSyncCheckBox->setChecked(config.video.verticalSync != 0);
ui->vThreadedVideoCheckBox->setChecked(config.video.threadedVideo != 0);

switch (config.texture.bilinearMode) {
case BILINEAR_3POINT:
Expand Down Expand Up @@ -426,6 +427,8 @@ void ConfigDialog::accept()

config.video.verticalSync = ui->vSyncCheckBox->isChecked() ? 1 : 0;

config.video.threadedVideo = ui->vThreadedVideoCheckBox->isChecked() ? 1 : 0;

// Emulation settings
config.generalEmulation.enableLOD = ui->emulateLodCheckBox->isChecked() ? 1 : 0;
config.generalEmulation.enableNoise = ui->emulateNoiseCheckBox->isChecked() ? 1 : 0;
Expand Down
2 changes: 2 additions & 0 deletions src/GLideNUI/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ void _loadSettings(QSettings & settings)
config.video.multisampling = settings.value("multisampling", config.video.multisampling).toInt();
config.video.fxaa= settings.value("fxaa", config.video.fxaa).toInt();
config.video.verticalSync = settings.value("verticalSync", config.video.verticalSync).toInt();
config.video.threadedVideo = settings.value("threadedVideo", config.video.threadedVideo).toInt();
settings.endGroup();

settings.beginGroup("texture");
Expand Down Expand Up @@ -197,6 +198,7 @@ void writeSettings(const QString & _strIniFolder)
settings.setValue("multisampling", config.video.multisampling);
settings.setValue("fxaa", config.video.fxaa);
settings.setValue("verticalSync", config.video.verticalSync);
settings.setValue("threadedVideo", config.video.threadedVideo);
settings.endGroup();

settings.beginGroup("texture");
Expand Down
10 changes: 10 additions & 0 deletions src/GLideNUI/configDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="vThreadedVideoCheckBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Threaded video can improve performance with poor OpenGL drivers at the cost of very marginal input lag, usually less than half a frame&lt;/p&gt;&lt;p&gt;[Recommended: &lt;span style=&quot; font-style:italic;&quot;&gt;Usually off, unless there are performance issues.&lt;/span&gt;]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable threaded video</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="overscanFrame">
<property name="minimumSize">
Expand Down
Loading

0 comments on commit cc242ec

Please sign in to comment.