From abf613c173c637d190a856f0c3179ffef33305da Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 13 Jan 2023 18:47:15 +0000 Subject: [PATCH] Don't print an error when precaching common types --- renderdoc/driver/shaders/dxil/dxil_bytecode.cpp | 12 ++++++------ renderdoc/driver/shaders/dxil/dxil_bytecode.h | 6 +++--- .../driver/shaders/dxil/dxil_bytecode_editor.cpp | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp b/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp index 0b150807e..85cfa2611 100644 --- a/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_bytecode.cpp @@ -2346,7 +2346,7 @@ uint32_t Program::GetOrAssignMetaID(DebugLocation &l) return l.id; } -const DXIL::Type *Program::GetVoidType() +const DXIL::Type *Program::GetVoidType(bool precache) { if(m_VoidType) return m_VoidType; @@ -2360,13 +2360,13 @@ const DXIL::Type *Program::GetVoidType() } } - if(!m_VoidType) + if(!m_VoidType && !precache) RDCERR("Couldn't find void type"); return m_VoidType; } -const DXIL::Type *Program::GetBoolType() +const DXIL::Type *Program::GetBoolType(bool precache) { if(m_BoolType) return m_BoolType; @@ -2381,13 +2381,13 @@ const DXIL::Type *Program::GetBoolType() } } - if(!m_BoolType) + if(!m_BoolType && !precache) RDCERR("Couldn't find bool type"); return m_BoolType; } -const Type *Program::GetInt32Type() +const Type *Program::GetInt32Type(bool precache) { if(m_Int32Type) return m_Int32Type; @@ -2402,7 +2402,7 @@ const Type *Program::GetInt32Type() } } - if(!m_Int32Type) + if(!m_Int32Type && !precache) RDCERR("Couldn't find int32 type"); return m_Int32Type; diff --git a/renderdoc/driver/shaders/dxil/dxil_bytecode.h b/renderdoc/driver/shaders/dxil/dxil_bytecode.h index b7f8d502a..621f8e59b 100644 --- a/renderdoc/driver/shaders/dxil/dxil_bytecode.h +++ b/renderdoc/driver/shaders/dxil/dxil_bytecode.h @@ -687,9 +687,9 @@ protected: uint32_t GetOrAssignMetaID(Metadata *m); uint32_t GetOrAssignMetaID(DebugLocation &l); - const Type *GetVoidType(); - const Type *GetBoolType(); - const Type *GetInt32Type(); + const Type *GetVoidType(bool precache = false); + const Type *GetBoolType(bool precache = false); + const Type *GetInt32Type(bool precache = false); const Type *GetInt8Type(); const Type *GetPointerType(const Type *type, Type::PointerAddrSpace addrSpace) const; diff --git a/renderdoc/driver/shaders/dxil/dxil_bytecode_editor.cpp b/renderdoc/driver/shaders/dxil/dxil_bytecode_editor.cpp index cf2c29332..282f644ae 100644 --- a/renderdoc/driver/shaders/dxil/dxil_bytecode_editor.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_bytecode_editor.cpp @@ -490,9 +490,9 @@ ProgramEditor::~ProgramEditor() #endif // cache known types for encoding - GetVoidType(); - GetBoolType(); - GetInt32Type(); + GetVoidType(true); + GetBoolType(true); + GetInt32Type(true); // replace the DXIL bytecode in the container with DXBC::DXBCContainer::ReplaceChunk(m_OutBlob, DXBC::FOURCC_DXIL, EncodeProgram());