From e03a728e5fd120c285e2d7321bb9a77abedb6759 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Mon, 1 Apr 2019 18:53:10 -0700 Subject: Implemented staging textures in D3D12 back-end --- Graphics/GraphicsEngine/src/Texture.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/src/Texture.cpp b/Graphics/GraphicsEngine/src/Texture.cpp index 8054ae5f..d33701ea 100644 --- a/Graphics/GraphicsEngine/src/Texture.cpp +++ b/Graphics/GraphicsEngine/src/Texture.cpp @@ -109,6 +109,21 @@ void ValidateTextureDesc( const TextureDesc& Desc ) "There might be an issue in OpenGL driver on NVidia hardware: when rendering to SNORM textures, all negative values are clamped to zero.\n" "Use UNORM format instead." ); } + + if (Desc.Usage == USAGE_STAGING) + { + if (Desc.BindFlags != 0) + LOG_TEXTURE_ERROR_AND_THROW("Staging textures cannot be bound to any GPU pipeline stage"); + + if (Desc.MiscFlags & MISC_TEXTURE_FLAG_GENERATE_MIPS) + LOG_TEXTURE_ERROR_AND_THROW("Mipmaps cannot be autogenerated for staging textures"); + + if (Desc.CPUAccessFlags == 0) + LOG_TEXTURE_ERROR_AND_THROW("Staging textures must specify CPU access flags"); + + if ( (Desc.CPUAccessFlags & (CPU_ACCESS_READ | CPU_ACCESS_WRITE)) == (CPU_ACCESS_READ | CPU_ACCESS_WRITE)) + LOG_TEXTURE_ERROR_AND_THROW("Staging textures must use exactly one of ACESS_READ or ACCESS_WRITE flags"); + } } -- cgit v1.2.3