diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-07-19 06:34:51 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-07-19 06:34:51 +0000 |
| commit | 9b9703f0a5d73076513f62458c88660c55a18e9c (patch) | |
| tree | 1caba8901ede285492a6526fda7b8cf3412bbf32 /Graphics/GraphicsEngine | |
| parent | Added Development configuration tests in Vulkan backend; fixed code formatting (diff) | |
| download | DiligentCore-9b9703f0a5d73076513f62458c88660c55a18e9c.tar.gz DiligentCore-9b9703f0a5d73076513f62458c88660c55a18e9c.zip | |
Updated development checks in GraphicsEngine project
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/BufferBase.h | 10 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/include/DeviceContextBase.h | 91 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/include/PipelineStateBase.h | 5 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/include/RenderDeviceBase.h | 2 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/include/ShaderBase.h | 6 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/include/TextureBase.h | 6 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/include/TextureViewBase.h | 5 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/src/Texture.cpp | 6 |
8 files changed, 76 insertions, 55 deletions
diff --git a/Graphics/GraphicsEngine/include/BufferBase.h b/Graphics/GraphicsEngine/include/BufferBase.h index 844b887e..9acd562c 100644 --- a/Graphics/GraphicsEngine/include/BufferBase.h +++ b/Graphics/GraphicsEngine/include/BufferBase.h @@ -67,9 +67,13 @@ public: m_pDefaultUAV(nullptr, STDDeleter<BufferViewImplType, TBuffViewObjAllocator>(BuffViewObjAllocator) ), m_pDefaultSRV(nullptr, STDDeleter<BufferViewImplType, TBuffViewObjAllocator>(BuffViewObjAllocator) ) { -#define VERIFY_BUFFER(Expr, ...) VERIFY(Expr, "Buffer \"", this->m_Desc.Name ? this->m_Desc.Name : "", "\": ", ##__VA_ARGS__) +#ifdef DEVELOPMENT +# define VERIFY_BUFFER(Expr, ...) if (!(Expr)) LOG_ERROR("Buffer \"", this->m_Desc.Name ? this->m_Desc.Name : "", "\": ", ##__VA_ARGS__) +#else +# define VERIFY_BUFFER(...)do{}while(false) +#endif -#ifdef _DEBUG +#ifdef DEVELOPMENT Uint32 AllowedBindFlags = BIND_VERTEX_BUFFER | BIND_INDEX_BUFFER | BIND_UNIFORM_BUFFER | BIND_SHADER_RESOURCE | BIND_STREAM_OUTPUT | BIND_UNORDERED_ACCESS | @@ -194,7 +198,7 @@ void BufferBase<BaseInterface, BufferViewImplType, TBuffViewObjAllocator> :: Map if (this->m_Desc.Usage == USAGE_DYNAMIC) { - VERIFY((MapFlags & MAP_FLAG_DISCARD) != 0 && MapType == MAP_WRITE, "Dynamic buffers can only be mapped for writing with discard flag"); + VERIFY_BUFFER((MapFlags & MAP_FLAG_DISCARD) != 0 && MapType == MAP_WRITE, "Dynamic buffers can only be mapped for writing with discard flag"); } if ( (MapFlags & MAP_FLAG_DISCARD) != 0 ) diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h index 5015a539..86b213ad 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.h +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h @@ -37,10 +37,6 @@ #include "ValidatedCast.h" #include "GraphicsAccessories.h" -#ifdef _DEBUG -# define DEBUG_CHECKS -#endif - namespace Diligent { @@ -203,19 +199,21 @@ protected: template<typename BaseInterface> inline void DeviceContextBase<BaseInterface> :: SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer **ppBuffers, Uint32 *pOffsets, Uint32 Flags ) { - if( StartSlot >= MaxBufferSlots ) +#ifdef DEVELOPMENT + if ( StartSlot >= MaxBufferSlots ) { LOG_ERROR_MESSAGE( "Start vertex buffer slot ", StartSlot, " is out of allowed range [0, ", MaxBufferSlots-1, "]." ); return; } - if( StartSlot + NumBuffersSet > MaxBufferSlots ) + if ( StartSlot + NumBuffersSet > MaxBufferSlots ) { LOG_ERROR_MESSAGE( "The range of vertex buffer slots being set [", StartSlot, ", ", StartSlot + NumBuffersSet - 1, "] is out of allowed range [0, ", MaxBufferSlots - 1, "]." ); NumBuffersSet = MaxBufferSlots - StartSlot; } +#endif - if( Flags & SET_VERTEX_BUFFERS_FLAG_RESET ) + if ( Flags & SET_VERTEX_BUFFERS_FLAG_RESET ) { for(Uint32 s=0; s < m_NumVertexStreams; ++s) m_VertexStreams[s] = VertexStreamInfo(); @@ -228,11 +226,11 @@ inline void DeviceContextBase<BaseInterface> :: SetVertexBuffers( Uint32 StartSl auto &CurrStream = m_VertexStreams[StartSlot + Buff]; CurrStream.pBuffer = RefCntAutoPtr<IBuffer>( ppBuffers ? ppBuffers[Buff] : nullptr ); CurrStream.Offset = pOffsets ? pOffsets[Buff] : 0; -#ifdef DEBUG_CHECKS - if( CurrStream.pBuffer ) +#ifdef DEVELOPMENT + if ( CurrStream.pBuffer ) { const auto &BuffDesc = CurrStream.pBuffer->GetDesc(); - if( !(BuffDesc.BindFlags & BIND_VERTEX_BUFFER) ) + if ( !(BuffDesc.BindFlags & BIND_VERTEX_BUFFER) ) { LOG_ERROR_MESSAGE( "Buffer \"", BuffDesc.Name ? BuffDesc.Name : "", "\" being bound as vertex buffer to slot ", Buff," was not created with BIND_VERTEX_BUFFER flag" ); } @@ -254,7 +252,7 @@ template<typename BaseInterface> template<typename PSOImplType> inline bool DeviceContextBase<BaseInterface> :: CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags, int) { -#ifdef _DEBUG +#ifdef DEVELOPMENT if (!m_pPipelineState) { LOG_ERROR_MESSAGE("No pipeline state is bound to the pipeline"); @@ -286,9 +284,9 @@ inline void DeviceContextBase<BaseInterface> :: SetIndexBuffer( IBuffer *pIndexB { m_pIndexBuffer = pIndexBuffer; m_IndexDataStartOffset = ByteOffset; -#ifdef DEBUG_CHECKS +#ifdef DEVELOPMENT const auto &BuffDesc = m_pIndexBuffer->GetDesc(); - if( !(BuffDesc.BindFlags & BIND_INDEX_BUFFER) ) + if ( !(BuffDesc.BindFlags & BIND_INDEX_BUFFER) ) { LOG_ERROR_MESSAGE( "Buffer \"", BuffDesc.Name ? BuffDesc.Name : "", "\" being bound as index buffer was not created with BIND_INDEX_BUFFER flag" ); } @@ -301,7 +299,7 @@ inline void DeviceContextBase<BaseInterface> :: GetPipelineState(IPipelineState { VERIFY( ppPSO != nullptr, "Null pointer provided null" ); VERIFY( *ppPSO == nullptr, "Memory address contains a pointer to a non-null blend state" ); - if(m_pPipelineState) + if (m_pPipelineState) { m_pPipelineState->QueryInterface( IID_PipelineState, reinterpret_cast<IObject**>( ppPSO ) ); } @@ -321,7 +319,7 @@ inline bool DeviceContextBase<BaseInterface> ::SetBlendFactors(const float *Blen bool FactorsDiffer = false; for( Uint32 f = 0; f < 4; ++f ) { - if( m_BlendFactors[f] != BlendFactors[f] ) + if ( m_BlendFactors[f] != BlendFactors[f] ) FactorsDiffer = true; m_BlendFactors[f] = BlendFactors[f]; } @@ -342,7 +340,7 @@ inline bool DeviceContextBase<BaseInterface> :: SetStencilRef(Uint32 StencilRef, template<typename BaseInterface> inline void DeviceContextBase<BaseInterface> :: SetViewports( Uint32 NumViewports, const Viewport *pViewports, Uint32 &RTWidth, Uint32 &RTHeight ) { - if( RTWidth == 0 || RTHeight == 0 ) + if ( RTWidth == 0 || RTHeight == 0 ) { RTWidth = m_FramebufferWidth; RTHeight = m_FramebufferHeight; @@ -353,7 +351,7 @@ inline void DeviceContextBase<BaseInterface> :: SetViewports( Uint32 NumViewport Viewport DefaultVP( 0, 0, static_cast<float>(RTWidth), static_cast<float>(RTHeight) ); // If no viewports are specified, use default viewport - if( m_NumViewports == 1 && pViewports == nullptr ) + if ( m_NumViewports == 1 && pViewports == nullptr ) { pViewports = &DefaultVP; } @@ -371,7 +369,7 @@ template<typename BaseInterface> inline void DeviceContextBase<BaseInterface> :: GetViewports( Uint32 &NumViewports, Viewport *pViewports ) { NumViewports = m_NumViewports; - if( pViewports ) + if ( pViewports ) { for( Uint32 vp = 0; vp < m_NumViewports; ++vp ) pViewports[vp] = m_Viewports[vp]; @@ -381,7 +379,7 @@ inline void DeviceContextBase<BaseInterface> :: GetViewports( Uint32 &NumViewpor template<typename BaseInterface> inline void DeviceContextBase<BaseInterface> :: SetScissorRects( Uint32 NumRects, const Rect *pRects, Uint32 &RTWidth, Uint32 &RTHeight ) { - if( RTWidth == 0 || RTHeight == 0 ) + if ( RTWidth == 0 || RTHeight == 0 ) { RTWidth = m_FramebufferWidth; RTHeight = m_FramebufferHeight; @@ -425,7 +423,7 @@ inline bool DeviceContextBase<BaseInterface> :: SetRenderTargets( Uint32 NumRend m_FramebufferSlices = 1; } - if( NumRenderTargets != m_NumBoundRenderTargets ) + if ( NumRenderTargets != m_NumBoundRenderTargets ) { bBindRenderTargets = true; for(Uint32 rt = NumRenderTargets; rt < m_NumBoundRenderTargets; ++rt ) @@ -437,13 +435,15 @@ inline bool DeviceContextBase<BaseInterface> :: SetRenderTargets( Uint32 NumRend for( Uint32 rt = 0; rt < NumRenderTargets; ++rt ) { auto *pRTView = ppRenderTargets[rt]; - if( pRTView ) + if ( pRTView ) { const auto &RTVDesc = pRTView->GetDesc(); - VERIFY(RTVDesc.ViewType == TEXTURE_VIEW_RENDER_TARGET, "Texture view object named \"", RTVDesc.Name ? RTVDesc.Name : "", "\" has incorrect view type (", GetTexViewTypeLiteralName(RTVDesc.ViewType), "). Render target view is expected" ); - +#ifdef DEVELOPMENT + if (RTVDesc.ViewType != TEXTURE_VIEW_RENDER_TARGET) + LOG_ERROR("Texture view object named \"", RTVDesc.Name ? RTVDesc.Name : "", "\" has incorrect view type (", GetTexViewTypeLiteralName(RTVDesc.ViewType), "). Render target view is expected" ); +#endif // Use this RTV to set the render target size - if(m_FramebufferWidth == 0) + if (m_FramebufferWidth == 0) { auto *pTex = pRTView->GetTexture(); const auto &TexDesc = pTex->GetDesc(); @@ -453,11 +453,14 @@ inline bool DeviceContextBase<BaseInterface> :: SetRenderTargets( Uint32 NumRend } else { -#ifdef _DEBUG +#ifdef DEVELOPMENT const auto &TexDesc = pRTView->GetTexture()->GetDesc(); - VERIFY(m_FramebufferWidth == std::max(TexDesc.Width >> RTVDesc.MostDetailedMip, 1U), "Inconsitent render target sizes"); - VERIFY(m_FramebufferHeight == std::max(TexDesc.Height >> RTVDesc.MostDetailedMip, 1U), "Inconsitent render target sizes"); - VERIFY(m_FramebufferSlices == RTVDesc.NumArraySlices, "Inconsitent number of layers in bound render targets"); + if (m_FramebufferWidth != std::max(TexDesc.Width >> RTVDesc.MostDetailedMip, 1U)) + LOG_ERROR("Render target width (", std::max(TexDesc.Width >> RTVDesc.MostDetailedMip, 1U), ") specified by RTV '", RTVDesc.Name, "' is inconsistent with the width of previously bound render targets (", m_FramebufferWidth, ")"); + if (m_FramebufferHeight != std::max(TexDesc.Height >> RTVDesc.MostDetailedMip, 1U)) + LOG_ERROR("Render target height (", std::max(TexDesc.Height >> RTVDesc.MostDetailedMip, 1U), ") specified by RTV '", RTVDesc.Name, "' is inconsistent with the height of previously bound render targets (", m_FramebufferHeight, ")"); + if (m_FramebufferSlices != RTVDesc.NumArraySlices) + LOG_ERROR("Number of slices (", RTVDesc.NumArraySlices, ") specified by RTV '", RTVDesc.Name, "' is inconsistent with the number of slices in previously bound render targets (", m_FramebufferSlices, ")"); #endif } } @@ -465,18 +468,21 @@ inline bool DeviceContextBase<BaseInterface> :: SetRenderTargets( Uint32 NumRend // Here both views are certainly live objects, since we store // strong references to all bound render targets. So we // can safely compare pointers. - if( m_pBoundRenderTargets[rt] != pRTView ) + if ( m_pBoundRenderTargets[rt] != pRTView ) { m_pBoundRenderTargets[rt] = pRTView; bBindRenderTargets = true; } } - if( pDepthStencil ) + if ( pDepthStencil ) { const auto &DSVDesc = pDepthStencil->GetDesc(); - VERIFY(DSVDesc.ViewType == TEXTURE_VIEW_DEPTH_STENCIL, "Texture view object named \"", DSVDesc.Name ? DSVDesc.Name : "", "\" has incorrect view type (", GetTexViewTypeLiteralName(DSVDesc.ViewType), "). Depth stencil view is expected" ); - +#ifdef DEVELOPMENT + if (DSVDesc.ViewType != TEXTURE_VIEW_DEPTH_STENCIL) + LOG_ERROR("Texture view object named \"", DSVDesc.Name ? DSVDesc.Name : "", "\" has incorrect view type (", GetTexViewTypeLiteralName(DSVDesc.ViewType), "). Depth stencil view is expected" ); +#endif + // Use depth stencil size to set render target size if (m_FramebufferWidth == 0) { @@ -488,16 +494,19 @@ inline bool DeviceContextBase<BaseInterface> :: SetRenderTargets( Uint32 NumRend } else { -#ifdef _DEBUG +#ifdef DEVELOPMENT const auto &TexDesc = pDepthStencil->GetTexture()->GetDesc(); - VERIFY(m_FramebufferWidth == std::max(TexDesc.Width >> DSVDesc.MostDetailedMip, 1U), "Inconsitent render target sizes"); - VERIFY(m_FramebufferHeight == std::max(TexDesc.Height >> DSVDesc.MostDetailedMip, 1U), "Inconsitent render target sizes"); - VERIFY(m_FramebufferSlices == DSVDesc.NumArraySlices, "Inconsitent number of layers in bound render targets"); + if (m_FramebufferWidth != std::max(TexDesc.Width >> DSVDesc.MostDetailedMip, 1U)) + LOG_ERROR("Depth-stencil target width (", std::max(TexDesc.Width >> DSVDesc.MostDetailedMip, 1U), ") specified by DSV '", DSVDesc.Name, "' is inconsistent with the width of previously bound render targets (", m_FramebufferWidth, ")"); + if (m_FramebufferHeight != std::max(TexDesc.Height >> DSVDesc.MostDetailedMip, 1U)) + LOG_ERROR("Depth-stencil target height (", std::max(TexDesc.Height >> DSVDesc.MostDetailedMip, 1U), ") specified by DSV '", DSVDesc.Name, "' is inconsistent with the height of previously bound render targets (", m_FramebufferHeight, ")"); + if (m_FramebufferSlices != DSVDesc.NumArraySlices) + LOG_ERROR("Number of slices (", DSVDesc.NumArraySlices, ") specified by DSV '", DSVDesc.Name, "' is inconsistent with the number of slices in previously bound render targets (", m_FramebufferSlices, ")"); #endif } } - if( m_pBoundDepthStencil != pDepthStencil) + if ( m_pBoundDepthStencil != pDepthStencil) { m_pBoundDepthStencil = pDepthStencil; bBindRenderTargets = true; @@ -514,13 +523,13 @@ inline void DeviceContextBase<BaseInterface> :: GetRenderTargets( Uint32 &NumRen { NumRenderTargets = m_NumBoundRenderTargets; - if( ppRTVs ) + if ( ppRTVs ) { for( Uint32 rt = 0; rt < NumRenderTargets; ++rt ) { VERIFY( ppRTVs[rt] == nullptr, "Non-null pointer found in RTV array element #", rt ); auto pBoundRTV = m_pBoundRenderTargets[rt]; - if( pBoundRTV ) + if ( pBoundRTV ) pBoundRTV->QueryInterface( IID_TextureView, reinterpret_cast<IObject**>(ppRTVs + rt) ); else ppRTVs[rt] = nullptr; @@ -532,10 +541,10 @@ inline void DeviceContextBase<BaseInterface> :: GetRenderTargets( Uint32 &NumRen } } - if( ppDSV ) + if ( ppDSV ) { VERIFY( *ppDSV == nullptr, "Non-null DSV pointer found" ); - if( m_pBoundDepthStencil ) + if ( m_pBoundDepthStencil ) m_pBoundDepthStencil->QueryInterface( IID_TextureView, reinterpret_cast<IObject**>(ppDSV) ); else *ppDSV = nullptr; diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.h b/Graphics/GraphicsEngine/include/PipelineStateBase.h index 5496e01d..092122f8 100644 --- a/Graphics/GraphicsEngine/include/PipelineStateBase.h +++ b/Graphics/GraphicsEngine/include/PipelineStateBase.h @@ -136,8 +136,9 @@ public: { if(m_Strides[BuffSlot] != 0) { - VERIFY(m_Strides[BuffSlot] == It->Stride, "Inconsistent strides specified for buffer slot ", BuffSlot, - ". Current value: ", m_Strides[BuffSlot], ". New value: ", It->Stride); + if (m_Strides[BuffSlot] != It->Stride) + LOG_ERROR_AND_THROW("Inconsistent strides specified for buffer slot ", BuffSlot, + ". Current value: ", m_Strides[BuffSlot], ". New value: ", It->Stride); } m_Strides[BuffSlot] = It->Stride; } diff --git a/Graphics/GraphicsEngine/include/RenderDeviceBase.h b/Graphics/GraphicsEngine/include/RenderDeviceBase.h index 16d84daf..57f7e163 100644 --- a/Graphics/GraphicsEngine/include/RenderDeviceBase.h +++ b/Graphics/GraphicsEngine/include/RenderDeviceBase.h @@ -316,7 +316,7 @@ public: { } - StateObjectsRegistry<SamplerDesc> &GetSamplerRegistry(){ return m_SamplersRegistry; } + StateObjectsRegistry<SamplerDesc>& GetSamplerRegistry(){ return m_SamplersRegistry; } /// Set weak reference to the immediate context void SetImmediateContext(IDeviceContext *pImmediateContext) diff --git a/Graphics/GraphicsEngine/include/ShaderBase.h b/Graphics/GraphicsEngine/include/ShaderBase.h index 2de7a3d5..5b47bcbd 100644 --- a/Graphics/GraphicsEngine/include/ShaderBase.h +++ b/Graphics/GraphicsEngine/include/ShaderBase.h @@ -226,13 +226,13 @@ public: VERIFY(m_StaticSamplers[s].TextureName != nullptr, "Static sampler texture name not provided"); *Str = m_StaticSamplers[s].TextureName; m_StaticSamplers[s].TextureName = Str->c_str(); -#ifdef _DEBUG +#ifdef DEVELOPMENT const auto &BorderColor = m_StaticSamplers[s].Desc.BorderColor; if( !( (BorderColor[0] == 0 && BorderColor[1] == 0 && BorderColor[2] == 0 && BorderColor[3] == 0) || (BorderColor[0] == 0 && BorderColor[1] == 0 && BorderColor[2] == 0 && BorderColor[3] == 1) || - (BorderColor[0] == 1 && BorderColor[1] == 1 && BorderColor[2] == 1 && BorderColor[3] == 0) ) ) + (BorderColor[0] == 1 && BorderColor[1] == 1 && BorderColor[2] == 1 && BorderColor[3] == 1) ) ) { - LOG_WARNING_MESSAGE("Static sampler for variable \"", *Str , "\" specifies border color (", BorderColor[0], ", ", BorderColor[1], ", ", BorderColor[2], ", ", BorderColor[3], "). D3D12 static samplers only allow transparent black (0,0,0,1), opaque black (0,0,0,0) or opaque white (1,1,1,0) as border colors"); + LOG_WARNING_MESSAGE("Static sampler for variable \"", *Str , "\" specifies border color (", BorderColor[0], ", ", BorderColor[1], ", ", BorderColor[2], ", ", BorderColor[3], "). D3D12 static samplers only allow transparent black (0,0,0,0), opaque black (0,0,0,1) or opaque white (1,1,1,1) as border colors"); } #endif } diff --git a/Graphics/GraphicsEngine/include/TextureBase.h b/Graphics/GraphicsEngine/include/TextureBase.h index bd2a7b71..60d08e0c 100644 --- a/Graphics/GraphicsEngine/include/TextureBase.h +++ b/Graphics/GraphicsEngine/include/TextureBase.h @@ -307,7 +307,8 @@ void TextureBase<BaseInterface, TTextureViewImpl, TTexViewObjAllocator> :: Corre if ( ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE ) { - VERIFY(ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "Unexpected view type: SRV is expected"); + if(ViewDesc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE) + TEX_VIEW_VALIDATION_ERROR( "Unexpected view type: SRV is expected"); if(ViewDesc.NumArraySlices != 6 && ViewDesc.NumArraySlices != 0) TEX_VIEW_VALIDATION_ERROR( "Texture cube SRV is expected to have 6 array slices, while ", ViewDesc.NumArraySlices, " is provided" ); if(ViewDesc.FirstArraySlice != 0) @@ -315,7 +316,8 @@ void TextureBase<BaseInterface, TTextureViewImpl, TTexViewObjAllocator> :: Corre } if ( ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE_ARRAY ) { - VERIFY(ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "Unexpected view type: SRV is expected"); + if(ViewDesc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE ) + TEX_VIEW_VALIDATION_ERROR( "Unexpected view type: SRV is expected"); if((ViewDesc.NumArraySlices % 6) != 0) TEX_VIEW_VALIDATION_ERROR( "Number of slices in texture cube array SRV is expected to be multiple of 6. ", ViewDesc.NumArraySlices, " slices provided." ); } diff --git a/Graphics/GraphicsEngine/include/TextureViewBase.h b/Graphics/GraphicsEngine/include/TextureViewBase.h index 97256df2..b8e7847a 100644 --- a/Graphics/GraphicsEngine/include/TextureViewBase.h +++ b/Graphics/GraphicsEngine/include/TextureViewBase.h @@ -71,7 +71,10 @@ public: /// Implementation of ITextureView::SetSampler() virtual void SetSampler( class ISampler *pSampler )override final { - VERIFY( this->m_Desc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "Texture view \"", this->m_Desc.Name, "\": A sampler can be attached to a shader resource view only. The view type is ", GetTexViewTypeLiteralName(this->m_Desc.ViewType) ); +#ifdef DEVELOPMENT + if( this->m_Desc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE) + LOG_ERROR("Texture view \"", this->m_Desc.Name, "\": a sampler can be attached to a shader resource view only. The view type is ", GetTexViewTypeLiteralName(this->m_Desc.ViewType) ); +#endif m_pSampler = pSampler; } diff --git a/Graphics/GraphicsEngine/src/Texture.cpp b/Graphics/GraphicsEngine/src/Texture.cpp index b8d30af8..74c86fd6 100644 --- a/Graphics/GraphicsEngine/src/Texture.cpp +++ b/Graphics/GraphicsEngine/src/Texture.cpp @@ -114,8 +114,8 @@ void ValidateTextureDesc( const TextureDesc& Desc ) void ValidateTextureRegion(const TextureDesc &TexDesc, Uint32 MipLevel, Uint32 Slice, const Box &Box) { -#define VERIFY_TEX_PARAMS(Expr, ...) VERIFY(Expr, "Texture \"", TexDesc.Name ? TexDesc.Name : "", "\": ", ##__VA_ARGS__) -#ifdef _DEBUG +#define VERIFY_TEX_PARAMS(Expr, ...) if(!(Expr))LOG_ERROR("Texture \"", TexDesc.Name ? TexDesc.Name : "", "\": ", ##__VA_ARGS__) +#ifdef DEVELOPMENT VERIFY_TEX_PARAMS( MipLevel < TexDesc.MipLevels, "Mip level (", MipLevel, ") is out of allowed range [0, ", TexDesc.MipLevels-1, "]" ); VERIFY_TEX_PARAMS( Box.MinX < Box.MaxX, "Incorrect X range [",Box.MinX, ", ", Box.MaxX, ")" ); VERIFY_TEX_PARAMS( Box.MinY < Box.MaxY, "Incorrect Y range [",Box.MinY, ", ", Box.MaxY, ")" ); @@ -156,8 +156,10 @@ void ValidateUpdateDataParams( const TextureDesc &TexDesc, Uint32 MipLevel, Uint VERIFY((SubresData.pData != nullptr) ^ (SubresData.pSrcBuffer != nullptr), "Either CPU memory pointer or GPU buffer must be provided, exclusively"); ValidateTextureRegion(TexDesc, MipLevel, Slice, DstBox); +#ifdef DEVELOPMENT 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" ); +#endif } void VliadateCopyTextureDataParams( const TextureDesc &SrcTexDesc, Uint32 SrcMipLevel, Uint32 SrcSlice, const Box *pSrcBox, |
