Explorar el Código

Add some asserts.

Tex Riddell hace 7 años
padre
commit
b6b3cd6d6d
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      lib/HLSL/DxilContainerReflection.cpp

+ 6 - 0
lib/HLSL/DxilContainerReflection.cpp

@@ -2126,6 +2126,7 @@ public:
 
 
 _Use_decl_annotations_
 _Use_decl_annotations_
 HRESULT CFunctionReflection::GetDesc(D3D12_FUNCTION_DESC *pDesc) {
 HRESULT CFunctionReflection::GetDesc(D3D12_FUNCTION_DESC *pDesc) {
+  DXASSERT_NOMSG(m_pLibraryReflection);
   IFR(ZeroMemoryToOut(pDesc));
   IFR(ZeroMemoryToOut(pDesc));
 
 
   const ShaderModel* pSM = m_pLibraryReflection->m_pDxilModule->GetShaderModel();
   const ShaderModel* pSM = m_pLibraryReflection->m_pDxilModule->GetShaderModel();
@@ -2176,28 +2177,33 @@ HRESULT CFunctionReflection::GetDesc(D3D12_FUNCTION_DESC *pDesc) {
 
 
 // BufferIndex is relative to used constant buffers here
 // BufferIndex is relative to used constant buffers here
 ID3D12ShaderReflectionConstantBuffer *CFunctionReflection::GetConstantBufferByIndex(UINT BufferIndex) {
 ID3D12ShaderReflectionConstantBuffer *CFunctionReflection::GetConstantBufferByIndex(UINT BufferIndex) {
+  DXASSERT_NOMSG(m_pLibraryReflection);
   if (BufferIndex >= m_UsedCBs.size())
   if (BufferIndex >= m_UsedCBs.size())
     return &g_InvalidSRConstantBuffer;
     return &g_InvalidSRConstantBuffer;
   return m_pLibraryReflection->_GetConstantBufferByIndex(m_UsedCBs[BufferIndex]);
   return m_pLibraryReflection->_GetConstantBufferByIndex(m_UsedCBs[BufferIndex]);
 }
 }
 
 
 ID3D12ShaderReflectionConstantBuffer *CFunctionReflection::GetConstantBufferByName(LPCSTR Name) {
 ID3D12ShaderReflectionConstantBuffer *CFunctionReflection::GetConstantBufferByName(LPCSTR Name) {
+  DXASSERT_NOMSG(m_pLibraryReflection);
   return m_pLibraryReflection->_GetConstantBufferByName(Name);
   return m_pLibraryReflection->_GetConstantBufferByName(Name);
 }
 }
 
 
 HRESULT CFunctionReflection::GetResourceBindingDesc(UINT ResourceIndex,
 HRESULT CFunctionReflection::GetResourceBindingDesc(UINT ResourceIndex,
   D3D12_SHADER_INPUT_BIND_DESC * pDesc) {
   D3D12_SHADER_INPUT_BIND_DESC * pDesc) {
+  DXASSERT_NOMSG(m_pLibraryReflection);
   if (ResourceIndex >= m_UsedResources.size())
   if (ResourceIndex >= m_UsedResources.size())
     return E_INVALIDARG;
     return E_INVALIDARG;
   return m_pLibraryReflection->_GetResourceBindingDesc(m_UsedResources[ResourceIndex], pDesc);
   return m_pLibraryReflection->_GetResourceBindingDesc(m_UsedResources[ResourceIndex], pDesc);
 }
 }
 
 
 ID3D12ShaderReflectionVariable * CFunctionReflection::GetVariableByName(LPCSTR Name) {
 ID3D12ShaderReflectionVariable * CFunctionReflection::GetVariableByName(LPCSTR Name) {
+  DXASSERT_NOMSG(m_pLibraryReflection);
   return m_pLibraryReflection->_GetVariableByName(Name);
   return m_pLibraryReflection->_GetVariableByName(Name);
 }
 }
 
 
 HRESULT CFunctionReflection::GetResourceBindingDescByName(LPCSTR Name,
 HRESULT CFunctionReflection::GetResourceBindingDescByName(LPCSTR Name,
   D3D12_SHADER_INPUT_BIND_DESC * pDesc) {
   D3D12_SHADER_INPUT_BIND_DESC * pDesc) {
+  DXASSERT_NOMSG(m_pLibraryReflection);
   return m_pLibraryReflection->_GetResourceBindingDescByName(Name, pDesc);
   return m_pLibraryReflection->_GetResourceBindingDescByName(Name, pDesc);
 }
 }