mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-18 07:23:24 +09:00
[Fix] (MG_Backend/DirectVulkan, MG_Backend/DirectGLES): fix vulkan program
cache, get EGLSurfaceSize on viewport = 0
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
#include "MG_Util/Converters/MGToStr/FramebufferEnumConverter.h"
|
||||
#include "MG_Util/Converters/MGToVk/TextureEnumConverter.h"
|
||||
#include "MG_Util/Metrics/TextureMetrics.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
|
||||
namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
@@ -74,6 +77,14 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
return uniformUnit >= 0 ? uniformUnit : 0;
|
||||
}
|
||||
|
||||
static Bool ShouldDumpDescriptorStats() {
|
||||
static const Bool enabled = [] {
|
||||
const char* value = std::getenv("MOBILEGL_DESCRIPTOR_STATS");
|
||||
return value != nullptr && value[0] != '\0' && std::strcmp(value, "0") != 0;
|
||||
}();
|
||||
return enabled;
|
||||
}
|
||||
|
||||
Bool UniformManager::Initialize(VkDevice device, VkBufferManager* bufferManager,
|
||||
ProgramFactory* programFactory,
|
||||
VkDeviceSize minUniformBufferOffsetAlignment, Uint32 frameCount,
|
||||
@@ -262,6 +273,21 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
.imageView = resource->fullView,
|
||||
.imageLayout = resource->layout,
|
||||
};
|
||||
if (ShouldDumpDescriptorStats()) {
|
||||
std::fprintf(stderr,
|
||||
"MOBILEGL_DESCRIPTOR_STATS program=%u binding=%u name=%s location=%d unit=%d "
|
||||
"texture=%u target=%d sampler=%p imageView=%p layout=%d\n",
|
||||
program.GetExternalIndex(),
|
||||
binding,
|
||||
programObj.samplerNameByBinding[binding].c_str(),
|
||||
location,
|
||||
unit,
|
||||
texture->GetExternalIndex(),
|
||||
static_cast<Int>(texture->GetTarget()),
|
||||
reinterpret_cast<void*>(outImageInfo.sampler),
|
||||
reinterpret_cast<void*>(outImageInfo.imageView),
|
||||
static_cast<Int>(outImageInfo.imageLayout));
|
||||
}
|
||||
return outImageInfo.sampler != VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user