summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-08-28 01:18:53 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-08-28 01:18:53 +0000
commitf920b651a8c4cd4a61155eef0f6a48b45024578a (patch)
tree927095fcd43d3646176cbc8cea8e16e0ce2c1da5 /Graphics/GraphicsEngineD3D11
parentFew minor updates (diff)
downloadDiligentCore-f920b651a8c4cd4a61155eef0f6a48b45024578a.tar.gz
DiligentCore-f920b651a8c4cd4a61155eef0f6a48b45024578a.zip
Fixed a problem with accessing variables in inactive shader stages in D3D11 backend; improved error messages
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp36
-rw-r--r--Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp2
2 files changed, 15 insertions, 23 deletions
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp
index 433ea149..7255f215 100644
--- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp
@@ -146,48 +146,42 @@ IShaderVariable* ShaderResourceBindingD3D11Impl::GetVariable(SHADER_TYPE ShaderT
{
auto Ind = GetShaderTypeIndex(ShaderType);
VERIFY_EXPR(Ind >= 0 && Ind < _countof(m_ResourceLayoutIndex));
- if( Ind >= 0 )
+ auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
+ if( ResLayoutIndex < 0 )
{
- auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
- return m_pResourceLayouts[ResLayoutIndex].GetShaderVariable(Name);
- }
- else
- {
- LOG_ERROR("Shader type ", GetShaderTypeLiteralName(ShaderType)," is not active in the resource binding");
+ LOG_ERROR("Unable to find mutable/dynamic variable '", Name, "': shader stage ", GetShaderTypeLiteralName(ShaderType), " is inactive");
return nullptr;
}
+
+ return m_pResourceLayouts[ResLayoutIndex].GetShaderVariable(Name);
}
Uint32 ShaderResourceBindingD3D11Impl::GetVariableCount(SHADER_TYPE ShaderType) const
{
auto Ind = GetShaderTypeIndex(ShaderType);
VERIFY_EXPR(Ind >= 0 && Ind < _countof(m_ResourceLayoutIndex));
- if( Ind >= 0 )
- {
- auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
- return m_pResourceLayouts[ResLayoutIndex].GetTotalResourceCount();
- }
- else
+ auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
+ if( ResLayoutIndex < 0 )
{
- LOG_ERROR("Shader type ", GetShaderTypeLiteralName(ShaderType)," is not active in the resource binding");
+ LOG_ERROR("Unable to get the number of mutable/dynamic variables: shader stage ", GetShaderTypeLiteralName(ShaderType), " is inactive");
return 0;
}
+
+ return m_pResourceLayouts[ResLayoutIndex].GetTotalResourceCount();
}
IShaderVariable* ShaderResourceBindingD3D11Impl::GetVariable(SHADER_TYPE ShaderType, Uint32 Index)
{
auto Ind = GetShaderTypeIndex(ShaderType);
VERIFY_EXPR(Ind >= 0 && Ind < _countof(m_ResourceLayoutIndex));
- if( Ind >= 0 )
- {
- auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
- return m_pResourceLayouts[ResLayoutIndex].GetShaderVariable(Index);
- }
- else
+ auto ResLayoutIndex = m_ResourceLayoutIndex[Ind];
+ if( ResLayoutIndex < 0 )
{
- LOG_ERROR("Shader type ", GetShaderTypeLiteralName(ShaderType)," is not active in the resource binding");
+ LOG_ERROR("Unable to get mutable/dynamic variable at index ", Index, ": shader stage ", GetShaderTypeLiteralName(ShaderType), " is inactive");
return nullptr;
}
+
+ return m_pResourceLayouts[ResLayoutIndex].GetShaderVariable(Index);
}
}
diff --git a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp
index 0fe0ace0..44fc2dc6 100644
--- a/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/TextureBaseD3D11.cpp
@@ -155,8 +155,6 @@ void TextureBaseD3D11::UpdateData( IDeviceContext* pContext, Uint32 MipLevel, Ui
return;
}
- VERIFY( m_Desc.Usage == USAGE_DEFAULT, "Only default usage resiurces can be updated with UpdateData()" );
-
auto* pd3d11DeviceContext = static_cast<DeviceContextD3D11Impl*>(pContext)->GetD3D11DeviceContext();
D3D11_BOX D3D11Box;