Experimental shared memory texture handling

This commit is contained in:
Georg Hagen
2024-07-23 01:21:27 +02:00
parent d64bb7a530
commit 75aa36c024
9 changed files with 76 additions and 7 deletions

View File

@@ -365,4 +365,19 @@ namespace OpenVulkano::Vulkan
if (!sampler) sampler = device.createSampler(samplerConfig);
return sampler;
}
Unique<Scene::Texture> ResourceManager::CreateSharedMemoryTexture(const Math::Vector3ui& resolution, DataFormat format)
{
const std::unique_lock lock(mutex);
Unique<Scene::Texture> texture = std::make_unique<Scene::Texture>();
texture->resolution = resolution;
texture->format = format;
texture->size = resolution.x * resolution.y * resolution.z * format.GetBytesPerPixel();
VulkanTexture* vkTexture = new VulkanTexture();
vkTexture->InitSharedMem(this, texture.get(), GetDescriptorLayoutSet(Scene::Texture::DESCRIPTOR_SET_LAYOUT_BINDING), Scene::Texture::DESCRIPTOR_SET_LAYOUT_BINDING);
textures.emplace_back(vkTexture);
return texture;
}
}