/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/RendererCore/Textures/TextureUtils.h
38 строк
3 KB
Jan Krassnigg
Added code documentation to RendererCore (#1697)
28 окт 2025, 13:18
Не верифицирован
28 окт 2025, 13:18
d573105
Код
Авторство
О чём код?
#pragma once #include <RendererCore/RenderContext/Implementation/RenderContextStructs.h> #include <RendererCore/RendererCoreDLL.h> #include <RendererFoundation/Resources/ResourceFormats.h> #include <Texture/Image/Image.h> /// Utility functions for texture format conversion and manipulation. struct EZ_RENDERERCORE_DLL ezTextureUtils { /// Converts an image format to the corresponding GPU texture format. /// /// The bSRGB parameter determines whether to use sRGB or linear variants. static ezGALResourceFormat::Enum ImageFormatToGalFormat(ezImageFormat::Enum format, bool bSRGB); /// Converts a GPU texture format to the corresponding image format. /// /// If bRemoveSRGB is true, sRGB formats are converted to their linear equivalents. static ezImageFormat::Enum GalFormatToImageFormat(ezGALResourceFormat::Enum format, bool bRemoveSRGB); /// Converts a GPU texture format to the corresponding image format. static ezImageFormat::Enum GalFormatToImageFormat(ezGALResourceFormat::Enum format); /// Configures a sampler state based on a texture filter setting. /// /// Sets up filtering mode, addressing, and anisotropy based on the filter enum. static void ConfigureSampler(ezTextureFilterSetting::Enum filter, ezGALSamplerStateCreationDescription& out_sampler); /// \brief Copies the given texture subresource from `memory` into `out_image` according to the texture description. static void CopySubResourceToImage(const ezGALTextureCreationDescription& desc, const ezGALTextureSubresource& subResource, const ezGALSystemMemoryDescription& memory, ezImage& out_image, bool bRemoveSRGB); /// \brief Returns an image view of the texture subresource in `memory`. If the format allows for it, the memory will be aliased, removing the need to copy the data but the view becomes invalid once the memory does. If this is not possible, the function reverts to calling CopySubResourceToImage with `ref_tempImage` used as the data storage. You can check if `ref_tempImage` is valid to figure out which code path was taken. static ezImageView MakeImageViewFromSubResource(const ezGALTextureCreationDescription& desc, const ezGALTextureSubresource& subResource, const ezGALSystemMemoryDescription& memory, ezImage& ref_tempImage, bool bRemoveSRGB); /// \brief Copies a texture subresource memory to a new location with a different row pitch. static void CopySubResourceToMemory(const ezGALTextureCreationDescription& desc, const ezGALTextureSubresource& subResource, const ezGALSystemMemoryDescription& sourceMemory, ezArrayPtr<ezUInt8> targetData, ezUInt32 uiTargetRowPitch); /// \brief If enabled, textures are always loaded to full quality immediately. Mostly necessary for image comparison unit tests. static bool s_bForceFullQualityAlways; };