소스 검색

Skip structured buffers when setting usage, since it's not gathered

Tex Riddell 7 년 전
부모
커밋
406f9a94e0
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      lib/HLSL/DxilContainerReflection.cpp

+ 4 - 1
lib/HLSL/DxilContainerReflection.cpp

@@ -1478,7 +1478,10 @@ static void SetCBufVarUsage(CShaderReflectionConstantBuffer &cb,
 void DxilShaderReflection::SetCBufferUsage() {
   hlsl::OP *hlslOP = m_pDxilModule->GetOP();
   LLVMContext &Ctx = m_pDxilModule->GetCtx();
-  unsigned cbSize = m_CBs.size();
+
+  // Indexes >= cbuffer size from DxilModule are SRV or UAV structured buffers.
+  // We only collect usage for actual cbuffers, so don't go clearing usage on other buffers.
+  unsigned cbSize = std::min(m_CBs.size(), m_pDxilModule->GetCBuffers().size());
   std::vector< std::vector<unsigned> > cbufUsage(cbSize);
 
   Function *createHandle = hlslOP->GetOpFunc(DXIL::OpCode::CreateHandle, Type::getVoidTy(Ctx));