summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-09-04 04:41:29 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-09-04 04:41:29 +0000
commit5ee7aadba299a3ac8964d75ca0fa96e31b0cbe2e (patch)
treeb0b8f1803b1840b9e88145dc0c9d4e480fd2656c /Graphics
parentCode formatting (diff)
downloadDiligentCore-5ee7aadba299a3ac8964d75ca0fa96e31b0cbe2e.tar.gz
DiligentCore-5ee7aadba299a3ac8964d75ca0fa96e31b0cbe2e.zip
Fixed texture usage checks to avoid false warnings in OpenGL
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/src/Texture.cpp1
-rw-r--r--Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp3
-rw-r--r--Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp2
4 files changed, 7 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngine/src/Texture.cpp b/Graphics/GraphicsEngine/src/Texture.cpp
index 3411ee20..62c66047 100644
--- a/Graphics/GraphicsEngine/src/Texture.cpp
+++ b/Graphics/GraphicsEngine/src/Texture.cpp
@@ -182,7 +182,6 @@ void ValidateUpdateDataParams( const TextureDesc& TexDesc, Uint32 MipLevel, Uint
ValidateTextureRegion(TexDesc, MipLevel, Slice, DstBox);
#ifdef DEVELOPMENT
- VERIFY_TEX_PARAMS( TexDesc.Usage == USAGE_DEFAULT, "Only textures created with USAGE_DEFAULT can be updated with UpdateData()" );
VERIFY_TEX_PARAMS( TexDesc.SampleCount == 1, "Only non-multisampled textures can be updated with UpdateData()" );
VERIFY_TEX_PARAMS( (SubresData.Stride & 0x03) == 0, "Texture data stride (", SubresData.Stride, ") must be at least 32-bit aligned" );
VERIFY_TEX_PARAMS( (SubresData.DepthStride & 0x03) == 0, "Texture data depth stride (", SubresData.DepthStride, ") must be at least 32-bit aligned" );
diff --git a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp
index e672cf86..cb257437 100644
--- a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp
@@ -149,6 +149,9 @@ TextureBaseD3D11 :: ~TextureBaseD3D11()
void TextureBaseD3D11::UpdateData( IDeviceContext* pContext, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData )
{
TTextureBase::UpdateData( pContext, MipLevel, Slice, DstBox, SubresData );
+ // OpenGL backend uses UpdateData() to initialize textures, so we can't check the usage in ValidateUpdateDataParams()
+ DEV_CHECK_ERR( m_Desc.Usage == USAGE_DEFAULT, "Only USAGE_DEFAULT textures should be updated with UpdateData()" );
+
if (SubresData.pSrcBuffer != nullptr)
{
LOG_ERROR("D3D11 does not support updating texture subresource from a GPU buffer");
diff --git a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp
index 21eeeca4..96bdc406 100644
--- a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp
@@ -408,6 +408,8 @@ void TextureD3D12Impl::UpdateData( IDeviceContext* pContext,
const TextureSubResData& SubresData )
{
TTextureBase::UpdateData( pContext, MipLevel, Slice, DstBox, SubresData );
+ // OpenGL backend uses UpdateData() to initialize textures, so we can't check the usage in ValidateUpdateDataParams()
+ DEV_CHECK_ERR( m_Desc.Usage == USAGE_DEFAULT, "Only USAGE_DEFAULT textures should be updated with UpdateData()" );
Box BlockAlignedBox;
const auto& FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
index f975e8f7..b2487bda 100644
--- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp
@@ -483,6 +483,8 @@ TextureVkImpl :: ~TextureVkImpl()
void TextureVkImpl::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData )
{
TTextureBase::UpdateData( pContext, MipLevel, Slice, DstBox, SubresData );
+ // OpenGL backend uses UpdateData() to initialize textures, so we can't check the usage in ValidateUpdateDataParams()
+ DEV_CHECK_ERR( m_Desc.Usage == USAGE_DEFAULT, "Only USAGE_DEFAULT textures should be updated with UpdateData()" );
auto *pCtxVk = ValidatedCast<DeviceContextVkImpl>(pContext);
//pCtxVk->CopyTextureRegion(SubresData.pSrcBuffer, SubresData.Stride, SubresData.DepthStride, this, DstSubResIndex, DstBox);