Ver Fonte

Switching all default depth buffer formats to D32S8X24 or D32 since D24S8 seems to be falling out of favor on modern GPUs

BearishSun há 9 anos atrás
pai
commit
90d5df0f83

+ 1 - 1
Source/BansheeCore/Include/BsRenderTexture.h

@@ -49,7 +49,7 @@ namespace bs
 
 		/** @copydoc TextureManager::createRenderTexture(const TEXTURE_DESC&, bool, PixelFormat) */
 		static SPtr<RenderTexture> create(const TEXTURE_DESC& colorDesc, 
-			bool createDepth = true, PixelFormat depthStencilFormat = PF_D24S8);
+			bool createDepth = true, PixelFormat depthStencilFormat = PF_D32);
 
 		/** @copydoc TextureManager::createRenderTexture(const RENDER_TEXTURE_DESC&) */
 		static SPtr<RenderTexture> create(const RENDER_TEXTURE_DESC& desc);

+ 1 - 1
Source/BansheeCore/Include/BsTextureManager.h

@@ -53,7 +53,7 @@ namespace bs
 		 * @param[in]	depthStencilFormat	Format of the depth/stencil buffer if enabled.
 		 */
 		virtual SPtr<RenderTexture> createRenderTexture(const TEXTURE_DESC& colorDesc,
-			bool createDepth = true, PixelFormat depthStencilFormat = PF_D24S8);
+			bool createDepth = true, PixelFormat depthStencilFormat = PF_D32);
 
 		/** 
 		 * Creates a RenderTexture using the description struct. 

+ 1 - 1
Source/BansheeD3D11RenderAPI/Source/BsD3D11Mappings.cpp

@@ -728,7 +728,7 @@ namespace bs
 		switch(format)
 		{
 		case PF_D32_S8X24:
-			return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
+			return DXGI_FORMAT_R32G8X24_TYPELESS;
 		case PF_D24S8:
 			return DXGI_FORMAT_R24G8_TYPELESS;
 		case PF_D32:

+ 1 - 1
Source/BansheeD3D11RenderAPI/Source/BsD3D11RenderWindow.cpp

@@ -649,7 +649,7 @@ namespace bs
 			texDesc.type = TEX_TYPE_2D;
 			texDesc.width = BBDesc.Width;
 			texDesc.height = BBDesc.Height;
-			texDesc.format = PF_D24S8;
+			texDesc.format = PF_D32_S8X24;
 			texDesc.usage = TU_DEPTHSTENCIL;
 			texDesc.numSamples = getProperties().getMultisampleCount();
 

+ 1 - 1
Source/BansheeGLRenderAPI/Source/BsGLPixelFormat.cpp

@@ -196,7 +196,7 @@ namespace bs
 		}
 
 		LOGERR("Invalid depth stencil format");
-		return PF_D24S8;
+		return PF_D32_S8X24;
 	}
 		
 	GLenum GLPixelUtil::getBufferFormat(GpuBufferFormat format)

+ 1 - 1
Source/MBansheeEditor/Windows/Scene/SceneWindow.cs

@@ -855,7 +855,7 @@ namespace BansheeEditor
 
             // Note: Depth buffer and readable flags are required because ScenePicking uses it
             Texture2D colorTex = new Texture2D(width, height, PixelFormat.R8G8B8A8, TextureUsage.Render | TextureUsage.CPUReadable);
-            Texture2D depthTex = new Texture2D(width, height, PixelFormat.D24S8, TextureUsage.DepthStencil | TextureUsage.CPUReadable);
+            Texture2D depthTex = new Texture2D(width, height, PixelFormat.D32_S8X24, TextureUsage.DepthStencil | TextureUsage.CPUReadable);
 
             renderTexture = new RenderTexture2D(colorTex, depthTex);
             renderTexture.Priority = 1;

+ 1 - 1
Source/MBansheeEngine/Rendering/RenderTexture2D.cs

@@ -27,7 +27,7 @@ namespace BansheeEngine
         /// <param name="depthStencilFormat">Format of the depth/stencil buffer, if <paramref name="createDepth"/> is
         ///                                  enabled. Format must be a valid depth/stencil format.</param>
         public RenderTexture2D(PixelFormat format, int width, int height, int numSamples = 1, 
-            bool gammaCorrection = false, bool createDepth = false, PixelFormat depthStencilFormat = PixelFormat.D24S8)
+            bool gammaCorrection = false, bool createDepth = false, PixelFormat depthStencilFormat = PixelFormat.D32)
         {
             Internal_CreateDetailed(this, format, width, height, numSamples, gammaCorrection, createDepth, depthStencilFormat);
         }

+ 1 - 1
Source/RenderBeast/Source/BsRenderTargets.cpp

@@ -40,7 +40,7 @@ namespace bs
 			height, TU_RENDERTARGET, mNumSamples, true));
 		SPtr<PooledRenderTexture> newNormalRT = texPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(mNormalFormat, width, 
 			height, TU_RENDERTARGET, mNumSamples, false));
-		SPtr<PooledRenderTexture> newDepthRT = texPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_D24S8, width, height, 
+		SPtr<PooledRenderTexture> newDepthRT = texPool.get(POOLED_RENDER_TEXTURE_DESC::create2D(PF_D32_S8X24, width, height, 
 			TU_DEPTHSTENCIL, mNumSamples, false));
 
 		bool rebuildTargets = newColorRT != mSceneColorTex || newAlbedoRT != mAlbedoTex || newNormalRT != mNormalTex || newDepthRT != mDepthTex;