Merge pull request #14433 from unknownbrackets/hwtess

GPU: Correctly initialize HW tessellation support
This commit is contained in:
Henrik Rydgård 2021-05-08 20:39:59 +02:00 committed by GitHub
commit 0b79c087ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 36 deletions

View file

@ -36,8 +36,6 @@ DrawEngineCommon::DrawEngineCommon() : decoderMap_(16) {
decJitCache_ = new VertexDecoderJitCache();
transformed = (TransformedVertex *)AllocateMemoryPages(TRANSFORMED_VERTEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE);
transformedExpanded = (TransformedVertex *)AllocateMemoryPages(3 * TRANSFORMED_VERTEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE);
useHWTransform_ = g_Config.bHardwareTransform;
useHWTessellation_ = UpdateUseHWTessellation(g_Config.bHardwareTessellation);
}
DrawEngineCommon::~DrawEngineCommon() {
@ -50,6 +48,11 @@ DrawEngineCommon::~DrawEngineCommon() {
ClearSplineBezierWeights();
}
void DrawEngineCommon::Init() {
useHWTransform_ = g_Config.bHardwareTransform;
useHWTessellation_ = UpdateUseHWTessellation(g_Config.bHardwareTessellation);
}
VertexDecoder *DrawEngineCommon::GetVertexDecoder(u32 vtype) {
VertexDecoder *dec = decoderMap_.Get(vtype);
if (dec)

View file

@ -56,6 +56,8 @@ public:
DrawEngineCommon();
virtual ~DrawEngineCommon();
void Init();
bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices);
static u32 NormalizeVertices(u8 *outPtr, u8 *bufPtr, const u8 *inPtr, VertexDecoder *dec, int lowerBound, int upperBound, u32 vertType);

View file

@ -15,25 +15,6 @@
// 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"
// Copyright (c) 2012- 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 <set>
#include "Common/Log.h"
@ -87,6 +68,7 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
drawEngine_.SetShaderManager(shaderManagerD3D11_);
drawEngine_.SetTextureCache(textureCacheD3D11_);
drawEngine_.SetFramebufferManager(framebufferManagerD3D11_);
drawEngine_.Init();
framebufferManagerD3D11_->SetTextureCache(textureCacheD3D11_);
framebufferManagerD3D11_->SetShaderManager(shaderManagerD3D11_);
framebufferManagerD3D11_->SetDrawEngine(&drawEngine_);

View file

@ -69,6 +69,7 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
drawEngine_.SetShaderManager(shaderManagerDX9_);
drawEngine_.SetTextureCache(textureCacheDX9_);
drawEngine_.SetFramebufferManager(framebufferManagerDX9_);
drawEngine_.Init();
framebufferManagerDX9_->SetTextureCache(textureCacheDX9_);
framebufferManagerDX9_->SetShaderManager(shaderManagerDX9_);
framebufferManagerDX9_->SetDrawEngine(&drawEngine_);

View file

@ -72,6 +72,7 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
drawEngine_.SetTextureCache(textureCacheGL_);
drawEngine_.SetFramebufferManager(framebufferManagerGL_);
drawEngine_.SetFragmentTestCache(&fragmentTestCache_);
drawEngine_.Init();
framebufferManagerGL_->SetTextureCache(textureCacheGL_);
framebufferManagerGL_->SetShaderManager(shaderManagerGL_);
framebufferManagerGL_->SetDrawEngine(&drawEngine_);

View file

@ -68,25 +68,12 @@ SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
Sampler::Init();
drawEngine_ = new SoftwareDrawEngine();
drawEngine_->Init();
drawEngineCommon_ = drawEngine_;
if (gfxCtx && draw) {
presentation_ = new PresentationCommon(draw_);
switch (GetGPUBackend()) {
case GPUBackend::OPENGL:
presentation_->SetLanguage(draw_->GetShaderLanguageDesc().shaderLanguage);
break;
case GPUBackend::DIRECT3D9:
presentation_->SetLanguage(HLSL_D3D9);
break;
case GPUBackend::DIRECT3D11:
presentation_->SetLanguage(HLSL_D3D11);
break;
case GPUBackend::VULKAN:
presentation_->SetLanguage(GLSL_VULKAN);
break;
}
presentation_->SetLanguage(draw_->GetShaderLanguageDesc().shaderLanguage);
}
Resized();
}

View file

@ -72,6 +72,7 @@ GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
drawEngine_.SetFramebufferManager(framebufferManagerVulkan_);
drawEngine_.SetShaderManager(shaderManagerVulkan_);
drawEngine_.SetPipelineManager(pipelineManager_);
drawEngine_.Init();
framebufferManagerVulkan_->SetVulkan2D(&vulkan2D_);
framebufferManagerVulkan_->SetTextureCache(textureCacheVulkan_);
framebufferManagerVulkan_->SetDrawEngine(&drawEngine_);