2017-02-19 22:02:30 +01:00
|
|
|
|
2015-10-10 16:41:19 +02:00
|
|
|
// Copyright (c) 2015- 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/.
|
|
|
|
|
2018-03-17 07:42:07 -07:00
|
|
|
#include <thread>
|
2019-09-04 21:42:47 +02:00
|
|
|
|
2020-10-04 10:04:01 +02:00
|
|
|
#include "Common/Profiler/Profiler.h"
|
2016-01-05 21:18:43 +01:00
|
|
|
|
2020-08-15 12:25:39 +02:00
|
|
|
#include "Common/Log.h"
|
2020-10-04 20:48:47 +02:00
|
|
|
#include "Common/File/FileUtil.h"
|
2016-01-05 21:18:43 +01:00
|
|
|
#include "Common/GraphicsContext.h"
|
2020-08-15 20:53:08 +02:00
|
|
|
#include "Common/Serialize/Serializer.h"
|
|
|
|
#include "Common/TimeUtil.h"
|
2016-01-05 21:18:43 +01:00
|
|
|
|
|
|
|
#include "Core/Config.h"
|
|
|
|
#include "Core/Debugger/Breakpoints.h"
|
|
|
|
#include "Core/MemMapHelpers.h"
|
|
|
|
#include "Core/Reporting.h"
|
|
|
|
#include "Core/System.h"
|
2018-03-13 23:22:21 +01:00
|
|
|
#include "Core/ELF/ParamSFO.h"
|
2016-01-05 21:18:43 +01:00
|
|
|
|
|
|
|
#include "GPU/GPUState.h"
|
|
|
|
#include "GPU/ge_constants.h"
|
|
|
|
#include "GPU/GeDisasm.h"
|
2020-08-03 23:17:22 +02:00
|
|
|
#include "GPU/Common/FramebufferManagerCommon.h"
|
2016-01-05 21:18:43 +01:00
|
|
|
#include "GPU/Vulkan/ShaderManagerVulkan.h"
|
2015-10-10 16:41:19 +02:00
|
|
|
#include "GPU/Vulkan/GPU_Vulkan.h"
|
2020-08-03 23:22:11 +02:00
|
|
|
#include "GPU/Vulkan/FramebufferManagerVulkan.h"
|
2016-01-05 21:18:43 +01:00
|
|
|
#include "GPU/Vulkan/DrawEngineVulkan.h"
|
|
|
|
#include "GPU/Vulkan/TextureCacheVulkan.h"
|
2020-10-04 23:24:14 +02:00
|
|
|
#include "Common/GPU/Vulkan/VulkanRenderManager.h"
|
|
|
|
#include "Common/GPU/Vulkan/VulkanQueueRunner.h"
|
2016-01-05 21:18:43 +01:00
|
|
|
|
|
|
|
#include "Core/MIPS/MIPS.h"
|
|
|
|
#include "Core/HLE/sceKernelThread.h"
|
|
|
|
#include "Core/HLE/sceKernelInterrupt.h"
|
|
|
|
#include "Core/HLE/sceGe.h"
|
|
|
|
|
2017-01-30 16:50:35 +01:00
|
|
|
GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
2022-08-05 15:09:33 +02:00
|
|
|
: GPUCommon(gfxCtx, draw), drawEngine_(draw) {
|
2022-10-17 08:27:49 +02:00
|
|
|
gstate_c.useFlags = CheckGPUFeatures();
|
2022-10-01 20:01:23 -07:00
|
|
|
drawEngine_.InitDeviceObjects();
|
2016-01-05 21:18:43 +01:00
|
|
|
|
2021-11-14 15:25:28 -08:00
|
|
|
VulkanContext *vulkan = (VulkanContext *)gfxCtx->GetAPIContext();
|
2021-12-19 22:49:42 +01:00
|
|
|
|
|
|
|
vulkan->SetProfilerEnabledPtr(&g_Config.bGpuLogProfiler);
|
|
|
|
|
2021-11-14 15:25:28 -08:00
|
|
|
shaderManagerVulkan_ = new ShaderManagerVulkan(draw);
|
|
|
|
pipelineManager_ = new PipelineManagerVulkan(vulkan);
|
|
|
|
framebufferManagerVulkan_ = new FramebufferManagerVulkan(draw);
|
2016-12-21 18:07:17 +01:00
|
|
|
framebufferManager_ = framebufferManagerVulkan_;
|
2022-08-23 11:11:04 +02:00
|
|
|
textureCacheVulkan_ = new TextureCacheVulkan(draw, framebufferManager_->GetDraw2D(), vulkan);
|
2016-12-21 18:07:17 +01:00
|
|
|
textureCache_ = textureCacheVulkan_;
|
2017-01-21 20:42:40 +01:00
|
|
|
drawEngineCommon_ = &drawEngine_;
|
2017-01-23 20:48:23 +01:00
|
|
|
shaderManager_ = shaderManagerVulkan_;
|
2016-12-21 18:07:17 +01:00
|
|
|
|
|
|
|
drawEngine_.SetTextureCache(textureCacheVulkan_);
|
|
|
|
drawEngine_.SetFramebufferManager(framebufferManagerVulkan_);
|
2017-01-23 20:48:23 +01:00
|
|
|
drawEngine_.SetShaderManager(shaderManagerVulkan_);
|
2016-01-09 01:23:32 +01:00
|
|
|
drawEngine_.SetPipelineManager(pipelineManager_);
|
2021-05-08 09:10:23 -07:00
|
|
|
drawEngine_.Init();
|
2016-12-21 18:07:17 +01:00
|
|
|
framebufferManagerVulkan_->SetTextureCache(textureCacheVulkan_);
|
|
|
|
framebufferManagerVulkan_->SetDrawEngine(&drawEngine_);
|
2017-02-19 22:02:30 +01:00
|
|
|
framebufferManagerVulkan_->SetShaderManager(shaderManagerVulkan_);
|
2020-05-16 09:57:01 -07:00
|
|
|
framebufferManagerVulkan_->Init();
|
2017-10-30 12:05:08 +01:00
|
|
|
textureCacheVulkan_->SetFramebufferManager(framebufferManagerVulkan_);
|
2017-01-23 20:48:23 +01:00
|
|
|
textureCacheVulkan_->SetShaderManager(shaderManagerVulkan_);
|
2017-02-04 11:47:19 +01:00
|
|
|
textureCacheVulkan_->SetDrawEngine(&drawEngine_);
|
2017-10-30 12:05:08 +01:00
|
|
|
|
|
|
|
InitDeviceObjects();
|
2016-01-05 21:18:43 +01:00
|
|
|
|
|
|
|
// Sanity check gstate
|
|
|
|
if ((int *)&gstate.transferstart - (int *)&gstate != 0xEA) {
|
|
|
|
ERROR_LOG(G3D, "gstate has drifted out of sync!");
|
|
|
|
}
|
|
|
|
|
|
|
|
BuildReportingInfo();
|
|
|
|
// Update again after init to be sure of any silly driver problems.
|
|
|
|
UpdateVsyncInterval(true);
|
2016-03-26 11:44:22 -07:00
|
|
|
|
2022-09-07 23:41:00 -07:00
|
|
|
textureCache_->NotifyConfigChanged();
|
2018-03-13 23:22:21 +01:00
|
|
|
|
|
|
|
// Load shader cache.
|
|
|
|
std::string discID = g_paramSFO.GetDiscID();
|
2018-12-15 10:44:05 +01:00
|
|
|
if (discID.size()) {
|
2018-03-13 23:22:21 +01:00
|
|
|
File::CreateFullPath(GetSysDirectory(DIRECTORY_APP_CACHE));
|
2021-05-06 01:31:38 +02:00
|
|
|
shaderCachePath_ = GetSysDirectory(DIRECTORY_APP_CACHE) / (discID + ".vkshadercache");
|
2018-03-17 07:42:07 -07:00
|
|
|
shaderCacheLoaded_ = false;
|
2018-03-13 23:22:21 +01:00
|
|
|
|
2018-03-17 07:42:07 -07:00
|
|
|
std::thread th([&] {
|
|
|
|
LoadCache(shaderCachePath_);
|
|
|
|
shaderCacheLoaded_ = true;
|
|
|
|
});
|
|
|
|
th.detach();
|
2018-10-30 19:13:22 -07:00
|
|
|
} else {
|
|
|
|
shaderCacheLoaded_ = true;
|
2018-03-13 23:22:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-17 07:42:07 -07:00
|
|
|
bool GPU_Vulkan::IsReady() {
|
|
|
|
return shaderCacheLoaded_;
|
|
|
|
}
|
|
|
|
|
2018-10-30 20:32:12 -07:00
|
|
|
void GPU_Vulkan::CancelReady() {
|
|
|
|
pipelineManager_->CancelCache();
|
|
|
|
}
|
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
void GPU_Vulkan::LoadCache(const Path &filename) {
|
2021-11-21 21:23:15 +01:00
|
|
|
if (!g_Config.bShaderCache) {
|
|
|
|
INFO_LOG(G3D, "Shader cache disabled. Not loading.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-13 23:22:21 +01:00
|
|
|
PSP_SetLoading("Loading shader cache...");
|
|
|
|
// Actually precompiled by IsReady() since we're single-threaded.
|
|
|
|
FILE *f = File::OpenCFile(filename, "rb");
|
|
|
|
if (!f)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// First compile shaders to SPIR-V, then load the pipeline cache and recreate the pipelines.
|
|
|
|
// It's when recreating the pipelines that the pipeline cache is useful - in the ideal case,
|
|
|
|
// it can just memcpy the finished shader binaries out of the pipeline cache file.
|
|
|
|
bool result = shaderManagerVulkan_->LoadCache(f);
|
|
|
|
if (result) {
|
2019-07-23 17:45:52 +02:00
|
|
|
// WARNING: See comment in LoadCache if you are tempted to flip the second parameter to true.
|
2018-03-29 16:21:58 +02:00
|
|
|
result = pipelineManager_->LoadCache(f, false, shaderManagerVulkan_, draw_, drawEngine_.GetPipelineLayout());
|
2018-03-13 23:22:21 +01:00
|
|
|
}
|
|
|
|
fclose(f);
|
|
|
|
if (!result) {
|
2020-08-27 10:02:50 +02:00
|
|
|
WARN_LOG(G3D, "Incompatible Vulkan pipeline cache - rebuilding.");
|
2018-03-13 23:22:21 +01:00
|
|
|
// Bad cache file for this GPU/Driver/etc. Delete it.
|
|
|
|
File::Delete(filename);
|
|
|
|
} else {
|
|
|
|
INFO_LOG(G3D, "Loaded Vulkan pipeline cache.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
void GPU_Vulkan::SaveCache(const Path &filename) {
|
2021-11-21 21:23:15 +01:00
|
|
|
if (!g_Config.bShaderCache) {
|
|
|
|
INFO_LOG(G3D, "Shader cache disabled. Not saving.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-04-05 20:26:29 +02:00
|
|
|
if (!draw_) {
|
|
|
|
// Already got the lost message, we're in shutdown.
|
|
|
|
WARN_LOG(G3D, "Not saving shaders - shutting down from in-game.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-13 23:22:21 +01:00
|
|
|
FILE *f = File::OpenCFile(filename, "wb");
|
|
|
|
if (!f)
|
|
|
|
return;
|
|
|
|
shaderManagerVulkan_->SaveCache(f);
|
2019-07-23 17:45:52 +02:00
|
|
|
// WARNING: See comment in LoadCache if you are tempted to flip the second parameter to true.
|
2018-03-29 14:36:04 +02:00
|
|
|
pipelineManager_->SaveCache(f, false, shaderManagerVulkan_, draw_);
|
2018-03-13 23:22:21 +01:00
|
|
|
INFO_LOG(G3D, "Saved Vulkan pipeline cache");
|
|
|
|
fclose(f);
|
2015-10-10 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
GPU_Vulkan::~GPU_Vulkan() {
|
2018-03-13 23:22:21 +01:00
|
|
|
SaveCache(shaderCachePath_);
|
|
|
|
// Note: We save the cache in DeviceLost
|
2017-10-30 12:05:08 +01:00
|
|
|
DestroyDeviceObjects();
|
2017-04-13 23:07:21 -07:00
|
|
|
framebufferManagerVulkan_->DestroyAllFBOs();
|
2017-12-03 11:02:49 +01:00
|
|
|
drawEngine_.DeviceLost();
|
2017-05-07 10:53:04 +02:00
|
|
|
delete textureCacheVulkan_;
|
2016-03-14 00:53:57 +01:00
|
|
|
delete pipelineManager_;
|
2017-01-23 20:48:23 +01:00
|
|
|
delete shaderManagerVulkan_;
|
2017-05-07 11:08:09 +02:00
|
|
|
delete framebufferManagerVulkan_;
|
2015-10-10 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
2022-09-20 10:02:15 +02:00
|
|
|
u32 GPU_Vulkan::CheckGPUFeatures() const {
|
|
|
|
uint32_t features = GPUCommon::CheckGPUFeatures();
|
2017-11-21 11:56:42 +01:00
|
|
|
|
2021-11-14 15:25:28 -08:00
|
|
|
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
|
|
|
switch (vulkan->GetPhysicalDeviceProperties().properties.vendorID) {
|
2017-12-10 19:20:11 +01:00
|
|
|
case VULKAN_VENDOR_AMD:
|
|
|
|
// Accurate depth is required on AMD (due to reverse-Z driver bug) so we ignore the compat flag to disable it on those. See #9545
|
2022-10-17 08:30:27 +02:00
|
|
|
features |= GPU_USE_ACCURATE_DEPTH;
|
2017-12-10 19:20:11 +01:00
|
|
|
break;
|
2019-02-26 15:21:21 +01:00
|
|
|
case VULKAN_VENDOR_QUALCOMM:
|
|
|
|
// Accurate depth is required on Adreno too (seems to also have a reverse-Z driver bug).
|
2022-10-17 08:30:27 +02:00
|
|
|
features |= GPU_USE_ACCURATE_DEPTH;
|
2019-02-26 15:21:21 +01:00
|
|
|
break;
|
2017-12-10 19:20:11 +01:00
|
|
|
case VULKAN_VENDOR_ARM:
|
2019-09-04 21:42:47 +02:00
|
|
|
{
|
|
|
|
// This check is probably not exactly accurate. But old drivers had problems with reverse-Z, just like AMD and Qualcomm.
|
2022-04-17 23:02:17 +02:00
|
|
|
|
|
|
|
// NOTE: Galaxy S8 has version 16 but still seems to have some problems with accurate depth.
|
|
|
|
|
2021-11-14 15:25:28 -08:00
|
|
|
bool driverTooOld = IsHashMaliDriverVersion(vulkan->GetPhysicalDeviceProperties().properties)
|
|
|
|
|| VK_VERSION_MAJOR(vulkan->GetPhysicalDeviceProperties().properties.driverVersion) < 14;
|
2022-04-17 23:02:17 +02:00
|
|
|
|
2019-09-04 21:42:47 +02:00
|
|
|
if (!PSP_CoreParameter().compat.flags().DisableAccurateDepth || driverTooOld) {
|
2022-10-17 08:30:27 +02:00
|
|
|
features |= GPU_USE_ACCURATE_DEPTH;
|
2017-12-10 19:20:11 +01:00
|
|
|
}
|
|
|
|
break;
|
2019-09-04 21:42:47 +02:00
|
|
|
}
|
2017-12-10 19:20:11 +01:00
|
|
|
default:
|
2019-09-04 23:20:57 +02:00
|
|
|
if (!PSP_CoreParameter().compat.flags().DisableAccurateDepth) {
|
2022-10-17 08:30:27 +02:00
|
|
|
features |= GPU_USE_ACCURATE_DEPTH;
|
2019-09-04 23:20:57 +02:00
|
|
|
}
|
2017-12-10 19:20:11 +01:00
|
|
|
break;
|
2017-11-21 11:56:42 +01:00
|
|
|
}
|
2017-11-21 13:58:42 +01:00
|
|
|
|
2018-12-11 00:22:16 +01:00
|
|
|
// Might enable this later - in the first round we are mostly looking at depth/stencil/discard.
|
2021-02-01 09:22:58 +01:00
|
|
|
// if (!g_Config.bEnableVendorBugChecks)
|
2022-10-17 08:30:27 +02:00
|
|
|
// features |= GPU_USE_ACCURATE_DEPTH;
|
2018-12-11 00:22:16 +01:00
|
|
|
|
2017-11-21 13:58:42 +01:00
|
|
|
// Mandatory features on Vulkan, which may be checked in "centralized" code
|
2022-10-17 08:30:27 +02:00
|
|
|
features |= GPU_USE_TEXTURE_LOD_CONTROL;
|
|
|
|
features |= GPU_USE_INSTANCE_RENDERING;
|
|
|
|
features |= GPU_USE_VERTEX_TEXTURE_FETCH;
|
|
|
|
features |= GPU_USE_TEXTURE_FLOAT;
|
2022-02-19 20:40:27 +01:00
|
|
|
|
2021-11-14 15:25:28 -08:00
|
|
|
auto &enabledFeatures = vulkan->GetDeviceFeatures().enabled;
|
2021-09-11 17:10:29 -07:00
|
|
|
if (enabledFeatures.depthClamp) {
|
2022-10-17 08:30:27 +02:00
|
|
|
features |= GPU_USE_DEPTH_CLAMP;
|
2017-12-26 16:35:14 -08:00
|
|
|
}
|
2017-01-28 10:04:50 +01:00
|
|
|
|
2022-10-01 20:39:22 -07:00
|
|
|
// Fall back to geometry shader culling if we can't do vertex range culling.
|
2022-10-02 07:41:36 -07:00
|
|
|
if (enabledFeatures.geometryShader) {
|
2022-10-09 00:57:10 -07:00
|
|
|
const bool useGeometry = g_Config.bUseGeometryShader && !draw_->GetBugs().Has(Draw::Bugs::GEOMETRY_SHADERS_SLOW_OR_BROKEN);
|
2022-10-01 20:39:22 -07:00
|
|
|
const bool vertexSupported = draw_->GetDeviceCaps().clipDistanceSupported && draw_->GetDeviceCaps().cullDistanceSupported;
|
2022-10-17 08:30:27 +02:00
|
|
|
if (useGeometry && (!vertexSupported || (features & GPU_USE_VS_RANGE_CULLING) == 0)) {
|
2022-10-01 20:39:22 -07:00
|
|
|
// Switch to culling via the geometry shader if not fully supported in vertex.
|
2022-10-17 08:30:27 +02:00
|
|
|
features |= GPU_USE_GS_CULLING;
|
|
|
|
features &= ~GPU_USE_VS_RANGE_CULLING;
|
2021-10-26 09:56:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-12 11:09:39 +02:00
|
|
|
// These are VULKAN_4444_FORMAT and friends.
|
2020-03-01 14:07:13 +01:00
|
|
|
uint32_t fmt4444 = draw_->GetDataFormatSupport(Draw::DataFormat::B4G4R4A4_UNORM_PACK16);
|
|
|
|
uint32_t fmt1555 = draw_->GetDataFormatSupport(Draw::DataFormat::A1R5G5B5_UNORM_PACK16);
|
2021-07-10 23:21:10 +02:00
|
|
|
|
|
|
|
// Note that we are (accidentally) using B5G6R5 instead of the mandatory R5G6B5.
|
|
|
|
// Support is almost as widespread, but not quite. So let's just not use any 16-bit formats
|
|
|
|
// if it's not available, for simplicity.
|
|
|
|
uint32_t fmt565 = draw_->GetDataFormatSupport(Draw::DataFormat::B5G6R5_UNORM_PACK16);
|
2020-03-01 14:07:13 +01:00
|
|
|
if ((fmt4444 & Draw::FMT_TEXTURE) && (fmt565 & Draw::FMT_TEXTURE) && (fmt1555 & Draw::FMT_TEXTURE)) {
|
2022-10-17 08:30:27 +02:00
|
|
|
features |= GPU_USE_16BIT_FORMATS;
|
2020-03-01 14:07:13 +01:00
|
|
|
} else {
|
|
|
|
INFO_LOG(G3D, "Deficient texture format support: 4444: %d 1555: %d 565: %d", fmt4444, fmt1555, fmt565);
|
|
|
|
}
|
|
|
|
|
2022-10-17 08:30:27 +02:00
|
|
|
if (!g_Config.bHighQualityDepth && (features & GPU_USE_ACCURATE_DEPTH) != 0) {
|
2017-11-15 21:49:02 +01:00
|
|
|
features |= GPU_SCALE_DEPTH_FROM_24BIT_TO_16BIT;
|
|
|
|
}
|
|
|
|
else if (PSP_CoreParameter().compat.flags().PixelDepthRounding) {
|
|
|
|
// Use fragment rounding on desktop and GLES3, most accurate.
|
|
|
|
features |= GPU_ROUND_FRAGMENT_DEPTH_TO_16BIT;
|
|
|
|
}
|
|
|
|
else if (PSP_CoreParameter().compat.flags().VertexDepthRounding) {
|
|
|
|
features |= GPU_ROUND_DEPTH_TO_16BIT;
|
|
|
|
}
|
2019-01-31 13:53:27 +01:00
|
|
|
|
2022-09-20 10:02:15 +02:00
|
|
|
return features;
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
|
2016-01-08 01:05:52 +01:00
|
|
|
void GPU_Vulkan::BeginHostFrame() {
|
|
|
|
drawEngine_.BeginFrame();
|
2018-04-10 12:22:02 +02:00
|
|
|
UpdateCmdInfo();
|
2016-01-08 01:05:52 +01:00
|
|
|
|
|
|
|
if (resized_) {
|
2022-10-17 08:27:49 +02:00
|
|
|
gstate_c.useFlags = CheckGPUFeatures();
|
2016-10-08 14:52:53 -07:00
|
|
|
// In case the GPU changed.
|
|
|
|
BuildReportingInfo();
|
2017-04-24 11:58:16 -07:00
|
|
|
framebufferManager_->Resized();
|
2016-01-08 01:05:52 +01:00
|
|
|
drawEngine_.Resized();
|
2022-09-07 23:41:00 -07:00
|
|
|
textureCache_->NotifyConfigChanged();
|
2020-06-24 01:04:41 +02:00
|
|
|
resized_ = false;
|
2016-01-08 01:05:52 +01:00
|
|
|
}
|
|
|
|
|
2016-12-21 18:07:17 +01:00
|
|
|
textureCacheVulkan_->StartFrame();
|
2017-10-30 12:05:08 +01:00
|
|
|
|
2021-11-14 15:25:28 -08:00
|
|
|
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
|
|
|
int curFrame = vulkan->GetCurFrame();
|
2017-10-31 23:49:47 +01:00
|
|
|
FrameData &frame = frameData_[curFrame];
|
2017-10-30 12:05:08 +01:00
|
|
|
|
|
|
|
frame.push_->Reset();
|
2021-11-14 15:25:28 -08:00
|
|
|
frame.push_->Begin(vulkan);
|
2016-01-08 01:05:52 +01:00
|
|
|
|
2022-08-16 21:38:09 +02:00
|
|
|
framebufferManagerVulkan_->BeginFrame();
|
2017-10-31 23:49:47 +01:00
|
|
|
textureCacheVulkan_->SetPushBuffer(frameData_[curFrame].push_);
|
2017-10-30 12:05:08 +01:00
|
|
|
|
2017-01-23 20:48:23 +01:00
|
|
|
shaderManagerVulkan_->DirtyShader();
|
2017-01-24 09:41:38 +01:00
|
|
|
gstate_c.Dirty(DIRTY_ALL);
|
2016-03-22 00:12:41 +01:00
|
|
|
|
2016-01-08 01:05:52 +01:00
|
|
|
if (dumpNextFrame_) {
|
|
|
|
NOTICE_LOG(G3D, "DUMPING THIS FRAME");
|
|
|
|
dumpThisFrame_ = true;
|
|
|
|
dumpNextFrame_ = false;
|
|
|
|
} else if (dumpThisFrame_) {
|
|
|
|
dumpThisFrame_ = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GPU_Vulkan::EndHostFrame() {
|
2021-11-14 15:25:28 -08:00
|
|
|
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
|
|
|
int curFrame = vulkan->GetCurFrame();
|
2017-10-31 23:49:47 +01:00
|
|
|
FrameData &frame = frameData_[curFrame];
|
2017-10-30 12:05:08 +01:00
|
|
|
frame.push_->End();
|
|
|
|
|
2016-01-08 01:05:52 +01:00
|
|
|
drawEngine_.EndFrame();
|
2016-12-21 18:07:17 +01:00
|
|
|
textureCacheVulkan_->EndFrame();
|
2020-08-22 10:50:39 +02:00
|
|
|
|
|
|
|
draw_->InvalidateCachedState();
|
2016-01-08 01:05:52 +01:00
|
|
|
}
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2016-01-05 21:18:43 +01:00
|
|
|
// Needs to be called on GPU thread, not reporting thread.
|
|
|
|
void GPU_Vulkan::BuildReportingInfo() {
|
2021-11-14 15:25:28 -08:00
|
|
|
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
|
|
|
const auto &props = vulkan->GetPhysicalDeviceProperties().properties;
|
|
|
|
const auto &features = vulkan->GetDeviceFeatures().available;
|
2016-03-27 08:52:55 -07:00
|
|
|
|
2016-03-27 09:25:25 -07:00
|
|
|
#define CHECK_BOOL_FEATURE(n) do { if (features.n) { featureNames += ", " #n; } } while (false)
|
2016-03-27 08:52:55 -07:00
|
|
|
|
|
|
|
std::string featureNames = "";
|
|
|
|
CHECK_BOOL_FEATURE(robustBufferAccess);
|
|
|
|
CHECK_BOOL_FEATURE(fullDrawIndexUint32);
|
|
|
|
CHECK_BOOL_FEATURE(imageCubeArray);
|
|
|
|
CHECK_BOOL_FEATURE(independentBlend);
|
|
|
|
CHECK_BOOL_FEATURE(geometryShader);
|
|
|
|
CHECK_BOOL_FEATURE(tessellationShader);
|
|
|
|
CHECK_BOOL_FEATURE(sampleRateShading);
|
|
|
|
CHECK_BOOL_FEATURE(dualSrcBlend);
|
|
|
|
CHECK_BOOL_FEATURE(logicOp);
|
|
|
|
CHECK_BOOL_FEATURE(multiDrawIndirect);
|
|
|
|
CHECK_BOOL_FEATURE(drawIndirectFirstInstance);
|
|
|
|
CHECK_BOOL_FEATURE(depthClamp);
|
|
|
|
CHECK_BOOL_FEATURE(depthBiasClamp);
|
|
|
|
CHECK_BOOL_FEATURE(fillModeNonSolid);
|
|
|
|
CHECK_BOOL_FEATURE(depthBounds);
|
|
|
|
CHECK_BOOL_FEATURE(alphaToOne);
|
|
|
|
CHECK_BOOL_FEATURE(multiViewport);
|
|
|
|
CHECK_BOOL_FEATURE(samplerAnisotropy);
|
|
|
|
CHECK_BOOL_FEATURE(textureCompressionETC2);
|
|
|
|
CHECK_BOOL_FEATURE(textureCompressionASTC_LDR);
|
|
|
|
CHECK_BOOL_FEATURE(textureCompressionBC);
|
|
|
|
CHECK_BOOL_FEATURE(occlusionQueryPrecise);
|
|
|
|
CHECK_BOOL_FEATURE(pipelineStatisticsQuery);
|
|
|
|
CHECK_BOOL_FEATURE(vertexPipelineStoresAndAtomics);
|
|
|
|
CHECK_BOOL_FEATURE(fragmentStoresAndAtomics);
|
|
|
|
CHECK_BOOL_FEATURE(shaderTessellationAndGeometryPointSize);
|
|
|
|
CHECK_BOOL_FEATURE(shaderImageGatherExtended);
|
|
|
|
CHECK_BOOL_FEATURE(shaderStorageImageExtendedFormats);
|
|
|
|
CHECK_BOOL_FEATURE(shaderStorageImageMultisample);
|
|
|
|
CHECK_BOOL_FEATURE(shaderStorageImageReadWithoutFormat);
|
|
|
|
CHECK_BOOL_FEATURE(shaderStorageImageWriteWithoutFormat);
|
|
|
|
CHECK_BOOL_FEATURE(shaderUniformBufferArrayDynamicIndexing);
|
|
|
|
CHECK_BOOL_FEATURE(shaderSampledImageArrayDynamicIndexing);
|
|
|
|
CHECK_BOOL_FEATURE(shaderStorageBufferArrayDynamicIndexing);
|
|
|
|
CHECK_BOOL_FEATURE(shaderStorageImageArrayDynamicIndexing);
|
|
|
|
CHECK_BOOL_FEATURE(shaderClipDistance);
|
|
|
|
CHECK_BOOL_FEATURE(shaderCullDistance);
|
|
|
|
CHECK_BOOL_FEATURE(shaderFloat64);
|
|
|
|
CHECK_BOOL_FEATURE(shaderInt64);
|
|
|
|
CHECK_BOOL_FEATURE(shaderInt16);
|
|
|
|
CHECK_BOOL_FEATURE(shaderResourceResidency);
|
|
|
|
CHECK_BOOL_FEATURE(shaderResourceMinLod);
|
|
|
|
CHECK_BOOL_FEATURE(sparseBinding);
|
|
|
|
CHECK_BOOL_FEATURE(sparseResidencyBuffer);
|
|
|
|
CHECK_BOOL_FEATURE(sparseResidencyImage2D);
|
|
|
|
CHECK_BOOL_FEATURE(sparseResidencyImage3D);
|
|
|
|
CHECK_BOOL_FEATURE(sparseResidency2Samples);
|
|
|
|
CHECK_BOOL_FEATURE(sparseResidency4Samples);
|
|
|
|
CHECK_BOOL_FEATURE(sparseResidency8Samples);
|
|
|
|
CHECK_BOOL_FEATURE(sparseResidency16Samples);
|
|
|
|
CHECK_BOOL_FEATURE(sparseResidencyAliased);
|
|
|
|
CHECK_BOOL_FEATURE(variableMultisampleRate);
|
|
|
|
CHECK_BOOL_FEATURE(inheritedQueries);
|
|
|
|
|
2016-03-27 09:26:34 -07:00
|
|
|
#undef CHECK_BOOL_FEATURE
|
|
|
|
|
2016-03-27 08:52:55 -07:00
|
|
|
if (!featureNames.empty()) {
|
|
|
|
featureNames = featureNames.substr(2);
|
|
|
|
}
|
|
|
|
|
2016-01-05 21:18:43 +01:00
|
|
|
char temp[16384];
|
2016-03-27 08:52:55 -07:00
|
|
|
snprintf(temp, sizeof(temp), "v%08x driver v%08x (%s), vendorID=%d, deviceID=%d (features: %s)", props.apiVersion, props.driverVersion, props.deviceName, props.vendorID, props.deviceID, featureNames.c_str());
|
|
|
|
reportingPrimaryInfo_ = props.deviceName;
|
2016-01-05 21:18:43 +01:00
|
|
|
reportingFullInfo_ = temp;
|
|
|
|
|
|
|
|
Reporting::UpdateConfig();
|
2015-10-10 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
2017-11-05 20:33:28 +01:00
|
|
|
void GPU_Vulkan::Reinitialize() {
|
|
|
|
GPUCommon::Reinitialize();
|
2015-10-10 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
2017-11-05 20:33:28 +01:00
|
|
|
void GPU_Vulkan::InitClear() {
|
2020-04-04 10:51:47 -07:00
|
|
|
if (!framebufferManager_->UseBufferedRendering()) {
|
2017-11-05 20:33:28 +01:00
|
|
|
// TODO?
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
}
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2020-03-01 13:55:28 -08:00
|
|
|
void GPU_Vulkan::CopyDisplayToOutput(bool reallyDirty) {
|
2016-01-05 21:18:43 +01:00
|
|
|
// Flush anything left over.
|
2017-05-19 17:21:08 +02:00
|
|
|
drawEngine_.Flush();
|
2016-01-05 21:18:43 +01:00
|
|
|
|
2017-01-23 20:48:23 +01:00
|
|
|
shaderManagerVulkan_->DirtyLastShader();
|
2016-01-05 21:18:43 +01:00
|
|
|
|
2020-03-01 13:55:28 -08:00
|
|
|
framebufferManagerVulkan_->CopyDisplayToOutput(reallyDirty);
|
2016-01-06 23:08:26 +01:00
|
|
|
|
2017-01-24 09:41:38 +01:00
|
|
|
gstate_c.Dirty(DIRTY_TEXTURE_IMAGE);
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GPU_Vulkan::FinishDeferred() {
|
2017-11-16 16:27:24 +01:00
|
|
|
drawEngine_.FinishDeferred();
|
2015-10-10 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
2016-01-05 21:18:43 +01:00
|
|
|
inline void GPU_Vulkan::CheckFlushOp(int cmd, u32 diff) {
|
|
|
|
const u8 cmdFlags = cmdInfo_[cmd].flags;
|
2018-09-20 20:36:41 -07:00
|
|
|
if (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE)) {
|
2016-01-05 21:18:43 +01:00
|
|
|
if (dumpThisFrame_) {
|
|
|
|
NOTICE_LOG(G3D, "================ FLUSH ================");
|
|
|
|
}
|
2017-05-19 17:21:08 +02:00
|
|
|
drawEngine_.Flush();
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
}
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2016-01-05 21:18:43 +01:00
|
|
|
void GPU_Vulkan::PreExecuteOp(u32 op, u32 diff) {
|
|
|
|
CheckFlushOp(op >> 24, diff);
|
2015-10-10 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
2016-01-05 21:18:43 +01:00
|
|
|
void GPU_Vulkan::ExecuteOp(u32 op, u32 diff) {
|
|
|
|
const u8 cmd = op >> 24;
|
|
|
|
const CommandInfo info = cmdInfo_[cmd];
|
|
|
|
const u8 cmdFlags = info.flags;
|
|
|
|
if ((cmdFlags & FLAG_EXECUTE) || (diff && (cmdFlags & FLAG_EXECUTEONCHANGE))) {
|
|
|
|
(this->*info.func)(op, diff);
|
2017-01-24 12:45:50 +01:00
|
|
|
} else if (diff) {
|
|
|
|
uint64_t dirty = info.flags >> 8;
|
|
|
|
if (dirty)
|
|
|
|
gstate_c.Dirty(dirty);
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
}
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2017-10-30 12:05:08 +01:00
|
|
|
void GPU_Vulkan::InitDeviceObjects() {
|
2020-08-15 16:13:24 +02:00
|
|
|
INFO_LOG(G3D, "GPU_Vulkan::InitDeviceObjects");
|
2021-11-14 15:25:28 -08:00
|
|
|
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
2017-10-30 12:05:08 +01:00
|
|
|
// Initialize framedata
|
|
|
|
for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) {
|
2020-08-16 00:38:55 +02:00
|
|
|
_assert_(!frameData_[i].push_);
|
2021-12-10 21:01:01 +01:00
|
|
|
VkBufferUsageFlags usage = VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
|
|
|
|
frameData_[i].push_ = new VulkanPushBuffer(vulkan, "gpuPush", 256 * 1024, usage, PushBufferType::CPU_TO_GPU);
|
2017-10-30 12:05:08 +01:00
|
|
|
}
|
2018-04-13 17:32:36 +02:00
|
|
|
|
|
|
|
VulkanRenderManager *rm = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
|
|
|
uint32_t hacks = 0;
|
2018-04-13 18:05:04 +02:00
|
|
|
if (PSP_CoreParameter().compat.flags().MGS2AcidHack)
|
2018-04-13 17:32:36 +02:00
|
|
|
hacks |= QUEUE_HACK_MGS2_ACID;
|
2018-04-13 18:05:04 +02:00
|
|
|
if (PSP_CoreParameter().compat.flags().SonicRivalsHack)
|
|
|
|
hacks |= QUEUE_HACK_SONIC;
|
2019-11-03 18:22:48 +01:00
|
|
|
|
|
|
|
// Always on.
|
|
|
|
hacks |= QUEUE_HACK_RENDERPASS_MERGE;
|
2019-08-13 23:07:58 +02:00
|
|
|
|
2018-04-13 17:32:36 +02:00
|
|
|
if (hacks) {
|
|
|
|
rm->GetQueueRunner()->EnableHacks(hacks);
|
|
|
|
}
|
2017-10-30 12:05:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GPU_Vulkan::DestroyDeviceObjects() {
|
2020-08-15 16:13:24 +02:00
|
|
|
INFO_LOG(G3D, "GPU_Vulkan::DestroyDeviceObjects");
|
2017-10-30 12:05:08 +01:00
|
|
|
for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) {
|
|
|
|
if (frameData_[i].push_) {
|
2021-11-21 05:35:07 -08:00
|
|
|
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
2021-11-14 15:25:28 -08:00
|
|
|
frameData_[i].push_->Destroy(vulkan);
|
2017-10-30 12:05:08 +01:00
|
|
|
delete frameData_[i].push_;
|
|
|
|
frameData_[i].push_ = nullptr;
|
|
|
|
}
|
|
|
|
}
|
2018-04-13 17:32:36 +02:00
|
|
|
|
|
|
|
// Need to turn off hacks when shutting down the GPU. Don't want them running in the menu.
|
2018-04-14 13:14:05 -07:00
|
|
|
if (draw_) {
|
|
|
|
VulkanRenderManager *rm = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
|
|
|
if (rm)
|
|
|
|
rm->GetQueueRunner()->EnableHacks(0);
|
|
|
|
}
|
2017-10-30 12:05:08 +01:00
|
|
|
}
|
|
|
|
|
2016-01-05 21:18:43 +01:00
|
|
|
void GPU_Vulkan::DeviceLost() {
|
2018-10-30 20:32:12 -07:00
|
|
|
CancelReady();
|
|
|
|
while (!IsReady()) {
|
|
|
|
sleep_ms(10);
|
|
|
|
}
|
2021-05-06 01:31:38 +02:00
|
|
|
if (shaderCachePath_.Valid()) {
|
2018-03-13 23:22:21 +01:00
|
|
|
SaveCache(shaderCachePath_);
|
|
|
|
}
|
2017-10-30 12:05:08 +01:00
|
|
|
DestroyDeviceObjects();
|
2016-10-09 11:27:16 -07:00
|
|
|
drawEngine_.DeviceLost();
|
|
|
|
pipelineManager_->DeviceLost();
|
2016-12-21 18:07:17 +01:00
|
|
|
textureCacheVulkan_->DeviceLost();
|
2022-08-23 20:15:30 -07:00
|
|
|
shaderManagerVulkan_->DeviceLost();
|
2020-11-07 00:56:48 +01:00
|
|
|
|
|
|
|
GPUCommon::DeviceLost();
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
|
2016-09-10 20:29:58 -07:00
|
|
|
void GPU_Vulkan::DeviceRestore() {
|
2020-11-07 00:56:48 +01:00
|
|
|
GPUCommon::DeviceRestore();
|
2017-11-09 16:02:05 +01:00
|
|
|
InitDeviceObjects();
|
|
|
|
|
2022-10-17 08:27:49 +02:00
|
|
|
gstate_c.useFlags = CheckGPUFeatures();
|
2016-10-09 11:27:16 -07:00
|
|
|
BuildReportingInfo();
|
2018-04-10 12:22:02 +02:00
|
|
|
UpdateCmdInfo();
|
2016-10-09 11:27:16 -07:00
|
|
|
|
2021-11-14 15:25:28 -08:00
|
|
|
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
|
|
|
drawEngine_.DeviceRestore(draw_);
|
|
|
|
pipelineManager_->DeviceRestore(vulkan);
|
|
|
|
textureCacheVulkan_->DeviceRestore(draw_);
|
|
|
|
shaderManagerVulkan_->DeviceRestore(draw_);
|
2016-09-10 20:29:58 -07:00
|
|
|
}
|
|
|
|
|
2016-03-31 10:17:02 +02:00
|
|
|
void GPU_Vulkan::GetStats(char *buffer, size_t bufsize) {
|
2020-09-20 21:33:06 +02:00
|
|
|
size_t offset = FormatGPUStatsCommon(buffer, bufsize);
|
|
|
|
buffer += offset;
|
|
|
|
bufsize -= offset;
|
|
|
|
if ((int)bufsize < 0)
|
|
|
|
return;
|
2016-03-31 10:23:40 +02:00
|
|
|
const DrawEngineVulkanStats &drawStats = drawEngine_.GetStats();
|
2017-12-03 10:29:41 +01:00
|
|
|
char texStats[256];
|
|
|
|
textureCacheVulkan_->GetStats(texStats, sizeof(texStats));
|
2020-09-20 21:33:06 +02:00
|
|
|
snprintf(buffer, bufsize,
|
2016-03-31 10:23:40 +02:00
|
|
|
"Vertex, Fragment, Pipelines loaded: %i, %i, %i\n"
|
2017-12-03 10:29:41 +01:00
|
|
|
"Pushbuffer space used: UBO %d, Vtx %d, Idx %d\n"
|
|
|
|
"%s\n",
|
2017-01-23 20:48:23 +01:00
|
|
|
shaderManagerVulkan_->GetNumVertexShaders(),
|
|
|
|
shaderManagerVulkan_->GetNumFragmentShaders(),
|
2016-03-31 10:23:40 +02:00
|
|
|
pipelineManager_->GetNumPipelines(),
|
|
|
|
drawStats.pushUBOSpaceUsed,
|
|
|
|
drawStats.pushVertexSpaceUsed,
|
2017-12-03 10:29:41 +01:00
|
|
|
drawStats.pushIndexSpaceUsed,
|
|
|
|
texStats
|
2016-03-31 10:17:02 +02:00
|
|
|
);
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GPU_Vulkan::ClearCacheNextFrame() {
|
2016-12-21 18:07:17 +01:00
|
|
|
textureCacheVulkan_->ClearNextFrame();
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GPU_Vulkan::ClearShaderCache() {
|
2016-01-10 14:24:10 +01:00
|
|
|
// TODO
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void GPU_Vulkan::DoState(PointerWrap &p) {
|
|
|
|
GPUCommon::DoState(p);
|
|
|
|
|
|
|
|
// TODO: Some of these things may not be necessary.
|
|
|
|
// None of these are necessary when saving.
|
|
|
|
// In Freeze-Frame mode, we don't want to do any of this.
|
|
|
|
if (p.mode == p.MODE_READ && !PSP_CoreParameter().frozen) {
|
2020-05-13 00:06:13 -07:00
|
|
|
textureCache_->Clear(true);
|
2016-01-05 21:18:43 +01:00
|
|
|
|
2017-01-24 09:41:38 +01:00
|
|
|
gstate_c.Dirty(DIRTY_TEXTURE_IMAGE);
|
2020-05-13 00:06:13 -07:00
|
|
|
framebufferManager_->DestroyAllFBOs();
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::string> GPU_Vulkan::DebugGetShaderIDs(DebugShaderType type) {
|
|
|
|
if (type == SHADER_TYPE_VERTEXLOADER) {
|
|
|
|
return drawEngine_.DebugGetVertexLoaderIDs();
|
2016-01-09 21:19:18 +01:00
|
|
|
} else if (type == SHADER_TYPE_PIPELINE) {
|
|
|
|
return pipelineManager_->DebugGetObjectIDs(type);
|
2022-08-22 12:28:46 +02:00
|
|
|
} else if (type == SHADER_TYPE_TEXTURE) {
|
|
|
|
return textureCache_->GetTextureShaderCache()->DebugGetShaderIDs(type);
|
2022-10-01 12:12:46 -07:00
|
|
|
} else if (type == SHADER_TYPE_VERTEX || type == SHADER_TYPE_FRAGMENT || type == SHADER_TYPE_GEOMETRY) {
|
2017-01-23 20:48:23 +01:00
|
|
|
return shaderManagerVulkan_->DebugGetShaderIDs(type);
|
2017-12-06 16:01:56 +01:00
|
|
|
} else if (type == SHADER_TYPE_SAMPLER) {
|
|
|
|
return textureCacheVulkan_->DebugGetSamplerIDs();
|
|
|
|
} else {
|
|
|
|
return std::vector<std::string>();
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
2015-10-10 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
2016-01-05 21:18:43 +01:00
|
|
|
std::string GPU_Vulkan::DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) {
|
|
|
|
if (type == SHADER_TYPE_VERTEXLOADER) {
|
|
|
|
return drawEngine_.DebugGetVertexLoaderString(id, stringType);
|
2016-01-09 21:19:18 +01:00
|
|
|
} else if (type == SHADER_TYPE_PIPELINE) {
|
|
|
|
return pipelineManager_->DebugGetObjectString(id, type, stringType);
|
2022-08-22 12:28:46 +02:00
|
|
|
} else if (type == SHADER_TYPE_TEXTURE) {
|
|
|
|
return textureCache_->GetTextureShaderCache()->DebugGetShaderString(id, type, stringType);
|
2017-12-06 16:01:56 +01:00
|
|
|
} else if (type == SHADER_TYPE_SAMPLER) {
|
|
|
|
return textureCacheVulkan_->DebugGetSamplerString(id, stringType);
|
2022-10-01 12:12:46 -07:00
|
|
|
} else if (type == SHADER_TYPE_VERTEX || type == SHADER_TYPE_FRAGMENT || type == SHADER_TYPE_GEOMETRY) {
|
2017-01-23 20:48:23 +01:00
|
|
|
return shaderManagerVulkan_->DebugGetShaderString(id, type, stringType);
|
2017-12-06 16:01:56 +01:00
|
|
|
} else {
|
|
|
|
return std::string();
|
2016-01-05 21:18:43 +01:00
|
|
|
}
|
2015-10-10 16:41:19 +02:00
|
|
|
}
|
2019-08-21 00:03:00 +02:00
|
|
|
|
|
|
|
std::string GPU_Vulkan::GetGpuProfileString() {
|
|
|
|
VulkanRenderManager *rm = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
|
|
|
|
return rm->GetGpuProfileString();
|
|
|
|
}
|