From 01e11c64373f20973e7e004d06d3b87f11f78c8b Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Wed, 8 Feb 2017 17:47:07 +0100 Subject: [PATCH] Some mostly empty files for D3D11 --- CMakeLists.txt | 24 ++++- GPU/D3D11/DepalettizeShaderD3D11.cpp | 0 GPU/D3D11/DepalettizeShaderD3D11.h | 20 ++++ GPU/D3D11/DrawEngineD3D11.cpp | 0 GPU/D3D11/DrawEngineD3D11.h | 23 ++++ GPU/D3D11/FragmentShaderGeneratorD3D11.h | 17 +++ GPU/D3D11/FramebufferManagerD3D11.cpp | 0 GPU/D3D11/FramebufferManagerD3D11.h | 20 ++++ GPU/D3D11/GPU_D3D11.cpp | 18 ++++ GPU/D3D11/GPU_D3D11.h | 132 +++++++++++++++++++++++ GPU/D3D11/TextureCacheD3D11.cpp | 0 GPU/D3D11/TextureCacheD3D11.h | 20 ++++ GPU/D3D11/VertexShaderGeneratorD3D11.h | 17 +++ GPU/GPU.cpp | 13 ++- GPU/GPU.vcxproj | 10 ++ GPU/GPU.vcxproj.filters | 33 +++++- 16 files changed, 341 insertions(+), 6 deletions(-) create mode 100644 GPU/D3D11/DepalettizeShaderD3D11.cpp create mode 100644 GPU/D3D11/DepalettizeShaderD3D11.h create mode 100644 GPU/D3D11/DrawEngineD3D11.cpp create mode 100644 GPU/D3D11/DrawEngineD3D11.h create mode 100644 GPU/D3D11/FramebufferManagerD3D11.cpp create mode 100644 GPU/D3D11/FramebufferManagerD3D11.h create mode 100644 GPU/D3D11/GPU_D3D11.cpp create mode 100644 GPU/D3D11/GPU_D3D11.h create mode 100644 GPU/D3D11/TextureCacheD3D11.cpp create mode 100644 GPU/D3D11/TextureCacheD3D11.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b3249f2eea..f2143496ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1156,13 +1156,35 @@ set(GPU_D3D9 GPU/Directx9/VertexShaderGeneratorDX9.h ) +set(GPU_D3D11 + GPU/D3D11/DepalettizeShaderD3D11.cpp + GPU/D3D11/DepalettizeShaderD3D11.h + GPU/D3D11/DrawEngineD3D11.cpp + GPU/D3D11/DrawEngineD3D11.h + GPU/D3D11/FragmentShaderGeneratorD3D11.cpp + GPU/D3D11/FragmentShaderGeneratorD3D11.h + GPU/D3D11/FramebufferManagerD3D11.cpp + GPU/D3D11/FramebufferManagerD3D11.h + GPU/D3D11/GPU_D3D11.cpp + GPU/D3D11/GPU_D3D11.h + GPU/D3D11/ShaderManagerD3D11.cpp + GPU/D3D11/ShaderManagerD3D11.h + GPU/D3D11/StateMappingD3D11.cpp + GPU/D3D11/StateMappingD3D11.h + GPU/D3D11/TextureCacheD3D11.cpp + GPU/D3D11/TextureCacheD3D11.h + GPU/D3D11/TextureScalerD3D11.cpp + GPU/D3D11/TextureScalerD3D11.h + GPU/D3D11/VertexShaderGeneratorD3D11.cpp + GPU/D3D11/VertexShaderGeneratorD3D11.h +) set(GPU_IMPLS ${GPU_GLES}) if(VULKAN) set(GPU_IMPLS ${GPU_IMPLS} ${GPU_VULKAN}) endif() if(WIN32) - list(APPEND GPU_IMPLS ${GPU_D3D9}) + list(APPEND GPU_IMPLS ${GPU_D3D9} ${GPU_D3D11}) endif() if(ARMV7 OR ARM64) diff --git a/GPU/D3D11/DepalettizeShaderD3D11.cpp b/GPU/D3D11/DepalettizeShaderD3D11.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/GPU/D3D11/DepalettizeShaderD3D11.h b/GPU/D3D11/DepalettizeShaderD3D11.h new file mode 100644 index 0000000000..73d7e85b00 --- /dev/null +++ b/GPU/D3D11/DepalettizeShaderD3D11.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +class DepalShaderCacheD3D11 {}; \ No newline at end of file diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/GPU/D3D11/DrawEngineD3D11.h b/GPU/D3D11/DrawEngineD3D11.h new file mode 100644 index 0000000000..a0222a9a33 --- /dev/null +++ b/GPU/D3D11/DrawEngineD3D11.h @@ -0,0 +1,23 @@ +// Copyright (c) 2017- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +class DrawEngineD3D11 { +public: + void Flush() {} +}; \ No newline at end of file diff --git a/GPU/D3D11/FragmentShaderGeneratorD3D11.h b/GPU/D3D11/FragmentShaderGeneratorD3D11.h index 7f4ce59f8b..c7d49c0c9d 100644 --- a/GPU/D3D11/FragmentShaderGeneratorD3D11.h +++ b/GPU/D3D11/FragmentShaderGeneratorD3D11.h @@ -1,3 +1,20 @@ +// Copyright (c) 2017- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + #pragma once #include "GPU/Common/ShaderId.h" diff --git a/GPU/D3D11/FramebufferManagerD3D11.cpp b/GPU/D3D11/FramebufferManagerD3D11.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/GPU/D3D11/FramebufferManagerD3D11.h b/GPU/D3D11/FramebufferManagerD3D11.h new file mode 100644 index 0000000000..9676b47d8b --- /dev/null +++ b/GPU/D3D11/FramebufferManagerD3D11.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +class FramebufferManagerD3D11 {}; \ No newline at end of file diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp new file mode 100644 index 0000000000..ebf88fedd6 --- /dev/null +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -0,0 +1,18 @@ +// Copyright (c) 2017- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#include "GPU/D3D11/GPU_D3D11.h" \ No newline at end of file diff --git a/GPU/D3D11/GPU_D3D11.h b/GPU/D3D11/GPU_D3D11.h new file mode 100644 index 0000000000..79ec63a29e --- /dev/null +++ b/GPU/D3D11/GPU_D3D11.h @@ -0,0 +1,132 @@ +// Copyright (c) 2017- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +#include +#include +#include + +#include "GPU/GPUCommon.h" +#include "GPU/D3D11/FramebufferManagerD3D11.h" +#include "GPU/D3D11/DrawEngineD3D11.h" +#include "GPU/D3D11/TextureCacheD3D11.h" +#include "GPU/D3D11/DepalettizeShaderD3D11.h" +#include "GPU/Common/VertexDecoderCommon.h" + +namespace D3D11 { + + class ShaderManagerD3D11; + class LinkedShaderD3D11; + + class GPU_D3D11 : public GPUCommon { + public: + GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw); + ~GPU_D3D11(); + + void CheckGPUFeatures(); + void PreExecuteOp(u32 op, u32 diff) override; + void ExecuteOp(u32 op, u32 diff) override; + + void ReapplyGfxStateInternal() override; + void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override; + void BeginFrame() override; + void GetStats(char *buffer, size_t bufsize) override; + void ClearCacheNextFrame() override; + void DeviceLost() override; // Only happens on Android. Drop all textures and shaders. + void DeviceRestore() override; + + void DumpNextFrame() override; + void DoState(PointerWrap &p) override; + + void ClearShaderCache() override; + bool DecodeTexture(u8 *dest, const GPUgstate &state) override { + return false; + } + bool FramebufferDirty() override; + bool FramebufferReallyDirty() override; + + void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) override { + primaryInfo = reportingPrimaryInfo_; + fullInfo = reportingFullInfo_; + } + std::vector GetFramebufferList() override; + + bool GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferType type, int maxRes = -1) override; + bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override; + bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override; + bool GetCurrentTexture(GPUDebugBuffer &buffer, int level) override; + bool GetCurrentClut(GPUDebugBuffer &buffer) override; + bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override; + bool GetCurrentSimpleVertices(int count, std::vector &vertices, std::vector &indices) override; + + typedef void (GPU_D3D11::*CmdFunc)(u32 op, u32 diff); + struct CommandInfo { + uint64_t flags; + GPU_D3D11::CmdFunc func; + }; + + void Execute_Prim(u32 op, u32 diff); + void Execute_Bezier(u32 op, u32 diff); + void Execute_Spline(u32 op, u32 diff); + void Execute_VertexType(u32 op, u32 diff); + void Execute_VertexTypeSkinning(u32 op, u32 diff); + void Execute_TexSize0(u32 op, u32 diff); + void Execute_LoadClut(u32 op, u32 diff); + + // Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend. + std::vector DebugGetShaderIDs(DebugShaderType shader) override; + std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override; + + protected: + void FastRunLoop(DisplayList &list) override; + void FinishDeferred() override; + + private: + void UpdateCmdInfo(); + + void Flush() { + drawEngine_.Flush(); + } + // void ApplyDrawState(int prim); + void CheckFlushOp(int cmd, u32 diff); + void BuildReportingInfo(); + + void InitClearInternal() override; + void BeginFrameInternal() override; + void CopyDisplayToOutputInternal() override; + + ID3D11Device *device_; + ID3D11DeviceContext *context_; + + FramebufferManagerD3D11 *framebufferManagerD3D11_; + TextureCacheD3D11 *textureCacheD3D11_; + DepalShaderCacheD3D11 depalShaderCache_; + DrawEngineD3D11 drawEngine_; + ShaderManagerD3D11 *shaderManagerD3D11_; + + static CommandInfo cmdInfo_[256]; + + int lastVsync_; + + std::string reportingPrimaryInfo_; + std::string reportingFullInfo_; + }; + +} // namespace D3D11 + +typedef D3D11::GPU_D3D11 D3D11_GPU; diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/GPU/D3D11/TextureCacheD3D11.h b/GPU/D3D11/TextureCacheD3D11.h new file mode 100644 index 0000000000..49cc4a292e --- /dev/null +++ b/GPU/D3D11/TextureCacheD3D11.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +class TextureCacheD3D11 {}; \ No newline at end of file diff --git a/GPU/D3D11/VertexShaderGeneratorD3D11.h b/GPU/D3D11/VertexShaderGeneratorD3D11.h index 746f4a0ce1..d8936e9722 100644 --- a/GPU/D3D11/VertexShaderGeneratorD3D11.h +++ b/GPU/D3D11/VertexShaderGeneratorD3D11.h @@ -1,3 +1,20 @@ +// Copyright (c) 2017- PPSSPP Project. + +// 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, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + #pragma once #include "GPU/Common/ShaderId.h" diff --git a/GPU/GPU.cpp b/GPU/GPU.cpp index 26c222da2a..deff4fdf70 100644 --- a/GPU/GPU.cpp +++ b/GPU/GPU.cpp @@ -29,6 +29,7 @@ #if defined(_WIN32) #include "GPU/Directx9/GPU_DX9.h" +#include "GPU/D3D11/GPU_D3D11.h" #endif GPUStatistics gpuStats; @@ -59,10 +60,18 @@ bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) { case GPUCORE_DIRECTX9: #if defined(_WIN32) SetGPU(new DIRECTX9_GPU(ctx, draw)); -#endif break; - case GPUCORE_DIRECTX11: +#else return false; +#endif + case GPUCORE_DIRECTX11: +#if defined(_WIN32) + // SetGPU(new D3D11_GPU(ctx, draw)); + // break; + return false; +#else + return false; +#endif case GPUCORE_VULKAN: #ifndef NO_VULKAN if (!ctx) { diff --git a/GPU/GPU.vcxproj b/GPU/GPU.vcxproj index 2c509f8848..cd9fdeb5dd 100644 --- a/GPU/GPU.vcxproj +++ b/GPU/GPU.vcxproj @@ -203,8 +203,13 @@ + + + + + @@ -291,9 +296,14 @@ + + + + + diff --git a/GPU/GPU.vcxproj.filters b/GPU/GPU.vcxproj.filters index 0c498c3f8a..07bfddc62f 100644 --- a/GPU/GPU.vcxproj.filters +++ b/GPU/GPU.vcxproj.filters @@ -16,9 +16,6 @@ {88629970-4774-4122-b031-2128244b795c} - - {ba434472-5d5e-4b08-ab16-bfb7ec8e7068} - {0cbddc00-4aa3-41d0-bed2-a454d37f838e} @@ -237,6 +234,21 @@ D3D11 + + D3D11 + + + D3D11 + + + D3D11 + + + D3D11 + + + D3D11 + @@ -458,5 +470,20 @@ D3D11 + + D3D11 + + + D3D11 + + + D3D11 + + + D3D11 + + + D3D11 + \ No newline at end of file