mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-10 13:18:31 +09:00
Merge remote-tracking branch 'origin/Feat/Backend-Direct-Vulkan' into Agent/CodexAudit
# Conflicts: # MobileGL/MG_Backend/BackendObject.h # MobileGL/MG_Backend/DirectGLES/Managers.cpp # MobileGL/MG_Backend/DirectVulkan/BackendObject_DirectVulkan.cpp # MobileGL/MG_Backend/DirectVulkan/Renderer/FrameContext.cpp # MobileGL/MG_Backend/DirectVulkan/Renderer/VkTextureManager.cpp # MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp # MobileGL/MG_Impl/GLImpl/Buffer/GL_Buffer.cpp # MobileGL/MG_Impl/GLImpl/Exporting/Definitions.cpp # MobileGL/MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.cpp # MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp # MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.h # MobileGL/MG_Impl/GLImpl/Program/GL_Program.cpp # MobileGL/MG_Impl/GLImpl/Program/GL_Program.h # MobileGL/MG_Impl/GLImpl/Sync/GL_Sync.cpp # MobileGL/MG_Impl/GLImpl/Sync/GL_Sync.h # MobileGL/MG_Impl/GLImpl/Texture/GL_Texture.cpp # MobileGL/MG_Impl/GLImpl/VertexArray/GL_VertexArray.cpp # MobileGL/MG_Impl/GLImpl/VertexArray/GL_VertexArray.h # MobileGL/MG_State/GLState/BufferState/BufferObject.cpp # MobileGL/MG_State/GLState/BufferState/BufferObject.h # MobileGL/MG_Util/BackendLoaders/Vulkan/Loader.cpp # MobileGL/MG_Util/BackendLoaders/Vulkan/Loader.h
This commit is contained in:
@@ -674,8 +674,9 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
|
||||
const TextureFormatInfo formatInfo = ResolveTextureFormatInfo(texture.GetFormat());
|
||||
const VkComponentMapping sampledComponents = ResolveSampledViewComponents(texture, formatInfo);
|
||||
perMipSampledView = CreateImageView(resource->image, resource->format, resource->aspect, resource->viewType,
|
||||
mipLevel, 1, 0, resource->arrayLayers, &sampledComponents);
|
||||
const VkImageAspectFlags sampledAspect = ResolveSampledImageViewAspectMask(resource->aspect);
|
||||
perMipSampledView = CreateImageView(resource->image, resource->format, sampledAspect, resource->viewType,
|
||||
mipLevel, 1, 0, resource->arrayLayers, &sampledComponents);
|
||||
if (perMipSampledView == VK_NULL_HANDLE) {
|
||||
MGLOG_D("%s: CreateImageView failed for textureId=%d mipLevel=%u", __func__, texture.GetExternalIndex(),
|
||||
mipLevel);
|
||||
@@ -1067,6 +1068,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
|
||||
void VkTextureManager::DeferResourceRelease(TextureResource&& resource) {
|
||||
if (resource.image == VK_NULL_HANDLE && resource.fullView == VK_NULL_HANDLE &&
|
||||
resource.sampledView == VK_NULL_HANDLE &&
|
||||
resource.perMipViews.empty() && resource.perMipSampledViews.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -1141,6 +1143,7 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
|
||||
const Bool needsRecreate =
|
||||
resource.fullView == VK_NULL_HANDLE ||
|
||||
resource.sampledView == VK_NULL_HANDLE ||
|
||||
resource.sampledBaseMipLevel != baseMipLevel ||
|
||||
resource.sampledLevelCount != levelCount ||
|
||||
resource.syncedTextureParamsVersion != texture.GetTextureParamsVersion();
|
||||
@@ -1152,6 +1155,10 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
DeferViewRelease(resource.fullView);
|
||||
resource.fullView = VK_NULL_HANDLE;
|
||||
}
|
||||
if (resource.sampledView != VK_NULL_HANDLE) {
|
||||
DeferViewRelease(resource.sampledView);
|
||||
resource.sampledView = VK_NULL_HANDLE;
|
||||
}
|
||||
for (auto& sampledView : resource.perMipSampledViews) {
|
||||
if (sampledView != VK_NULL_HANDLE) {
|
||||
DeferViewRelease(sampledView);
|
||||
@@ -1166,6 +1173,12 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
if (resource.fullView == VK_NULL_HANDLE) {
|
||||
return false;
|
||||
}
|
||||
const VkImageAspectFlags sampledAspect = ResolveSampledImageViewAspectMask(resource.aspect);
|
||||
resource.sampledView = CreateImageView(resource.image, resource.format, sampledAspect, resource.viewType,
|
||||
baseMipLevel, levelCount, 0, resource.arrayLayers, &sampledComponents);
|
||||
if (resource.sampledView == VK_NULL_HANDLE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
resource.sampledBaseMipLevel = baseMipLevel;
|
||||
resource.sampledLevelCount = levelCount;
|
||||
@@ -1496,4 +1509,17 @@ namespace MobileGL::MG_Backend::DirectVulkan {
|
||||
return VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
VkImageAspectFlags VkTextureManager::ResolveSampledImageViewAspectMask(VkImageAspectFlags imageAspect) {
|
||||
if ((imageAspect & VK_IMAGE_ASPECT_COLOR_BIT) != 0) {
|
||||
return VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
}
|
||||
if ((imageAspect & VK_IMAGE_ASPECT_DEPTH_BIT) != 0) {
|
||||
return VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
}
|
||||
if ((imageAspect & VK_IMAGE_ASPECT_STENCIL_BIT) != 0) {
|
||||
return VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
}
|
||||
return imageAspect;
|
||||
}
|
||||
} // namespace MobileGL::MG_Backend::DirectVulkan
|
||||
|
||||
Reference in New Issue
Block a user