/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/RendererVulkan/Resources/TextureVulkan.h
73 строки
3 KB
Sanakan8472
Copy / Readback fixes (#1963)
11 июн 2026, 18:07
Не верифицирован
11 июн 2026, 18:07
b50d6f1
Код
Авторство
О чём код?
#pragma once #include <RendererVulkan/RendererVulkanDLL.h> #include <RendererFoundation/Resources/Texture.h> class ezGALBufferVulkan; class ezGALDeviceVulkan; class ezGALTextureVulkan : public ezGALTexture { public: struct SubResourceOffset { EZ_DECLARE_POD_TYPE(); ezUInt32 m_uiOffset; ezUInt32 m_uiSize; ezUInt32 m_uiRowLength; ezUInt32 m_uiImageHeight; }; static vk::Format ComputeImageFormat(const ezGALDeviceVulkan* pDevice, ezEnum<ezGALResourceFormat> galFormat, vk::ImageCreateInfo& ref_createInfo, vk::ImageFormatListCreateInfo& ref_imageFormats); static void ComputeCreateInfo(const ezGALDeviceVulkan* pDevice, const ezGALTextureCreationDescription& description, vk::ImageCreateInfo& ref_createInfo); static void ComputeAllocInfo(ezVulkanAllocationCreateInfo& ref_allocInfo); static ezUInt32 ComputeSubResourceOffsets(const ezGALDeviceVulkan* pDevice, const ezGALTextureCreationDescription& description, ezDynamicArray<SubResourceOffset>& ref_subResourceSizes); static vk::Extent3D GetMipLevelSize(const ezGALTextureCreationDescription& description, ezUInt32 uiMipLevel); public: EZ_ALWAYS_INLINE vk::Image GetImage() const; EZ_ALWAYS_INLINE vk::Format GetImageFormat() const { return m_ImageFormat; } EZ_ALWAYS_INLINE ezVulkanAllocation GetAllocation() const; EZ_ALWAYS_INLINE const ezVulkanAllocationInfo& GetAllocationInfo() const; vk::Extent3D GetMipLevelSize(ezUInt32 uiMipLevel) const { return GetMipLevelSize(m_Description, uiMipLevel); } vk::ImageSubresourceRange GetFullRange() const; vk::ImageAspectFlags GetAspectMask() const; vk::DescriptorImageInfo GetDescriptorImageInfo(ezGALTextureRange textureRange, ezEnum<ezGALShaderResourceType> resourceType, ezEnum<ezGALShaderTextureType> textureType, ezEnum<ezGALResourceFormat> overrideViewFormat) const; protected: friend class ezGALDeviceVulkan; friend class ezMemoryUtils; ezGALTextureVulkan(const ezGALTextureCreationDescription& Description); ~ezGALTextureVulkan(); virtual ezResult InitPlatform(ezGALDevice* pDevice, ezArrayPtr<ezGALSystemMemoryDescription> pInitialData) override; virtual ezResult DeInitPlatform(ezGALDevice* pDevice) override; virtual void SetDebugNamePlatform(const char* szName) const override; protected: vk::Image m_Image = {}; vk::Format m_ImageFormat = vk::Format::eUndefined; ezVulkanAllocation m_pAlloc = nullptr; ezVulkanAllocationInfo m_AllocInfo; // Views struct View : ezHashableStruct<View> { ezGALTextureRange m_TextureRange; ezEnum<ezGALShaderResourceType> m_ResourceType; ezEnum<ezGALShaderTextureType> m_TextureType; ezEnum<ezGALResourceFormat> m_OverrideViewFormat; EZ_ALWAYS_INLINE static ezUInt32 Hash(const View& value) { return value.CalculateHash(); } EZ_ALWAYS_INLINE static bool Equal(const View& a, const View& b) { return a == b; } }; mutable ezHashTable<View, vk::DescriptorImageInfo, View> m_TextureViews; ezGALDeviceVulkan* m_pDevice = nullptr; }; #include <RendererVulkan/Resources/Implementation/TextureVulkan_inl.h>