Skip to content

Commit

Permalink
Move most backend functionality to VideoCommon
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Feb 19, 2019
1 parent 933f3ba commit f039149
Show file tree
Hide file tree
Showing 182 changed files with 8,214 additions and 15,797 deletions.
3 changes: 3 additions & 0 deletions Source/Core/Common/GL/GLUtil.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@


class GLContext; class GLContext;


// Texture which we use to not disturb the other bindings.
constexpr GLenum GL_MUTABLE_TEXTURE_INDEX = GL_TEXTURE10;

namespace GLUtil namespace GLUtil
{ {
GLuint CompileProgram(const std::string& vertexShader, const std::string& fragmentShader); GLuint CompileProgram(const std::string& vertexShader, const std::string& fragmentShader);
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Core/Config/GraphicsSettings.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ const ConfigInfo<int> GFX_STEREO_DEPTH_PERCENTAGE{


const ConfigInfo<bool> GFX_HACK_EFB_ACCESS_ENABLE{{System::GFX, "Hacks", "EFBAccessEnable"}, true}; const ConfigInfo<bool> GFX_HACK_EFB_ACCESS_ENABLE{{System::GFX, "Hacks", "EFBAccessEnable"}, true};
const ConfigInfo<bool> GFX_HACK_BBOX_ENABLE{{System::GFX, "Hacks", "BBoxEnable"}, false}; const ConfigInfo<bool> GFX_HACK_BBOX_ENABLE{{System::GFX, "Hacks", "BBoxEnable"}, false};
const ConfigInfo<bool> GFX_HACK_BBOX_PREFER_STENCIL_IMPLEMENTATION{
{System::GFX, "Hacks", "BBoxPreferStencilImplementation"}, false};
const ConfigInfo<bool> GFX_HACK_FORCE_PROGRESSIVE{{System::GFX, "Hacks", "ForceProgressive"}, true}; const ConfigInfo<bool> GFX_HACK_FORCE_PROGRESSIVE{{System::GFX, "Hacks", "ForceProgressive"}, true};
const ConfigInfo<bool> GFX_HACK_SKIP_EFB_COPY_TO_RAM{{System::GFX, "Hacks", "EFBToTextureEnable"}, const ConfigInfo<bool> GFX_HACK_SKIP_EFB_COPY_TO_RAM{{System::GFX, "Hacks", "EFBToTextureEnable"},
true}; true};
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/Config/GraphicsSettings.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ extern const ConfigInfo<int> GFX_STEREO_DEPTH_PERCENTAGE;


extern const ConfigInfo<bool> GFX_HACK_EFB_ACCESS_ENABLE; extern const ConfigInfo<bool> GFX_HACK_EFB_ACCESS_ENABLE;
extern const ConfigInfo<bool> GFX_HACK_BBOX_ENABLE; extern const ConfigInfo<bool> GFX_HACK_BBOX_ENABLE;
extern const ConfigInfo<bool> GFX_HACK_BBOX_PREFER_STENCIL_IMPLEMENTATION;
extern const ConfigInfo<bool> GFX_HACK_FORCE_PROGRESSIVE; extern const ConfigInfo<bool> GFX_HACK_FORCE_PROGRESSIVE;
extern const ConfigInfo<bool> GFX_HACK_SKIP_EFB_COPY_TO_RAM; extern const ConfigInfo<bool> GFX_HACK_SKIP_EFB_COPY_TO_RAM;
extern const ConfigInfo<bool> GFX_HACK_SKIP_XFB_COPY_TO_RAM; extern const ConfigInfo<bool> GFX_HACK_SKIP_XFB_COPY_TO_RAM;
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ bool IsSettingSaveable(const Config::ConfigLocation& config_location)


Config::GFX_HACK_EFB_ACCESS_ENABLE.location, Config::GFX_HACK_EFB_ACCESS_ENABLE.location,
Config::GFX_HACK_BBOX_ENABLE.location, Config::GFX_HACK_BBOX_ENABLE.location,
Config::GFX_HACK_BBOX_PREFER_STENCIL_IMPLEMENTATION.location,
Config::GFX_HACK_FORCE_PROGRESSIVE.location, Config::GFX_HACK_FORCE_PROGRESSIVE.location,
Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM.location, Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM.location,
Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM.location, Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM.location,
Expand Down
11 changes: 5 additions & 6 deletions Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -152,10 +152,9 @@ void EnhancementsWidget::ConnectWidgets()
void EnhancementsWidget::LoadPPShaders() void EnhancementsWidget::LoadPPShaders()
{ {
const bool anaglyph = g_Config.stereo_mode == StereoMode::Anaglyph; const bool anaglyph = g_Config.stereo_mode == StereoMode::Anaglyph;
std::vector<std::string> shaders = std::vector<std::string> shaders = anaglyph ?
anaglyph ? PostProcessingShaderImplementation::GetAnaglyphShaderList( VideoCommon::PostProcessing::GetAnaglyphShaderList() :
g_Config.backend_info.api_type) : VideoCommon::PostProcessing::GetShaderList();
PostProcessingShaderImplementation::GetShaderList(g_Config.backend_info.api_type);


m_pp_effect->clear(); m_pp_effect->clear();


Expand Down Expand Up @@ -187,7 +186,7 @@ void EnhancementsWidget::LoadPPShaders()
tr("%1 doesn't support this feature.") tr("%1 doesn't support this feature.")
.arg(tr(g_video_backend->GetDisplayName().c_str()))); .arg(tr(g_video_backend->GetDisplayName().c_str())));


PostProcessingShaderConfiguration pp_shader; VideoCommon::PostProcessingConfiguration pp_shader;
if (selected_shader != "(off)" && supports_postprocessing) if (selected_shader != "(off)" && supports_postprocessing)
{ {
pp_shader.LoadShader(selected_shader); pp_shader.LoadShader(selected_shader);
Expand Down Expand Up @@ -266,7 +265,7 @@ void EnhancementsWidget::SaveSettings()
"(off)" : "(off)" :
m_pp_effect->currentText().toStdString()); m_pp_effect->currentText().toStdString());


PostProcessingShaderConfiguration pp_shader; VideoCommon::PostProcessingConfiguration pp_shader;
if (Config::Get(Config::GFX_ENHANCE_POST_SHADER) != "(off)") if (Config::Get(Config::GFX_ENHANCE_POST_SHADER) != "(off)")
{ {
pp_shader.LoadShader(Config::Get(Config::GFX_ENHANCE_POST_SHADER)); pp_shader.LoadShader(Config::Get(Config::GFX_ENHANCE_POST_SHADER));
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "VideoCommon/RenderBase.h" #include "VideoCommon/RenderBase.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"


using ConfigurationOption = PostProcessingShaderConfiguration::ConfigurationOption; using ConfigurationOption = VideoCommon::PostProcessingConfiguration::ConfigurationOption;
using OptionType = ConfigurationOption::OptionType; using OptionType = ConfigurationOption::OptionType;


PostProcessingConfigWindow::PostProcessingConfigWindow(EnhancementsWidget* parent, PostProcessingConfigWindow::PostProcessingConfigWindow(EnhancementsWidget* parent,
Expand All @@ -38,7 +38,7 @@ PostProcessingConfigWindow::PostProcessingConfigWindow(EnhancementsWidget* paren
} }
else else
{ {
m_post_processor = new PostProcessingShaderConfiguration(); m_post_processor = new VideoCommon::PostProcessingConfiguration();
m_post_processor->LoadShader(m_shader); m_post_processor->LoadShader(m_shader);
} }


Expand All @@ -61,7 +61,8 @@ PostProcessingConfigWindow::~PostProcessingConfigWindow()


void PostProcessingConfigWindow::PopulateGroups() void PostProcessingConfigWindow::PopulateGroups()
{ {
const PostProcessingShaderConfiguration::ConfigMap& config_map = m_post_processor->GetOptions(); const VideoCommon::PostProcessingConfiguration::ConfigMap& config_map =
m_post_processor->GetOptions();


auto config_groups = std::vector<std::unique_ptr<ConfigGroup>>(); auto config_groups = std::vector<std::unique_ptr<ConfigGroup>>();
for (const auto& it : config_map) for (const auto& it : config_map)
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PostProcessingConfigWindow final : public QDialog
{ {
public: public:
explicit ConfigGroup( explicit ConfigGroup(
const PostProcessingShaderConfiguration::ConfigurationOption* config_option); const VideoCommon::PostProcessingConfiguration::ConfigurationOption* config_option);


const std::string& GetGUIName() const noexcept; const std::string& GetGUIName() const noexcept;
const std::string& GetParent() const noexcept; const std::string& GetParent() const noexcept;
Expand All @@ -57,7 +57,7 @@ class PostProcessingConfigWindow final : public QDialog
std::vector<QSlider*> m_sliders; std::vector<QSlider*> m_sliders;
std::vector<QLineEdit*> m_value_boxes; std::vector<QLineEdit*> m_value_boxes;


const PostProcessingShaderConfiguration::ConfigurationOption* m_config_option; const VideoCommon::PostProcessingConfiguration::ConfigurationOption* m_config_option;
std::vector<std::unique_ptr<ConfigGroup>> m_subgroups; std::vector<std::unique_ptr<ConfigGroup>> m_subgroups;
}; };
void Create(); void Create();
Expand All @@ -72,7 +72,7 @@ class PostProcessingConfigWindow final : public QDialog
QDialogButtonBox* m_buttons; QDialogButtonBox* m_buttons;


const std::string& m_shader; const std::string& m_shader;
PostProcessingShaderConfiguration* m_post_processor; VideoCommon::PostProcessingConfiguration* m_post_processor;
std::unordered_map<std::string, ConfigGroup*> m_config_map; std::unordered_map<std::string, ConfigGroup*> m_config_map;
std::vector<std::unique_ptr<ConfigGroup>> m_config_groups; std::vector<std::unique_ptr<ConfigGroup>> m_config_groups;
}; };
4 changes: 3 additions & 1 deletion Source/Core/VideoBackends/D3D/BoundingBox.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "VideoBackends/D3D/BoundingBox.h" #include "VideoBackends/D3D/BoundingBox.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "VideoBackends/D3D/D3DState.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"


namespace DX11 namespace DX11
Expand Down Expand Up @@ -54,6 +55,7 @@ void BBox::Init()
hr = D3D::device->CreateUnorderedAccessView(s_bbox_buffer, &UAVdesc, &s_bbox_uav); hr = D3D::device->CreateUnorderedAccessView(s_bbox_buffer, &UAVdesc, &s_bbox_uav);
CHECK(SUCCEEDED(hr), "Create BoundingBox UAV."); CHECK(SUCCEEDED(hr), "Create BoundingBox UAV.");
D3D::SetDebugObjectName(s_bbox_uav, "BoundingBox UAV"); D3D::SetDebugObjectName(s_bbox_uav, "BoundingBox UAV");
D3D::stateman->SetOMUAV(s_bbox_uav);
} }
} }


Expand Down Expand Up @@ -83,4 +85,4 @@ int BBox::Get(int index)
D3D::context->Unmap(s_bbox_staging_buffer, 0); D3D::context->Unmap(s_bbox_staging_buffer, 0);
return data; return data;
} }
}; }; // namespace DX11
20 changes: 0 additions & 20 deletions Source/Core/VideoBackends/D3D/CMakeLists.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,42 +3,22 @@ add_library(videod3d
BoundingBox.h BoundingBox.h
D3DBase.cpp D3DBase.cpp
D3DBase.h D3DBase.h
D3DBlob.cpp
D3DBlob.h
D3DShader.cpp
D3DShader.h
D3DState.cpp D3DState.cpp
D3DState.h D3DState.h
D3DTexture.cpp
D3DTexture.h
D3DUtil.cpp
D3DUtil.h
DXPipeline.cpp DXPipeline.cpp
DXPipeline.h DXPipeline.h
DXShader.cpp DXShader.cpp
DXShader.h DXShader.h
DXTexture.cpp DXTexture.cpp
DXTexture.h DXTexture.h
FramebufferManager.cpp
FramebufferManager.h
GeometryShaderCache.cpp
GeometryShaderCache.h
main.cpp main.cpp
NativeVertexFormat.cpp NativeVertexFormat.cpp
PerfQuery.cpp PerfQuery.cpp
PerfQuery.h PerfQuery.h
PixelShaderCache.cpp
PixelShaderCache.h
PSTextureEncoder.cpp
PSTextureEncoder.h
Render.cpp Render.cpp
Render.h Render.h
TextureCache.cpp
TextureCache.h
VertexManager.cpp VertexManager.cpp
VertexManager.h VertexManager.h
VertexShaderCache.cpp
VertexShaderCache.h
VideoBackend.h VideoBackend.h
) )


Expand Down
20 changes: 0 additions & 20 deletions Source/Core/VideoBackends/D3D/D3D.vcxproj
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,46 +38,26 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="BoundingBox.cpp" /> <ClCompile Include="BoundingBox.cpp" />
<ClCompile Include="D3DBase.cpp" /> <ClCompile Include="D3DBase.cpp" />
<ClCompile Include="D3DBlob.cpp" />
<ClCompile Include="D3DShader.cpp" />
<ClCompile Include="D3DState.cpp" /> <ClCompile Include="D3DState.cpp" />
<ClCompile Include="D3DTexture.cpp" />
<ClCompile Include="D3DUtil.cpp" />
<ClCompile Include="DXPipeline.cpp" /> <ClCompile Include="DXPipeline.cpp" />
<ClCompile Include="DXShader.cpp" /> <ClCompile Include="DXShader.cpp" />
<ClCompile Include="DXTexture.cpp" /> <ClCompile Include="DXTexture.cpp" />
<ClCompile Include="FramebufferManager.cpp" />
<ClCompile Include="GeometryShaderCache.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<ClCompile Include="NativeVertexFormat.cpp" /> <ClCompile Include="NativeVertexFormat.cpp" />
<ClCompile Include="PerfQuery.cpp" /> <ClCompile Include="PerfQuery.cpp" />
<ClCompile Include="PixelShaderCache.cpp" />
<ClCompile Include="PSTextureEncoder.cpp" />
<ClCompile Include="Render.cpp" /> <ClCompile Include="Render.cpp" />
<ClCompile Include="TextureCache.cpp" />
<ClCompile Include="VertexManager.cpp" /> <ClCompile Include="VertexManager.cpp" />
<ClCompile Include="VertexShaderCache.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="BoundingBox.h" /> <ClInclude Include="BoundingBox.h" />
<ClInclude Include="D3DBase.h" /> <ClInclude Include="D3DBase.h" />
<ClInclude Include="D3DBlob.h" />
<ClInclude Include="D3DShader.h" />
<ClInclude Include="D3DState.h" /> <ClInclude Include="D3DState.h" />
<ClInclude Include="D3DTexture.h" />
<ClInclude Include="D3DUtil.h" />
<ClInclude Include="DXPipeline.h" /> <ClInclude Include="DXPipeline.h" />
<ClInclude Include="DXShader.h" /> <ClInclude Include="DXShader.h" />
<ClInclude Include="DXTexture.h" /> <ClInclude Include="DXTexture.h" />
<ClInclude Include="FramebufferManager.h" />
<ClInclude Include="GeometryShaderCache.h" />
<ClInclude Include="PerfQuery.h" /> <ClInclude Include="PerfQuery.h" />
<ClInclude Include="PixelShaderCache.h" />
<ClInclude Include="PSTextureEncoder.h" />
<ClInclude Include="Render.h" /> <ClInclude Include="Render.h" />
<ClInclude Include="TextureCache.h" />
<ClInclude Include="VertexManager.h" /> <ClInclude Include="VertexManager.h" />
<ClInclude Include="VertexShaderCache.h" />
<ClInclude Include="VideoBackend.h" /> <ClInclude Include="VideoBackend.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
Expand Down
60 changes: 0 additions & 60 deletions Source/Core/VideoBackends/D3D/D3D.vcxproj.filters
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,51 +12,21 @@
<ClCompile Include="D3DBase.cpp"> <ClCompile Include="D3DBase.cpp">
<Filter>D3D</Filter> <Filter>D3D</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="D3DBlob.cpp">
<Filter>D3D</Filter>
</ClCompile>
<ClCompile Include="D3DShader.cpp">
<Filter>D3D</Filter>
</ClCompile>
<ClCompile Include="D3DTexture.cpp">
<Filter>D3D</Filter>
</ClCompile>
<ClCompile Include="D3DUtil.cpp">
<Filter>D3D</Filter>
</ClCompile>
<ClCompile Include="D3DState.cpp"> <ClCompile Include="D3DState.cpp">
<Filter>D3D</Filter> <Filter>D3D</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="FramebufferManager.cpp">
<Filter>Render</Filter>
</ClCompile>
<ClCompile Include="GeometryShaderCache.cpp">
<Filter>Render</Filter>
</ClCompile>
<ClCompile Include="NativeVertexFormat.cpp"> <ClCompile Include="NativeVertexFormat.cpp">
<Filter>Render</Filter> <Filter>Render</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="PerfQuery.cpp"> <ClCompile Include="PerfQuery.cpp">
<Filter>Render</Filter> <Filter>Render</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="PixelShaderCache.cpp">
<Filter>Render</Filter>
</ClCompile>
<ClCompile Include="PSTextureEncoder.cpp">
<Filter>Render</Filter>
</ClCompile>
<ClCompile Include="Render.cpp"> <ClCompile Include="Render.cpp">
<Filter>Render</Filter> <Filter>Render</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="TextureCache.cpp">
<Filter>Render</Filter>
</ClCompile>
<ClCompile Include="VertexManager.cpp"> <ClCompile Include="VertexManager.cpp">
<Filter>Render</Filter> <Filter>Render</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="VertexShaderCache.cpp">
<Filter>Render</Filter>
</ClCompile>
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<ClCompile Include="BoundingBox.cpp"> <ClCompile Include="BoundingBox.cpp">
<Filter>Render</Filter> <Filter>Render</Filter>
Expand All @@ -75,48 +45,18 @@
<ClInclude Include="D3DBase.h"> <ClInclude Include="D3DBase.h">
<Filter>D3D</Filter> <Filter>D3D</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="D3DBlob.h">
<Filter>D3D</Filter>
</ClInclude>
<ClInclude Include="D3DShader.h">
<Filter>D3D</Filter>
</ClInclude>
<ClInclude Include="D3DTexture.h">
<Filter>D3D</Filter>
</ClInclude>
<ClInclude Include="D3DUtil.h">
<Filter>D3D</Filter>
</ClInclude>
<ClInclude Include="D3DState.h"> <ClInclude Include="D3DState.h">
<Filter>D3D</Filter> <Filter>D3D</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="FramebufferManager.h">
<Filter>Render</Filter>
</ClInclude>
<ClInclude Include="GeometryShaderCache.h">
<Filter>Render</Filter>
</ClInclude>
<ClInclude Include="PerfQuery.h"> <ClInclude Include="PerfQuery.h">
<Filter>Render</Filter> <Filter>Render</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="PixelShaderCache.h">
<Filter>Render</Filter>
</ClInclude>
<ClInclude Include="PSTextureEncoder.h">
<Filter>Render</Filter>
</ClInclude>
<ClInclude Include="Render.h"> <ClInclude Include="Render.h">
<Filter>Render</Filter> <Filter>Render</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="TextureCache.h">
<Filter>Render</Filter>
</ClInclude>
<ClInclude Include="VertexManager.h"> <ClInclude Include="VertexManager.h">
<Filter>Render</Filter> <Filter>Render</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="VertexShaderCache.h">
<Filter>Render</Filter>
</ClInclude>
<ClInclude Include="VideoBackend.h" /> <ClInclude Include="VideoBackend.h" />
<ClInclude Include="BoundingBox.h"> <ClInclude Include="BoundingBox.h">
<Filter>Render</Filter> <Filter>Render</Filter>
Expand Down
Loading

0 comments on commit f039149

Please sign in to comment.