From 33b85d42a6f981e81a6f94edad613bcf2eec912e Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Sat, 20 Jul 2024 22:55:04 +0200 Subject: [PATCH] Main: Texture - rename TU_NOT_SRV to TU_NOT_SAMPLED --- OgreMain/include/OgreTexture.h | 16 +++++++++------- .../Direct3D11/src/OgreD3D11Mappings.cpp | 2 +- .../Direct3D11/src/OgreD3D11Texture.cpp | 2 +- RenderSystems/Metal/src/OgreMetalTexture.mm | 2 +- .../Vulkan/src/OgreVulkanTextureGpuManager.cpp | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/OgreMain/include/OgreTexture.h b/OgreMain/include/OgreTexture.h index 7bad4ca1090..a2b90783fee 100644 --- a/OgreMain/include/OgreTexture.h +++ b/OgreMain/include/OgreTexture.h @@ -62,21 +62,23 @@ namespace Ogre { /// Mipmaps will be automatically generated for this texture TU_AUTOMIPMAP = 0x10, /** This texture will be a render target, i.e. used as a target for render to texture - setting this flag will ignore all other texture usages except TU_AUTOMIPMAP, TU_UAV, TU_NOT_SRV */ + setting this flag will ignore all other texture usages except TU_AUTOMIPMAP, TU_UNORDERED_ACCESS, TU_NOT_SAMPLED */ TU_RENDERTARGET = 0x20, - /// Texture would not be used as Shader Resource View, i.e. as regular texture. - /// That flag could be combined with TU_RENDERTARGET or TU_UAV to remove possible limitations on some hardware - TU_NOT_SRV = 0x40, + /// Texture will not be sampled inside a shader i.e. used as regular texture. + /// When used with TU_RENDERTARGET this can improve performance and compatibility with FL9.1 hardware + TU_NOT_SAMPLED = 0x40, /// Texture can be bound as an Unordered Access View /// (imageStore/imageRead/glBindImageTexture in GL jargon) TU_UNORDERED_ACCESS = 0x80, - /// Texture can be used as an UAV, but not as a regular texture. - TU_UAV_NOT_SRV = TU_UNORDERED_ACCESS | TU_NOT_SRV, /// Default to automatic mipmap generation static textures TU_DEFAULT = TU_AUTOMIPMAP | HBU_GPU_ONLY, /// @deprecated - TU_NOTSHADERRESOURCE = TU_NOT_SRV, + TU_UAV_NOT_SRV = TU_UNORDERED_ACCESS | TU_NOT_SAMPLED, + /// @deprecated + TU_NOT_SRV = TU_NOT_SAMPLED, + /// @deprecated + TU_NOTSHADERRESOURCE = TU_NOT_SAMPLED, /// @deprecated TU_UAV = TU_UNORDERED_ACCESS }; diff --git a/RenderSystems/Direct3D11/src/OgreD3D11Mappings.cpp b/RenderSystems/Direct3D11/src/OgreD3D11Mappings.cpp index a64f796b150..5595b8acb6f 100644 --- a/RenderSystems/Direct3D11/src/OgreD3D11Mappings.cpp +++ b/RenderSystems/Direct3D11/src/OgreD3D11Mappings.cpp @@ -753,7 +753,7 @@ namespace Ogre } UINT retVal = 0; - if( !(usage & TU_NOT_SRV) ) + if( !(usage & TU_NOT_SAMPLED) ) retVal |= D3D11_BIND_SHADER_RESOURCE; if( isRenderTarget ) diff --git a/RenderSystems/Direct3D11/src/OgreD3D11Texture.cpp b/RenderSystems/Direct3D11/src/OgreD3D11Texture.cpp index 422b6873ace..f4635e9fdde 100644 --- a/RenderSystems/Direct3D11/src/OgreD3D11Texture.cpp +++ b/RenderSystems/Direct3D11/src/OgreD3D11Texture.cpp @@ -137,7 +137,7 @@ namespace Ogre D3D11RenderSystem* rsys = static_cast(Root::getSingleton().getRenderSystem()); // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150%28v=vs.85%29.aspx#ID3D11Device_CreateTexture2D // 10Level9, When using D3D11_BIND_SHADER_RESOURCE, SampleDesc.Count must be 1. - if(rsys->_getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 || (mUsage & TU_NOT_SRV)) + if(rsys->_getFeatureLevel() >= D3D_FEATURE_LEVEL_10_0 || (mUsage & TU_NOT_SAMPLED)) rsys->determineFSAASettings(mFSAA, mFSAAHint, mD3DFormat, &mFSAAType); } diff --git a/RenderSystems/Metal/src/OgreMetalTexture.mm b/RenderSystems/Metal/src/OgreMetalTexture.mm index 69b307b0704..f82165a04f5 100644 --- a/RenderSystems/Metal/src/OgreMetalTexture.mm +++ b/RenderSystems/Metal/src/OgreMetalTexture.mm @@ -112,7 +112,7 @@ of this software and associated documentation files (the "Software"), to deal if( mUsage & TU_UNORDERED_ACCESS ) desc.usage |= MTLTextureUsageShaderWrite; - if( mUsage & (TU_UNORDERED_ACCESS|TU_NOT_SRV|TU_RENDERTARGET) ) + if( mUsage & (TU_UNORDERED_ACCESS|TU_NOT_SAMPLED|TU_RENDERTARGET) ) desc.storageMode = MTLStorageModePrivate; mTexture = [mDevice->mDevice newTextureWithDescriptor:desc]; diff --git a/RenderSystems/Vulkan/src/OgreVulkanTextureGpuManager.cpp b/RenderSystems/Vulkan/src/OgreVulkanTextureGpuManager.cpp index f6c6b502c74..8806d9ac518 100644 --- a/RenderSystems/Vulkan/src/OgreVulkanTextureGpuManager.cpp +++ b/RenderSystems/Vulkan/src/OgreVulkanTextureGpuManager.cpp @@ -142,7 +142,7 @@ namespace Ogre bool VulkanTextureGpuManager::checkSupport( PixelFormatGpu format, uint32 textureFlags ) const { OGRE_ASSERT_LOW( - textureFlags != TU_NOT_SRV && + textureFlags != TU_NOT_SAMPLED && "Invalid textureFlags combination. Asking to check if format is supported to do nothing" ); const VkFormat vkFormat = VulkanMappings::get( format ); @@ -152,7 +152,7 @@ namespace Ogre uint32 features = 0; - if( !( textureFlags & TU_NOT_SRV ) ) + if( !( textureFlags & TU_NOT_SAMPLED ) ) features |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT; if( textureFlags & TU_UNORDERED_ACCESS )